@streamflow/stream 9.0.2 → 9.0.4

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.
@@ -2,8 +2,8 @@ import { A as AptosStreamClient, I as ICreateStreamAptosExt, a as ITransactionAp
2
2
  export { i as StreamflowAptos } from './index-DYIamO0j.cjs';
3
3
  import { E as EvmStreamClient } from './index-BMZATAYa.cjs';
4
4
  export { i as StreamflowEVM } from './index-BMZATAYa.cjs';
5
- import { S as SolanaStreamClient, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, b as ITopUpStreamSolanaExt } from './index-oCYfzJrc.cjs';
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-oCYfzJrc.cjs';
5
+ import { S as SolanaStreamClient, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, b as ITopUpStreamSolanaExt } from './index-BgGtpOPg.cjs';
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-BgGtpOPg.cjs';
7
7
  import { S as SuiStreamClient } from './index-Y0HH2ugY.cjs';
8
8
  export { i as StreamflowSui } from './index-Y0HH2ugY.cjs';
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.cjs';
@@ -2454,6 +2454,9 @@ var SolanaStreamClient = class extends BaseStreamClient {
2454
2454
  getProgramId() {
2455
2455
  return this.programId.toBase58();
2456
2456
  }
2457
+ getAlignedProxyProgramId() {
2458
+ return this.alignedProxyProgram.programId.toBase58();
2459
+ }
2457
2460
  /**
2458
2461
  * Builds transaction instructions for creating a new stream/vesting contract without creating a transaction.
2459
2462
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
@@ -3584,10 +3587,20 @@ var SolanaStreamClient = class extends BaseStreamClient {
3584
3587
  const accounts = await this.connection.getProgramAccounts(this.programId, {
3585
3588
  filters
3586
3589
  });
3587
- return accounts.map(({ pubkey, account }) => ({
3588
- publicKey: pubkey,
3589
- account: new Contract(decodeStream(account.data))
3590
- }));
3590
+ const mapped = await Promise.all(
3591
+ accounts.map(async ({ pubkey, account }) => {
3592
+ const stream = decodeStream(account.data);
3593
+ if (this.isAlignedUnlock(pubkey, stream.sender)) {
3594
+ const alignedProxy = await this.alignedProxyProgram.account.contract.fetch(
3595
+ deriveContractPDA(this.alignedProxyProgram.programId, pubkey)
3596
+ );
3597
+ common.invariant(alignedProxy, "Couldn't get aligned proxy account info");
3598
+ return { publicKey: pubkey, account: new AlignedContract(stream, alignedProxy) };
3599
+ }
3600
+ return { publicKey: pubkey, account: new Contract(stream) };
3601
+ })
3602
+ );
3603
+ return mapped;
3591
3604
  }
3592
3605
  /**
3593
3606
  * Attempts updating the stream auto withdrawal params and amount per period
@@ -3682,6 +3695,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
3682
3695
  const logs = "logs" in err && Array.isArray(err.logs) ? err.logs : void 0;
3683
3696
  return extractSolanaErrorCode(err.toString() ?? "Unknown error!", logs);
3684
3697
  }
3698
+ /**
3699
+ * Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
3700
+ */
3701
+ isAlignedUnlock(streamPublicKey, senderPublicKey) {
3702
+ const pda = deriveContractPDA(this.alignedProxyProgram.programId, streamPublicKey);
3703
+ return senderPublicKey.equals(pda);
3704
+ }
3685
3705
  /**
3686
3706
  * Utility function to generate metadata for a Contract or return existing Pubkey
3687
3707
  */
@@ -3696,13 +3716,6 @@ var SolanaStreamClient = class extends BaseStreamClient {
3696
3716
  }
3697
3717
  return { metadata, metadataPubKey };
3698
3718
  }
3699
- /**
3700
- * Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
3701
- */
3702
- isAlignedUnlock(streamPublicKey, senderPublicKey) {
3703
- const pda = deriveContractPDA(this.alignedProxyProgram.programId, streamPublicKey);
3704
- return senderPublicKey.equals(pda);
3705
- }
3706
3719
  /**
3707
3720
  * Returns insrtuctions for creating associated token accounts for the provided owners
3708
3721
  */