@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.
@@ -1,4 +1,4 @@
1
- export { Z as Account, a5 as AlignedContract, M as AlignedUnlocksContract, a8 as BatchItem, aa as BatchItemError, ab as BatchItemResult, a9 as BatchItemSuccess, U as ChangeOracleParams, y as ClientCreationOptions, a4 as Contract, R as CreateParams, V as CreateTestOracleParams, a6 as DecodedStream, $ as ICreateSolanaExt, a3 as ICreateStreamInstructions, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, a1 as IPrepareCreateStreamSolanaExt, a2 as IPrepareStreamSolanaExt, Y as ISearchStreams, b as ITopUpStreamSolanaExt, a0 as ITransactionSolanaExtWithInstructions, ac as InstructionGenerator, a7 as MetadataRecipientHashMap, N as OracleType, S as SolanaStreamClient, Q as TestOracle, X as UpdateTestOracleParams, ah as cancelStreamInstruction, x as constants, ad as createStreamInstruction, ae 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, aj as topupStreamInstruction, ai as transferStreamInstruction, ag as updateStreamInstruction, af as withdrawStreamInstruction } from '../index-ByMlPIUq.cjs';
1
+ export { Z as Account, a5 as AlignedContract, M as AlignedUnlocksContract, a8 as BatchItem, aa as BatchItemError, ab as BatchItemResult, a9 as BatchItemSuccess, U as ChangeOracleParams, y as ClientCreationOptions, a4 as Contract, R as CreateParams, V as CreateTestOracleParams, a6 as DecodedStream, $ as ICreateSolanaExt, a3 as ICreateStreamInstructions, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, a1 as IPrepareCreateStreamSolanaExt, a2 as IPrepareStreamSolanaExt, Y as ISearchStreams, b as ITopUpStreamSolanaExt, a0 as ITransactionSolanaExtWithInstructions, ac as InstructionGenerator, a7 as MetadataRecipientHashMap, N as OracleType, S as SolanaStreamClient, Q as TestOracle, X as UpdateTestOracleParams, ah as cancelStreamInstruction, x as constants, ad as createStreamInstruction, ae 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, aj as topupStreamInstruction, ai as transferStreamInstruction, ag as updateStreamInstruction, af as withdrawStreamInstruction } from '../index-CPUhIwK2.cjs';
2
2
  export { ContractError, IChain, ICluster } from '@streamflow/common';
3
3
  import 'p-queue';
4
4
  import '@solana/web3.js';
@@ -463,6 +463,10 @@ declare class SolanaStreamClient extends BaseStreamClient {
463
463
  * @returns Record of stream data
464
464
  */
465
465
  searchStreams(data: ISearchStreams): Promise<IProgramAccount<Stream>[]>;
466
+ private decodeStreamsFromAccounts;
467
+ private collectAlignedEntries;
468
+ private fetchAlignedProxiesByEntries;
469
+ private mapDecodedToProgramAccounts;
466
470
  /**
467
471
  * Attempts updating the stream auto withdrawal params and amount per period
468
472
  * @param {IUpdateData} data - Update parameters including stream ID and new settings
@@ -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-DsFyl13W.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-DsFyl13W.js';
5
+ import { S as SolanaStreamClient, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, b as ITopUpStreamSolanaExt } from './index-DLVKn7Ae.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-DLVKn7Ae.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
@@ -5566,6 +5566,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
5566
5566
  const metadatas = [];
5567
5567
  const metadataToRecipient = {};
5568
5568
  const instructionsBatch = [];
5569
+ const metadataPubKeys = metadataPubKeysExt || [];
5569
5570
  const partnerPublicKey = data.partner ? new PublicKey(data.partner) : WITHDRAWOR_PUBLIC_KEY;
5570
5571
  const mintPublicKey = new PublicKey(data.tokenId);
5571
5572
  if (recipients.length === 0) {
@@ -5575,8 +5576,8 @@ var SolanaStreamClient = class extends BaseStreamClient {
5575
5576
  const recipientData = recipients[i];
5576
5577
  const createStreamData = { ...streamParams, ...recipientData };
5577
5578
  const createStreamExtParams = {
5578
- ...extParams,
5579
- metadataPubKeys: metadataPubKeysExt?.[i] ? [metadataPubKeysExt[i]] : void 0
5579
+ metadataPubKeys: metadataPubKeys[i] ? [metadataPubKeys[i]] : void 0,
5580
+ ...extParams
5580
5581
  };
5581
5582
  const { ixs, metadata, metadataPubKey } = await this.prepareCreateInstructions(
5582
5583
  createStreamData,
@@ -6242,20 +6243,41 @@ var SolanaStreamClient = class extends BaseStreamClient {
6242
6243
  const accounts = await this.connection.getProgramAccounts(this.programId, {
6243
6244
  filters
6244
6245
  });
6245
- const mapped = await Promise.all(
6246
- accounts.map(async ({ pubkey, account }) => {
6247
- const stream = decodeStream(account.data);
6248
- if (this.isAlignedUnlock(pubkey, stream.sender)) {
6249
- const alignedProxy = await this.alignedProxyProgram.account.contract.fetch(
6250
- deriveContractPDA(this.alignedProxyProgram.programId, pubkey)
6251
- );
6252
- invariant(alignedProxy, "Couldn't get aligned proxy account info");
6253
- return { publicKey: pubkey, account: new AlignedContract(stream, alignedProxy) };
6254
- }
6255
- return { publicKey: pubkey, account: new Contract2(stream) };
6256
- })
6257
- );
6258
- return mapped;
6246
+ const decoded = this.decodeStreamsFromAccounts(accounts);
6247
+ const alignedEntries = this.collectAlignedEntries(decoded);
6248
+ const alignedProxies = await this.fetchAlignedProxiesByEntries(alignedEntries);
6249
+ return this.mapDecodedToProgramAccounts(decoded, alignedEntries, alignedProxies);
6250
+ }
6251
+ decodeStreamsFromAccounts(accounts) {
6252
+ return accounts.map(({ pubkey, account }) => ({
6253
+ pubkey,
6254
+ stream: decodeStream(account.data)
6255
+ }));
6256
+ }
6257
+ collectAlignedEntries(decoded) {
6258
+ const entries = [];
6259
+ decoded.forEach(({ pubkey, stream }, index) => {
6260
+ if (this.isAlignedUnlock(pubkey, stream.sender)) {
6261
+ entries.push({ index, pda: deriveContractPDA(this.alignedProxyProgram.programId, pubkey) });
6262
+ }
6263
+ });
6264
+ return entries;
6265
+ }
6266
+ async fetchAlignedProxiesByEntries(aligned) {
6267
+ if (aligned.length === 0) return [];
6268
+ const res = await this.alignedProxyProgram.account.contract.fetchMultiple(aligned.map((a) => a.pda));
6269
+ return res;
6270
+ }
6271
+ mapDecodedToProgramAccounts(decoded, alignedEntries, alignedProxies) {
6272
+ return decoded.map(({ pubkey, stream }, idx) => {
6273
+ const alignedIdx = alignedEntries.findIndex((a) => a.index === idx);
6274
+ if (alignedIdx !== -1) {
6275
+ const alignedProxy = alignedProxies[alignedIdx];
6276
+ invariant(alignedProxy, "Couldn't get aligned proxy account info");
6277
+ return { publicKey: pubkey, account: new AlignedContract(stream, alignedProxy) };
6278
+ }
6279
+ return { publicKey: pubkey, account: new Contract2(stream) };
6280
+ });
6259
6281
  }
6260
6282
  /**
6261
6283
  * Attempts updating the stream auto withdrawal params and amount per period