@streamflow/stream 10.0.0-alpha.p313.3ce4d29 → 10.0.0-alpha.p313.4470e29

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.
@@ -114,7 +114,6 @@ declare enum StreamDirection {
114
114
  }
115
115
  declare enum StreamType {
116
116
  All = "all",
117
- Payment = "payment",
118
117
  Vesting = "vesting",
119
118
  Lock = "lock"
120
119
  }
@@ -994,11 +993,7 @@ declare const isCliffCloseToDepositedAmount: (streamData: {
994
993
  depositedAmount: BN;
995
994
  cliffAmount: BN;
996
995
  }) => boolean;
997
- declare const isPayment: (streamData: {
998
- canTopup: boolean;
999
- }) => boolean;
1000
996
  declare const isVesting: (streamData: {
1001
- canTopup: boolean;
1002
997
  depositedAmount: BN;
1003
998
  cliffAmount: BN;
1004
999
  minPrice?: number;
@@ -1131,4 +1126,4 @@ declare const _default: {
1131
1126
  }[];
1132
1127
  };
1133
1128
 
1134
- 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_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_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_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isPayment, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, _default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
1129
+ 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_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_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_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, _default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
@@ -33,11 +33,8 @@ var calculateUnlockedAmount = ({
33
33
  var isCliffCloseToDepositedAmount = (streamData) => {
34
34
  return streamData.cliffAmount.gte(streamData.depositedAmount.sub(new BN3(1)));
35
35
  };
36
- var isPayment = (streamData) => {
37
- return streamData.canTopup;
38
- };
39
36
  var isVesting = (streamData) => {
40
- return !streamData.canTopup && !isCliffCloseToDepositedAmount(streamData) && !isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage);
37
+ return !isCliffCloseToDepositedAmount(streamData) && !isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage);
41
38
  };
42
39
  var isAligned = (stream) => {
43
40
  return "minPrice" in stream && "maxPrice" in stream && "minPercentage" in stream && "maxPercentage" in stream;
@@ -52,13 +49,10 @@ var isTokenLock = (streamData) => {
52
49
  return !streamData.canTopup && !streamData.automaticWithdrawal && !streamData.cancelableBySender && !streamData.cancelableByRecipient && !streamData.transferableBySender && (isCliffCloseToDepositedAmount(streamData) || isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage));
53
50
  };
54
51
  var buildStreamType = (streamData) => {
55
- if (isVesting(streamData)) {
56
- return "vesting" /* Vesting */;
57
- }
58
52
  if (isTokenLock(streamData)) {
59
53
  return "lock" /* Lock */;
60
54
  }
61
- return "payment" /* Payment */;
55
+ return "vesting" /* Vesting */;
62
56
  };
63
57
  var decodeEndTime = (endTime) => {
64
58
  if (endTime.gt(new BN3(MAX_SAFE_UNIX_TIME_VALUE))) {
@@ -75,7 +69,6 @@ var StreamDirection = /* @__PURE__ */ ((StreamDirection2) => {
75
69
  })(StreamDirection || {});
76
70
  var StreamType = /* @__PURE__ */ ((StreamType2) => {
77
71
  StreamType2["All"] = "all";
78
- StreamType2["Payment"] = "payment";
79
72
  StreamType2["Vesting"] = "vesting";
80
73
  StreamType2["Lock"] = "lock";
81
74
  return StreamType2;
@@ -3572,10 +3565,20 @@ var SolanaStreamClient = class {
3572
3565
  const accounts = await this.connection.getProgramAccounts(this.programId, {
3573
3566
  filters
3574
3567
  });
3575
- return accounts.map(({ pubkey, account }) => ({
3576
- publicKey: pubkey,
3577
- account: new Contract(decodeStream(account.data))
3578
- }));
3568
+ const mapped = await Promise.all(
3569
+ accounts.map(async ({ pubkey, account }) => {
3570
+ const stream = decodeStream(account.data);
3571
+ if (this.isAlignedUnlock(pubkey, stream.sender)) {
3572
+ const alignedProxy = await this.alignedProxyProgram.account.contract.fetch(
3573
+ deriveContractPDA(this.alignedProxyProgram.programId, pubkey)
3574
+ );
3575
+ invariant(alignedProxy, "Couldn't get aligned proxy account info");
3576
+ return { publicKey: pubkey, account: new AlignedContract(stream, alignedProxy) };
3577
+ }
3578
+ return { publicKey: pubkey, account: new Contract(stream) };
3579
+ })
3580
+ );
3581
+ return mapped;
3579
3582
  }
3580
3583
  /**
3581
3584
  * Attempts updating the stream auto withdrawal params and amount per period
@@ -4150,6 +4153,6 @@ var timelockIDL_default = {
4150
4153
  ]
4151
4154
  };
4152
4155
 
4153
- 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_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_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isPayment, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, timelockIDL_default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
4156
+ 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_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_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, timelockIDL_default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
4154
4157
  //# sourceMappingURL=index.js.map
4155
4158
  //# sourceMappingURL=index.js.map