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

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
  }
@@ -785,8 +784,8 @@ declare class SolanaStreamClient {
785
784
  */
786
785
  extractErrorCode(err: Error): string | null;
787
786
  /**
788
- * Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
789
- */
787
+ * Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
788
+ */
790
789
  isAlignedUnlock(streamPublicKey: PublicKey, senderPublicKey: PublicKey): boolean;
791
790
  /**
792
791
  * Utility function to generate metadata for a Contract or return existing Pubkey
@@ -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 };
@@ -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_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_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, Stream, StreamClientOptions, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, TestOracle, TransactionSchedulingOptions, 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, 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_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_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, Stream, StreamClientOptions, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, TestOracle, TransactionSchedulingOptions, 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, 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
@@ -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;
@@ -886,7 +879,7 @@ var streamflow_aligned_unlocks_default = {
886
879
  address: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
887
880
  metadata: {
888
881
  name: "streamflow_aligned_unlocks",
889
- version: "1.3.0",
882
+ version: "1.4.0",
890
883
  spec: "0.1.0",
891
884
  description: "Proxy to update unlock amount within Streamflow vesting protocol according to Token performance and other metrics"
892
885
  },
@@ -1760,6 +1753,80 @@ var streamflow_aligned_unlocks_default = {
1760
1753
  ],
1761
1754
  args: []
1762
1755
  },
1756
+ {
1757
+ name: "update_contract",
1758
+ discriminator: [
1759
+ 78,
1760
+ 184,
1761
+ 162,
1762
+ 174,
1763
+ 233,
1764
+ 5,
1765
+ 40,
1766
+ 82
1767
+ ],
1768
+ accounts: [
1769
+ {
1770
+ name: "sender",
1771
+ writable: true,
1772
+ signer: true
1773
+ },
1774
+ {
1775
+ name: "proxy_metadata",
1776
+ docs: [
1777
+ "Proxy Contract"
1778
+ ],
1779
+ writable: true,
1780
+ pda: {
1781
+ seeds: [
1782
+ {
1783
+ kind: "const",
1784
+ value: [
1785
+ 99,
1786
+ 111,
1787
+ 110,
1788
+ 116,
1789
+ 114,
1790
+ 97,
1791
+ 99,
1792
+ 116
1793
+ ]
1794
+ },
1795
+ {
1796
+ kind: "account",
1797
+ path: "stream_metadata"
1798
+ }
1799
+ ]
1800
+ }
1801
+ },
1802
+ {
1803
+ name: "stream_metadata",
1804
+ writable: true
1805
+ },
1806
+ {
1807
+ name: "withdrawor",
1808
+ writable: true
1809
+ },
1810
+ {
1811
+ name: "streamflow_program",
1812
+ address: "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m"
1813
+ },
1814
+ {
1815
+ name: "system_program",
1816
+ address: "11111111111111111111111111111111"
1817
+ }
1818
+ ],
1819
+ args: [
1820
+ {
1821
+ name: "params",
1822
+ type: {
1823
+ defined: {
1824
+ name: "UpdateContractParams"
1825
+ }
1826
+ }
1827
+ }
1828
+ ]
1829
+ },
1763
1830
  {
1764
1831
  name: "update_test_oracle",
1765
1832
  discriminator: [
@@ -2355,6 +2422,32 @@ var streamflow_aligned_unlocks_default = {
2355
2422
  ]
2356
2423
  }
2357
2424
  },
2425
+ {
2426
+ name: "UpdateContractParams",
2427
+ type: {
2428
+ kind: "struct",
2429
+ fields: [
2430
+ {
2431
+ name: "transferable_by_sender",
2432
+ type: {
2433
+ option: "bool"
2434
+ }
2435
+ },
2436
+ {
2437
+ name: "transferable_by_recipient",
2438
+ type: {
2439
+ option: "bool"
2440
+ }
2441
+ },
2442
+ {
2443
+ name: "cancelable_by_sender",
2444
+ type: {
2445
+ option: "bool"
2446
+ }
2447
+ }
2448
+ ]
2449
+ }
2450
+ },
2358
2451
  {
2359
2452
  name: "UpdateTestOracleParams",
2360
2453
  type: {
@@ -2579,7 +2672,10 @@ var SolanaStreamClient = class {
2579
2672
  floorPrice
2580
2673
  } = streamParams;
2581
2674
  const { isNative, sender, computeLimit, computePrice, metadataPubKeys } = extParams;
2582
- invariant(priceOracle || !oracleType || oracleType === "none", "Price oracle is required for the specified oracle type");
2675
+ invariant(
2676
+ priceOracle || !oracleType || oracleType === "none",
2677
+ "Price oracle is required for the specified oracle type"
2678
+ );
2583
2679
  assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
2584
2680
  const recipientPublicKey = new PublicKey(recipient);
2585
2681
  const mintPublicKey = isNative ? NATIVE_MINT : new PublicKey(mint);
@@ -2754,10 +2850,7 @@ var SolanaStreamClient = class {
2754
2850
  * @returns Create result
2755
2851
  */
2756
2852
  async createUnchecked(data, extParams) {
2757
- const { ixs, metadata, metadataPubKey } = await this.prepareCreateUncheckedInstructions(
2758
- data,
2759
- extParams
2760
- );
2853
+ const { ixs, metadata, metadataPubKey } = await this.prepareCreateUncheckedInstructions(data, extParams);
2761
2854
  const { tx, hash, context } = await prepareTransaction(
2762
2855
  this.connection,
2763
2856
  ixs,
@@ -2909,19 +3002,10 @@ var SolanaStreamClient = class {
2909
3002
  recipient: recipientData.recipient
2910
3003
  });
2911
3004
  }
2912
- const prepareInstructions = await this.getCreateATAInstructions(
2913
- [partnerPublicKey],
2914
- mintPublicKey,
2915
- sender,
2916
- true
2917
- );
3005
+ const prepareInstructions = await this.getCreateATAInstructions([partnerPublicKey], mintPublicKey, sender, true);
2918
3006
  if (isNative) {
2919
3007
  const totalDepositedAmount = recipients.reduce((acc, recipient) => recipient.amount.add(acc), new BN3(0));
2920
- const nativeInstructions = await prepareWrappedAccount(
2921
- this.connection,
2922
- sender.publicKey,
2923
- totalDepositedAmount
2924
- );
3008
+ const nativeInstructions = await prepareWrappedAccount(this.connection, sender.publicKey, totalDepositedAmount);
2925
3009
  prepareInstructions.push(...nativeInstructions);
2926
3010
  }
2927
3011
  return {
@@ -3119,10 +3203,7 @@ var SolanaStreamClient = class {
3119
3203
  async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, extParams) {
3120
3204
  const { invoker, customInstructions } = extParams;
3121
3205
  assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
3122
- const ixs = await this.prepareWithdrawInstructions(
3123
- { id, amount },
3124
- extParams
3125
- );
3206
+ const ixs = await this.prepareWithdrawInstructions({ id, amount }, extParams);
3126
3207
  const metadata = new PublicKey(id);
3127
3208
  await this.applyCustomAfterInstructions(ixs, customInstructions, metadata);
3128
3209
  const { tx, hash, context } = await prepareTransaction(this.connection, ixs, invoker.publicKey);
@@ -3572,10 +3653,20 @@ var SolanaStreamClient = class {
3572
3653
  const accounts = await this.connection.getProgramAccounts(this.programId, {
3573
3654
  filters
3574
3655
  });
3575
- return accounts.map(({ pubkey, account }) => ({
3576
- publicKey: pubkey,
3577
- account: new Contract(decodeStream(account.data))
3578
- }));
3656
+ const mapped = await Promise.all(
3657
+ accounts.map(async ({ pubkey, account }) => {
3658
+ const stream = decodeStream(account.data);
3659
+ if (this.isAlignedUnlock(pubkey, stream.sender)) {
3660
+ const alignedProxy = await this.alignedProxyProgram.account.contract.fetch(
3661
+ deriveContractPDA(this.alignedProxyProgram.programId, pubkey)
3662
+ );
3663
+ invariant(alignedProxy, "Couldn't get aligned proxy account info");
3664
+ return { publicKey: pubkey, account: new AlignedContract(stream, alignedProxy) };
3665
+ }
3666
+ return { publicKey: pubkey, account: new Contract(stream) };
3667
+ })
3668
+ );
3669
+ return mapped;
3579
3670
  }
3580
3671
  /**
3581
3672
  * Attempts updating the stream auto withdrawal params and amount per period
@@ -3616,17 +3707,26 @@ var SolanaStreamClient = class {
3616
3707
  const streamPublicKey = new PublicKey(data.id);
3617
3708
  const escrow = await this.connection.getAccountInfo(streamPublicKey);
3618
3709
  invariant(escrow, "Couldn't get account info");
3710
+ const { sender: senderPublicKey } = decodeStream(escrow.data);
3711
+ const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, senderPublicKey);
3712
+ if (isAlignedUnlock && (data.enableAutomaticWithdrawal !== void 0 || data.amountPerPeriod !== void 0)) {
3713
+ throw new Error("Automatic withdrawal and rate update are not possible in price-based vesting!");
3714
+ }
3619
3715
  const ixs = prepareBaseInstructions(this.connection, {
3620
3716
  computePrice,
3621
3717
  computeLimit
3622
3718
  });
3623
3719
  ixs.push(
3624
- await updateStreamInstruction(data, this.programId, {
3720
+ await (isAlignedUnlock ? this.alignedProxyProgram.methods.updateContract({
3721
+ transferableBySender: data.transferableBySender ?? null,
3722
+ transferableByRecipient: data.transferableByRecipient ?? null,
3723
+ cancelableBySender: data.cancelableBySender ?? null
3724
+ }).accounts({ sender: invoker.publicKey, streamMetadata: streamPublicKey, withdrawor: WITHDRAWOR_PUBLIC_KEY }).accountsPartial({ streamflowProgram: this.programId }).instruction() : updateStreamInstruction(data, this.programId, {
3625
3725
  authority: invoker.publicKey,
3626
3726
  metadata: streamPublicKey,
3627
3727
  withdrawor: WITHDRAWOR_PUBLIC_KEY,
3628
3728
  systemProgram: SystemProgram.programId
3629
- })
3729
+ }))
3630
3730
  );
3631
3731
  return ixs;
3632
3732
  }
@@ -3685,8 +3785,8 @@ var SolanaStreamClient = class {
3685
3785
  return extractSolanaErrorCode(err.toString() ?? "Unknown error!", logs);
3686
3786
  }
3687
3787
  /**
3688
- * Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
3689
- */
3788
+ * Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
3789
+ */
3690
3790
  isAlignedUnlock(streamPublicKey, senderPublicKey) {
3691
3791
  const pda = deriveContractPDA(this.alignedProxyProgram.programId, streamPublicKey);
3692
3792
  return senderPublicKey.equals(pda);
@@ -4150,6 +4250,6 @@ var timelockIDL_default = {
4150
4250
  ]
4151
4251
  };
4152
4252
 
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 };
4253
+ 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
4254
  //# sourceMappingURL=index.js.map
4155
4255
  //# sourceMappingURL=index.js.map