@streamflow/stream 9.2.0 → 9.2.1-alpha.p321.02efd07

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-ByMlPIUq.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-ByMlPIUq.cjs';
5
+ import { S as SolanaStreamClient, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, b as ITopUpStreamSolanaExt } from './index-CPUhIwK2.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-CPUhIwK2.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';
@@ -3675,20 +3675,41 @@ var SolanaStreamClient = class extends BaseStreamClient {
3675
3675
  const accounts = await this.connection.getProgramAccounts(this.programId, {
3676
3676
  filters
3677
3677
  });
3678
- const mapped = await Promise.all(
3679
- accounts.map(async ({ pubkey, account }) => {
3680
- const stream = decodeStream(account.data);
3681
- if (this.isAlignedUnlock(pubkey, stream.sender)) {
3682
- const alignedProxy = await this.alignedProxyProgram.account.contract.fetch(
3683
- deriveContractPDA(this.alignedProxyProgram.programId, pubkey)
3684
- );
3685
- common.invariant(alignedProxy, "Couldn't get aligned proxy account info");
3686
- return { publicKey: pubkey, account: new AlignedContract(stream, alignedProxy) };
3687
- }
3688
- return { publicKey: pubkey, account: new Contract(stream) };
3689
- })
3690
- );
3691
- return mapped;
3678
+ const decoded = this.decodeStreamsFromAccounts(accounts);
3679
+ const alignedEntries = this.collectAlignedEntries(decoded);
3680
+ const alignedProxies = await this.fetchAlignedProxiesByEntries(alignedEntries);
3681
+ return this.mapDecodedToProgramAccounts(decoded, alignedEntries, alignedProxies);
3682
+ }
3683
+ decodeStreamsFromAccounts(accounts) {
3684
+ return accounts.map(({ pubkey, account }) => ({
3685
+ pubkey,
3686
+ stream: decodeStream(account.data)
3687
+ }));
3688
+ }
3689
+ collectAlignedEntries(decoded) {
3690
+ const entries = [];
3691
+ decoded.forEach(({ pubkey, stream }, index) => {
3692
+ if (this.isAlignedUnlock(pubkey, stream.sender)) {
3693
+ entries.push({ index, pda: deriveContractPDA(this.alignedProxyProgram.programId, pubkey) });
3694
+ }
3695
+ });
3696
+ return entries;
3697
+ }
3698
+ async fetchAlignedProxiesByEntries(aligned) {
3699
+ if (aligned.length === 0) return [];
3700
+ const res = await this.alignedProxyProgram.account.contract.fetchMultiple(aligned.map((a) => a.pda));
3701
+ return res;
3702
+ }
3703
+ mapDecodedToProgramAccounts(decoded, alignedEntries, alignedProxies) {
3704
+ return decoded.map(({ pubkey, stream }, idx) => {
3705
+ const alignedIdx = alignedEntries.findIndex((a) => a.index === idx);
3706
+ if (alignedIdx !== -1) {
3707
+ const alignedProxy = alignedProxies[alignedIdx];
3708
+ common.invariant(alignedProxy, "Couldn't get aligned proxy account info");
3709
+ return { publicKey: pubkey, account: new AlignedContract(stream, alignedProxy) };
3710
+ }
3711
+ return { publicKey: pubkey, account: new Contract(stream) };
3712
+ });
3692
3713
  }
3693
3714
  /**
3694
3715
  * Attempts updating the stream auto withdrawal params and amount per period