@streamflow/stream 9.2.0-alpha.p0.5034440 → 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';
@@ -2998,6 +2998,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
2998
2998
  const metadatas = [];
2999
2999
  const metadataToRecipient = {};
3000
3000
  const instructionsBatch = [];
3001
+ const metadataPubKeys = metadataPubKeysExt || [];
3001
3002
  const partnerPublicKey = data.partner ? new web3_js.PublicKey(data.partner) : WITHDRAWOR_PUBLIC_KEY;
3002
3003
  const mintPublicKey = new web3_js.PublicKey(data.tokenId);
3003
3004
  if (recipients.length === 0) {
@@ -3007,8 +3008,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
3007
3008
  const recipientData = recipients[i];
3008
3009
  const createStreamData = { ...streamParams, ...recipientData };
3009
3010
  const createStreamExtParams = {
3010
- ...extParams,
3011
- metadataPubKeys: metadataPubKeysExt?.[i] ? [metadataPubKeysExt[i]] : void 0
3011
+ metadataPubKeys: metadataPubKeys[i] ? [metadataPubKeys[i]] : void 0,
3012
+ ...extParams
3012
3013
  };
3013
3014
  const { ixs, metadata, metadataPubKey } = await this.prepareCreateInstructions(
3014
3015
  createStreamData,
@@ -3674,20 +3675,41 @@ var SolanaStreamClient = class extends BaseStreamClient {
3674
3675
  const accounts = await this.connection.getProgramAccounts(this.programId, {
3675
3676
  filters
3676
3677
  });
3677
- const mapped = await Promise.all(
3678
- accounts.map(async ({ pubkey, account }) => {
3679
- const stream = decodeStream(account.data);
3680
- if (this.isAlignedUnlock(pubkey, stream.sender)) {
3681
- const alignedProxy = await this.alignedProxyProgram.account.contract.fetch(
3682
- deriveContractPDA(this.alignedProxyProgram.programId, pubkey)
3683
- );
3684
- common.invariant(alignedProxy, "Couldn't get aligned proxy account info");
3685
- return { publicKey: pubkey, account: new AlignedContract(stream, alignedProxy) };
3686
- }
3687
- return { publicKey: pubkey, account: new Contract(stream) };
3688
- })
3689
- );
3690
- 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
+ });
3691
3713
  }
3692
3714
  /**
3693
3715
  * Attempts updating the stream auto withdrawal params and amount per period