@streamflow/stream 8.8.1 → 8.9.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/README.md +213 -175
- package/dist/cjs/{index-Bll7jg8V.d.cts → index-oCYfzJrc.d.cts} +37 -33
- package/dist/cjs/index.cjs +56 -88
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -2
- package/dist/cjs/solana/index.cjs +56 -88
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +1 -1
- package/dist/esm/{index-D-w3ZCyC.d.ts → index-BNQVJtIE.d.ts} +37 -33
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +57 -89
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +1 -1
- package/dist/esm/solana/index.js +57 -89
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -41,10 +41,20 @@ interface ICreateStreamSolanaExt extends ICreateSolanaExt, ITransactionSolanaExt
|
|
|
41
41
|
metadataPubKeys?: PublicKey[];
|
|
42
42
|
partner?: string | null;
|
|
43
43
|
}
|
|
44
|
+
interface IPrepareCreateStreamSolanaExt extends Omit<ICreateStreamSolanaExt, "sender"> {
|
|
45
|
+
sender: {
|
|
46
|
+
publicKey: PublicKey | null;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
44
49
|
interface IInteractStreamSolanaExt extends ITransactionSolanaExtWithInstructions {
|
|
45
50
|
invoker: SignerWalletAdapter | Keypair;
|
|
46
51
|
checkTokenAccounts?: boolean;
|
|
47
52
|
}
|
|
53
|
+
interface IPrepareStreamSolanaExt extends Omit<IInteractStreamSolanaExt, "invoker"> {
|
|
54
|
+
invoker: {
|
|
55
|
+
publicKey: PublicKey | null;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
48
58
|
interface ITopUpStreamSolanaExt extends ITransactionSolanaExt {
|
|
49
59
|
invoker: SignerWalletAdapter | Keypair;
|
|
50
60
|
isNative?: boolean;
|
|
@@ -220,9 +230,7 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
220
230
|
* @param {Omit<ICreateStreamSolanaExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
221
231
|
* @returns Transaction instructions and metadata ID
|
|
222
232
|
*/
|
|
223
|
-
buildCreateTransactionInstructions(data: ICreateStreamData, extParams:
|
|
224
|
-
senderPublicKey: PublicKey;
|
|
225
|
-
}): Promise<{
|
|
233
|
+
buildCreateTransactionInstructions(data: ICreateStreamData, extParams: IPrepareCreateStreamSolanaExt): Promise<{
|
|
226
234
|
ixs: TransactionInstruction[];
|
|
227
235
|
metadataId: string;
|
|
228
236
|
metadata?: Keypair;
|
|
@@ -238,9 +246,7 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
238
246
|
* @param {Omit<ICreateStreamSolanaExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
239
247
|
* @returns Transaction and metadata information
|
|
240
248
|
*/
|
|
241
|
-
buildCreateTransaction(data: ICreateStreamData, extParams:
|
|
242
|
-
senderPublicKey: PublicKey;
|
|
243
|
-
}): Promise<{
|
|
249
|
+
buildCreateTransaction(data: ICreateStreamData, extParams: IPrepareCreateStreamSolanaExt): Promise<{
|
|
244
250
|
tx: VersionedTransaction;
|
|
245
251
|
metadataId: string;
|
|
246
252
|
metadata?: Keypair;
|
|
@@ -255,16 +261,16 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
255
261
|
* @returns Create result
|
|
256
262
|
*/
|
|
257
263
|
create(data: ICreateStreamData, extParams: ICreateStreamSolanaExt): Promise<ICreateResult>;
|
|
258
|
-
prepareCreateInstructions(streamParams: ICreateStreamData, extParams:
|
|
259
|
-
prepareCreateAlignedUnlockInstructions(streamParams: ICreateAlignedStreamData, extParams:
|
|
264
|
+
prepareCreateInstructions(streamParams: ICreateStreamData, extParams: IPrepareCreateStreamSolanaExt): Promise<ICreateStreamInstructions>;
|
|
265
|
+
prepareCreateAlignedUnlockInstructions(streamParams: ICreateAlignedStreamData, extParams: IPrepareCreateStreamSolanaExt): Promise<ICreateStreamInstructions>;
|
|
260
266
|
/**
|
|
261
267
|
* Creates a new stream/vesting contract.
|
|
262
268
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
263
269
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
264
|
-
* @param {
|
|
270
|
+
* @param {IPrepareCreateStreamSolanaExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
265
271
|
* @returns Create stream instructions
|
|
266
272
|
*/
|
|
267
|
-
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 }:
|
|
273
|
+
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 }: IPrepareCreateStreamSolanaExt): Promise<ICreateStreamInstructions>;
|
|
268
274
|
/**
|
|
269
275
|
* Creates a new stream/vesting contract using unchecked instruction.
|
|
270
276
|
*
|
|
@@ -282,7 +288,7 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
282
288
|
/**
|
|
283
289
|
* Create Transaction instructions for `createUnchecked`
|
|
284
290
|
*/
|
|
285
|
-
prepareCreateUncheckedInstructions({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canTopup, canUpdateRate, canPause, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, partner, }: ICreateStreamData, { sender, metadataPubKeys, isNative, computePrice, computeLimit }:
|
|
291
|
+
prepareCreateUncheckedInstructions({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canTopup, canUpdateRate, canPause, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, partner, }: ICreateStreamData, { sender, metadataPubKeys, isNative, computePrice, computeLimit }: IPrepareCreateStreamSolanaExt): Promise<{
|
|
286
292
|
ixs: TransactionInstruction[];
|
|
287
293
|
metadata: Keypair | undefined;
|
|
288
294
|
metadataPubKey: PublicKey;
|
|
@@ -291,12 +297,10 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
291
297
|
* Builds transaction instructions for creating multiple stream/vesting contracts without creating transactions.
|
|
292
298
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
293
299
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
294
|
-
* @param {
|
|
300
|
+
* @param {IPrepareCreateStreamSolanaExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
295
301
|
* @returns Create multiple transaction instructions
|
|
296
302
|
*/
|
|
297
|
-
buildCreateMultipleTransactionInstructions(data: ICreateMultipleStreamData, extParams:
|
|
298
|
-
senderPublicKey: PublicKey;
|
|
299
|
-
}): Promise<{
|
|
303
|
+
buildCreateMultipleTransactionInstructions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamSolanaExt): Promise<{
|
|
300
304
|
instructionsBatch: {
|
|
301
305
|
ixs: TransactionInstruction[];
|
|
302
306
|
metadata: Keypair | undefined;
|
|
@@ -329,12 +333,10 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
329
333
|
* ```
|
|
330
334
|
*
|
|
331
335
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
332
|
-
* @param {
|
|
336
|
+
* @param {IPrepareCreateStreamSolanaExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
333
337
|
* @returns Multiple transaction information
|
|
334
338
|
*/
|
|
335
|
-
buildCreateMultipleTransactions(data: ICreateMultipleStreamData, extParams:
|
|
336
|
-
senderPublicKey: PublicKey;
|
|
337
|
-
}): Promise<{
|
|
339
|
+
buildCreateMultipleTransactions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamSolanaExt): Promise<{
|
|
338
340
|
transactions: BatchItem[];
|
|
339
341
|
metadatas: string[];
|
|
340
342
|
metadataToRecipient: MetadataRecipientHashMap;
|
|
@@ -372,10 +374,10 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
372
374
|
/**
|
|
373
375
|
* Creates Transaction Instructions for withdrawal
|
|
374
376
|
* @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
|
|
375
|
-
* @param {
|
|
377
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
|
|
376
378
|
* @returns Transaction instructions
|
|
377
379
|
*/
|
|
378
|
-
prepareWithdrawInstructions({ id, amount }: IWithdrawData, { invoker, checkTokenAccounts, computePrice, computeLimit }:
|
|
380
|
+
prepareWithdrawInstructions({ id, amount }: IWithdrawData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IPrepareStreamSolanaExt): Promise<TransactionInstruction[]>;
|
|
379
381
|
/**
|
|
380
382
|
* Attempts canceling the specified stream.
|
|
381
383
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
@@ -386,24 +388,24 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
386
388
|
/**
|
|
387
389
|
* Creates Transaction Instructions for cancel
|
|
388
390
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
389
|
-
* @param {
|
|
391
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
|
|
390
392
|
* @returns Transaction instructions
|
|
391
393
|
*/
|
|
392
|
-
prepareCancelInstructions(cancelData: ICancelData, extParams:
|
|
394
|
+
prepareCancelInstructions(cancelData: ICancelData, extParams: IPrepareStreamSolanaExt): Promise<TransactionInstruction[]>;
|
|
393
395
|
/**
|
|
394
396
|
* Creates Transaction Instructions for cancel
|
|
395
397
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
396
|
-
* @param {
|
|
398
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
397
399
|
* @returns Transaction instructions
|
|
398
400
|
*/
|
|
399
|
-
prepareCancelAlignedUnlockInstructions({ id }: ICancelData, { invoker, checkTokenAccounts, computePrice, computeLimit }:
|
|
401
|
+
prepareCancelAlignedUnlockInstructions({ id }: ICancelData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IPrepareStreamSolanaExt): Promise<TransactionInstruction[]>;
|
|
400
402
|
/**
|
|
401
403
|
* Creates Transaction Instructions for cancel
|
|
402
404
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
403
|
-
* @param {
|
|
405
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
404
406
|
* @returns Transaction instructions
|
|
405
407
|
*/
|
|
406
|
-
prepareCancelStreamInstructions({ id }: ICancelData, { invoker, checkTokenAccounts, computePrice, computeLimit }:
|
|
408
|
+
prepareCancelStreamInstructions({ id }: ICancelData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IPrepareStreamSolanaExt): Promise<TransactionInstruction[]>;
|
|
407
409
|
/**
|
|
408
410
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
409
411
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
@@ -416,10 +418,10 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
416
418
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
417
419
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
418
420
|
* @param {ITransferData} transferData - Transfer parameters including stream ID and new recipient address
|
|
419
|
-
* @param {
|
|
421
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
420
422
|
* @returns Transaction instructions
|
|
421
423
|
*/
|
|
422
|
-
prepareTransferInstructions({ id, newRecipient }: ITransferData, { invoker, computePrice, computeLimit }:
|
|
424
|
+
prepareTransferInstructions({ id, newRecipient }: ITransferData, { invoker, computePrice, computeLimit }: IPrepareStreamSolanaExt): Promise<TransactionInstruction[]>;
|
|
423
425
|
/**
|
|
424
426
|
* Tops up stream account with specified amount.
|
|
425
427
|
* @param {ITopUpData} topupData - Top-up parameters including stream ID and amount to add
|
|
@@ -470,10 +472,10 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
470
472
|
/**
|
|
471
473
|
* Create Transaction instructions for update
|
|
472
474
|
* @param {IUpdateData} data - Update parameters including stream ID and new settings
|
|
473
|
-
* @param {
|
|
475
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
474
476
|
* @returns Transaction instructions
|
|
475
477
|
*/
|
|
476
|
-
prepareUpdateInstructions(data: IUpdateData, { invoker, computePrice, computeLimit }:
|
|
478
|
+
prepareUpdateInstructions(data: IUpdateData, { invoker, computePrice, computeLimit }: IPrepareStreamSolanaExt): Promise<TransactionInstruction[]>;
|
|
477
479
|
/**
|
|
478
480
|
* Gets fees for a given address
|
|
479
481
|
* @param {IGetFeesData} getData - Query parameters containing the partner address to check for custom fees
|
|
@@ -813,6 +815,8 @@ type index_ICreateSolanaExt = ICreateSolanaExt;
|
|
|
813
815
|
type index_ICreateStreamInstructions = ICreateStreamInstructions;
|
|
814
816
|
type index_ICreateStreamSolanaExt = ICreateStreamSolanaExt;
|
|
815
817
|
type index_IInteractStreamSolanaExt = IInteractStreamSolanaExt;
|
|
818
|
+
type index_IPrepareCreateStreamSolanaExt = IPrepareCreateStreamSolanaExt;
|
|
819
|
+
type index_IPrepareStreamSolanaExt = IPrepareStreamSolanaExt;
|
|
816
820
|
type index_ISearchStreams = ISearchStreams;
|
|
817
821
|
type index_ITopUpStreamSolanaExt = ITopUpStreamSolanaExt;
|
|
818
822
|
type index_ITransactionSolanaExtWithInstructions = ITransactionSolanaExtWithInstructions;
|
|
@@ -839,7 +843,7 @@ declare const index_transferStreamInstruction: typeof transferStreamInstruction;
|
|
|
839
843
|
declare const index_updateStreamInstruction: typeof updateStreamInstruction;
|
|
840
844
|
declare const index_withdrawStreamInstruction: typeof withdrawStreamInstruction;
|
|
841
845
|
declare namespace index {
|
|
842
|
-
export { type index_Account as Account, index_AlignedContract as AlignedContract, type index_AlignedUnlocksContract as AlignedUnlocksContract, type index_BatchItem as BatchItem, type index_BatchItemError as BatchItemError, type index_BatchItemResult as BatchItemResult, type index_BatchItemSuccess as BatchItemSuccess, type index_ChangeOracleParams as ChangeOracleParams, type index_ClientCreationOptions as ClientCreationOptions, index_Contract as Contract, index_ContractError as ContractError, type index_CreateParams as CreateParams, type index_CreateTestOracleParams as CreateTestOracleParams, type index_DecodedStream as DecodedStream, index_IChain as IChain, index_ICluster as ICluster, type index_ICreateSolanaExt as ICreateSolanaExt, type index_ICreateStreamInstructions as ICreateStreamInstructions, type index_ICreateStreamSolanaExt as ICreateStreamSolanaExt, type index_IInteractStreamSolanaExt as IInteractStreamSolanaExt, type index_ISearchStreams as ISearchStreams, type index_ITopUpStreamSolanaExt as ITopUpStreamSolanaExt, type index_ITransactionSolanaExtWithInstructions as ITransactionSolanaExtWithInstructions, type index_InstructionGenerator as InstructionGenerator, type index_MetadataRecipientHashMap as MetadataRecipientHashMap, type index_OracleType as OracleType, index_SolanaStreamClient as SolanaStreamClient, type index_TestOracle as TestOracle, type index_UpdateTestOracleParams as UpdateTestOracleParams, index_cancelStreamInstruction as cancelStreamInstruction, index_constants as constants, index_createStreamInstruction as createStreamInstruction, index_createUncheckedStreamInstruction as createUncheckedStreamInstruction, index_decodeStream as decodeStream, index_deriveContractPDA as deriveContractPDA, index_deriveEscrowPDA as deriveEscrowPDA, index_deriveTestOraclePDA as deriveTestOraclePDA, index_extractSolanaErrorCode as extractSolanaErrorCode, index_sendAndConfirmStreamRawTransaction as sendAndConfirmStreamRawTransaction, index_signAllTransactionWithRecipients as signAllTransactionWithRecipients, _default as timelockIDL, index_topupStreamInstruction as topupStreamInstruction, index_transferStreamInstruction as transferStreamInstruction, index_updateStreamInstruction as updateStreamInstruction, index_withdrawStreamInstruction as withdrawStreamInstruction };
|
|
846
|
+
export { type index_Account as Account, index_AlignedContract as AlignedContract, type index_AlignedUnlocksContract as AlignedUnlocksContract, type index_BatchItem as BatchItem, type index_BatchItemError as BatchItemError, type index_BatchItemResult as BatchItemResult, type index_BatchItemSuccess as BatchItemSuccess, type index_ChangeOracleParams as ChangeOracleParams, type index_ClientCreationOptions as ClientCreationOptions, index_Contract as Contract, index_ContractError as ContractError, type index_CreateParams as CreateParams, type index_CreateTestOracleParams as CreateTestOracleParams, type index_DecodedStream as DecodedStream, index_IChain as IChain, index_ICluster as ICluster, type index_ICreateSolanaExt as ICreateSolanaExt, type index_ICreateStreamInstructions as ICreateStreamInstructions, type index_ICreateStreamSolanaExt as ICreateStreamSolanaExt, type index_IInteractStreamSolanaExt as IInteractStreamSolanaExt, type index_IPrepareCreateStreamSolanaExt as IPrepareCreateStreamSolanaExt, type index_IPrepareStreamSolanaExt as IPrepareStreamSolanaExt, type index_ISearchStreams as ISearchStreams, type index_ITopUpStreamSolanaExt as ITopUpStreamSolanaExt, type index_ITransactionSolanaExtWithInstructions as ITransactionSolanaExtWithInstructions, type index_InstructionGenerator as InstructionGenerator, type index_MetadataRecipientHashMap as MetadataRecipientHashMap, type index_OracleType as OracleType, index_SolanaStreamClient as SolanaStreamClient, type index_TestOracle as TestOracle, type index_UpdateTestOracleParams as UpdateTestOracleParams, index_cancelStreamInstruction as cancelStreamInstruction, index_constants as constants, index_createStreamInstruction as createStreamInstruction, index_createUncheckedStreamInstruction as createUncheckedStreamInstruction, index_decodeStream as decodeStream, index_deriveContractPDA as deriveContractPDA, index_deriveEscrowPDA as deriveEscrowPDA, index_deriveTestOraclePDA as deriveTestOraclePDA, index_extractSolanaErrorCode as extractSolanaErrorCode, index_sendAndConfirmStreamRawTransaction as sendAndConfirmStreamRawTransaction, index_signAllTransactionWithRecipients as signAllTransactionWithRecipients, _default as timelockIDL, index_topupStreamInstruction as topupStreamInstruction, index_transferStreamInstruction as transferStreamInstruction, index_updateStreamInstruction as updateStreamInstruction, index_withdrawStreamInstruction as withdrawStreamInstruction };
|
|
843
847
|
}
|
|
844
848
|
|
|
845
|
-
export { type ICreateSolanaExt as $, ALIGNED_PRECISION_FACTOR_POW as A, signAllTransactionWithRecipients as B, CREATE_PARAMS_PADDING as C, DEFAULT_STREAMFLOW_FEE as D, ESCROW_SEED as E, FEE_ORACLE_PUBLIC_KEY as F, sendAndConfirmStreamRawTransaction as G, extractSolanaErrorCode as H, type ICreateStreamSolanaExt as I, deriveContractPDA as J, deriveEscrowPDA as K, deriveTestOraclePDA as L, type AlignedUnlocksContract as M, type OracleType as N, ORIGINAL_CONTRACT_SENDER_OFFSET as O, PROGRAM_ID as P, type TestOracle as Q, type CreateParams as R, SolanaStreamClient as S, TX_FINALITY_CONFIRMED as T, type ChangeOracleParams as U, type CreateTestOracleParams as V, WITHDRAWOR_PUBLIC_KEY as W, type UpdateTestOracleParams as X, type ISearchStreams as Y, type Account as Z, _default as _, type IInteractStreamSolanaExt as a, type ITransactionSolanaExtWithInstructions as a0, type
|
|
849
|
+
export { type ICreateSolanaExt as $, ALIGNED_PRECISION_FACTOR_POW as A, signAllTransactionWithRecipients as B, CREATE_PARAMS_PADDING as C, DEFAULT_STREAMFLOW_FEE as D, ESCROW_SEED as E, FEE_ORACLE_PUBLIC_KEY as F, sendAndConfirmStreamRawTransaction as G, extractSolanaErrorCode as H, type ICreateStreamSolanaExt as I, deriveContractPDA as J, deriveEscrowPDA as K, deriveTestOraclePDA as L, type AlignedUnlocksContract as M, type OracleType as N, ORIGINAL_CONTRACT_SENDER_OFFSET as O, PROGRAM_ID as P, type TestOracle as Q, type CreateParams as R, SolanaStreamClient as S, TX_FINALITY_CONFIRMED as T, type ChangeOracleParams as U, type CreateTestOracleParams as V, WITHDRAWOR_PUBLIC_KEY as W, type UpdateTestOracleParams as X, type ISearchStreams as Y, type Account as Z, _default as _, type IInteractStreamSolanaExt as a, type ITransactionSolanaExtWithInstructions as a0, type IPrepareCreateStreamSolanaExt as a1, type IPrepareStreamSolanaExt as a2, type ICreateStreamInstructions as a3, Contract as a4, AlignedContract as a5, type DecodedStream as a6, type MetadataRecipientHashMap as a7, type BatchItem as a8, type BatchItemSuccess as a9, type BatchItemError as aa, type BatchItemResult as ab, type InstructionGenerator as ac, createStreamInstruction as ad, createUncheckedStreamInstruction as ae, withdrawStreamInstruction as af, updateStreamInstruction as ag, cancelStreamInstruction as ah, transferStreamInstruction as ai, topupStreamInstruction as aj, type ITopUpStreamSolanaExt as b, STREAM_STRUCT_OFFSET_SENDER as c, STREAM_STRUCT_OFFSET_RECIPIENT as d, STREAM_STRUCT_OFFSET_MINT as e, STREAM_STRUCT_OFFSET_CLOSED as f, STREAM_STRUCT_OFFSETS as g, ALIGNED_UNLOCKS_PROGRAM_ID as h, index as i, ALIGNED_COMPUTE_LIMIT as j, CONTRACT_DISCRIMINATOR as k, TEST_ORACLE_DISCRIMINATOR as l, CONTRACT_SEED as m, TEST_ORACLE_SEED as n, PARTNER_ORACLE_PROGRAM_ID as o, STREAMFLOW_TREASURY_PUBLIC_KEY as p, AIRDROP_TEST_TOKEN as q, FEES_METADATA_SEED as r, AIRDROP_AMOUNT as s, PARTNER_SCHEMA as t, PARTNERS_SCHEMA as u, SOLANA_ERROR_MATCH_REGEX as v, SOLANA_ERROR_MAP as w, constants as x, type ClientCreationOptions as y, decodeStream as z };
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -5061,14 +5061,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5061
5061
|
*/
|
|
5062
5062
|
async buildCreateTransactionInstructions(data, extParams) {
|
|
5063
5063
|
const { partner, amount, tokenProgramId } = data;
|
|
5064
|
-
const { isNative,
|
|
5064
|
+
const { isNative, sender, customInstructions } = extParams;
|
|
5065
|
+
common.assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5065
5066
|
const partnerPublicKey = partner ? new web3_js.PublicKey(partner) : WITHDRAWOR_PUBLIC_KEY;
|
|
5066
5067
|
const mintPublicKey = new web3_js.PublicKey(data.tokenId);
|
|
5067
|
-
const tempSender = { publicKey: senderPublicKey };
|
|
5068
5068
|
const ixs = await this.getCreateATAInstructions(
|
|
5069
5069
|
[partnerPublicKey],
|
|
5070
5070
|
mintPublicKey,
|
|
5071
|
-
|
|
5071
|
+
sender,
|
|
5072
5072
|
true,
|
|
5073
5073
|
tokenProgramId ? new web3_js.PublicKey(tokenProgramId) : void 0
|
|
5074
5074
|
);
|
|
@@ -5077,7 +5077,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5077
5077
|
address: partnerPublicKey.toString()
|
|
5078
5078
|
});
|
|
5079
5079
|
const totalAmount = calculateTotalAmountToDeposit(amount, totalFee);
|
|
5080
|
-
ixs.push(...await solana.prepareWrappedAccount(this.connection,
|
|
5080
|
+
ixs.push(...await solana.prepareWrappedAccount(this.connection, sender.publicKey, totalAmount));
|
|
5081
5081
|
}
|
|
5082
5082
|
const {
|
|
5083
5083
|
ixs: createIxs,
|
|
@@ -5085,7 +5085,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5085
5085
|
metadataPubKey
|
|
5086
5086
|
} = await this.prepareCreateInstructions(data, {
|
|
5087
5087
|
...extParams,
|
|
5088
|
-
sender
|
|
5088
|
+
sender
|
|
5089
5089
|
});
|
|
5090
5090
|
ixs.push(...createIxs);
|
|
5091
5091
|
await this.applyCustomAfterInstructions(ixs, customInstructions, metadataPubKey);
|
|
@@ -5107,9 +5107,9 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5107
5107
|
* @returns Transaction and metadata information
|
|
5108
5108
|
*/
|
|
5109
5109
|
async buildCreateTransaction(data, extParams) {
|
|
5110
|
-
const {
|
|
5110
|
+
const { sender } = extParams;
|
|
5111
5111
|
const { ixs, metadataId, metadata } = await this.buildCreateTransactionInstructions(data, extParams);
|
|
5112
|
-
const { tx, hash, context } = await solana.prepareTransaction(this.connection, ixs,
|
|
5112
|
+
const { tx, hash, context } = await solana.prepareTransaction(this.connection, ixs, sender.publicKey, void 0, [
|
|
5113
5113
|
metadata
|
|
5114
5114
|
]);
|
|
5115
5115
|
return {
|
|
@@ -5129,12 +5129,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5129
5129
|
*/
|
|
5130
5130
|
async create(data, extParams) {
|
|
5131
5131
|
const { sender } = extParams;
|
|
5132
|
-
|
|
5133
|
-
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5134
|
-
}
|
|
5132
|
+
common.assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5135
5133
|
const { ixs, metadataId, metadata } = await this.buildCreateTransactionInstructions(data, {
|
|
5136
5134
|
...extParams,
|
|
5137
|
-
|
|
5135
|
+
sender
|
|
5138
5136
|
});
|
|
5139
5137
|
const { tx, hash, context } = await solana.prepareTransaction(this.connection, ixs, sender.publicKey, void 0, [
|
|
5140
5138
|
metadata
|
|
@@ -5187,19 +5185,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5187
5185
|
floorPrice
|
|
5188
5186
|
} = streamParams;
|
|
5189
5187
|
const { isNative, sender, computeLimit, computePrice, metadataPubKeys } = extParams;
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
}
|
|
5193
|
-
if (!priceOracle && oracleType && oracleType !== "none") {
|
|
5194
|
-
throw new Error("Price oracle is required for the specified oracle type");
|
|
5195
|
-
}
|
|
5188
|
+
common.invariant(!priceOracle && oracleType && oracleType !== "none", "Price oracle is required for the specified oracle type");
|
|
5189
|
+
common.assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5196
5190
|
const recipientPublicKey = new web3_js.PublicKey(recipient);
|
|
5197
5191
|
const mintPublicKey = isNative ? splToken.NATIVE_MINT : new web3_js.PublicKey(mint);
|
|
5198
5192
|
const metadata = !metadataPubKeys ? web3_js.Keypair.generate() : void 0;
|
|
5199
5193
|
const metadataPubKey = metadata ? metadata.publicKey : metadataPubKeys[0];
|
|
5200
|
-
|
|
5201
|
-
throw new Error("Metadata public key is required");
|
|
5202
|
-
}
|
|
5194
|
+
common.invariant(metadataPubKey, "Metadata public key is required");
|
|
5203
5195
|
let tokenProgramId = streamTokenProgramId ? new web3_js.PublicKey(streamTokenProgramId) : void 0;
|
|
5204
5196
|
if (!tokenProgramId) {
|
|
5205
5197
|
tokenProgramId = (await solana.getMintAndProgram(this.connection, mintPublicKey)).tokenProgramId;
|
|
@@ -5212,7 +5204,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5212
5204
|
computePrice,
|
|
5213
5205
|
computeLimit: computeLimit ?? ALIGNED_COMPUTE_LIMIT
|
|
5214
5206
|
});
|
|
5215
|
-
if (recipientPublicKey.toString() !== sender.
|
|
5207
|
+
if (recipientPublicKey.toString() !== sender.toString() || !isNative) {
|
|
5216
5208
|
ixs.push(
|
|
5217
5209
|
...await this.getCreateATAInstructions([recipientPublicKey], mintPublicKey, sender, true, tokenProgramId)
|
|
5218
5210
|
);
|
|
@@ -5263,7 +5255,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5263
5255
|
* Creates a new stream/vesting contract.
|
|
5264
5256
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
5265
5257
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
5266
|
-
* @param {
|
|
5258
|
+
* @param {IPrepareCreateStreamSolanaExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
5267
5259
|
* @returns Create stream instructions
|
|
5268
5260
|
*/
|
|
5269
5261
|
async prepareCreateStreamInstructions({
|
|
@@ -5288,9 +5280,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5288
5280
|
partner,
|
|
5289
5281
|
tokenProgramId: streamTokenProgramId
|
|
5290
5282
|
}, { sender, metadataPubKeys, isNative = false, computePrice, computeLimit }) {
|
|
5291
|
-
|
|
5292
|
-
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5293
|
-
}
|
|
5283
|
+
common.assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5294
5284
|
const ixs = solana.prepareBaseInstructions(this.connection, {
|
|
5295
5285
|
computePrice,
|
|
5296
5286
|
computeLimit
|
|
@@ -5370,7 +5360,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5370
5360
|
* @returns Create result
|
|
5371
5361
|
*/
|
|
5372
5362
|
async createUnchecked(data, extParams) {
|
|
5373
|
-
const { ixs, metadata, metadataPubKey } = await this.prepareCreateUncheckedInstructions(
|
|
5363
|
+
const { ixs, metadata, metadataPubKey } = await this.prepareCreateUncheckedInstructions(
|
|
5364
|
+
data,
|
|
5365
|
+
extParams
|
|
5366
|
+
);
|
|
5374
5367
|
const { tx, hash, context } = await solana.prepareTransaction(
|
|
5375
5368
|
this.connection,
|
|
5376
5369
|
ixs,
|
|
@@ -5415,9 +5408,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5415
5408
|
withdrawalFrequency = 0,
|
|
5416
5409
|
partner
|
|
5417
5410
|
}, { sender, metadataPubKeys, isNative = false, computePrice, computeLimit }) {
|
|
5418
|
-
|
|
5419
|
-
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5420
|
-
}
|
|
5411
|
+
common.assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5421
5412
|
const mintPublicKey = new web3_js.PublicKey(mint);
|
|
5422
5413
|
const recipientPublicKey = new web3_js.PublicKey(recipient);
|
|
5423
5414
|
const { metadata, metadataPubKey } = this.getOrCreateStreamMetadata(metadataPubKeys);
|
|
@@ -5426,7 +5417,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5426
5417
|
programId: this.programId,
|
|
5427
5418
|
space: METADATA_ACC_SIZE,
|
|
5428
5419
|
lamports: rentToExempt,
|
|
5429
|
-
fromPubkey: sender
|
|
5420
|
+
fromPubkey: sender.publicKey,
|
|
5430
5421
|
newAccountPubkey: metadataPubKey
|
|
5431
5422
|
});
|
|
5432
5423
|
const [escrowTokens] = web3_js.PublicKey.findProgramAddressSync(
|
|
@@ -5488,12 +5479,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5488
5479
|
* Builds transaction instructions for creating multiple stream/vesting contracts without creating transactions.
|
|
5489
5480
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
5490
5481
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
5491
|
-
* @param {
|
|
5482
|
+
* @param {IPrepareCreateStreamSolanaExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
5492
5483
|
* @returns Create multiple transaction instructions
|
|
5493
5484
|
*/
|
|
5494
5485
|
async buildCreateMultipleTransactionInstructions(data, extParams) {
|
|
5495
5486
|
const { recipients, ...streamParams } = data;
|
|
5496
|
-
const {
|
|
5487
|
+
const { sender, metadataPubKeys: metadataPubKeysExt, isNative, customInstructions } = extParams;
|
|
5488
|
+
common.assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5497
5489
|
const metadatas = [];
|
|
5498
5490
|
const metadataToRecipient = {};
|
|
5499
5491
|
const instructionsBatch = [];
|
|
@@ -5503,12 +5495,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5503
5495
|
if (recipients.length === 0) {
|
|
5504
5496
|
throw new Error("Recipients array is empty!");
|
|
5505
5497
|
}
|
|
5506
|
-
const tempSender = { publicKey: senderPublicKey };
|
|
5507
5498
|
for (let i = 0; i < recipients.length; i++) {
|
|
5508
5499
|
const recipientData = recipients[i];
|
|
5509
5500
|
const createStreamData = { ...streamParams, ...recipientData };
|
|
5510
5501
|
const createStreamExtParams = {
|
|
5511
|
-
sender: tempSender,
|
|
5512
5502
|
metadataPubKeys: metadataPubKeys[i] ? [metadataPubKeys[i]] : void 0,
|
|
5513
5503
|
...extParams
|
|
5514
5504
|
};
|
|
@@ -5528,14 +5518,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5528
5518
|
const prepareInstructions = await this.getCreateATAInstructions(
|
|
5529
5519
|
[partnerPublicKey],
|
|
5530
5520
|
mintPublicKey,
|
|
5531
|
-
|
|
5521
|
+
sender,
|
|
5532
5522
|
true
|
|
5533
5523
|
);
|
|
5534
5524
|
if (isNative) {
|
|
5535
5525
|
const totalDepositedAmount = recipients.reduce((acc, recipient) => recipient.amount.add(acc), new BN7__default.default(0));
|
|
5536
5526
|
const nativeInstructions = await solana.prepareWrappedAccount(
|
|
5537
5527
|
this.connection,
|
|
5538
|
-
|
|
5528
|
+
sender.publicKey,
|
|
5539
5529
|
totalDepositedAmount
|
|
5540
5530
|
);
|
|
5541
5531
|
prepareInstructions.push(...nativeInstructions);
|
|
@@ -5570,20 +5560,20 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5570
5560
|
* ```
|
|
5571
5561
|
*
|
|
5572
5562
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
5573
|
-
* @param {
|
|
5563
|
+
* @param {IPrepareCreateStreamSolanaExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
5574
5564
|
* @returns Multiple transaction information
|
|
5575
5565
|
*/
|
|
5576
5566
|
async buildCreateMultipleTransactions(data, extParams) {
|
|
5577
|
-
const {
|
|
5567
|
+
const { sender } = extParams;
|
|
5578
5568
|
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams);
|
|
5579
5569
|
const { value: hash, context } = await this.connection.getLatestBlockhashAndContext();
|
|
5580
5570
|
const batch = [];
|
|
5581
5571
|
for (const { ixs, metadata, recipient } of instructionsBatch) {
|
|
5582
|
-
batch.push({ tx: solana.createVersionedTransaction(ixs,
|
|
5572
|
+
batch.push({ tx: solana.createVersionedTransaction(ixs, sender.publicKey, hash.blockhash, [metadata]), recipient });
|
|
5583
5573
|
}
|
|
5584
5574
|
let prepareTx;
|
|
5585
5575
|
if (prepareInstructions.length > 0) {
|
|
5586
|
-
prepareTx = solana.createVersionedTransaction(prepareInstructions,
|
|
5576
|
+
prepareTx = solana.createVersionedTransaction(prepareInstructions, sender.publicKey, hash.blockhash);
|
|
5587
5577
|
}
|
|
5588
5578
|
return {
|
|
5589
5579
|
transactions: batch,
|
|
@@ -5606,10 +5596,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5606
5596
|
if (!sender.publicKey) {
|
|
5607
5597
|
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5608
5598
|
}
|
|
5609
|
-
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data,
|
|
5610
|
-
...extParams,
|
|
5611
|
-
senderPublicKey: sender.publicKey
|
|
5612
|
-
});
|
|
5599
|
+
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams);
|
|
5613
5600
|
const errors = [];
|
|
5614
5601
|
const signatures = [];
|
|
5615
5602
|
const metadataPubKeys = metadataPubKeysExt || [];
|
|
@@ -5674,10 +5661,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5674
5661
|
if (!sender.publicKey) {
|
|
5675
5662
|
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5676
5663
|
}
|
|
5677
|
-
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data,
|
|
5678
|
-
...extParams,
|
|
5679
|
-
senderPublicKey: sender.publicKey
|
|
5680
|
-
});
|
|
5664
|
+
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams);
|
|
5681
5665
|
const errors = [];
|
|
5682
5666
|
const signatures = [];
|
|
5683
5667
|
const batch = [];
|
|
@@ -5740,10 +5724,11 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5740
5724
|
*/
|
|
5741
5725
|
async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, extParams) {
|
|
5742
5726
|
const { invoker, customInstructions } = extParams;
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5727
|
+
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5728
|
+
const ixs = await this.prepareWithdrawInstructions(
|
|
5729
|
+
{ id, amount },
|
|
5730
|
+
extParams
|
|
5731
|
+
);
|
|
5747
5732
|
const metadata = new web3_js.PublicKey(id);
|
|
5748
5733
|
await this.applyCustomAfterInstructions(ixs, customInstructions, metadata);
|
|
5749
5734
|
const { tx, hash, context } = await solana.prepareTransaction(this.connection, ixs, invoker.publicKey);
|
|
@@ -5763,22 +5748,18 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5763
5748
|
/**
|
|
5764
5749
|
* Creates Transaction Instructions for withdrawal
|
|
5765
5750
|
* @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
|
|
5766
|
-
* @param {
|
|
5751
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
|
|
5767
5752
|
* @returns Transaction instructions
|
|
5768
5753
|
*/
|
|
5769
5754
|
async prepareWithdrawInstructions({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
5770
|
-
|
|
5771
|
-
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5772
|
-
}
|
|
5755
|
+
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5773
5756
|
const ixs = solana.prepareBaseInstructions(this.connection, {
|
|
5774
5757
|
computePrice,
|
|
5775
5758
|
computeLimit
|
|
5776
5759
|
});
|
|
5777
5760
|
const streamPublicKey = new web3_js.PublicKey(id);
|
|
5778
5761
|
const escrow = await this.connection.getAccountInfo(streamPublicKey);
|
|
5779
|
-
|
|
5780
|
-
throw new Error("Couldn't get account info");
|
|
5781
|
-
}
|
|
5762
|
+
common.invariant(escrow?.data, "Couldn't get account info");
|
|
5782
5763
|
const data = decodeStream(escrow.data);
|
|
5783
5764
|
const { sender, recipient, mint, streamflowTreasury, partner, recipientTokens, escrowTokens } = data;
|
|
5784
5765
|
const { tokenProgramId } = await solana.getMintAndProgram(this.connection, mint);
|
|
@@ -5834,7 +5815,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5834
5815
|
/**
|
|
5835
5816
|
* Creates Transaction Instructions for cancel
|
|
5836
5817
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5837
|
-
* @param {
|
|
5818
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
|
|
5838
5819
|
* @returns Transaction instructions
|
|
5839
5820
|
*/
|
|
5840
5821
|
async prepareCancelInstructions(cancelData, extParams) {
|
|
@@ -5851,18 +5832,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5851
5832
|
/**
|
|
5852
5833
|
* Creates Transaction Instructions for cancel
|
|
5853
5834
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5854
|
-
* @param {
|
|
5835
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
5855
5836
|
* @returns Transaction instructions
|
|
5856
5837
|
*/
|
|
5857
5838
|
async prepareCancelAlignedUnlockInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
5858
|
-
|
|
5859
|
-
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5860
|
-
}
|
|
5839
|
+
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5861
5840
|
const streamPublicKey = new web3_js.PublicKey(id);
|
|
5862
5841
|
const escrowAcc = await this.connection.getAccountInfo(streamPublicKey);
|
|
5863
|
-
|
|
5864
|
-
throw new Error("Couldn't get account info");
|
|
5865
|
-
}
|
|
5842
|
+
common.invariant(escrowAcc?.data, "Couldn't get account info");
|
|
5866
5843
|
const streamData = decodeStream(escrowAcc.data);
|
|
5867
5844
|
const { sender, recipient, mint, streamflowTreasury, partner, escrowTokens } = streamData;
|
|
5868
5845
|
const { tokenProgramId } = await solana.getMintAndProgram(this.connection, mint);
|
|
@@ -5894,18 +5871,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5894
5871
|
/**
|
|
5895
5872
|
* Creates Transaction Instructions for cancel
|
|
5896
5873
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5897
|
-
* @param {
|
|
5874
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
5898
5875
|
* @returns Transaction instructions
|
|
5899
5876
|
*/
|
|
5900
5877
|
async prepareCancelStreamInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
5901
|
-
|
|
5902
|
-
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5903
|
-
}
|
|
5878
|
+
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5904
5879
|
const streamPublicKey = new web3_js.PublicKey(id);
|
|
5905
5880
|
const escrowAcc = await this.connection.getAccountInfo(streamPublicKey);
|
|
5906
|
-
|
|
5907
|
-
throw new Error("Couldn't get account info");
|
|
5908
|
-
}
|
|
5881
|
+
common.invariant(escrowAcc?.data, "Couldn't get account info");
|
|
5909
5882
|
const data = decodeStream(escrowAcc.data);
|
|
5910
5883
|
const { sender, recipient, partner, streamflowTreasury, mint, senderTokens, recipientTokens, escrowTokens } = data;
|
|
5911
5884
|
const { tokenProgramId } = await solana.getMintAndProgram(this.connection, mint);
|
|
@@ -5969,13 +5942,11 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5969
5942
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
5970
5943
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
5971
5944
|
* @param {ITransferData} transferData - Transfer parameters including stream ID and new recipient address
|
|
5972
|
-
* @param {
|
|
5945
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
5973
5946
|
* @returns Transaction instructions
|
|
5974
5947
|
*/
|
|
5975
5948
|
async prepareTransferInstructions({ id, newRecipient }, { invoker, computePrice, computeLimit = 100001 }) {
|
|
5976
|
-
|
|
5977
|
-
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5978
|
-
}
|
|
5949
|
+
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5979
5950
|
const ixs = solana.prepareBaseInstructions(this.connection, {
|
|
5980
5951
|
computePrice,
|
|
5981
5952
|
computeLimit
|
|
@@ -5983,9 +5954,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5983
5954
|
const stream = new web3_js.PublicKey(id);
|
|
5984
5955
|
const newRecipientPublicKey = new web3_js.PublicKey(newRecipient);
|
|
5985
5956
|
const escrow = await this.connection.getAccountInfo(stream);
|
|
5986
|
-
|
|
5987
|
-
throw new Error("Couldn't get account info");
|
|
5988
|
-
}
|
|
5957
|
+
common.invariant(escrow?.data, "Couldn't get account info");
|
|
5989
5958
|
const { mint } = decodeStream(escrow?.data);
|
|
5990
5959
|
const { tokenProgramId } = await solana.getMintAndProgram(this.connection, mint);
|
|
5991
5960
|
const newRecipientTokens = await solana.ata(mint, newRecipientPublicKey, tokenProgramId);
|
|
@@ -6221,6 +6190,9 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6221
6190
|
* @returns Transaction result
|
|
6222
6191
|
*/
|
|
6223
6192
|
async update(data, extParams) {
|
|
6193
|
+
if (!extParams.invoker.publicKey) {
|
|
6194
|
+
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
6195
|
+
}
|
|
6224
6196
|
const ixs = await this.prepareUpdateInstructions(data, extParams);
|
|
6225
6197
|
const { tx, hash, context } = await solana.prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
6226
6198
|
const signature = await solana.signAndExecuteTransaction(
|
|
@@ -6242,18 +6214,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6242
6214
|
/**
|
|
6243
6215
|
* Create Transaction instructions for update
|
|
6244
6216
|
* @param {IUpdateData} data - Update parameters including stream ID and new settings
|
|
6245
|
-
* @param {
|
|
6217
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
6246
6218
|
* @returns Transaction instructions
|
|
6247
6219
|
*/
|
|
6248
6220
|
async prepareUpdateInstructions(data, { invoker, computePrice, computeLimit }) {
|
|
6249
|
-
|
|
6250
|
-
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
6251
|
-
}
|
|
6221
|
+
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
6252
6222
|
const streamPublicKey = new web3_js.PublicKey(data.id);
|
|
6253
6223
|
const escrow = await this.connection.getAccountInfo(streamPublicKey);
|
|
6254
|
-
|
|
6255
|
-
throw new Error("Couldn't get account info");
|
|
6256
|
-
}
|
|
6224
|
+
common.invariant(escrow, "Couldn't get account info");
|
|
6257
6225
|
const ixs = solana.prepareBaseInstructions(this.connection, {
|
|
6258
6226
|
computePrice,
|
|
6259
6227
|
computeLimit
|