@streamflow/stream 11.0.1 → 11.0.2

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.
@@ -167,6 +167,7 @@ interface LinearStream {
167
167
  lastRateChangeTime: number;
168
168
  fundsUnlockedAtLastRateChange: BN;
169
169
  oldMetadata: PublicKey;
170
+ metadata: PublicKey;
170
171
  type: StreamType;
171
172
  unlocked(currentTimestamp: number): BN;
172
173
  remaining(decimals: number): number;
@@ -397,9 +398,10 @@ declare class Contract implements LinearStream {
397
398
  lastRateChangeTime: number;
398
399
  fundsUnlockedAtLastRateChange: BN;
399
400
  oldMetadata: PublicKey;
401
+ metadata: PublicKey;
400
402
  type: StreamType;
401
403
  isAligned: boolean;
402
- constructor(stream: DecodedStream);
404
+ constructor(stream: DecodedStream, metadata: PublicKey);
403
405
  unlocked(currentTimestamp: number): BN;
404
406
  remaining(decimals: number): number;
405
407
  }
@@ -420,7 +422,7 @@ declare class AlignedContract extends Contract implements AlignedStream {
420
422
  expiryTime: number;
421
423
  expiryPercentage: number;
422
424
  floorPrice: number;
423
- constructor(stream: DecodedStream, alignedProxy: AlignedUnlocksContract);
425
+ constructor(stream: DecodedStream, metadata: PublicKey, alignedProxy: AlignedUnlocksContract);
424
426
  }
425
427
  interface DecodedStream {
426
428
  magic: BN;
@@ -826,7 +828,7 @@ declare class SolanaStreamClient {
826
828
  * For migrated streams, the aligned proxy PDA was derived from the original (old) metadata key,
827
829
  * so we need to use that instead of the current stream pubkey.
828
830
  */
829
- declare const getMetadataKey: (streamPubkey: PublicKey, oldMetadata: PublicKey) => PublicKey;
831
+ declare const getOriginalMetadataKey: (streamPubkey: PublicKey, oldMetadata: PublicKey) => PublicKey;
830
832
  /**
831
833
  * Calculate total amount of a Contract including all fees.
832
834
  * - first we convert fee floating to a BN with up to 4 decimals precision
@@ -1183,4 +1185,4 @@ declare const _default: {
1183
1185
  }[];
1184
1186
  };
1185
1187
 
1186
- export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, type Account, AlignedContract, AlignedProxyErrorCode, type AlignedStream, type AlignedStreamData, type AlignedUnlocksContract, type BatchItem, type BatchItemError, type BatchItemResult, type BatchItemSuccess, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, type ChangeOracleParams, type ClientCreationOptions, Contract, ContractErrorCode, type CreateParams, type CreateTestOracleParams, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, type DecodedStream, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, type IAlignedStreamConfig, type IBaseStreamConfig, type ICancelData, type ICreateAlignedStreamData, type ICreateExt, type ICreateLinearStreamData, type ICreateMultiError, type ICreateMultipleAlignedStreamData, type ICreateMultipleLinearStreamData, type ICreateMultipleStreamData, type ICreateResult, type ICreateStreamData, type ICreateStreamExt, type ICreateStreamInstructions, type IFees, type IGetAllData, type IGetFeesData, type IGetOneData, type IInteractData, type IInteractStreamExt, type IMultiTransactionResult, type IPrepareCreateStreamExt, type IPrepareStreamExt, type IRecipient, type ISearchStreams, type ITopUpData, type ITopUpStreamExt, type ITransactionExtWithInstructions, type ITransactionResult, type ITransferData, type IUpdateData, type IWithdrawData, type InstructionGenerator, type LinearStream, MAX_SAFE_UNIX_TIME_VALUE, type MetadataRecipientHashMap, ORIGINAL_CONTRACT_SENDER_OFFSET, type OracleType, type OracleTypeName, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_OLD_METADATA_KEY, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, type Stream, type StreamClientOptions, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, type TestOracle, type TransactionSchedulingOptions, type UpdateTestOracleParams, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, _default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
1188
+ export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, type Account, AlignedContract, AlignedProxyErrorCode, type AlignedStream, type AlignedStreamData, type AlignedUnlocksContract, type BatchItem, type BatchItemError, type BatchItemResult, type BatchItemSuccess, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, type ChangeOracleParams, type ClientCreationOptions, Contract, ContractErrorCode, type CreateParams, type CreateTestOracleParams, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, type DecodedStream, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, type IAlignedStreamConfig, type IBaseStreamConfig, type ICancelData, type ICreateAlignedStreamData, type ICreateExt, type ICreateLinearStreamData, type ICreateMultiError, type ICreateMultipleAlignedStreamData, type ICreateMultipleLinearStreamData, type ICreateMultipleStreamData, type ICreateResult, type ICreateStreamData, type ICreateStreamExt, type ICreateStreamInstructions, type IFees, type IGetAllData, type IGetFeesData, type IGetOneData, type IInteractData, type IInteractStreamExt, type IMultiTransactionResult, type IPrepareCreateStreamExt, type IPrepareStreamExt, type IRecipient, type ISearchStreams, type ITopUpData, type ITopUpStreamExt, type ITransactionExtWithInstructions, type ITransactionResult, type ITransferData, type IUpdateData, type IWithdrawData, type InstructionGenerator, type LinearStream, MAX_SAFE_UNIX_TIME_VALUE, type MetadataRecipientHashMap, ORIGINAL_CONTRACT_SENDER_OFFSET, type OracleType, type OracleTypeName, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_OLD_METADATA_KEY, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, type Stream, type StreamClientOptions, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, type TestOracle, type TransactionSchedulingOptions, type UpdateTestOracleParams, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, getOriginalMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, _default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
@@ -1,4 +1,4 @@
1
- export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, Account, AlignedContract, AlignedProxyErrorCode, AlignedStream, AlignedStreamData, AlignedUnlocksContract, BatchItem, BatchItemError, BatchItemResult, BatchItemSuccess, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, ChangeOracleParams, ClientCreationOptions, Contract, ContractErrorCode, CreateParams, CreateTestOracleParams, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, DecodedStream, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, IAlignedStreamConfig, IBaseStreamConfig, ICancelData, ICreateAlignedStreamData, ICreateExt, ICreateLinearStreamData, ICreateMultiError, ICreateMultipleAlignedStreamData, ICreateMultipleLinearStreamData, ICreateMultipleStreamData, ICreateResult, ICreateStreamData, ICreateStreamExt, ICreateStreamInstructions, IFees, IGetAllData, IGetFeesData, IGetOneData, IInteractData, IInteractStreamExt, IMultiTransactionResult, IPrepareCreateStreamExt, IPrepareStreamExt, IRecipient, ISearchStreams, ITopUpData, ITopUpStreamExt, ITransactionExtWithInstructions, ITransactionResult, ITransferData, IUpdateData, IWithdrawData, InstructionGenerator, LinearStream, MAX_SAFE_UNIX_TIME_VALUE, MetadataRecipientHashMap, ORIGINAL_CONTRACT_SENDER_OFFSET, OracleType, OracleTypeName, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_OLD_METADATA_KEY, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, Stream, StreamClientOptions, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, TestOracle, TransactionSchedulingOptions, UpdateTestOracleParams, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction } from './solana/index.js';
1
+ export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, Account, AlignedContract, AlignedProxyErrorCode, AlignedStream, AlignedStreamData, AlignedUnlocksContract, BatchItem, BatchItemError, BatchItemResult, BatchItemSuccess, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, ChangeOracleParams, ClientCreationOptions, Contract, ContractErrorCode, CreateParams, CreateTestOracleParams, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, DecodedStream, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, IAlignedStreamConfig, IBaseStreamConfig, ICancelData, ICreateAlignedStreamData, ICreateExt, ICreateLinearStreamData, ICreateMultiError, ICreateMultipleAlignedStreamData, ICreateMultipleLinearStreamData, ICreateMultipleStreamData, ICreateResult, ICreateStreamData, ICreateStreamExt, ICreateStreamInstructions, IFees, IGetAllData, IGetFeesData, IGetOneData, IInteractData, IInteractStreamExt, IMultiTransactionResult, IPrepareCreateStreamExt, IPrepareStreamExt, IRecipient, ISearchStreams, ITopUpData, ITopUpStreamExt, ITransactionExtWithInstructions, ITransactionResult, ITransferData, IUpdateData, IWithdrawData, InstructionGenerator, LinearStream, MAX_SAFE_UNIX_TIME_VALUE, MetadataRecipientHashMap, ORIGINAL_CONTRACT_SENDER_OFFSET, OracleType, OracleTypeName, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_OLD_METADATA_KEY, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, Stream, StreamClientOptions, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, TestOracle, TransactionSchedulingOptions, UpdateTestOracleParams, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, getOriginalMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction } from './solana/index.js';
2
2
  export { ContractError, ICluster, getBN, getNumberFromBN } from '@streamflow/common';
3
3
  import 'p-queue';
4
4
  import '@solana/web3.js';
package/dist/esm/index.js CHANGED
@@ -3,7 +3,7 @@ import bs58 from 'bs58';
3
3
  import { Buffer } from 'buffer';
4
4
  import { NATIVE_MINT, ASSOCIATED_TOKEN_PROGRAM_ID } from '@solana/spl-token';
5
5
  import { PublicKey, TransactionInstruction, Connection, Keypair, SYSVAR_RENT_PUBKEY, SystemProgram, TransactionMessage, VersionedTransaction } from '@solana/web3.js';
6
- import { ICluster, getNumberFromBN, isSignerKeypair, isSignerWallet, executeTransaction, ContractError, buildSendThrottler, assertHasPublicKey, prepareWrappedAccount, prepareTransaction, signAndExecuteTransaction, invariant, getMintAndProgram, prepareBaseInstructions, getBN, ata, createVersionedTransaction, executeMultipleTransactions, getMultipleAccountsInfoBatched, getProgramAccounts, checkOrCreateAtaBatch } from '@streamflow/common';
6
+ import { ICluster, getNumberFromBN, isSignerKeypair, isSignerWallet, executeTransaction, ContractError, buildSendThrottler, assertHasPublicKey, prepareWrappedAccount, prepareTransaction, signAndExecuteTransaction, invariant, getMintAndProgram, prepareBaseInstructions, getBN, ata, createVersionedTransaction, executeMultipleTransactions, pk, getMultipleAccountsInfoBatched, getProgramAccounts, checkOrCreateAtaBatch } from '@streamflow/common';
7
7
  export { ContractError, ICluster, getBN, getNumberFromBN } from '@streamflow/common';
8
8
  import * as borsh from 'borsh';
9
9
  import { Program } from '@coral-xyz/anchor';
@@ -116,7 +116,7 @@ var AlignedProxyErrorCode = /* @__PURE__ */ ((AlignedProxyErrorCode2) => {
116
116
  return AlignedProxyErrorCode2;
117
117
  })(AlignedProxyErrorCode || {});
118
118
  var Contract = class {
119
- constructor(stream) {
119
+ constructor(stream, metadata) {
120
120
  this.magic = stream.magic.toNumber();
121
121
  this.version = stream.version.toNumber();
122
122
  this.createdAt = stream.createdAt.toNumber();
@@ -160,6 +160,7 @@ var Contract = class {
160
160
  this.lastRateChangeTime = stream.lastRateChangeTime.toNumber();
161
161
  this.fundsUnlockedAtLastRateChange = stream.fundsUnlockedAtLastRateChange;
162
162
  this.oldMetadata = stream.oldMetadata;
163
+ this.metadata = metadata;
163
164
  this.type = buildStreamType(this);
164
165
  this.isAligned = false;
165
166
  }
@@ -174,8 +175,8 @@ var Contract = class {
174
175
  }
175
176
  };
176
177
  var AlignedContract = class extends Contract {
177
- constructor(stream, alignedProxy) {
178
- super(stream);
178
+ constructor(stream, metadata, alignedProxy) {
179
+ super(stream, metadata);
179
180
  this.minPrice = getNumberFromBN(alignedProxy.minPrice, ALIGNED_PRECISION_FACTOR_POW);
180
181
  this.maxPrice = getNumberFromBN(alignedProxy.maxPrice, ALIGNED_PRECISION_FACTOR_POW);
181
182
  this.minPercentage = getNumberFromBN(alignedProxy.minPercentage, ALIGNED_PRECISION_FACTOR_POW);
@@ -469,7 +470,7 @@ var encodeUpdateStream = (values, data) => {
469
470
  var topupStreamLayout = BufferLayout.struct([
470
471
  BufferLayout.blob(8, "amount")
471
472
  ]);
472
- var getMetadataKey = (streamPubkey, oldMetadata) => {
473
+ var getOriginalMetadataKey = (streamPubkey, oldMetadata) => {
473
474
  if (PublicKey.default.equals(oldMetadata)) {
474
475
  return streamPubkey;
475
476
  }
@@ -3577,7 +3578,7 @@ var SolanaStreamClient = class {
3577
3578
  }
3578
3579
  async decodeStreamAccount(pubkey, data) {
3579
3580
  const stream = decodeStream(data);
3580
- const metadataKey = getMetadataKey(pubkey, stream.oldMetadata);
3581
+ const metadataKey = getOriginalMetadataKey(pubkey, stream.oldMetadata);
3581
3582
  if (this.isAlignedUnlock(pubkey, stream.sender, stream.oldMetadata)) {
3582
3583
  const alignedProxy = await this.alignedProxyProgram.account.contract.fetch(
3583
3584
  deriveContractPDA(this.alignedProxyProgram.programId, metadataKey)
@@ -3585,9 +3586,9 @@ var SolanaStreamClient = class {
3585
3586
  if (!alignedProxy) {
3586
3587
  throw new Error("Couldn't get proxy account info.");
3587
3588
  }
3588
- return new AlignedContract(stream, alignedProxy);
3589
+ return new AlignedContract(stream, pk(pubkey), alignedProxy);
3589
3590
  }
3590
- return new Contract(stream);
3591
+ return new Contract(stream, pk(pubkey));
3591
3592
  }
3592
3593
  /**
3593
3594
  * Fetch all aligned outgoing streams/contracts by the provided public key.
@@ -3612,7 +3613,7 @@ var SolanaStreamClient = class {
3612
3613
  streamAccounts.forEach((account, index) => {
3613
3614
  if (account) {
3614
3615
  const alignedData = alignedOutgoingProgramAccounts[index].account;
3615
- streams[streamPubKeys[index].toBase58()] = new AlignedContract(decodeStream(account.data), alignedData);
3616
+ streams[streamPubKeys[index].toBase58()] = new AlignedContract(decodeStream(account.data), pk(streamPubKeys[index]), alignedData);
3616
3617
  }
3617
3618
  });
3618
3619
  return streams;
@@ -3622,7 +3623,7 @@ var SolanaStreamClient = class {
3622
3623
  const alignedStreamsPubKeys = Object.keys(streamRecord);
3623
3624
  const alignedProxyPDAs = alignedStreamsPubKeys.map((streamPubKey) => {
3624
3625
  const pubkey = new PublicKey(streamPubKey);
3625
- const metadataKey = getMetadataKey(pubkey, streamRecord[streamPubKey].oldMetadata);
3626
+ const metadataKey = getOriginalMetadataKey(pubkey, streamRecord[streamPubKey].oldMetadata);
3626
3627
  return deriveContractPDA(this.alignedProxyProgram.programId, metadataKey);
3627
3628
  });
3628
3629
  const alignedProxyAccounts = await getMultipleAccountsInfoBatched(this.connection, alignedProxyPDAs);
@@ -3631,6 +3632,7 @@ var SolanaStreamClient = class {
3631
3632
  const alignedData = streamRecord[alignedStreamsPubKeys[index]];
3632
3633
  streams[alignedStreamsPubKeys[index]] = new AlignedContract(
3633
3634
  alignedData,
3635
+ pk(alignedStreamsPubKeys[index]),
3634
3636
  this.alignedProxyProgram.account.contract.coder.accounts.decode("contract", account.data)
3635
3637
  );
3636
3638
  }
@@ -3659,7 +3661,7 @@ var SolanaStreamClient = class {
3659
3661
  this.programId
3660
3662
  );
3661
3663
  outgoingStreamAccounts.forEach((account) => {
3662
- streams[account.pubkey.toBase58()] = new Contract(decodeStream(account.account.data));
3664
+ streams[account.pubkey.toBase58()] = new Contract(decodeStream(account.account.data), pk(account.pubkey));
3663
3665
  });
3664
3666
  if (shouldFetchAligned) {
3665
3667
  const alignedStreams = await this.getOutgoingAlignedStreams(address);
@@ -3679,7 +3681,7 @@ var SolanaStreamClient = class {
3679
3681
  if (this.isAlignedUnlock(account.pubkey, allIncomingStreams[index].sender, allIncomingStreams[index].oldMetadata)) {
3680
3682
  alignedDecoded[account.pubkey.toBase58()] = allIncomingStreams[index];
3681
3683
  } else {
3682
- streams[account.pubkey.toBase58()] = new Contract(allIncomingStreams[index]);
3684
+ streams[account.pubkey.toBase58()] = new Contract(allIncomingStreams[index], pk(account.pubkey));
3683
3685
  }
3684
3686
  });
3685
3687
  if (shouldFetchAligned) {
@@ -3722,7 +3724,7 @@ var SolanaStreamClient = class {
3722
3724
  const entries = [];
3723
3725
  decoded.forEach(({ pubkey, stream }, index) => {
3724
3726
  if (this.isAlignedUnlock(pubkey, stream.sender, stream.oldMetadata)) {
3725
- const metadataKey = getMetadataKey(pubkey, stream.oldMetadata);
3727
+ const metadataKey = getOriginalMetadataKey(pubkey, stream.oldMetadata);
3726
3728
  entries.push({ index, pda: deriveContractPDA(this.alignedProxyProgram.programId, metadataKey) });
3727
3729
  }
3728
3730
  });
@@ -3739,9 +3741,9 @@ var SolanaStreamClient = class {
3739
3741
  if (alignedIdx !== -1) {
3740
3742
  const alignedProxy = alignedProxies[alignedIdx];
3741
3743
  invariant(alignedProxy, "Couldn't get aligned proxy account info");
3742
- return { publicKey: pubkey, account: new AlignedContract(stream, alignedProxy) };
3744
+ return { publicKey: pubkey, account: new AlignedContract(stream, pk(pubkey), alignedProxy) };
3743
3745
  }
3744
- return { publicKey: pubkey, account: new Contract(stream) };
3746
+ return { publicKey: pubkey, account: new Contract(stream, pk(pubkey)) };
3745
3747
  });
3746
3748
  }
3747
3749
  /**
@@ -3879,7 +3881,7 @@ var SolanaStreamClient = class {
3879
3881
  * For migrated streams, the PDA was derived from the old metadata key.
3880
3882
  */
3881
3883
  isAlignedUnlock(streamPublicKey, senderPublicKey, oldMetadata) {
3882
- const metadataKey = oldMetadata ? getMetadataKey(streamPublicKey, oldMetadata) : streamPublicKey;
3884
+ const metadataKey = oldMetadata ? getOriginalMetadataKey(streamPublicKey, oldMetadata) : streamPublicKey;
3883
3885
  const pda = deriveContractPDA(this.alignedProxyProgram.programId, metadataKey);
3884
3886
  return senderPublicKey.equals(pda);
3885
3887
  }
@@ -4357,6 +4359,6 @@ var timelockIDL_default = {
4357
4359
  ]
4358
4360
  };
4359
4361
 
4360
- export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW2 as ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, AlignedContract, AlignedProxyErrorCode, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, Contract, ContractErrorCode, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, MAX_SAFE_UNIX_TIME_VALUE2 as MAX_SAFE_UNIX_TIME_VALUE, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_OLD_METADATA_KEY, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, timelockIDL_default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
4362
+ export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW2 as ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, AlignedContract, AlignedProxyErrorCode, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, Contract, ContractErrorCode, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, MAX_SAFE_UNIX_TIME_VALUE2 as MAX_SAFE_UNIX_TIME_VALUE, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_OLD_METADATA_KEY, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, getOriginalMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, timelockIDL_default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
4361
4363
  //# sourceMappingURL=index.js.map
4362
4364
  //# sourceMappingURL=index.js.map