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

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,6 +114,7 @@ declare enum StreamDirection {
114
114
  }
115
115
  declare enum StreamType {
116
116
  All = "all",
117
+ Payment = "payment",
117
118
  Vesting = "vesting",
118
119
  Lock = "lock"
119
120
  }
@@ -784,8 +785,8 @@ declare class SolanaStreamClient {
784
785
  */
785
786
  extractErrorCode(err: Error): string | null;
786
787
  /**
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
- */
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
+ */
789
790
  isAlignedUnlock(streamPublicKey: PublicKey, senderPublicKey: PublicKey): boolean;
790
791
  /**
791
792
  * Utility function to generate metadata for a Contract or return existing Pubkey
@@ -993,7 +994,11 @@ declare const isCliffCloseToDepositedAmount: (streamData: {
993
994
  depositedAmount: BN;
994
995
  cliffAmount: BN;
995
996
  }) => boolean;
997
+ declare const isPayment: (streamData: {
998
+ canTopup: boolean;
999
+ }) => boolean;
996
1000
  declare const isVesting: (streamData: {
1001
+ canTopup: boolean;
997
1002
  depositedAmount: BN;
998
1003
  cliffAmount: BN;
999
1004
  minPrice?: number;
@@ -1126,4 +1131,4 @@ declare const _default: {
1126
1131
  }[];
1127
1132
  };
1128
1133
 
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 };
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 };
@@ -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, 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, isPayment, 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,8 +33,11 @@ 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
+ };
36
39
  var isVesting = (streamData) => {
37
- return !isCliffCloseToDepositedAmount(streamData) && !isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage);
40
+ return !streamData.canTopup && !isCliffCloseToDepositedAmount(streamData) && !isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage);
38
41
  };
39
42
  var isAligned = (stream) => {
40
43
  return "minPrice" in stream && "maxPrice" in stream && "minPercentage" in stream && "maxPercentage" in stream;
@@ -49,10 +52,13 @@ var isTokenLock = (streamData) => {
49
52
  return !streamData.canTopup && !streamData.automaticWithdrawal && !streamData.cancelableBySender && !streamData.cancelableByRecipient && !streamData.transferableBySender && (isCliffCloseToDepositedAmount(streamData) || isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage));
50
53
  };
51
54
  var buildStreamType = (streamData) => {
55
+ if (isVesting(streamData)) {
56
+ return "vesting" /* Vesting */;
57
+ }
52
58
  if (isTokenLock(streamData)) {
53
59
  return "lock" /* Lock */;
54
60
  }
55
- return "vesting" /* Vesting */;
61
+ return "payment" /* Payment */;
56
62
  };
57
63
  var decodeEndTime = (endTime) => {
58
64
  if (endTime.gt(new BN3(MAX_SAFE_UNIX_TIME_VALUE))) {
@@ -69,6 +75,7 @@ var StreamDirection = /* @__PURE__ */ ((StreamDirection2) => {
69
75
  })(StreamDirection || {});
70
76
  var StreamType = /* @__PURE__ */ ((StreamType2) => {
71
77
  StreamType2["All"] = "all";
78
+ StreamType2["Payment"] = "payment";
72
79
  StreamType2["Vesting"] = "vesting";
73
80
  StreamType2["Lock"] = "lock";
74
81
  return StreamType2;
@@ -879,7 +886,7 @@ var streamflow_aligned_unlocks_default = {
879
886
  address: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
880
887
  metadata: {
881
888
  name: "streamflow_aligned_unlocks",
882
- version: "1.3.0",
889
+ version: "1.4.0",
883
890
  spec: "0.1.0",
884
891
  description: "Proxy to update unlock amount within Streamflow vesting protocol according to Token performance and other metrics"
885
892
  },
@@ -1753,6 +1760,80 @@ var streamflow_aligned_unlocks_default = {
1753
1760
  ],
1754
1761
  args: []
1755
1762
  },
1763
+ {
1764
+ name: "update_contract",
1765
+ discriminator: [
1766
+ 78,
1767
+ 184,
1768
+ 162,
1769
+ 174,
1770
+ 233,
1771
+ 5,
1772
+ 40,
1773
+ 82
1774
+ ],
1775
+ accounts: [
1776
+ {
1777
+ name: "sender",
1778
+ writable: true,
1779
+ signer: true
1780
+ },
1781
+ {
1782
+ name: "proxy_metadata",
1783
+ docs: [
1784
+ "Proxy Contract"
1785
+ ],
1786
+ writable: true,
1787
+ pda: {
1788
+ seeds: [
1789
+ {
1790
+ kind: "const",
1791
+ value: [
1792
+ 99,
1793
+ 111,
1794
+ 110,
1795
+ 116,
1796
+ 114,
1797
+ 97,
1798
+ 99,
1799
+ 116
1800
+ ]
1801
+ },
1802
+ {
1803
+ kind: "account",
1804
+ path: "stream_metadata"
1805
+ }
1806
+ ]
1807
+ }
1808
+ },
1809
+ {
1810
+ name: "stream_metadata",
1811
+ writable: true
1812
+ },
1813
+ {
1814
+ name: "withdrawor",
1815
+ writable: true
1816
+ },
1817
+ {
1818
+ name: "streamflow_program",
1819
+ address: "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m"
1820
+ },
1821
+ {
1822
+ name: "system_program",
1823
+ address: "11111111111111111111111111111111"
1824
+ }
1825
+ ],
1826
+ args: [
1827
+ {
1828
+ name: "params",
1829
+ type: {
1830
+ defined: {
1831
+ name: "UpdateContractParams"
1832
+ }
1833
+ }
1834
+ }
1835
+ ]
1836
+ },
1756
1837
  {
1757
1838
  name: "update_test_oracle",
1758
1839
  discriminator: [
@@ -2348,6 +2429,32 @@ var streamflow_aligned_unlocks_default = {
2348
2429
  ]
2349
2430
  }
2350
2431
  },
2432
+ {
2433
+ name: "UpdateContractParams",
2434
+ type: {
2435
+ kind: "struct",
2436
+ fields: [
2437
+ {
2438
+ name: "transferable_by_sender",
2439
+ type: {
2440
+ option: "bool"
2441
+ }
2442
+ },
2443
+ {
2444
+ name: "transferable_by_recipient",
2445
+ type: {
2446
+ option: "bool"
2447
+ }
2448
+ },
2449
+ {
2450
+ name: "cancelable_by_sender",
2451
+ type: {
2452
+ option: "bool"
2453
+ }
2454
+ }
2455
+ ]
2456
+ }
2457
+ },
2351
2458
  {
2352
2459
  name: "UpdateTestOracleParams",
2353
2460
  type: {
@@ -2572,7 +2679,10 @@ var SolanaStreamClient = class {
2572
2679
  floorPrice
2573
2680
  } = streamParams;
2574
2681
  const { isNative, sender, computeLimit, computePrice, metadataPubKeys } = extParams;
2575
- invariant(priceOracle || !oracleType || oracleType === "none", "Price oracle is required for the specified oracle type");
2682
+ invariant(
2683
+ priceOracle || !oracleType || oracleType === "none",
2684
+ "Price oracle is required for the specified oracle type"
2685
+ );
2576
2686
  assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
2577
2687
  const recipientPublicKey = new PublicKey(recipient);
2578
2688
  const mintPublicKey = isNative ? NATIVE_MINT : new PublicKey(mint);
@@ -2747,10 +2857,7 @@ var SolanaStreamClient = class {
2747
2857
  * @returns Create result
2748
2858
  */
2749
2859
  async createUnchecked(data, extParams) {
2750
- const { ixs, metadata, metadataPubKey } = await this.prepareCreateUncheckedInstructions(
2751
- data,
2752
- extParams
2753
- );
2860
+ const { ixs, metadata, metadataPubKey } = await this.prepareCreateUncheckedInstructions(data, extParams);
2754
2861
  const { tx, hash, context } = await prepareTransaction(
2755
2862
  this.connection,
2756
2863
  ixs,
@@ -2902,19 +3009,10 @@ var SolanaStreamClient = class {
2902
3009
  recipient: recipientData.recipient
2903
3010
  });
2904
3011
  }
2905
- const prepareInstructions = await this.getCreateATAInstructions(
2906
- [partnerPublicKey],
2907
- mintPublicKey,
2908
- sender,
2909
- true
2910
- );
3012
+ const prepareInstructions = await this.getCreateATAInstructions([partnerPublicKey], mintPublicKey, sender, true);
2911
3013
  if (isNative) {
2912
3014
  const totalDepositedAmount = recipients.reduce((acc, recipient) => recipient.amount.add(acc), new BN3(0));
2913
- const nativeInstructions = await prepareWrappedAccount(
2914
- this.connection,
2915
- sender.publicKey,
2916
- totalDepositedAmount
2917
- );
3015
+ const nativeInstructions = await prepareWrappedAccount(this.connection, sender.publicKey, totalDepositedAmount);
2918
3016
  prepareInstructions.push(...nativeInstructions);
2919
3017
  }
2920
3018
  return {
@@ -3112,10 +3210,7 @@ var SolanaStreamClient = class {
3112
3210
  async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, extParams) {
3113
3211
  const { invoker, customInstructions } = extParams;
3114
3212
  assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
3115
- const ixs = await this.prepareWithdrawInstructions(
3116
- { id, amount },
3117
- extParams
3118
- );
3213
+ const ixs = await this.prepareWithdrawInstructions({ id, amount }, extParams);
3119
3214
  const metadata = new PublicKey(id);
3120
3215
  await this.applyCustomAfterInstructions(ixs, customInstructions, metadata);
3121
3216
  const { tx, hash, context } = await prepareTransaction(this.connection, ixs, invoker.publicKey);
@@ -3619,17 +3714,26 @@ var SolanaStreamClient = class {
3619
3714
  const streamPublicKey = new PublicKey(data.id);
3620
3715
  const escrow = await this.connection.getAccountInfo(streamPublicKey);
3621
3716
  invariant(escrow, "Couldn't get account info");
3717
+ const { sender: senderPublicKey } = decodeStream(escrow.data);
3718
+ const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, senderPublicKey);
3719
+ if (isAlignedUnlock && (data.enableAutomaticWithdrawal !== void 0 || data.amountPerPeriod !== void 0)) {
3720
+ throw new Error("Automatic withdrawal and rate update are not possible in price-based vesting!");
3721
+ }
3622
3722
  const ixs = prepareBaseInstructions(this.connection, {
3623
3723
  computePrice,
3624
3724
  computeLimit
3625
3725
  });
3626
3726
  ixs.push(
3627
- await updateStreamInstruction(data, this.programId, {
3727
+ await (isAlignedUnlock ? this.alignedProxyProgram.methods.updateContract({
3728
+ transferableBySender: data.transferableBySender ?? null,
3729
+ transferableByRecipient: data.transferableByRecipient ?? null,
3730
+ cancelableBySender: data.cancelableBySender ?? null
3731
+ }).accounts({ sender: invoker.publicKey, streamMetadata: streamPublicKey, withdrawor: WITHDRAWOR_PUBLIC_KEY }).accountsPartial({ streamflowProgram: this.programId }).instruction() : updateStreamInstruction(data, this.programId, {
3628
3732
  authority: invoker.publicKey,
3629
3733
  metadata: streamPublicKey,
3630
3734
  withdrawor: WITHDRAWOR_PUBLIC_KEY,
3631
3735
  systemProgram: SystemProgram.programId
3632
- })
3736
+ }))
3633
3737
  );
3634
3738
  return ixs;
3635
3739
  }
@@ -3688,8 +3792,8 @@ var SolanaStreamClient = class {
3688
3792
  return extractSolanaErrorCode(err.toString() ?? "Unknown error!", logs);
3689
3793
  }
3690
3794
  /**
3691
- * Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
3692
- */
3795
+ * Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
3796
+ */
3693
3797
  isAlignedUnlock(streamPublicKey, senderPublicKey) {
3694
3798
  const pda = deriveContractPDA(this.alignedProxyProgram.programId, streamPublicKey);
3695
3799
  return senderPublicKey.equals(pda);
@@ -4153,6 +4257,6 @@ var timelockIDL_default = {
4153
4257
  ]
4154
4258
  };
4155
4259
 
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 };
4260
+ 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 };
4157
4261
  //# sourceMappingURL=index.js.map
4158
4262
  //# sourceMappingURL=index.js.map