@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-RvzYFo_L.js';
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-D-w3ZCyC.js';
2
2
  export { ContractError, IChain, ICluster } from '@streamflow/common';
3
3
  import 'p-queue';
4
4
  import '@solana/web3.js';
@@ -2431,6 +2431,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
2431
2431
  /**
2432
2432
  * Builds transaction instructions for creating a new stream/vesting contract without creating a transaction.
2433
2433
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
2434
+ *
2435
+ * For native SOL (isNative: true), SOL wrapping instructions are automatically included in the correct order
2436
+ * (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.
2437
+ *
2434
2438
  * @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
2435
2439
  * @param {Omit<ICreateStreamSolanaExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
2436
2440
  * @returns Transaction instructions and metadata ID
@@ -2448,6 +2452,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
2448
2452
  true,
2449
2453
  tokenProgramId ? new PublicKey(tokenProgramId) : void 0
2450
2454
  );
2455
+ if (isNative) {
2456
+ const totalFee = await this.getTotalFee({
2457
+ address: partnerPublicKey.toString()
2458
+ });
2459
+ const totalAmount = calculateTotalAmountToDeposit(amount, totalFee);
2460
+ ixs.push(...await prepareWrappedAccount(this.connection, tempSender.publicKey, totalAmount));
2461
+ }
2451
2462
  const {
2452
2463
  ixs: createIxs,
2453
2464
  metadata,
@@ -2457,13 +2468,6 @@ var SolanaStreamClient = class extends BaseStreamClient {
2457
2468
  sender: tempSender
2458
2469
  });
2459
2470
  ixs.push(...createIxs);
2460
- if (isNative) {
2461
- const totalFee = await this.getTotalFee({
2462
- address: partnerPublicKey.toString()
2463
- });
2464
- const totalAmount = calculateTotalAmountToDeposit(amount, totalFee);
2465
- ixs.push(...await prepareWrappedAccount(this.connection, tempSender.publicKey, totalAmount));
2466
- }
2467
2471
  await this.applyCustomAfterInstructions(ixs, customInstructions, metadataPubKey);
2468
2472
  return {
2469
2473
  ixs,
@@ -2474,6 +2478,10 @@ var SolanaStreamClient = class extends BaseStreamClient {
2474
2478
  /**
2475
2479
  * Builds a transaction for creating a new stream/vesting contract without signing or executing it.
2476
2480
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
2481
+ *
2482
+ * For native SOL (isNative: true), SOL wrapping instructions are automatically included in the correct order
2483
+ * (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.
2484
+ *
2477
2485
  * @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
2478
2486
  * @param {Omit<ICreateStreamSolanaExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
2479
2487
  * @returns Transaction and metadata information
@@ -2920,6 +2928,25 @@ var SolanaStreamClient = class extends BaseStreamClient {
2920
2928
  /**
2921
2929
  * Builds multiple transactions for creating stream/vesting contracts without signing or executing them.
2922
2930
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
2931
+ *
2932
+ * IMPORTANT: When using native SOL (isNative: true), you MUST execute the prepareTx FIRST and wait for confirmation
2933
+ * before executing the stream creation transactions. Otherwise, stream creation will fail with "InvalidAccountData".
2934
+ *
2935
+ * @example
2936
+ * ```typescript
2937
+ * const result = await streamClient.buildCreateMultipleTransactions(data, { isNative: true, senderPublicKey });
2938
+ *
2939
+ * // CRITICAL: Execute prepareTx first if it exists
2940
+ * if (result.prepareTx) {
2941
+ * await connection.sendAndConfirmTransaction(result.prepareTx, [signer]);
2942
+ * }
2943
+ *
2944
+ * // Only then execute stream creation transactions
2945
+ * for (const item of result.transactions) {
2946
+ * await connection.sendAndConfirmTransaction(item.tx, [signer]);
2947
+ * }
2948
+ * ```
2949
+ *
2923
2950
  * @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
2924
2951
  * @param {Omit<ICreateStreamSolanaExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
2925
2952
  * @returns Multiple transaction information