@streamflow/stream 10.0.0-alpha.p313.fe3720a → 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/dist/cjs/index.cjs +30 -14
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/solana/index.cjs +30 -14
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +10 -9
- package/dist/esm/index.js +30 -14
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +10 -9
- package/dist/esm/solana/index.js +30 -14
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -583,7 +583,7 @@ declare class SolanaStreamClient {
|
|
|
583
583
|
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
584
584
|
* @returns Create multiple transaction instructions
|
|
585
585
|
*/
|
|
586
|
-
buildCreateMultipleTransactionInstructions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamExt): Promise<{
|
|
586
|
+
buildCreateMultipleTransactionInstructions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamExt, applyCustomAfterInstructions?: boolean): Promise<{
|
|
587
587
|
instructionsBatch: {
|
|
588
588
|
ixs: TransactionInstruction[];
|
|
589
589
|
metadata: Keypair | undefined;
|
|
@@ -619,7 +619,7 @@ declare class SolanaStreamClient {
|
|
|
619
619
|
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
620
620
|
* @returns Multiple transaction information
|
|
621
621
|
*/
|
|
622
|
-
buildCreateMultipleTransactions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamExt): Promise<{
|
|
622
|
+
buildCreateMultipleTransactions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamExt, applyCustomAfterInstructions?: boolean): Promise<{
|
|
623
623
|
transactions: BatchItem[];
|
|
624
624
|
metadatas: string[];
|
|
625
625
|
metadataToRecipient: MetadataRecipientHashMap;
|
|
@@ -637,7 +637,7 @@ declare class SolanaStreamClient {
|
|
|
637
637
|
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
638
638
|
* @returns Multiple transaction information
|
|
639
639
|
*/
|
|
640
|
-
createMultiple(data: ICreateMultipleStreamData, extParams: ICreateStreamExt): Promise<IMultiTransactionResult>;
|
|
640
|
+
createMultiple(data: ICreateMultipleStreamData[] | ICreateMultipleStreamData, extParams: ICreateStreamExt): Promise<IMultiTransactionResult>;
|
|
641
641
|
/**
|
|
642
642
|
* Creates multiple stream/vesting contracts, and send all transactions sequentially.
|
|
643
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).
|
|
@@ -646,7 +646,7 @@ declare class SolanaStreamClient {
|
|
|
646
646
|
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
647
647
|
* @returns Multiple transaction information
|
|
648
648
|
*/
|
|
649
|
-
createMultipleSequential(data: ICreateMultipleStreamData, extParams: ICreateStreamExt): Promise<IMultiTransactionResult>;
|
|
649
|
+
createMultipleSequential(data: ICreateMultipleStreamData[] | ICreateMultipleStreamData, extParams: ICreateStreamExt): Promise<IMultiTransactionResult>;
|
|
650
650
|
/**
|
|
651
651
|
* Attempts withdrawing from the specified stream.
|
|
652
652
|
* @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
|
|
@@ -771,11 +771,11 @@ declare class SolanaStreamClient {
|
|
|
771
771
|
*/
|
|
772
772
|
getDefaultStreamflowFee(): Promise<number>;
|
|
773
773
|
/**
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
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
|
+
*/
|
|
779
779
|
getTotalFee(getFeesData: IGetFeesData): Promise<number>;
|
|
780
780
|
/**
|
|
781
781
|
* Extracts error code from an error
|
|
@@ -787,6 +787,7 @@ declare class SolanaStreamClient {
|
|
|
787
787
|
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
788
788
|
*/
|
|
789
789
|
isAlignedUnlock(streamPublicKey: PublicKey, senderPublicKey: PublicKey): boolean;
|
|
790
|
+
private flatBuildCreateMultipleTransactionInstructions;
|
|
790
791
|
/**
|
|
791
792
|
* Utility function to generate metadata for a Contract or return existing Pubkey
|
|
792
793
|
*/
|
package/dist/esm/solana/index.js
CHANGED
|
@@ -2969,14 +2969,13 @@ var SolanaStreamClient = class {
|
|
|
2969
2969
|
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
2970
2970
|
* @returns Create multiple transaction instructions
|
|
2971
2971
|
*/
|
|
2972
|
-
async buildCreateMultipleTransactionInstructions(data, extParams) {
|
|
2972
|
+
async buildCreateMultipleTransactionInstructions(data, extParams, applyCustomAfterInstructions = true) {
|
|
2973
2973
|
const { recipients, ...streamParams } = data;
|
|
2974
2974
|
const { sender, metadataPubKeys: metadataPubKeysExt, isNative, customInstructions } = extParams;
|
|
2975
2975
|
assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
2976
2976
|
const metadatas = [];
|
|
2977
2977
|
const metadataToRecipient = {};
|
|
2978
2978
|
const instructionsBatch = [];
|
|
2979
|
-
const metadataPubKeys = metadataPubKeysExt || [];
|
|
2980
2979
|
const partnerPublicKey = data.partner ? new PublicKey(data.partner) : WITHDRAWOR_PUBLIC_KEY;
|
|
2981
2980
|
const mintPublicKey = new PublicKey(data.tokenId);
|
|
2982
2981
|
if (recipients.length === 0) {
|
|
@@ -2986,14 +2985,16 @@ var SolanaStreamClient = class {
|
|
|
2986
2985
|
const recipientData = recipients[i];
|
|
2987
2986
|
const createStreamData = { ...streamParams, ...recipientData };
|
|
2988
2987
|
const createStreamExtParams = {
|
|
2989
|
-
|
|
2990
|
-
|
|
2988
|
+
...extParams,
|
|
2989
|
+
metadataPubKeys: metadataPubKeysExt?.[i] ? [metadataPubKeysExt[i]] : void 0
|
|
2991
2990
|
};
|
|
2992
2991
|
const { ixs, metadata, metadataPubKey } = await this.prepareCreateInstructions(
|
|
2993
2992
|
createStreamData,
|
|
2994
2993
|
createStreamExtParams
|
|
2995
2994
|
);
|
|
2996
|
-
|
|
2995
|
+
if (applyCustomAfterInstructions) {
|
|
2996
|
+
await this.applyCustomAfterInstructions(ixs, customInstructions, metadataPubKey);
|
|
2997
|
+
}
|
|
2997
2998
|
metadataToRecipient[metadataPubKey.toBase58()] = recipientData;
|
|
2998
2999
|
metadatas.push(metadataPubKey.toBase58());
|
|
2999
3000
|
instructionsBatch.push({
|
|
@@ -3041,9 +3042,9 @@ var SolanaStreamClient = class {
|
|
|
3041
3042
|
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
3042
3043
|
* @returns Multiple transaction information
|
|
3043
3044
|
*/
|
|
3044
|
-
async buildCreateMultipleTransactions(data, extParams) {
|
|
3045
|
+
async buildCreateMultipleTransactions(data, extParams, applyCustomAfterInstructions = true) {
|
|
3045
3046
|
const { sender } = extParams;
|
|
3046
|
-
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams);
|
|
3047
|
+
const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams, applyCustomAfterInstructions);
|
|
3047
3048
|
const { value: hash, context } = await this.connection.getLatestBlockhashAndContext();
|
|
3048
3049
|
const batch = [];
|
|
3049
3050
|
for (const { ixs, metadata, recipient } of instructionsBatch) {
|
|
@@ -3074,7 +3075,7 @@ var SolanaStreamClient = class {
|
|
|
3074
3075
|
if (!sender.publicKey) {
|
|
3075
3076
|
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
3076
3077
|
}
|
|
3077
|
-
const { instructionsBatch, metadatas,
|
|
3078
|
+
const { instructionsBatch, metadatas, prepareInstructions, metadataToRecipient } = await this.flatBuildCreateMultipleTransactionInstructions(data, extParams);
|
|
3078
3079
|
const errors = [];
|
|
3079
3080
|
const signatures = [];
|
|
3080
3081
|
const metadataPubKeys = metadataPubKeysExt || [];
|
|
@@ -3139,7 +3140,7 @@ var SolanaStreamClient = class {
|
|
|
3139
3140
|
if (!sender.publicKey) {
|
|
3140
3141
|
throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
|
|
3141
3142
|
}
|
|
3142
|
-
const { instructionsBatch, metadatas,
|
|
3143
|
+
const { instructionsBatch, metadatas, prepareInstructions, metadataToRecipient } = await this.flatBuildCreateMultipleTransactionInstructions(data, extParams);
|
|
3143
3144
|
const errors = [];
|
|
3144
3145
|
const signatures = [];
|
|
3145
3146
|
const batch = [];
|
|
@@ -3762,11 +3763,11 @@ var SolanaStreamClient = class {
|
|
|
3762
3763
|
return DEFAULT_STREAMFLOW_FEE;
|
|
3763
3764
|
}
|
|
3764
3765
|
/**
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
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
|
+
*/
|
|
3770
3771
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3771
3772
|
async getTotalFee(getFeesData) {
|
|
3772
3773
|
const fees = await this.getFees(getFeesData);
|
|
@@ -3791,6 +3792,21 @@ var SolanaStreamClient = class {
|
|
|
3791
3792
|
const pda = deriveContractPDA(this.alignedProxyProgram.programId, streamPublicKey);
|
|
3792
3793
|
return senderPublicKey.equals(pda);
|
|
3793
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
|
+
}
|
|
3794
3810
|
/**
|
|
3795
3811
|
* Utility function to generate metadata for a Contract or return existing Pubkey
|
|
3796
3812
|
*/
|