@streamflow/stream 8.7.0-alpha.0 → 8.7.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.
@@ -1,4 +1,4 @@
1
- export { Z as Account, a3 as AlignedContract, M as AlignedUnlocksContract, a6 as BatchItem, a8 as BatchItemError, a9 as BatchItemResult, a7 as BatchItemSuccess, U as ChangeOracleParams, y as ClientCreationOptions, a2 as Contract, R as CreateParams, V as CreateTestOracleParams, a4 as DecodedStream, $ as ICreateSolanaExt, a1 as ICreateStreamInstructions, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, Y as ISearchStreams, b as ITopUpStreamSolanaExt, a0 as ITransactionSolanaExtWithInstructions, aa as InstructionGenerator, a5 as MetadataRecipientHashMap, N as OracleType, S as SolanaStreamClient, Q as TestOracle, X as UpdateTestOracleParams, af as cancelStreamInstruction, x as constants, ab as createStreamInstruction, ac 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, ah as topupStreamInstruction, ag as transferStreamInstruction, ae as updateStreamInstruction, ad as withdrawStreamInstruction } from '../index-Dl7EztUT.cjs';
1
+ export { Z as Account, a3 as AlignedContract, M as AlignedUnlocksContract, a6 as BatchItem, a8 as BatchItemError, a9 as BatchItemResult, a7 as BatchItemSuccess, U as ChangeOracleParams, y as ClientCreationOptions, a2 as Contract, R as CreateParams, V as CreateTestOracleParams, a4 as DecodedStream, $ as ICreateSolanaExt, a1 as ICreateStreamInstructions, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, Y as ISearchStreams, b as ITopUpStreamSolanaExt, a0 as ITransactionSolanaExtWithInstructions, aa as InstructionGenerator, a5 as MetadataRecipientHashMap, N as OracleType, S as SolanaStreamClient, Q as TestOracle, X as UpdateTestOracleParams, af as cancelStreamInstruction, x as constants, ab as createStreamInstruction, ac 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, ah as topupStreamInstruction, ag as transferStreamInstruction, ae as updateStreamInstruction, ad as withdrawStreamInstruction } from '../index-Bll7jg8V.cjs';
2
2
  export { ContractError, IChain, ICluster } from '@streamflow/common';
3
3
  import 'p-queue';
4
4
  import '@solana/web3.js';
@@ -212,6 +212,10 @@ declare class SolanaStreamClient extends BaseStreamClient {
212
212
  /**
213
213
  * Builds transaction instructions for creating a new stream/vesting contract without creating a transaction.
214
214
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
215
+ *
216
+ * For native SOL (isNative: true), SOL wrapping instructions are automatically included in the correct order
217
+ * (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.
218
+ *
215
219
  * @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
216
220
  * @param {Omit<ICreateStreamSolanaExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
217
221
  * @returns Transaction instructions and metadata ID
@@ -226,6 +230,10 @@ declare class SolanaStreamClient extends BaseStreamClient {
226
230
  /**
227
231
  * Builds a transaction for creating a new stream/vesting contract without signing or executing it.
228
232
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
233
+ *
234
+ * For native SOL (isNative: true), SOL wrapping instructions are automatically included in the correct order
235
+ * (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.
236
+ *
229
237
  * @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
230
238
  * @param {Omit<ICreateStreamSolanaExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
231
239
  * @returns Transaction and metadata information
@@ -301,6 +309,25 @@ declare class SolanaStreamClient extends BaseStreamClient {
301
309
  /**
302
310
  * Builds multiple transactions for creating stream/vesting contracts without signing or executing them.
303
311
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
312
+ *
313
+ * IMPORTANT: When using native SOL (isNative: true), you MUST execute the prepareTx FIRST and wait for confirmation
314
+ * before executing the stream creation transactions. Otherwise, stream creation will fail with "InvalidAccountData".
315
+ *
316
+ * @example
317
+ * ```typescript
318
+ * const result = await streamClient.buildCreateMultipleTransactions(data, { isNative: true, senderPublicKey });
319
+ *
320
+ * // CRITICAL: Execute prepareTx first if it exists
321
+ * if (result.prepareTx) {
322
+ * await connection.sendAndConfirmTransaction(result.prepareTx, [signer]);
323
+ * }
324
+ *
325
+ * // Only then execute stream creation transactions
326
+ * for (const item of result.transactions) {
327
+ * await connection.sendAndConfirmTransaction(item.tx, [signer]);
328
+ * }
329
+ * ```
330
+ *
304
331
  * @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
305
332
  * @param {Omit<ICreateStreamSolanaExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
306
333
  * @returns Multiple transaction information
@@ -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-RvzYFo_L.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-RvzYFo_L.js';
5
+ import { S as SolanaStreamClient, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, b as ITopUpStreamSolanaExt } from './index-D-w3ZCyC.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-D-w3ZCyC.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
@@ -5025,6 +5025,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
5025
5025
  /**
5026
5026
  * Builds transaction instructions for creating a new stream/vesting contract without creating a transaction.
5027
5027
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
5028
+ *
5029
+ * For native SOL (isNative: true), SOL wrapping instructions are automatically included in the correct order
5030
+ * (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.
5031
+ *
5028
5032
  * @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
5029
5033
  * @param {Omit<ICreateStreamSolanaExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
5030
5034
  * @returns Transaction instructions and metadata ID
@@ -5042,6 +5046,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
5042
5046
  true,
5043
5047
  tokenProgramId ? new PublicKey(tokenProgramId) : void 0
5044
5048
  );
5049
+ if (isNative) {
5050
+ const totalFee = await this.getTotalFee({
5051
+ address: partnerPublicKey.toString()
5052
+ });
5053
+ const totalAmount = calculateTotalAmountToDeposit(amount, totalFee);
5054
+ ixs.push(...await prepareWrappedAccount(this.connection, tempSender.publicKey, totalAmount));
5055
+ }
5045
5056
  const {
5046
5057
  ixs: createIxs,
5047
5058
  metadata,
@@ -5051,13 +5062,6 @@ var SolanaStreamClient = class extends BaseStreamClient {
5051
5062
  sender: tempSender
5052
5063
  });
5053
5064
  ixs.push(...createIxs);
5054
- if (isNative) {
5055
- const totalFee = await this.getTotalFee({
5056
- address: partnerPublicKey.toString()
5057
- });
5058
- const totalAmount = calculateTotalAmountToDeposit(amount, totalFee);
5059
- ixs.push(...await prepareWrappedAccount(this.connection, tempSender.publicKey, totalAmount));
5060
- }
5061
5065
  await this.applyCustomAfterInstructions(ixs, customInstructions, metadataPubKey);
5062
5066
  return {
5063
5067
  ixs,
@@ -5068,6 +5072,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
5068
5072
  /**
5069
5073
  * Builds a transaction for creating a new stream/vesting contract without signing or executing it.
5070
5074
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
5075
+ *
5076
+ * For native SOL (isNative: true), SOL wrapping instructions are automatically included in the correct order
5077
+ * (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.
5078
+ *
5071
5079
  * @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
5072
5080
  * @param {Omit<ICreateStreamSolanaExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
5073
5081
  * @returns Transaction and metadata information
@@ -5514,6 +5522,25 @@ var SolanaStreamClient = class extends BaseStreamClient {
5514
5522
  /**
5515
5523
  * Builds multiple transactions for creating stream/vesting contracts without signing or executing them.
5516
5524
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
5525
+ *
5526
+ * IMPORTANT: When using native SOL (isNative: true), you MUST execute the prepareTx FIRST and wait for confirmation
5527
+ * before executing the stream creation transactions. Otherwise, stream creation will fail with "InvalidAccountData".
5528
+ *
5529
+ * @example
5530
+ * ```typescript
5531
+ * const result = await streamClient.buildCreateMultipleTransactions(data, { isNative: true, senderPublicKey });
5532
+ *
5533
+ * // CRITICAL: Execute prepareTx first if it exists
5534
+ * if (result.prepareTx) {
5535
+ * await connection.sendAndConfirmTransaction(result.prepareTx, [signer]);
5536
+ * }
5537
+ *
5538
+ * // Only then execute stream creation transactions
5539
+ * for (const item of result.transactions) {
5540
+ * await connection.sendAndConfirmTransaction(item.tx, [signer]);
5541
+ * }
5542
+ * ```
5543
+ *
5517
5544
  * @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
5518
5545
  * @param {Omit<ICreateStreamSolanaExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
5519
5546
  * @returns Multiple transaction information