@streamflow/stream 10.0.0-alpha.p313.e531e2c → 10.0.0-alpha.p317.e143b57
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 +2 -2
- package/dist/cjs/index.cjs +36 -28
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/solana/index.cjs +36 -28
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +13 -17
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +37 -28
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +13 -17
- package/dist/esm/solana/index.js +37 -28
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -114,7 +114,6 @@ declare enum StreamDirection {
|
|
|
114
114
|
}
|
|
115
115
|
declare enum StreamType {
|
|
116
116
|
All = "all",
|
|
117
|
-
Payment = "payment",
|
|
118
117
|
Vesting = "vesting",
|
|
119
118
|
Lock = "lock"
|
|
120
119
|
}
|
|
@@ -554,7 +553,7 @@ declare class SolanaStreamClient {
|
|
|
554
553
|
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
555
554
|
* @returns Create stream instructions
|
|
556
555
|
*/
|
|
557
|
-
|
|
556
|
+
prepareCreateLinearStreamInstructions({ 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 }: IPrepareCreateStreamExt): Promise<ICreateStreamInstructions>;
|
|
558
557
|
/**
|
|
559
558
|
* Creates a new stream/vesting contract using unchecked instruction.
|
|
560
559
|
*
|
|
@@ -584,7 +583,7 @@ declare class SolanaStreamClient {
|
|
|
584
583
|
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
585
584
|
* @returns Create multiple transaction instructions
|
|
586
585
|
*/
|
|
587
|
-
buildCreateMultipleTransactionInstructions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamExt): Promise<{
|
|
586
|
+
buildCreateMultipleTransactionInstructions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamExt, applyCustomAfterInstructions?: boolean): Promise<{
|
|
588
587
|
instructionsBatch: {
|
|
589
588
|
ixs: TransactionInstruction[];
|
|
590
589
|
metadata: Keypair | undefined;
|
|
@@ -620,7 +619,7 @@ declare class SolanaStreamClient {
|
|
|
620
619
|
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
621
620
|
* @returns Multiple transaction information
|
|
622
621
|
*/
|
|
623
|
-
buildCreateMultipleTransactions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamExt): Promise<{
|
|
622
|
+
buildCreateMultipleTransactions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamExt, applyCustomAfterInstructions?: boolean): Promise<{
|
|
624
623
|
transactions: BatchItem[];
|
|
625
624
|
metadatas: string[];
|
|
626
625
|
metadataToRecipient: MetadataRecipientHashMap;
|
|
@@ -638,7 +637,7 @@ declare class SolanaStreamClient {
|
|
|
638
637
|
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
639
638
|
* @returns Multiple transaction information
|
|
640
639
|
*/
|
|
641
|
-
createMultiple(data: ICreateMultipleStreamData, extParams: ICreateStreamExt): Promise<IMultiTransactionResult>;
|
|
640
|
+
createMultiple(data: ICreateMultipleStreamData[] | ICreateMultipleStreamData, extParams: ICreateStreamExt): Promise<IMultiTransactionResult>;
|
|
642
641
|
/**
|
|
643
642
|
* Creates multiple stream/vesting contracts, and send all transactions sequentially.
|
|
644
643
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
@@ -647,7 +646,7 @@ declare class SolanaStreamClient {
|
|
|
647
646
|
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
648
647
|
* @returns Multiple transaction information
|
|
649
648
|
*/
|
|
650
|
-
createMultipleSequential(data: ICreateMultipleStreamData, extParams: ICreateStreamExt): Promise<IMultiTransactionResult>;
|
|
649
|
+
createMultipleSequential(data: ICreateMultipleStreamData[] | ICreateMultipleStreamData, extParams: ICreateStreamExt): Promise<IMultiTransactionResult>;
|
|
651
650
|
/**
|
|
652
651
|
* Attempts withdrawing from the specified stream.
|
|
653
652
|
* @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
|
|
@@ -689,7 +688,7 @@ declare class SolanaStreamClient {
|
|
|
689
688
|
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
690
689
|
* @returns Transaction instructions
|
|
691
690
|
*/
|
|
692
|
-
|
|
691
|
+
prepareCancelLinearStream({ id }: ICancelData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
|
|
693
692
|
/**
|
|
694
693
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
695
694
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
@@ -772,11 +771,11 @@ declare class SolanaStreamClient {
|
|
|
772
771
|
*/
|
|
773
772
|
getDefaultStreamflowFee(): Promise<number>;
|
|
774
773
|
/**
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
774
|
+
* Returns total fee percent, streamflow fees + partner fees
|
|
775
|
+
* @param getFeesData structure with address for which we need to derive fee, either sender or partner usually
|
|
776
|
+
* @param chainSpecificParams additional parameters required by chain client
|
|
777
|
+
* @returns fee as floating number, so if fee is 0.99%, it will return 0.99
|
|
778
|
+
*/
|
|
780
779
|
getTotalFee(getFeesData: IGetFeesData): Promise<number>;
|
|
781
780
|
/**
|
|
782
781
|
* Extracts error code from an error
|
|
@@ -788,6 +787,7 @@ declare class SolanaStreamClient {
|
|
|
788
787
|
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
789
788
|
*/
|
|
790
789
|
isAlignedUnlock(streamPublicKey: PublicKey, senderPublicKey: PublicKey): boolean;
|
|
790
|
+
private flatBuildCreateMultipleTransactionInstructions;
|
|
791
791
|
/**
|
|
792
792
|
* Utility function to generate metadata for a Contract or return existing Pubkey
|
|
793
793
|
*/
|
|
@@ -994,11 +994,7 @@ declare const isCliffCloseToDepositedAmount: (streamData: {
|
|
|
994
994
|
depositedAmount: BN;
|
|
995
995
|
cliffAmount: BN;
|
|
996
996
|
}) => boolean;
|
|
997
|
-
declare const isPayment: (streamData: {
|
|
998
|
-
canTopup: boolean;
|
|
999
|
-
}) => boolean;
|
|
1000
997
|
declare const isVesting: (streamData: {
|
|
1001
|
-
canTopup: boolean;
|
|
1002
998
|
depositedAmount: BN;
|
|
1003
999
|
cliffAmount: BN;
|
|
1004
1000
|
minPrice?: number;
|
|
@@ -1131,4 +1127,4 @@ declare const _default: {
|
|
|
1131
1127
|
}[];
|
|
1132
1128
|
};
|
|
1133
1129
|
|
|
1134
|
-
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, type Account, AlignedContract, AlignedProxyErrorCode, type AlignedStream, type AlignedStreamData, type AlignedUnlocksContract, type BatchItem, type BatchItemError, type BatchItemResult, type BatchItemSuccess, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, type ChangeOracleParams, type ClientCreationOptions, Contract, ContractErrorCode, type CreateParams, type CreateTestOracleParams, DEFAULT_STREAMFLOW_FEE, type DecodedStream, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, type IAlignedStreamConfig, type IBaseStreamConfig, type ICancelData, type ICreateAlignedStreamData, type ICreateExt, type ICreateLinearStreamData, type ICreateMultiError, type ICreateMultipleAlignedStreamData, type ICreateMultipleLinearStreamData, type ICreateMultipleStreamData, type ICreateResult, type ICreateStreamData, type ICreateStreamExt, type ICreateStreamInstructions, type IFees, type IGetAllData, type IGetFeesData, type IGetOneData, type IInteractData, type IInteractStreamExt, type IMultiTransactionResult, type IPrepareCreateStreamExt, type IPrepareStreamExt, type IRecipient, type ISearchStreams, type ITopUpData, type ITopUpStreamExt, type ITransactionExtWithInstructions, type ITransactionResult, type ITransferData, type IUpdateData, type IWithdrawData, type InstructionGenerator, type LinearStream, MAX_SAFE_UNIX_TIME_VALUE, type MetadataRecipientHashMap, ORIGINAL_CONTRACT_SENDER_OFFSET, type OracleType, type OracleTypeName, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, type Stream, type StreamClientOptions, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, type TestOracle, type TransactionSchedulingOptions, type UpdateTestOracleParams, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock,
|
|
1130
|
+
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, type Account, AlignedContract, AlignedProxyErrorCode, type AlignedStream, type AlignedStreamData, type AlignedUnlocksContract, type BatchItem, type BatchItemError, type BatchItemResult, type BatchItemSuccess, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, type ChangeOracleParams, type ClientCreationOptions, Contract, ContractErrorCode, type CreateParams, type CreateTestOracleParams, DEFAULT_STREAMFLOW_FEE, type DecodedStream, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, type IAlignedStreamConfig, type IBaseStreamConfig, type ICancelData, type ICreateAlignedStreamData, type ICreateExt, type ICreateLinearStreamData, type ICreateMultiError, type ICreateMultipleAlignedStreamData, type ICreateMultipleLinearStreamData, type ICreateMultipleStreamData, type ICreateResult, type ICreateStreamData, type ICreateStreamExt, type ICreateStreamInstructions, type IFees, type IGetAllData, type IGetFeesData, type IGetOneData, type IInteractData, type IInteractStreamExt, type IMultiTransactionResult, type IPrepareCreateStreamExt, type IPrepareStreamExt, type IRecipient, type ISearchStreams, type ITopUpData, type ITopUpStreamExt, type ITransactionExtWithInstructions, type ITransactionResult, type ITransferData, type IUpdateData, type IWithdrawData, type InstructionGenerator, type LinearStream, MAX_SAFE_UNIX_TIME_VALUE, type MetadataRecipientHashMap, ORIGINAL_CONTRACT_SENDER_OFFSET, type OracleType, type OracleTypeName, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, type Stream, type StreamClientOptions, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, type TestOracle, type TransactionSchedulingOptions, type UpdateTestOracleParams, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, _default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
|
package/dist/esm/solana/index.js
CHANGED
|
@@ -33,11 +33,8 @@ var calculateUnlockedAmount = ({
|
|
|
33
33
|
var isCliffCloseToDepositedAmount = (streamData) => {
|
|
34
34
|
return streamData.cliffAmount.gte(streamData.depositedAmount.sub(new BN3(1)));
|
|
35
35
|
};
|
|
36
|
-
var isPayment = (streamData) => {
|
|
37
|
-
return streamData.canTopup;
|
|
38
|
-
};
|
|
39
36
|
var isVesting = (streamData) => {
|
|
40
|
-
return !
|
|
37
|
+
return !isCliffCloseToDepositedAmount(streamData) && !isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage);
|
|
41
38
|
};
|
|
42
39
|
var isAligned = (stream) => {
|
|
43
40
|
return "minPrice" in stream && "maxPrice" in stream && "minPercentage" in stream && "maxPercentage" in stream;
|
|
@@ -52,13 +49,10 @@ var isTokenLock = (streamData) => {
|
|
|
52
49
|
return !streamData.canTopup && !streamData.automaticWithdrawal && !streamData.cancelableBySender && !streamData.cancelableByRecipient && !streamData.transferableBySender && (isCliffCloseToDepositedAmount(streamData) || isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage));
|
|
53
50
|
};
|
|
54
51
|
var buildStreamType = (streamData) => {
|
|
55
|
-
if (isVesting(streamData)) {
|
|
56
|
-
return "vesting" /* Vesting */;
|
|
57
|
-
}
|
|
58
52
|
if (isTokenLock(streamData)) {
|
|
59
53
|
return "lock" /* Lock */;
|
|
60
54
|
}
|
|
61
|
-
return "
|
|
55
|
+
return "vesting" /* Vesting */;
|
|
62
56
|
};
|
|
63
57
|
var decodeEndTime = (endTime) => {
|
|
64
58
|
if (endTime.gt(new BN3(MAX_SAFE_UNIX_TIME_VALUE))) {
|
|
@@ -75,7 +69,6 @@ var StreamDirection = /* @__PURE__ */ ((StreamDirection2) => {
|
|
|
75
69
|
})(StreamDirection || {});
|
|
76
70
|
var StreamType = /* @__PURE__ */ ((StreamType2) => {
|
|
77
71
|
StreamType2["All"] = "all";
|
|
78
|
-
StreamType2["Payment"] = "payment";
|
|
79
72
|
StreamType2["Vesting"] = "vesting";
|
|
80
73
|
StreamType2["Lock"] = "lock";
|
|
81
74
|
return StreamType2;
|
|
@@ -2645,7 +2638,7 @@ var SolanaStreamClient = class {
|
|
|
2645
2638
|
return { ixs, txId: signature, metadataId };
|
|
2646
2639
|
}
|
|
2647
2640
|
async prepareCreateInstructions(streamParams, extParams) {
|
|
2648
|
-
const { ixs, metadata, metadataPubKey } = isCreateAlignedStreamData(streamParams) ? await this.prepareCreateAlignedUnlockInstructions(streamParams, extParams) : await this.
|
|
2641
|
+
const { ixs, metadata, metadataPubKey } = isCreateAlignedStreamData(streamParams) ? await this.prepareCreateAlignedUnlockInstructions(streamParams, extParams) : await this.prepareCreateLinearStreamInstructions(streamParams, extParams);
|
|
2649
2642
|
return { ixs, metadata, metadataPubKey };
|
|
2650
2643
|
}
|
|
2651
2644
|
async prepareCreateAlignedUnlockInstructions(streamParams, extParams) {
|
|
@@ -2755,7 +2748,7 @@ var SolanaStreamClient = class {
|
|
|
2755
2748
|
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
2756
2749
|
* @returns Create stream instructions
|
|
2757
2750
|
*/
|
|
2758
|
-
async
|
|
2751
|
+
async prepareCreateLinearStreamInstructions({
|
|
2759
2752
|
recipient,
|
|
2760
2753
|
tokenId: mint,
|
|
2761
2754
|
start,
|
|
@@ -2976,14 +2969,13 @@ var SolanaStreamClient = class {
|
|
|
2976
2969
|
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
2977
2970
|
* @returns Create multiple transaction instructions
|
|
2978
2971
|
*/
|
|
2979
|
-
async buildCreateMultipleTransactionInstructions(data, extParams) {
|
|
2972
|
+
async buildCreateMultipleTransactionInstructions(data, extParams, applyCustomAfterInstructions = true) {
|
|
2980
2973
|
const { recipients, ...streamParams } = data;
|
|
2981
2974
|
const { sender, metadataPubKeys: metadataPubKeysExt, isNative, customInstructions } = extParams;
|
|
2982
2975
|
assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
2983
2976
|
const metadatas = [];
|
|
2984
2977
|
const metadataToRecipient = {};
|
|
2985
2978
|
const instructionsBatch = [];
|
|
2986
|
-
const metadataPubKeys = metadataPubKeysExt || [];
|
|
2987
2979
|
const partnerPublicKey = data.partner ? new PublicKey(data.partner) : WITHDRAWOR_PUBLIC_KEY;
|
|
2988
2980
|
const mintPublicKey = new PublicKey(data.tokenId);
|
|
2989
2981
|
if (recipients.length === 0) {
|
|
@@ -2993,14 +2985,16 @@ var SolanaStreamClient = class {
|
|
|
2993
2985
|
const recipientData = recipients[i];
|
|
2994
2986
|
const createStreamData = { ...streamParams, ...recipientData };
|
|
2995
2987
|
const createStreamExtParams = {
|
|
2996
|
-
|
|
2997
|
-
|
|
2988
|
+
...extParams,
|
|
2989
|
+
metadataPubKeys: metadataPubKeysExt?.[i] ? [metadataPubKeysExt[i]] : void 0
|
|
2998
2990
|
};
|
|
2999
2991
|
const { ixs, metadata, metadataPubKey } = await this.prepareCreateInstructions(
|
|
3000
2992
|
createStreamData,
|
|
3001
2993
|
createStreamExtParams
|
|
3002
2994
|
);
|
|
3003
|
-
|
|
2995
|
+
if (applyCustomAfterInstructions) {
|
|
2996
|
+
await this.applyCustomAfterInstructions(ixs, customInstructions, metadataPubKey);
|
|
2997
|
+
}
|
|
3004
2998
|
metadataToRecipient[metadataPubKey.toBase58()] = recipientData;
|
|
3005
2999
|
metadatas.push(metadataPubKey.toBase58());
|
|
3006
3000
|
instructionsBatch.push({
|
|
@@ -3048,9 +3042,9 @@ var SolanaStreamClient = class {
|
|
|
3048
3042
|
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
3049
3043
|
* @returns Multiple transaction information
|
|
3050
3044
|
*/
|
|
3051
|
-
async buildCreateMultipleTransactions(data, extParams) {
|
|
3045
|
+
async buildCreateMultipleTransactions(data, extParams, applyCustomAfterInstructions = true) {
|
|
3052
3046
|
const { sender } = extParams;
|
|
3053
|
-
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams);
|
|
3047
|
+
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams, applyCustomAfterInstructions);
|
|
3054
3048
|
const { value: hash, context } = await this.connection.getLatestBlockhashAndContext();
|
|
3055
3049
|
const batch = [];
|
|
3056
3050
|
for (const { ixs, metadata, recipient } of instructionsBatch) {
|
|
@@ -3081,7 +3075,7 @@ var SolanaStreamClient = class {
|
|
|
3081
3075
|
if (!sender.publicKey) {
|
|
3082
3076
|
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
3083
3077
|
}
|
|
3084
|
-
const { instructionsBatch, metadatas,
|
|
3078
|
+
const { instructionsBatch, metadatas, prepareInstructions, metadataToRecipient } = await this.flatBuildCreateMultipleTransactionInstructions(data, extParams);
|
|
3085
3079
|
const errors = [];
|
|
3086
3080
|
const signatures = [];
|
|
3087
3081
|
const metadataPubKeys = metadataPubKeysExt || [];
|
|
@@ -3146,7 +3140,7 @@ var SolanaStreamClient = class {
|
|
|
3146
3140
|
if (!sender.publicKey) {
|
|
3147
3141
|
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
3148
3142
|
}
|
|
3149
|
-
const { instructionsBatch, metadatas,
|
|
3143
|
+
const { instructionsBatch, metadatas, prepareInstructions, metadataToRecipient } = await this.flatBuildCreateMultipleTransactionInstructions(data, extParams);
|
|
3150
3144
|
const errors = [];
|
|
3151
3145
|
const signatures = [];
|
|
3152
3146
|
const batch = [];
|
|
@@ -3308,7 +3302,7 @@ var SolanaStreamClient = class {
|
|
|
3308
3302
|
}
|
|
3309
3303
|
const { sender: senderPublicKey } = decodeStream(account.data);
|
|
3310
3304
|
const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, senderPublicKey);
|
|
3311
|
-
const ixs = isAlignedUnlock ? await this.prepareCancelAlignedUnlockInstructions(cancelData, extParams) : await this.
|
|
3305
|
+
const ixs = isAlignedUnlock ? await this.prepareCancelAlignedUnlockInstructions(cancelData, extParams) : await this.prepareCancelLinearStream(cancelData, extParams);
|
|
3312
3306
|
return ixs;
|
|
3313
3307
|
}
|
|
3314
3308
|
/**
|
|
@@ -3356,7 +3350,7 @@ var SolanaStreamClient = class {
|
|
|
3356
3350
|
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
3357
3351
|
* @returns Transaction instructions
|
|
3358
3352
|
*/
|
|
3359
|
-
async
|
|
3353
|
+
async prepareCancelLinearStream({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
3360
3354
|
assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
3361
3355
|
const streamPublicKey = new PublicKey(id);
|
|
3362
3356
|
const escrowAcc = await this.connection.getAccountInfo(streamPublicKey);
|
|
@@ -3769,11 +3763,11 @@ var SolanaStreamClient = class {
|
|
|
3769
3763
|
return DEFAULT_STREAMFLOW_FEE;
|
|
3770
3764
|
}
|
|
3771
3765
|
/**
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3766
|
+
* Returns total fee percent, streamflow fees + partner fees
|
|
3767
|
+
* @param getFeesData structure with address for which we need to derive fee, either sender or partner usually
|
|
3768
|
+
* @param chainSpecificParams additional parameters required by chain client
|
|
3769
|
+
* @returns fee as floating number, so if fee is 0.99%, it will return 0.99
|
|
3770
|
+
*/
|
|
3777
3771
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3778
3772
|
async getTotalFee(getFeesData) {
|
|
3779
3773
|
const fees = await this.getFees(getFeesData);
|
|
@@ -3798,6 +3792,21 @@ var SolanaStreamClient = class {
|
|
|
3798
3792
|
const pda = deriveContractPDA(this.alignedProxyProgram.programId, streamPublicKey);
|
|
3799
3793
|
return senderPublicKey.equals(pda);
|
|
3800
3794
|
}
|
|
3795
|
+
async flatBuildCreateMultipleTransactionInstructions(data, extParams) {
|
|
3796
|
+
const dataArray = Array.isArray(data) ? data : [data];
|
|
3797
|
+
const results = await Promise.all(
|
|
3798
|
+
dataArray.map((item, index) => this.buildCreateMultipleTransactionInstructions(item, extParams, index === 0))
|
|
3799
|
+
);
|
|
3800
|
+
return {
|
|
3801
|
+
instructionsBatch: results.flatMap((r) => r.instructionsBatch),
|
|
3802
|
+
metadatas: results.flatMap((r) => r.metadatas),
|
|
3803
|
+
prepareInstructions: results.flatMap((r) => r.prepareInstructions),
|
|
3804
|
+
metadataToRecipient: results.reduce(
|
|
3805
|
+
(acc, r) => Object.assign(acc, r.metadataToRecipient),
|
|
3806
|
+
{}
|
|
3807
|
+
)
|
|
3808
|
+
};
|
|
3809
|
+
}
|
|
3801
3810
|
/**
|
|
3802
3811
|
* Utility function to generate metadata for a Contract or return existing Pubkey
|
|
3803
3812
|
*/
|
|
@@ -4257,6 +4266,6 @@ var timelockIDL_default = {
|
|
|
4257
4266
|
]
|
|
4258
4267
|
};
|
|
4259
4268
|
|
|
4260
|
-
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW2 as ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, AlignedContract, AlignedProxyErrorCode, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, Contract, ContractErrorCode, DEFAULT_STREAMFLOW_FEE, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, MAX_SAFE_UNIX_TIME_VALUE2 as MAX_SAFE_UNIX_TIME_VALUE, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock,
|
|
4269
|
+
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW2 as ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, AlignedContract, AlignedProxyErrorCode, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, Contract, ContractErrorCode, DEFAULT_STREAMFLOW_FEE, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, MAX_SAFE_UNIX_TIME_VALUE2 as MAX_SAFE_UNIX_TIME_VALUE, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, timelockIDL_default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
|
|
4261
4270
|
//# sourceMappingURL=index.js.map
|
|
4262
4271
|
//# sourceMappingURL=index.js.map
|