@streamflow/stream 8.4.0 → 8.7.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-BAZFUaQL.d.cts → index-Dl7EztUT.d.cts} +152 -1
- package/dist/cjs/index.cjs +220 -92
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -2
- package/dist/cjs/solana/index.cjs +220 -92
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +1 -1
- package/dist/esm/{index-DKkJbavt.d.ts → index-RvzYFo_L.d.ts} +152 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +220 -92
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +1 -1
- package/dist/esm/solana/index.js +220 -92
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -4,7 +4,7 @@ import { ITransactionSolanaExt, IProgramAccount, ConfirmationParams, ThrottlePar
|
|
|
4
4
|
import { IdlAccounts, IdlTypes, Program } from '@coral-xyz/anchor';
|
|
5
5
|
import { SignerWalletAdapter } from '@solana/wallet-adapter-base';
|
|
6
6
|
import BN from 'bn.js';
|
|
7
|
-
import { L as LinearStream, b as StreamType, A as AlignedStream, O as OracleTypeName,
|
|
7
|
+
import { u as IRecipient, L as LinearStream, b as StreamType, A as AlignedStream, O as OracleTypeName, c as SolanaStreamClientOptions, B as BaseStreamClient, I as ICreateStreamData, g as ICreateResult, a as ICreateAlignedStreamData, h as ICreateMultipleStreamData, i as IMultiTransactionResult, j as IWithdrawData, l as ITransactionResult, m as ICancelData, n as ITransferData, o as ITopUpData, p as IGetOneData, S as Stream, q as IGetAllData, r as IUpdateData, s as IGetFeesData, t as IFees } from './BaseStreamClient-DOyJqO7R.cjs';
|
|
8
8
|
import { StreamflowAlignedUnlocks } from './solana/descriptor/streamflow_aligned_unlocks.cjs';
|
|
9
9
|
import { ICluster, ContractError, IChain } from '@streamflow/common';
|
|
10
10
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
@@ -209,9 +209,42 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
209
209
|
getConnection(): Connection;
|
|
210
210
|
getCommitment(): Commitment | undefined;
|
|
211
211
|
getProgramId(): string;
|
|
212
|
+
/**
|
|
213
|
+
* Builds transaction instructions for creating a new stream/vesting contract without creating a transaction.
|
|
214
|
+
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
215
|
+
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
216
|
+
* @param {Omit<ICreateStreamSolanaExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
217
|
+
* @returns Transaction instructions and metadata ID
|
|
218
|
+
*/
|
|
219
|
+
buildCreateTransactionInstructions(data: ICreateStreamData, extParams: Omit<ICreateStreamSolanaExt, "sender"> & {
|
|
220
|
+
senderPublicKey: PublicKey;
|
|
221
|
+
}): Promise<{
|
|
222
|
+
ixs: TransactionInstruction[];
|
|
223
|
+
metadataId: string;
|
|
224
|
+
metadata?: Keypair;
|
|
225
|
+
}>;
|
|
226
|
+
/**
|
|
227
|
+
* Builds a transaction for creating a new stream/vesting contract without signing or executing it.
|
|
228
|
+
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
229
|
+
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
230
|
+
* @param {Omit<ICreateStreamSolanaExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
231
|
+
* @returns Transaction and metadata information
|
|
232
|
+
*/
|
|
233
|
+
buildCreateTransaction(data: ICreateStreamData, extParams: Omit<ICreateStreamSolanaExt, "sender"> & {
|
|
234
|
+
senderPublicKey: PublicKey;
|
|
235
|
+
}): Promise<{
|
|
236
|
+
tx: VersionedTransaction;
|
|
237
|
+
metadataId: string;
|
|
238
|
+
metadata?: Keypair;
|
|
239
|
+
hash: string;
|
|
240
|
+
context: any;
|
|
241
|
+
}>;
|
|
212
242
|
/**
|
|
213
243
|
* Creates a new stream/vesting contract.
|
|
214
244
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
245
|
+
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
246
|
+
* @param {ICreateStreamSolanaExt} extParams - Transaction configuration including sender wallet, native token handling, and compute settings
|
|
247
|
+
* @returns Create result
|
|
215
248
|
*/
|
|
216
249
|
create(data: ICreateStreamData, extParams: ICreateStreamSolanaExt): Promise<ICreateResult>;
|
|
217
250
|
prepareCreateInstructions(streamParams: ICreateStreamData, extParams: ICreateStreamSolanaExt): Promise<ICreateStreamInstructions>;
|
|
@@ -219,6 +252,9 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
219
252
|
/**
|
|
220
253
|
* Creates a new stream/vesting contract.
|
|
221
254
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
255
|
+
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
256
|
+
* @param {ICreateStreamSolanaExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
257
|
+
* @returns Create stream instructions
|
|
222
258
|
*/
|
|
223
259
|
prepareCreateStreamInstructions({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canPause, canUpdateRate, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, partner, tokenProgramId: streamTokenProgramId, }: ICreateStreamData, { sender, metadataPubKeys, isNative, computePrice, computeLimit }: ICreateStreamSolanaExt): Promise<ICreateStreamInstructions>;
|
|
224
260
|
/**
|
|
@@ -230,6 +266,9 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
230
266
|
* - initialized contract PDA off chain
|
|
231
267
|
*
|
|
232
268
|
* If you are not sure if you should use create or create_unchecked, go for create to be safer.
|
|
269
|
+
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
270
|
+
* @param {ICreateStreamSolanaExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
271
|
+
* @returns Create result
|
|
233
272
|
*/
|
|
234
273
|
createUnchecked(data: ICreateStreamData, extParams: ICreateStreamSolanaExt): Promise<ICreateResult>;
|
|
235
274
|
/**
|
|
@@ -240,78 +279,190 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
240
279
|
metadata: Keypair | undefined;
|
|
241
280
|
metadataPubKey: PublicKey;
|
|
242
281
|
}>;
|
|
282
|
+
/**
|
|
283
|
+
* Builds transaction instructions for creating multiple stream/vesting contracts without creating transactions.
|
|
284
|
+
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
285
|
+
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
286
|
+
* @param {Omit<ICreateStreamSolanaExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
287
|
+
* @returns Create multiple transaction instructions
|
|
288
|
+
*/
|
|
289
|
+
buildCreateMultipleTransactionInstructions(data: ICreateMultipleStreamData, extParams: Omit<ICreateStreamSolanaExt, "sender"> & {
|
|
290
|
+
senderPublicKey: PublicKey;
|
|
291
|
+
}): Promise<{
|
|
292
|
+
instructionsBatch: {
|
|
293
|
+
ixs: TransactionInstruction[];
|
|
294
|
+
metadata: Keypair | undefined;
|
|
295
|
+
recipient: string;
|
|
296
|
+
}[];
|
|
297
|
+
metadatas: string[];
|
|
298
|
+
metadataToRecipient: MetadataRecipientHashMap;
|
|
299
|
+
prepareInstructions: TransactionInstruction[];
|
|
300
|
+
}>;
|
|
301
|
+
/**
|
|
302
|
+
* Builds multiple transactions for creating stream/vesting contracts without signing or executing them.
|
|
303
|
+
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
304
|
+
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
305
|
+
* @param {Omit<ICreateStreamSolanaExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
306
|
+
* @returns Multiple transaction information
|
|
307
|
+
*/
|
|
308
|
+
buildCreateMultipleTransactions(data: ICreateMultipleStreamData, extParams: Omit<ICreateStreamSolanaExt, "sender"> & {
|
|
309
|
+
senderPublicKey: PublicKey;
|
|
310
|
+
}): Promise<{
|
|
311
|
+
transactions: BatchItem[];
|
|
312
|
+
metadatas: string[];
|
|
313
|
+
metadataToRecipient: MetadataRecipientHashMap;
|
|
314
|
+
hash: Readonly<{
|
|
315
|
+
blockhash: string;
|
|
316
|
+
lastValidBlockHeight: number;
|
|
317
|
+
}>;
|
|
318
|
+
context: any;
|
|
319
|
+
prepareTx?: VersionedTransaction;
|
|
320
|
+
}>;
|
|
243
321
|
/**
|
|
244
322
|
* Creates multiple stream/vesting contracts.
|
|
245
323
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
324
|
+
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
325
|
+
* @param {ICreateStreamSolanaExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
326
|
+
* @returns Multiple transaction information
|
|
246
327
|
*/
|
|
247
328
|
createMultiple(data: ICreateMultipleStreamData, extParams: ICreateStreamSolanaExt): Promise<IMultiTransactionResult>;
|
|
248
329
|
/**
|
|
249
330
|
* Creates multiple stream/vesting contracts, and send all transactions sequentially.
|
|
250
331
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
251
332
|
* In most cases, createMultiple should be used instead.
|
|
333
|
+
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
334
|
+
* @param {ICreateStreamSolanaExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
335
|
+
* @returns Multiple transaction information
|
|
252
336
|
*/
|
|
253
337
|
createMultipleSequential(data: ICreateMultipleStreamData, extParams: ICreateStreamSolanaExt): Promise<IMultiTransactionResult>;
|
|
254
338
|
/**
|
|
255
339
|
* Attempts withdrawing from the specified stream.
|
|
340
|
+
* @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
|
|
341
|
+
* @param {IInteractStreamSolanaExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
342
|
+
* @returns Transaction result
|
|
256
343
|
*/
|
|
257
344
|
withdraw({ id, amount }: IWithdrawData, extParams: IInteractStreamSolanaExt): Promise<ITransactionResult>;
|
|
258
345
|
/**
|
|
259
346
|
* Creates Transaction Instructions for withdrawal
|
|
347
|
+
* @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
|
|
348
|
+
* @param {IInteractStreamSolanaExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
349
|
+
* @returns Transaction instructions
|
|
260
350
|
*/
|
|
261
351
|
prepareWithdrawInstructions({ id, amount }: IWithdrawData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IInteractStreamSolanaExt): Promise<TransactionInstruction[]>;
|
|
262
352
|
/**
|
|
263
353
|
* Attempts canceling the specified stream.
|
|
354
|
+
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
355
|
+
* @param {IInteractStreamSolanaExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
356
|
+
* @returns Transaction result
|
|
264
357
|
*/
|
|
265
358
|
cancel(cancelData: ICancelData, extParams: IInteractStreamSolanaExt): Promise<ITransactionResult>;
|
|
359
|
+
/**
|
|
360
|
+
* Creates Transaction Instructions for cancel
|
|
361
|
+
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
362
|
+
* @param {IInteractStreamSolanaExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
363
|
+
* @returns Transaction instructions
|
|
364
|
+
*/
|
|
266
365
|
prepareCancelInstructions(cancelData: ICancelData, extParams: IInteractStreamSolanaExt): Promise<TransactionInstruction[]>;
|
|
366
|
+
/**
|
|
367
|
+
* Creates Transaction Instructions for cancel
|
|
368
|
+
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
369
|
+
* @param {IInteractStreamSolanaExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
370
|
+
* @returns Transaction instructions
|
|
371
|
+
*/
|
|
267
372
|
prepareCancelAlignedUnlockInstructions({ id }: ICancelData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IInteractStreamSolanaExt): Promise<TransactionInstruction[]>;
|
|
268
373
|
/**
|
|
269
374
|
* Creates Transaction Instructions for cancel
|
|
375
|
+
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
376
|
+
* @param {IInteractStreamSolanaExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
377
|
+
* @returns Transaction instructions
|
|
270
378
|
*/
|
|
271
379
|
prepareCancelStreamInstructions({ id }: ICancelData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IInteractStreamSolanaExt): Promise<TransactionInstruction[]>;
|
|
272
380
|
/**
|
|
273
381
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
274
382
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
383
|
+
* @param {ITransferData} transferData - Transfer parameters including stream ID and new recipient address
|
|
384
|
+
* @param {IInteractStreamSolanaExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
385
|
+
* @returns Transaction result
|
|
275
386
|
*/
|
|
276
387
|
transfer({ id, newRecipient }: ITransferData, extParams: IInteractStreamSolanaExt): Promise<ITransactionResult>;
|
|
277
388
|
/**
|
|
278
389
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
279
390
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
391
|
+
* @param {ITransferData} transferData - Transfer parameters including stream ID and new recipient address
|
|
392
|
+
* @param {IInteractStreamSolanaExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
393
|
+
* @returns Transaction instructions
|
|
280
394
|
*/
|
|
281
395
|
prepareTransferInstructions({ id, newRecipient }: ITransferData, { invoker, computePrice, computeLimit }: IInteractStreamSolanaExt): Promise<TransactionInstruction[]>;
|
|
282
396
|
/**
|
|
283
397
|
* Tops up stream account with specified amount.
|
|
398
|
+
* @param {ITopUpData} topupData - Top-up parameters including stream ID and amount to add
|
|
399
|
+
* @param {ITopUpStreamSolanaExt} extParams - Transaction configuration including invoker wallet, native token handling, and compute settings
|
|
400
|
+
* @returns Transaction result
|
|
284
401
|
*/
|
|
285
402
|
topup({ id, amount }: ITopUpData, extParams: ITopUpStreamSolanaExt): Promise<ITransactionResult>;
|
|
286
403
|
/**
|
|
287
404
|
* Create Transaction instructions for topup
|
|
405
|
+
* @param {ITopUpData} topupData - Top-up parameters including stream ID and amount to add
|
|
406
|
+
* @param {ITopUpStreamSolanaExt} extParams - Transaction configuration including invoker wallet, native token handling, and compute settings
|
|
407
|
+
* @returns Transaction instructions
|
|
288
408
|
*/
|
|
289
409
|
prepareTopupInstructions({ id, amount }: ITopUpData, { invoker, isNative, computePrice, computeLimit }: ITopUpStreamSolanaExt): Promise<TransactionInstruction[]>;
|
|
290
410
|
/**
|
|
291
411
|
* Fetch stream data by its id (address).
|
|
412
|
+
* @param {IGetOneData} getData - Query parameters containing the stream ID to fetch
|
|
413
|
+
* @returns Stream data
|
|
292
414
|
*/
|
|
293
415
|
getOne({ id }: IGetOneData): Promise<Stream>;
|
|
294
416
|
/**
|
|
295
417
|
* Fetch all aligned outgoing streams/contracts by the provided public key.
|
|
418
|
+
* @param {string} sender - Sender public key
|
|
419
|
+
* @returns Record of stream data
|
|
296
420
|
*/
|
|
297
421
|
private getOutgoingAlignedStreams;
|
|
298
422
|
private getIncomingAlignedStreams;
|
|
299
423
|
/**
|
|
300
424
|
* Fetch streams/contracts by providing direction.
|
|
301
425
|
* Streams are sorted by start time in ascending order.
|
|
426
|
+
* @param {IGetAllData} getData - Query parameters including address, stream type filter, and direction filter
|
|
427
|
+
* @returns Record of stream data
|
|
302
428
|
*/
|
|
303
429
|
get({ address, type, direction, }: IGetAllData): Promise<[string, Stream][]>;
|
|
430
|
+
/**
|
|
431
|
+
* Searches for streams/contracts by providing filters.
|
|
432
|
+
* @param {ISearchStreams} data - Search by mint, sender, recipient or closed status
|
|
433
|
+
* @returns Record of stream data
|
|
434
|
+
*/
|
|
304
435
|
searchStreams(data: ISearchStreams): Promise<IProgramAccount<Stream>[]>;
|
|
305
436
|
/**
|
|
306
437
|
* Attempts updating the stream auto withdrawal params and amount per period
|
|
438
|
+
* @param {IUpdateData} data - Update parameters including stream ID and new settings
|
|
439
|
+
* @param {IInteractStreamSolanaExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
440
|
+
* @returns Transaction result
|
|
307
441
|
*/
|
|
308
442
|
update(data: IUpdateData, extParams: IInteractStreamSolanaExt): Promise<ITransactionResult>;
|
|
309
443
|
/**
|
|
310
444
|
* Create Transaction instructions for update
|
|
445
|
+
* @param {IUpdateData} data - Update parameters including stream ID and new settings
|
|
446
|
+
* @param {IInteractStreamSolanaExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
447
|
+
* @returns Transaction instructions
|
|
311
448
|
*/
|
|
312
449
|
prepareUpdateInstructions(data: IUpdateData, { invoker, computePrice, computeLimit }: IInteractStreamSolanaExt): Promise<TransactionInstruction[]>;
|
|
450
|
+
/**
|
|
451
|
+
* Gets fees for a given address
|
|
452
|
+
* @param {IGetFeesData} getData - Query parameters containing the partner address to check for custom fees
|
|
453
|
+
* @returns Fees
|
|
454
|
+
*/
|
|
313
455
|
getFees({ address }: IGetFeesData): Promise<IFees | null>;
|
|
456
|
+
/**
|
|
457
|
+
* Gets default streamflow fee
|
|
458
|
+
* @returns Default streamflow fee
|
|
459
|
+
*/
|
|
314
460
|
getDefaultStreamflowFee(): Promise<number>;
|
|
461
|
+
/**
|
|
462
|
+
* Extracts error code from an error
|
|
463
|
+
* @param {Error} err - Error
|
|
464
|
+
* @returns Error code
|
|
465
|
+
*/
|
|
315
466
|
extractErrorCode(err: Error): string | null;
|
|
316
467
|
/**
|
|
317
468
|
* Utility function to generate metadata for a Contract or return existing Pubkey
|