@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Z as Account,
|
|
1
|
+
export { Z as Account, a5 as AlignedContract, M as AlignedUnlocksContract, a8 as BatchItem, aa as BatchItemError, ab as BatchItemResult, a9 as BatchItemSuccess, U as ChangeOracleParams, y as ClientCreationOptions, a4 as Contract, R as CreateParams, V as CreateTestOracleParams, a6 as DecodedStream, $ as ICreateSolanaExt, a3 as ICreateStreamInstructions, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, a1 as IPrepareCreateStreamSolanaExt, a2 as IPrepareStreamSolanaExt, Y as ISearchStreams, b as ITopUpStreamSolanaExt, a0 as ITransactionSolanaExtWithInstructions, ac as InstructionGenerator, a7 as MetadataRecipientHashMap, N as OracleType, S as SolanaStreamClient, Q as TestOracle, X as UpdateTestOracleParams, ah as cancelStreamInstruction, x as constants, ad as createStreamInstruction, ae as createUncheckedStreamInstruction, z as decodeStream, J as deriveContractPDA, K as deriveEscrowPDA, L as deriveTestOraclePDA, H as extractSolanaErrorCode, G as sendAndConfirmStreamRawTransaction, B as signAllTransactionWithRecipients, _ as timelockIDL, aj as topupStreamInstruction, ai as transferStreamInstruction, ag as updateStreamInstruction, af as withdrawStreamInstruction } from '../index-oCYfzJrc.cjs';
|
|
2
2
|
export { ContractError, IChain, ICluster } from '@streamflow/common';
|
|
3
3
|
import 'p-queue';
|
|
4
4
|
import '@solana/web3.js';
|
|
@@ -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/esm/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { A as AptosStreamClient, I as ICreateStreamAptosExt, a as ITransactionAp
|
|
|
2
2
|
export { i as StreamflowAptos } from './index-D54wSYym.js';
|
|
3
3
|
import { E as EvmStreamClient } from './index-elpYUBph.js';
|
|
4
4
|
export { i as StreamflowEVM } from './index-elpYUBph.js';
|
|
5
|
-
import { S as SolanaStreamClient, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, b as ITopUpStreamSolanaExt } from './index-
|
|
6
|
-
export { s as AIRDROP_AMOUNT, q as AIRDROP_TEST_TOKEN, j as ALIGNED_COMPUTE_LIMIT, A as ALIGNED_PRECISION_FACTOR_POW, h as ALIGNED_UNLOCKS_PROGRAM_ID, k as CONTRACT_DISCRIMINATOR, m as CONTRACT_SEED, C as CREATE_PARAMS_PADDING, D as DEFAULT_STREAMFLOW_FEE, E as ESCROW_SEED, r as FEES_METADATA_SEED, F as FEE_ORACLE_PUBLIC_KEY, O as ORIGINAL_CONTRACT_SENDER_OFFSET, u as PARTNERS_SCHEMA, o as PARTNER_ORACLE_PROGRAM_ID, t as PARTNER_SCHEMA, P as PROGRAM_ID, w as SOLANA_ERROR_MAP, v as SOLANA_ERROR_MATCH_REGEX, p as STREAMFLOW_TREASURY_PUBLIC_KEY, g as STREAM_STRUCT_OFFSETS, f as STREAM_STRUCT_OFFSET_CLOSED, e as STREAM_STRUCT_OFFSET_MINT, d as STREAM_STRUCT_OFFSET_RECIPIENT, c as STREAM_STRUCT_OFFSET_SENDER, i as StreamflowSolana, l as TEST_ORACLE_DISCRIMINATOR, n as TEST_ORACLE_SEED, T as TX_FINALITY_CONFIRMED, W as WITHDRAWOR_PUBLIC_KEY } from './index-
|
|
5
|
+
import { S as SolanaStreamClient, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, b as ITopUpStreamSolanaExt } from './index-BNQVJtIE.js';
|
|
6
|
+
export { s as AIRDROP_AMOUNT, q as AIRDROP_TEST_TOKEN, j as ALIGNED_COMPUTE_LIMIT, A as ALIGNED_PRECISION_FACTOR_POW, h as ALIGNED_UNLOCKS_PROGRAM_ID, k as CONTRACT_DISCRIMINATOR, m as CONTRACT_SEED, C as CREATE_PARAMS_PADDING, D as DEFAULT_STREAMFLOW_FEE, E as ESCROW_SEED, r as FEES_METADATA_SEED, F as FEE_ORACLE_PUBLIC_KEY, O as ORIGINAL_CONTRACT_SENDER_OFFSET, u as PARTNERS_SCHEMA, o as PARTNER_ORACLE_PROGRAM_ID, t as PARTNER_SCHEMA, P as PROGRAM_ID, w as SOLANA_ERROR_MAP, v as SOLANA_ERROR_MATCH_REGEX, p as STREAMFLOW_TREASURY_PUBLIC_KEY, g as STREAM_STRUCT_OFFSETS, f as STREAM_STRUCT_OFFSET_CLOSED, e as STREAM_STRUCT_OFFSET_MINT, d as STREAM_STRUCT_OFFSET_RECIPIENT, c as STREAM_STRUCT_OFFSET_SENDER, i as StreamflowSolana, l as TEST_ORACLE_DISCRIMINATOR, n as TEST_ORACLE_SEED, T as TX_FINALITY_CONFIRMED, W as WITHDRAWOR_PUBLIC_KEY } from './index-BNQVJtIE.js';
|
|
7
7
|
import { S as SuiStreamClient } from './index-DrzqsoIB.js';
|
|
8
8
|
export { i as StreamflowSui } from './index-DrzqsoIB.js';
|
|
9
9
|
import { S as Stream, A as AlignedStream, I as ICreateStreamData, a as ICreateAlignedStreamData, b as StreamType, B as BaseStreamClient, c as SolanaStreamClientOptions, d as AptosStreamClientOptions, e as SuiStreamClientOptions, E as EvmStreamClientOptions, f as ICreateStreamSuiExt, g as ICreateResult, h as ICreateMultipleStreamData, i as IMultiTransactionResult, j as IWithdrawData, k as ITransactionSuiExt, l as ITransactionResult, m as ICancelData, n as ITransferData, o as ITopUpData, p as IGetOneData, q as IGetAllData, r as IUpdateData, s as IGetFeesData, t as IFees } from './BaseStreamClient-DOyJqO7R.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AptosClient, AptosAccount, TransactionBuilderRemoteABI } from 'aptos';
|
|
2
|
-
import { ICluster, ContractError, IChain, getBN as getBN$1 } from '@streamflow/common';
|
|
2
|
+
import { ICluster, ContractError, IChain, assertHasPublicKey, invariant, getBN as getBN$1 } from '@streamflow/common';
|
|
3
3
|
export { ContractError, IChain, ICluster } from '@streamflow/common';
|
|
4
4
|
import BN7 from 'bn.js';
|
|
5
5
|
import { Buffer } from 'buffer';
|
|
@@ -5035,14 +5035,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5035
5035
|
*/
|
|
5036
5036
|
async buildCreateTransactionInstructions(data, extParams) {
|
|
5037
5037
|
const { partner, amount, tokenProgramId } = data;
|
|
5038
|
-
const { isNative,
|
|
5038
|
+
const { isNative, sender, customInstructions } = extParams;
|
|
5039
|
+
assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5039
5040
|
const partnerPublicKey = partner ? new PublicKey(partner) : WITHDRAWOR_PUBLIC_KEY;
|
|
5040
5041
|
const mintPublicKey = new PublicKey(data.tokenId);
|
|
5041
|
-
const tempSender = { publicKey: senderPublicKey };
|
|
5042
5042
|
const ixs = await this.getCreateATAInstructions(
|
|
5043
5043
|
[partnerPublicKey],
|
|
5044
5044
|
mintPublicKey,
|
|
5045
|
-
|
|
5045
|
+
sender,
|
|
5046
5046
|
true,
|
|
5047
5047
|
tokenProgramId ? new PublicKey(tokenProgramId) : void 0
|
|
5048
5048
|
);
|
|
@@ -5051,7 +5051,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5051
5051
|
address: partnerPublicKey.toString()
|
|
5052
5052
|
});
|
|
5053
5053
|
const totalAmount = calculateTotalAmountToDeposit(amount, totalFee);
|
|
5054
|
-
ixs.push(...await prepareWrappedAccount(this.connection,
|
|
5054
|
+
ixs.push(...await prepareWrappedAccount(this.connection, sender.publicKey, totalAmount));
|
|
5055
5055
|
}
|
|
5056
5056
|
const {
|
|
5057
5057
|
ixs: createIxs,
|
|
@@ -5059,7 +5059,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5059
5059
|
metadataPubKey
|
|
5060
5060
|
} = await this.prepareCreateInstructions(data, {
|
|
5061
5061
|
...extParams,
|
|
5062
|
-
sender
|
|
5062
|
+
sender
|
|
5063
5063
|
});
|
|
5064
5064
|
ixs.push(...createIxs);
|
|
5065
5065
|
await this.applyCustomAfterInstructions(ixs, customInstructions, metadataPubKey);
|
|
@@ -5081,9 +5081,9 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5081
5081
|
* @returns Transaction and metadata information
|
|
5082
5082
|
*/
|
|
5083
5083
|
async buildCreateTransaction(data, extParams) {
|
|
5084
|
-
const {
|
|
5084
|
+
const { sender } = extParams;
|
|
5085
5085
|
const { ixs, metadataId, metadata } = await this.buildCreateTransactionInstructions(data, extParams);
|
|
5086
|
-
const { tx, hash, context } = await prepareTransaction(this.connection, ixs,
|
|
5086
|
+
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, sender.publicKey, void 0, [
|
|
5087
5087
|
metadata
|
|
5088
5088
|
]);
|
|
5089
5089
|
return {
|
|
@@ -5103,12 +5103,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5103
5103
|
*/
|
|
5104
5104
|
async create(data, extParams) {
|
|
5105
5105
|
const { sender } = extParams;
|
|
5106
|
-
|
|
5107
|
-
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5108
|
-
}
|
|
5106
|
+
assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5109
5107
|
const { ixs, metadataId, metadata } = await this.buildCreateTransactionInstructions(data, {
|
|
5110
5108
|
...extParams,
|
|
5111
|
-
|
|
5109
|
+
sender
|
|
5112
5110
|
});
|
|
5113
5111
|
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, sender.publicKey, void 0, [
|
|
5114
5112
|
metadata
|
|
@@ -5161,19 +5159,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5161
5159
|
floorPrice
|
|
5162
5160
|
} = streamParams;
|
|
5163
5161
|
const { isNative, sender, computeLimit, computePrice, metadataPubKeys } = extParams;
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
}
|
|
5167
|
-
if (!priceOracle && oracleType && oracleType !== "none") {
|
|
5168
|
-
throw new Error("Price oracle is required for the specified oracle type");
|
|
5169
|
-
}
|
|
5162
|
+
invariant(!priceOracle && oracleType && oracleType !== "none", "Price oracle is required for the specified oracle type");
|
|
5163
|
+
assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5170
5164
|
const recipientPublicKey = new PublicKey(recipient);
|
|
5171
5165
|
const mintPublicKey = isNative ? NATIVE_MINT : new PublicKey(mint);
|
|
5172
5166
|
const metadata = !metadataPubKeys ? Keypair.generate() : void 0;
|
|
5173
5167
|
const metadataPubKey = metadata ? metadata.publicKey : metadataPubKeys[0];
|
|
5174
|
-
|
|
5175
|
-
throw new Error("Metadata public key is required");
|
|
5176
|
-
}
|
|
5168
|
+
invariant(metadataPubKey, "Metadata public key is required");
|
|
5177
5169
|
let tokenProgramId = streamTokenProgramId ? new PublicKey(streamTokenProgramId) : void 0;
|
|
5178
5170
|
if (!tokenProgramId) {
|
|
5179
5171
|
tokenProgramId = (await getMintAndProgram(this.connection, mintPublicKey)).tokenProgramId;
|
|
@@ -5186,7 +5178,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5186
5178
|
computePrice,
|
|
5187
5179
|
computeLimit: computeLimit ?? ALIGNED_COMPUTE_LIMIT
|
|
5188
5180
|
});
|
|
5189
|
-
if (recipientPublicKey.toString() !== sender.
|
|
5181
|
+
if (recipientPublicKey.toString() !== sender.toString() || !isNative) {
|
|
5190
5182
|
ixs.push(
|
|
5191
5183
|
...await this.getCreateATAInstructions([recipientPublicKey], mintPublicKey, sender, true, tokenProgramId)
|
|
5192
5184
|
);
|
|
@@ -5237,7 +5229,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5237
5229
|
* Creates a new stream/vesting contract.
|
|
5238
5230
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
5239
5231
|
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
5240
|
-
* @param {
|
|
5232
|
+
* @param {IPrepareCreateStreamSolanaExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
5241
5233
|
* @returns Create stream instructions
|
|
5242
5234
|
*/
|
|
5243
5235
|
async prepareCreateStreamInstructions({
|
|
@@ -5262,9 +5254,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5262
5254
|
partner,
|
|
5263
5255
|
tokenProgramId: streamTokenProgramId
|
|
5264
5256
|
}, { sender, metadataPubKeys, isNative = false, computePrice, computeLimit }) {
|
|
5265
|
-
|
|
5266
|
-
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5267
|
-
}
|
|
5257
|
+
assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5268
5258
|
const ixs = prepareBaseInstructions(this.connection, {
|
|
5269
5259
|
computePrice,
|
|
5270
5260
|
computeLimit
|
|
@@ -5344,7 +5334,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5344
5334
|
* @returns Create result
|
|
5345
5335
|
*/
|
|
5346
5336
|
async createUnchecked(data, extParams) {
|
|
5347
|
-
const { ixs, metadata, metadataPubKey } = await this.prepareCreateUncheckedInstructions(
|
|
5337
|
+
const { ixs, metadata, metadataPubKey } = await this.prepareCreateUncheckedInstructions(
|
|
5338
|
+
data,
|
|
5339
|
+
extParams
|
|
5340
|
+
);
|
|
5348
5341
|
const { tx, hash, context } = await prepareTransaction(
|
|
5349
5342
|
this.connection,
|
|
5350
5343
|
ixs,
|
|
@@ -5389,9 +5382,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5389
5382
|
withdrawalFrequency = 0,
|
|
5390
5383
|
partner
|
|
5391
5384
|
}, { sender, metadataPubKeys, isNative = false, computePrice, computeLimit }) {
|
|
5392
|
-
|
|
5393
|
-
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5394
|
-
}
|
|
5385
|
+
assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5395
5386
|
const mintPublicKey = new PublicKey(mint);
|
|
5396
5387
|
const recipientPublicKey = new PublicKey(recipient);
|
|
5397
5388
|
const { metadata, metadataPubKey } = this.getOrCreateStreamMetadata(metadataPubKeys);
|
|
@@ -5400,7 +5391,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5400
5391
|
programId: this.programId,
|
|
5401
5392
|
space: METADATA_ACC_SIZE,
|
|
5402
5393
|
lamports: rentToExempt,
|
|
5403
|
-
fromPubkey: sender
|
|
5394
|
+
fromPubkey: sender.publicKey,
|
|
5404
5395
|
newAccountPubkey: metadataPubKey
|
|
5405
5396
|
});
|
|
5406
5397
|
const [escrowTokens] = PublicKey.findProgramAddressSync(
|
|
@@ -5462,12 +5453,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5462
5453
|
* Builds transaction instructions for creating multiple stream/vesting contracts without creating transactions.
|
|
5463
5454
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
5464
5455
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
5465
|
-
* @param {
|
|
5456
|
+
* @param {IPrepareCreateStreamSolanaExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
5466
5457
|
* @returns Create multiple transaction instructions
|
|
5467
5458
|
*/
|
|
5468
5459
|
async buildCreateMultipleTransactionInstructions(data, extParams) {
|
|
5469
5460
|
const { recipients, ...streamParams } = data;
|
|
5470
|
-
const {
|
|
5461
|
+
const { sender, metadataPubKeys: metadataPubKeysExt, isNative, customInstructions } = extParams;
|
|
5462
|
+
assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5471
5463
|
const metadatas = [];
|
|
5472
5464
|
const metadataToRecipient = {};
|
|
5473
5465
|
const instructionsBatch = [];
|
|
@@ -5477,12 +5469,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5477
5469
|
if (recipients.length === 0) {
|
|
5478
5470
|
throw new Error("Recipients array is empty!");
|
|
5479
5471
|
}
|
|
5480
|
-
const tempSender = { publicKey: senderPublicKey };
|
|
5481
5472
|
for (let i = 0; i < recipients.length; i++) {
|
|
5482
5473
|
const recipientData = recipients[i];
|
|
5483
5474
|
const createStreamData = { ...streamParams, ...recipientData };
|
|
5484
5475
|
const createStreamExtParams = {
|
|
5485
|
-
sender: tempSender,
|
|
5486
5476
|
metadataPubKeys: metadataPubKeys[i] ? [metadataPubKeys[i]] : void 0,
|
|
5487
5477
|
...extParams
|
|
5488
5478
|
};
|
|
@@ -5502,14 +5492,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5502
5492
|
const prepareInstructions = await this.getCreateATAInstructions(
|
|
5503
5493
|
[partnerPublicKey],
|
|
5504
5494
|
mintPublicKey,
|
|
5505
|
-
|
|
5495
|
+
sender,
|
|
5506
5496
|
true
|
|
5507
5497
|
);
|
|
5508
5498
|
if (isNative) {
|
|
5509
5499
|
const totalDepositedAmount = recipients.reduce((acc, recipient) => recipient.amount.add(acc), new BN7(0));
|
|
5510
5500
|
const nativeInstructions = await prepareWrappedAccount(
|
|
5511
5501
|
this.connection,
|
|
5512
|
-
|
|
5502
|
+
sender.publicKey,
|
|
5513
5503
|
totalDepositedAmount
|
|
5514
5504
|
);
|
|
5515
5505
|
prepareInstructions.push(...nativeInstructions);
|
|
@@ -5544,20 +5534,20 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5544
5534
|
* ```
|
|
5545
5535
|
*
|
|
5546
5536
|
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
5547
|
-
* @param {
|
|
5537
|
+
* @param {IPrepareCreateStreamSolanaExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
5548
5538
|
* @returns Multiple transaction information
|
|
5549
5539
|
*/
|
|
5550
5540
|
async buildCreateMultipleTransactions(data, extParams) {
|
|
5551
|
-
const {
|
|
5541
|
+
const { sender } = extParams;
|
|
5552
5542
|
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams);
|
|
5553
5543
|
const { value: hash, context } = await this.connection.getLatestBlockhashAndContext();
|
|
5554
5544
|
const batch = [];
|
|
5555
5545
|
for (const { ixs, metadata, recipient } of instructionsBatch) {
|
|
5556
|
-
batch.push({ tx: createVersionedTransaction(ixs,
|
|
5546
|
+
batch.push({ tx: createVersionedTransaction(ixs, sender.publicKey, hash.blockhash, [metadata]), recipient });
|
|
5557
5547
|
}
|
|
5558
5548
|
let prepareTx;
|
|
5559
5549
|
if (prepareInstructions.length > 0) {
|
|
5560
|
-
prepareTx = createVersionedTransaction(prepareInstructions,
|
|
5550
|
+
prepareTx = createVersionedTransaction(prepareInstructions, sender.publicKey, hash.blockhash);
|
|
5561
5551
|
}
|
|
5562
5552
|
return {
|
|
5563
5553
|
transactions: batch,
|
|
@@ -5580,10 +5570,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5580
5570
|
if (!sender.publicKey) {
|
|
5581
5571
|
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5582
5572
|
}
|
|
5583
|
-
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data,
|
|
5584
|
-
...extParams,
|
|
5585
|
-
senderPublicKey: sender.publicKey
|
|
5586
|
-
});
|
|
5573
|
+
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams);
|
|
5587
5574
|
const errors = [];
|
|
5588
5575
|
const signatures = [];
|
|
5589
5576
|
const metadataPubKeys = metadataPubKeysExt || [];
|
|
@@ -5648,10 +5635,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5648
5635
|
if (!sender.publicKey) {
|
|
5649
5636
|
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5650
5637
|
}
|
|
5651
|
-
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data,
|
|
5652
|
-
...extParams,
|
|
5653
|
-
senderPublicKey: sender.publicKey
|
|
5654
|
-
});
|
|
5638
|
+
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams);
|
|
5655
5639
|
const errors = [];
|
|
5656
5640
|
const signatures = [];
|
|
5657
5641
|
const batch = [];
|
|
@@ -5714,10 +5698,11 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5714
5698
|
*/
|
|
5715
5699
|
async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, extParams) {
|
|
5716
5700
|
const { invoker, customInstructions } = extParams;
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5701
|
+
assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5702
|
+
const ixs = await this.prepareWithdrawInstructions(
|
|
5703
|
+
{ id, amount },
|
|
5704
|
+
extParams
|
|
5705
|
+
);
|
|
5721
5706
|
const metadata = new PublicKey(id);
|
|
5722
5707
|
await this.applyCustomAfterInstructions(ixs, customInstructions, metadata);
|
|
5723
5708
|
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, invoker.publicKey);
|
|
@@ -5737,22 +5722,18 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5737
5722
|
/**
|
|
5738
5723
|
* Creates Transaction Instructions for withdrawal
|
|
5739
5724
|
* @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
|
|
5740
|
-
* @param {
|
|
5725
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
|
|
5741
5726
|
* @returns Transaction instructions
|
|
5742
5727
|
*/
|
|
5743
5728
|
async prepareWithdrawInstructions({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
5744
|
-
|
|
5745
|
-
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5746
|
-
}
|
|
5729
|
+
assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5747
5730
|
const ixs = prepareBaseInstructions(this.connection, {
|
|
5748
5731
|
computePrice,
|
|
5749
5732
|
computeLimit
|
|
5750
5733
|
});
|
|
5751
5734
|
const streamPublicKey = new PublicKey(id);
|
|
5752
5735
|
const escrow = await this.connection.getAccountInfo(streamPublicKey);
|
|
5753
|
-
|
|
5754
|
-
throw new Error("Couldn't get account info");
|
|
5755
|
-
}
|
|
5736
|
+
invariant(escrow?.data, "Couldn't get account info");
|
|
5756
5737
|
const data = decodeStream(escrow.data);
|
|
5757
5738
|
const { sender, recipient, mint, streamflowTreasury, partner, recipientTokens, escrowTokens } = data;
|
|
5758
5739
|
const { tokenProgramId } = await getMintAndProgram(this.connection, mint);
|
|
@@ -5808,7 +5789,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5808
5789
|
/**
|
|
5809
5790
|
* Creates Transaction Instructions for cancel
|
|
5810
5791
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5811
|
-
* @param {
|
|
5792
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
|
|
5812
5793
|
* @returns Transaction instructions
|
|
5813
5794
|
*/
|
|
5814
5795
|
async prepareCancelInstructions(cancelData, extParams) {
|
|
@@ -5825,18 +5806,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5825
5806
|
/**
|
|
5826
5807
|
* Creates Transaction Instructions for cancel
|
|
5827
5808
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5828
|
-
* @param {
|
|
5809
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
5829
5810
|
* @returns Transaction instructions
|
|
5830
5811
|
*/
|
|
5831
5812
|
async prepareCancelAlignedUnlockInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
5832
|
-
|
|
5833
|
-
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5834
|
-
}
|
|
5813
|
+
assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5835
5814
|
const streamPublicKey = new PublicKey(id);
|
|
5836
5815
|
const escrowAcc = await this.connection.getAccountInfo(streamPublicKey);
|
|
5837
|
-
|
|
5838
|
-
throw new Error("Couldn't get account info");
|
|
5839
|
-
}
|
|
5816
|
+
invariant(escrowAcc?.data, "Couldn't get account info");
|
|
5840
5817
|
const streamData = decodeStream(escrowAcc.data);
|
|
5841
5818
|
const { sender, recipient, mint, streamflowTreasury, partner, escrowTokens } = streamData;
|
|
5842
5819
|
const { tokenProgramId } = await getMintAndProgram(this.connection, mint);
|
|
@@ -5868,18 +5845,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5868
5845
|
/**
|
|
5869
5846
|
* Creates Transaction Instructions for cancel
|
|
5870
5847
|
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
5871
|
-
* @param {
|
|
5848
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
5872
5849
|
* @returns Transaction instructions
|
|
5873
5850
|
*/
|
|
5874
5851
|
async prepareCancelStreamInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
5875
|
-
|
|
5876
|
-
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5877
|
-
}
|
|
5852
|
+
assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5878
5853
|
const streamPublicKey = new PublicKey(id);
|
|
5879
5854
|
const escrowAcc = await this.connection.getAccountInfo(streamPublicKey);
|
|
5880
|
-
|
|
5881
|
-
throw new Error("Couldn't get account info");
|
|
5882
|
-
}
|
|
5855
|
+
invariant(escrowAcc?.data, "Couldn't get account info");
|
|
5883
5856
|
const data = decodeStream(escrowAcc.data);
|
|
5884
5857
|
const { sender, recipient, partner, streamflowTreasury, mint, senderTokens, recipientTokens, escrowTokens } = data;
|
|
5885
5858
|
const { tokenProgramId } = await getMintAndProgram(this.connection, mint);
|
|
@@ -5943,13 +5916,11 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5943
5916
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
5944
5917
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
5945
5918
|
* @param {ITransferData} transferData - Transfer parameters including stream ID and new recipient address
|
|
5946
|
-
* @param {
|
|
5919
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
5947
5920
|
* @returns Transaction instructions
|
|
5948
5921
|
*/
|
|
5949
5922
|
async prepareTransferInstructions({ id, newRecipient }, { invoker, computePrice, computeLimit = 100001 }) {
|
|
5950
|
-
|
|
5951
|
-
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5952
|
-
}
|
|
5923
|
+
assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
5953
5924
|
const ixs = prepareBaseInstructions(this.connection, {
|
|
5954
5925
|
computePrice,
|
|
5955
5926
|
computeLimit
|
|
@@ -5957,9 +5928,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5957
5928
|
const stream = new PublicKey(id);
|
|
5958
5929
|
const newRecipientPublicKey = new PublicKey(newRecipient);
|
|
5959
5930
|
const escrow = await this.connection.getAccountInfo(stream);
|
|
5960
|
-
|
|
5961
|
-
throw new Error("Couldn't get account info");
|
|
5962
|
-
}
|
|
5931
|
+
invariant(escrow?.data, "Couldn't get account info");
|
|
5963
5932
|
const { mint } = decodeStream(escrow?.data);
|
|
5964
5933
|
const { tokenProgramId } = await getMintAndProgram(this.connection, mint);
|
|
5965
5934
|
const newRecipientTokens = await ata(mint, newRecipientPublicKey, tokenProgramId);
|
|
@@ -6195,6 +6164,9 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6195
6164
|
* @returns Transaction result
|
|
6196
6165
|
*/
|
|
6197
6166
|
async update(data, extParams) {
|
|
6167
|
+
if (!extParams.invoker.publicKey) {
|
|
6168
|
+
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
6169
|
+
}
|
|
6198
6170
|
const ixs = await this.prepareUpdateInstructions(data, extParams);
|
|
6199
6171
|
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
6200
6172
|
const signature = await signAndExecuteTransaction(
|
|
@@ -6216,18 +6188,14 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6216
6188
|
/**
|
|
6217
6189
|
* Create Transaction instructions for update
|
|
6218
6190
|
* @param {IUpdateData} data - Update parameters including stream ID and new settings
|
|
6219
|
-
* @param {
|
|
6191
|
+
* @param {IPrepareStreamSolanaExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
6220
6192
|
* @returns Transaction instructions
|
|
6221
6193
|
*/
|
|
6222
6194
|
async prepareUpdateInstructions(data, { invoker, computePrice, computeLimit }) {
|
|
6223
|
-
|
|
6224
|
-
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
6225
|
-
}
|
|
6195
|
+
assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
6226
6196
|
const streamPublicKey = new PublicKey(data.id);
|
|
6227
6197
|
const escrow = await this.connection.getAccountInfo(streamPublicKey);
|
|
6228
|
-
|
|
6229
|
-
throw new Error("Couldn't get account info");
|
|
6230
|
-
}
|
|
6198
|
+
invariant(escrow, "Couldn't get account info");
|
|
6231
6199
|
const ixs = prepareBaseInstructions(this.connection, {
|
|
6232
6200
|
computePrice,
|
|
6233
6201
|
computeLimit
|