@streamflow/stream 8.8.0 → 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 +60 -90
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -2
- package/dist/cjs/solana/index.cjs +60 -90
- 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 +61 -91
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +1 -1
- package/dist/esm/solana/index.js +61 -91
- 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,9 +5204,11 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5212
5204
|
computePrice,
|
|
5213
5205
|
computeLimit: computeLimit ?? ALIGNED_COMPUTE_LIMIT
|
|
5214
5206
|
});
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5207
|
+
if (recipientPublicKey.toString() !== sender.toString() || !isNative) {
|
|
5208
|
+
ixs.push(
|
|
5209
|
+
...await this.getCreateATAInstructions([recipientPublicKey], mintPublicKey, sender, true, tokenProgramId)
|
|
5210
|
+
);
|
|
5211
|
+
}
|
|
5218
5212
|
const encodedUIntArray = new TextEncoder().encode(streamName);
|
|
5219
5213
|
const streamNameArray = Array.from(encodedUIntArray);
|
|
5220
5214
|
const createIx = await this.alignedProxyProgram.methods.create({
|
|
@@ -5261,7 +5255,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5261
5255
|
* Creates a new stream/vesting contract.
|
|
5262
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).
|
|
5263
5257
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
5264
|
-
* @param {
|
|
5258
|
+
* @param {IPrepareCreateStreamSolanaExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
5265
5259
|
* @returns Create stream instructions
|
|
5266
5260
|
*/
|
|
5267
5261
|
async prepareCreateStreamInstructions({
|
|
@@ -5286,9 +5280,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5286
5280
|
partner,
|
|
5287
5281
|
tokenProgramId: streamTokenProgramId
|
|
5288
5282
|
}, { sender, metadataPubKeys, isNative = false, computePrice, computeLimit }) {
|
|
5289
|
-
|
|
5290
|
-
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5291
|
-
}
|
|
5283
|
+
common.assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5292
5284
|
const ixs = solana.prepareBaseInstructions(this.connection, {
|
|
5293
5285
|
computePrice,
|
|
5294
5286
|
computeLimit
|
|
@@ -5368,7 +5360,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5368
5360
|
* @returns Create result
|
|
5369
5361
|
*/
|
|
5370
5362
|
async createUnchecked(data, extParams) {
|
|
5371
|
-
const { ixs, metadata, metadataPubKey } = await this.prepareCreateUncheckedInstructions(
|
|
5363
|
+
const { ixs, metadata, metadataPubKey } = await this.prepareCreateUncheckedInstructions(
|
|
5364
|
+
data,
|
|
5365
|
+
extParams
|
|
5366
|
+
);
|
|
5372
5367
|
const { tx, hash, context } = await solana.prepareTransaction(
|
|
5373
5368
|
this.connection,
|
|
5374
5369
|
ixs,
|
|
@@ -5413,9 +5408,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5413
5408
|
withdrawalFrequency = 0,
|
|
5414
5409
|
partner
|
|
5415
5410
|
}, { sender, metadataPubKeys, isNative = false, computePrice, computeLimit }) {
|
|
5416
|
-
|
|
5417
|
-
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5418
|
-
}
|
|
5411
|
+
common.assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5419
5412
|
const mintPublicKey = new web3_js.PublicKey(mint);
|
|
5420
5413
|
const recipientPublicKey = new web3_js.PublicKey(recipient);
|
|
5421
5414
|
const { metadata, metadataPubKey } = this.getOrCreateStreamMetadata(metadataPubKeys);
|
|
@@ -5424,7 +5417,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5424
5417
|
programId: this.programId,
|
|
5425
5418
|
space: METADATA_ACC_SIZE,
|
|
5426
5419
|
lamports: rentToExempt,
|
|
5427
|
-
fromPubkey: sender
|
|
5420
|
+
fromPubkey: sender.publicKey,
|
|
5428
5421
|
newAccountPubkey: metadataPubKey
|
|
5429
5422
|
});
|
|
5430
5423
|
const [escrowTokens] = web3_js.PublicKey.findProgramAddressSync(
|
|
@@ -5486,12 +5479,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5486
5479
|
* Builds transaction instructions for creating multiple stream/vesting contracts without creating transactions.
|
|
5487
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).
|
|
5488
5481
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
5489
|
-
* @param {
|
|
5482
|
+
* @param {IPrepareCreateStreamSolanaExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
5490
5483
|
* @returns Create multiple transaction instructions
|
|
5491
5484
|
*/
|
|
5492
5485
|
async buildCreateMultipleTransactionInstructions(data, extParams) {
|
|
5493
5486
|
const { recipients, ...streamParams } = data;
|
|
5494
|
-
const {
|
|
5487
|
+
const { sender, metadataPubKeys: metadataPubKeysExt, isNative, customInstructions } = extParams;
|
|
5488
|
+
common.assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5495
5489
|
const metadatas = [];
|
|
5496
5490
|
const metadataToRecipient = {};
|
|
5497
5491
|
const instructionsBatch = [];
|
|
@@ -5501,12 +5495,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5501
5495
|
if (recipients.length === 0) {
|
|
5502
5496
|
throw new Error("Recipients array is empty!");
|
|
5503
5497
|
}
|
|
5504
|
-
const tempSender = { publicKey: senderPublicKey };
|
|
5505
5498
|
for (let i = 0; i < recipients.length; i++) {
|
|
5506
5499
|
const recipientData = recipients[i];
|
|
5507
5500
|
const createStreamData = { ...streamParams, ...recipientData };
|
|
5508
5501
|
const createStreamExtParams = {
|
|
5509
|
-
sender: tempSender,
|
|
5510
5502
|
metadataPubKeys: metadataPubKeys[i] ? [metadataPubKeys[i]] : void 0,
|
|
5511
5503
|
...extParams
|
|
5512
5504
|
};
|
|
@@ -5526,14 +5518,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5526
5518
|
const prepareInstructions = await this.getCreateATAInstructions(
|
|
5527
5519
|
[partnerPublicKey],
|
|
5528
5520
|
mintPublicKey,
|
|
5529
|
-
|
|
5521
|
+
sender,
|
|
5530
5522
|
true
|
|
5531
5523
|
);
|
|
5532
5524
|
if (isNative) {
|
|
5533
5525
|
const totalDepositedAmount = recipients.reduce((acc, recipient) => recipient.amount.add(acc), new BN7__default.default(0));
|
|
5534
5526
|
const nativeInstructions = await solana.prepareWrappedAccount(
|
|
5535
5527
|
this.connection,
|
|
5536
|
-
|
|
5528
|
+
sender.publicKey,
|
|
5537
5529
|
totalDepositedAmount
|
|
5538
5530
|
);
|
|
5539
5531
|
prepareInstructions.push(...nativeInstructions);
|
|
@@ -5568,20 +5560,20 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5568
5560
|
* ```
|
|
5569
5561
|
*
|
|
5570
5562
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
5571
|
-
* @param {
|
|
5563
|
+
* @param {IPrepareCreateStreamSolanaExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
5572
5564
|
* @returns Multiple transaction information
|
|
5573
5565
|
*/
|
|
5574
5566
|
async buildCreateMultipleTransactions(data, extParams) {
|
|
5575
|
-
const {
|
|
5567
|
+
const { sender } = extParams;
|
|
5576
5568
|
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams);
|
|
5577
5569
|
const { value: hash, context } = await this.connection.getLatestBlockhashAndContext();
|
|
5578
5570
|
const batch = [];
|
|
5579
5571
|
for (const { ixs, metadata, recipient } of instructionsBatch) {
|
|
5580
|
-
batch.push({ tx: solana.createVersionedTransaction(ixs,
|
|
5572
|
+
batch.push({ tx: solana.createVersionedTransaction(ixs, sender.publicKey, hash.blockhash, [metadata]), recipient });
|
|
5581
5573
|
}
|
|
5582
5574
|
let prepareTx;
|
|
5583
5575
|
if (prepareInstructions.length > 0) {
|
|
5584
|
-
prepareTx = solana.createVersionedTransaction(prepareInstructions,
|
|
5576
|
+
prepareTx = solana.createVersionedTransaction(prepareInstructions, sender.publicKey, hash.blockhash);
|
|
5585
5577
|
}
|
|
5586
5578
|
return {
|
|
5587
5579
|
transactions: batch,
|
|
@@ -5604,10 +5596,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5604
5596
|
if (!sender.publicKey) {
|
|
5605
5597
|
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5606
5598
|
}
|
|
5607
|
-
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data,
|
|
5608
|
-
...extParams,
|
|
5609
|
-
senderPublicKey: sender.publicKey
|
|
5610
|
-
});
|
|
5599
|
+
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams);
|
|
5611
5600
|
const errors = [];
|
|
5612
5601
|
const signatures = [];
|
|
5613
5602
|
const metadataPubKeys = metadataPubKeysExt || [];
|
|
@@ -5672,10 +5661,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5672
5661
|
if (!sender.publicKey) {
|
|
5673
5662
|
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5674
5663
|
}
|
|
5675
|
-
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data,
|
|
5676
|
-
...extParams,
|
|
5677
|
-
senderPublicKey: sender.publicKey
|
|
5678
|
-
});
|
|
5664
|
+
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams);
|
|
5679
5665
|
const errors = [];
|
|
5680
5666
|
const signatures = [];
|
|
5681
5667
|
const batch = [];
|
|
@@ -5738,10 +5724,11 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5738
5724
|
*/
|
|
5739
5725
|
async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, extParams) {
|
|
5740
5726
|
const { invoker, customInstructions } = extParams;
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
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
|
+
);
|
|
5745
5732
|
const metadata = new web3_js.PublicKey(id);
|
|
5746
5733
|
await this.applyCustomAfterInstructions(ixs, customInstructions, metadata);
|
|
5747
5734
|
const { tx, hash, context } = await solana.prepareTransaction(this.connection, ixs, invoker.publicKey);
|
|
@@ -5761,22 +5748,18 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5761
5748
|
/**
|
|
5762
5749
|
* Creates Transaction Instructions for withdrawal
|
|
5763
5750
|
* @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
|
|
5764
|
-
* @param {
|
|
5751
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
|
|
5765
5752
|
* @returns Transaction instructions
|
|
5766
5753
|
*/
|
|
5767
5754
|
async prepareWithdrawInstructions({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
5768
|
-
|
|
5769
|
-
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5770
|
-
}
|
|
5755
|
+
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5771
5756
|
const ixs = solana.prepareBaseInstructions(this.connection, {
|
|
5772
5757
|
computePrice,
|
|
5773
5758
|
computeLimit
|
|
5774
5759
|
});
|
|
5775
5760
|
const streamPublicKey = new web3_js.PublicKey(id);
|
|
5776
5761
|
const escrow = await this.connection.getAccountInfo(streamPublicKey);
|
|
5777
|
-
|
|
5778
|
-
throw new Error("Couldn't get account info");
|
|
5779
|
-
}
|
|
5762
|
+
common.invariant(escrow?.data, "Couldn't get account info");
|
|
5780
5763
|
const data = decodeStream(escrow.data);
|
|
5781
5764
|
const { sender, recipient, mint, streamflowTreasury, partner, recipientTokens, escrowTokens } = data;
|
|
5782
5765
|
const { tokenProgramId } = await solana.getMintAndProgram(this.connection, mint);
|
|
@@ -5832,7 +5815,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5832
5815
|
/**
|
|
5833
5816
|
* Creates Transaction Instructions for cancel
|
|
5834
5817
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5835
|
-
* @param {
|
|
5818
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
|
|
5836
5819
|
* @returns Transaction instructions
|
|
5837
5820
|
*/
|
|
5838
5821
|
async prepareCancelInstructions(cancelData, extParams) {
|
|
@@ -5849,18 +5832,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5849
5832
|
/**
|
|
5850
5833
|
* Creates Transaction Instructions for cancel
|
|
5851
5834
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5852
|
-
* @param {
|
|
5835
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
5853
5836
|
* @returns Transaction instructions
|
|
5854
5837
|
*/
|
|
5855
5838
|
async prepareCancelAlignedUnlockInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
5856
|
-
|
|
5857
|
-
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5858
|
-
}
|
|
5839
|
+
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5859
5840
|
const streamPublicKey = new web3_js.PublicKey(id);
|
|
5860
5841
|
const escrowAcc = await this.connection.getAccountInfo(streamPublicKey);
|
|
5861
|
-
|
|
5862
|
-
throw new Error("Couldn't get account info");
|
|
5863
|
-
}
|
|
5842
|
+
common.invariant(escrowAcc?.data, "Couldn't get account info");
|
|
5864
5843
|
const streamData = decodeStream(escrowAcc.data);
|
|
5865
5844
|
const { sender, recipient, mint, streamflowTreasury, partner, escrowTokens } = streamData;
|
|
5866
5845
|
const { tokenProgramId } = await solana.getMintAndProgram(this.connection, mint);
|
|
@@ -5892,18 +5871,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5892
5871
|
/**
|
|
5893
5872
|
* Creates Transaction Instructions for cancel
|
|
5894
5873
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5895
|
-
* @param {
|
|
5874
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
5896
5875
|
* @returns Transaction instructions
|
|
5897
5876
|
*/
|
|
5898
5877
|
async prepareCancelStreamInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
5899
|
-
|
|
5900
|
-
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5901
|
-
}
|
|
5878
|
+
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5902
5879
|
const streamPublicKey = new web3_js.PublicKey(id);
|
|
5903
5880
|
const escrowAcc = await this.connection.getAccountInfo(streamPublicKey);
|
|
5904
|
-
|
|
5905
|
-
throw new Error("Couldn't get account info");
|
|
5906
|
-
}
|
|
5881
|
+
common.invariant(escrowAcc?.data, "Couldn't get account info");
|
|
5907
5882
|
const data = decodeStream(escrowAcc.data);
|
|
5908
5883
|
const { sender, recipient, partner, streamflowTreasury, mint, senderTokens, recipientTokens, escrowTokens } = data;
|
|
5909
5884
|
const { tokenProgramId } = await solana.getMintAndProgram(this.connection, mint);
|
|
@@ -5967,13 +5942,11 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5967
5942
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
5968
5943
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
5969
5944
|
* @param {ITransferData} transferData - Transfer parameters including stream ID and new recipient address
|
|
5970
|
-
* @param {
|
|
5945
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
5971
5946
|
* @returns Transaction instructions
|
|
5972
5947
|
*/
|
|
5973
5948
|
async prepareTransferInstructions({ id, newRecipient }, { invoker, computePrice, computeLimit = 100001 }) {
|
|
5974
|
-
|
|
5975
|
-
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5976
|
-
}
|
|
5949
|
+
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5977
5950
|
const ixs = solana.prepareBaseInstructions(this.connection, {
|
|
5978
5951
|
computePrice,
|
|
5979
5952
|
computeLimit
|
|
@@ -5981,9 +5954,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5981
5954
|
const stream = new web3_js.PublicKey(id);
|
|
5982
5955
|
const newRecipientPublicKey = new web3_js.PublicKey(newRecipient);
|
|
5983
5956
|
const escrow = await this.connection.getAccountInfo(stream);
|
|
5984
|
-
|
|
5985
|
-
throw new Error("Couldn't get account info");
|
|
5986
|
-
}
|
|
5957
|
+
common.invariant(escrow?.data, "Couldn't get account info");
|
|
5987
5958
|
const { mint } = decodeStream(escrow?.data);
|
|
5988
5959
|
const { tokenProgramId } = await solana.getMintAndProgram(this.connection, mint);
|
|
5989
5960
|
const newRecipientTokens = await solana.ata(mint, newRecipientPublicKey, tokenProgramId);
|
|
@@ -6219,6 +6190,9 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6219
6190
|
* @returns Transaction result
|
|
6220
6191
|
*/
|
|
6221
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
|
+
}
|
|
6222
6196
|
const ixs = await this.prepareUpdateInstructions(data, extParams);
|
|
6223
6197
|
const { tx, hash, context } = await solana.prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
6224
6198
|
const signature = await solana.signAndExecuteTransaction(
|
|
@@ -6240,18 +6214,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6240
6214
|
/**
|
|
6241
6215
|
* Create Transaction instructions for update
|
|
6242
6216
|
* @param {IUpdateData} data - Update parameters including stream ID and new settings
|
|
6243
|
-
* @param {
|
|
6217
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
6244
6218
|
* @returns Transaction instructions
|
|
6245
6219
|
*/
|
|
6246
6220
|
async prepareUpdateInstructions(data, { invoker, computePrice, computeLimit }) {
|
|
6247
|
-
|
|
6248
|
-
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
6249
|
-
}
|
|
6221
|
+
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
6250
6222
|
const streamPublicKey = new web3_js.PublicKey(data.id);
|
|
6251
6223
|
const escrow = await this.connection.getAccountInfo(streamPublicKey);
|
|
6252
|
-
|
|
6253
|
-
throw new Error("Couldn't get account info");
|
|
6254
|
-
}
|
|
6224
|
+
common.invariant(escrow, "Couldn't get account info");
|
|
6255
6225
|
const ixs = solana.prepareBaseInstructions(this.connection, {
|
|
6256
6226
|
computePrice,
|
|
6257
6227
|
computeLimit
|