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

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.
@@ -2,7 +2,7 @@
2
2
  "address": "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
3
3
  "metadata": {
4
4
  "name": "streamflow_aligned_unlocks",
5
- "version": "1.3.0",
5
+ "version": "1.4.0",
6
6
  "spec": "0.1.0",
7
7
  "description": "Proxy to update unlock amount within Streamflow vesting protocol according to Token performance and other metrics"
8
8
  },
@@ -876,6 +876,80 @@
876
876
  ],
877
877
  "args": []
878
878
  },
879
+ {
880
+ "name": "update_contract",
881
+ "discriminator": [
882
+ 78,
883
+ 184,
884
+ 162,
885
+ 174,
886
+ 233,
887
+ 5,
888
+ 40,
889
+ 82
890
+ ],
891
+ "accounts": [
892
+ {
893
+ "name": "sender",
894
+ "writable": true,
895
+ "signer": true
896
+ },
897
+ {
898
+ "name": "proxy_metadata",
899
+ "docs": [
900
+ "Proxy Contract"
901
+ ],
902
+ "writable": true,
903
+ "pda": {
904
+ "seeds": [
905
+ {
906
+ "kind": "const",
907
+ "value": [
908
+ 99,
909
+ 111,
910
+ 110,
911
+ 116,
912
+ 114,
913
+ 97,
914
+ 99,
915
+ 116
916
+ ]
917
+ },
918
+ {
919
+ "kind": "account",
920
+ "path": "stream_metadata"
921
+ }
922
+ ]
923
+ }
924
+ },
925
+ {
926
+ "name": "stream_metadata",
927
+ "writable": true
928
+ },
929
+ {
930
+ "name": "withdrawor",
931
+ "writable": true
932
+ },
933
+ {
934
+ "name": "streamflow_program",
935
+ "address": "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m"
936
+ },
937
+ {
938
+ "name": "system_program",
939
+ "address": "11111111111111111111111111111111"
940
+ }
941
+ ],
942
+ "args": [
943
+ {
944
+ "name": "params",
945
+ "type": {
946
+ "defined": {
947
+ "name": "UpdateContractParams"
948
+ }
949
+ }
950
+ }
951
+ ]
952
+ },
879
953
  {
880
954
  "name": "update_test_oracle",
881
955
  "discriminator": [
@@ -1471,6 +1545,32 @@
1471
1545
  ]
1472
1546
  }
1473
1547
  },
1548
+ {
1549
+ "name": "UpdateContractParams",
1550
+ "type": {
1551
+ "kind": "struct",
1552
+ "fields": [
1553
+ {
1554
+ "name": "transferable_by_sender",
1555
+ "type": {
1556
+ "option": "bool"
1557
+ }
1558
+ },
1559
+ {
1560
+ "name": "transferable_by_recipient",
1561
+ "type": {
1562
+ "option": "bool"
1563
+ }
1564
+ },
1565
+ {
1566
+ "name": "cancelable_by_sender",
1567
+ "type": {
1568
+ "option": "bool"
1569
+ }
1570
+ }
1571
+ ]
1572
+ }
1573
+ },
1474
1574
  {
1475
1575
  "name": "UpdateTestOracleParams",
1476
1576
  "type": {
@@ -8,7 +8,7 @@ type StreamflowAlignedUnlocks = {
8
8
  "address": "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH";
9
9
  "metadata": {
10
10
  "name": "streamflowAlignedUnlocks";
11
- "version": "1.3.0";
11
+ "version": "1.4.0";
12
12
  "spec": "0.1.0";
13
13
  "description": "Proxy to update unlock amount within Streamflow vesting protocol according to Token performance and other metrics";
14
14
  };
@@ -882,6 +882,80 @@ type StreamflowAlignedUnlocks = {
882
882
  ];
883
883
  "args": [];
884
884
  },
885
+ {
886
+ "name": "updateContract";
887
+ "discriminator": [
888
+ 78,
889
+ 184,
890
+ 162,
891
+ 174,
892
+ 233,
893
+ 5,
894
+ 40,
895
+ 82
896
+ ];
897
+ "accounts": [
898
+ {
899
+ "name": "sender";
900
+ "writable": true;
901
+ "signer": true;
902
+ },
903
+ {
904
+ "name": "proxyMetadata";
905
+ "docs": [
906
+ "Proxy Contract"
907
+ ];
908
+ "writable": true;
909
+ "pda": {
910
+ "seeds": [
911
+ {
912
+ "kind": "const";
913
+ "value": [
914
+ 99,
915
+ 111,
916
+ 110,
917
+ 116,
918
+ 114,
919
+ 97,
920
+ 99,
921
+ 116
922
+ ];
923
+ },
924
+ {
925
+ "kind": "account";
926
+ "path": "streamMetadata";
927
+ }
928
+ ];
929
+ };
930
+ },
931
+ {
932
+ "name": "streamMetadata";
933
+ "writable": true;
934
+ },
935
+ {
936
+ "name": "withdrawor";
937
+ "writable": true;
938
+ },
939
+ {
940
+ "name": "streamflowProgram";
941
+ "address": "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m";
942
+ },
943
+ {
944
+ "name": "systemProgram";
945
+ "address": "11111111111111111111111111111111";
946
+ }
947
+ ];
948
+ "args": [
949
+ {
950
+ "name": "params";
951
+ "type": {
952
+ "defined": {
953
+ "name": "updateContractParams";
954
+ };
955
+ };
956
+ }
957
+ ];
958
+ },
885
959
  {
886
960
  "name": "updateTestOracle";
887
961
  "discriminator": [
@@ -1477,6 +1551,32 @@ type StreamflowAlignedUnlocks = {
1477
1551
  ];
1478
1552
  };
1479
1553
  },
1554
+ {
1555
+ "name": "updateContractParams";
1556
+ "type": {
1557
+ "kind": "struct";
1558
+ "fields": [
1559
+ {
1560
+ "name": "transferableBySender";
1561
+ "type": {
1562
+ "option": "bool";
1563
+ };
1564
+ },
1565
+ {
1566
+ "name": "transferableByRecipient";
1567
+ "type": {
1568
+ "option": "bool";
1569
+ };
1570
+ },
1571
+ {
1572
+ "name": "cancelableBySender";
1573
+ "type": {
1574
+ "option": "bool";
1575
+ };
1576
+ }
1577
+ ];
1578
+ };
1579
+ },
1480
1580
  {
1481
1581
  "name": "updateTestOracleParams";
1482
1582
  "type": {
@@ -553,7 +553,7 @@ declare class SolanaStreamClient {
553
553
  * @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
554
554
  * @returns Create stream instructions
555
555
  */
556
- prepareCreateStreamInstructions({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canPause, canUpdateRate, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, partner, tokenProgramId: streamTokenProgramId, }: ICreateStreamData, { sender, metadataPubKeys, isNative, computePrice, computeLimit }: IPrepareCreateStreamExt): Promise<ICreateStreamInstructions>;
556
+ prepareCreateLinearStreamInstructions({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canPause, canUpdateRate, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, partner, tokenProgramId: streamTokenProgramId, }: ICreateStreamData, { sender, metadataPubKeys, isNative, computePrice, computeLimit }: IPrepareCreateStreamExt): Promise<ICreateStreamInstructions>;
557
557
  /**
558
558
  * Creates a new stream/vesting contract using unchecked instruction.
559
559
  *
@@ -583,7 +583,7 @@ declare class SolanaStreamClient {
583
583
  * @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
584
584
  * @returns Create multiple transaction instructions
585
585
  */
586
- buildCreateMultipleTransactionInstructions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamExt): Promise<{
586
+ buildCreateMultipleTransactionInstructions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamExt, applyCustomAfterInstructions?: boolean): Promise<{
587
587
  instructionsBatch: {
588
588
  ixs: TransactionInstruction[];
589
589
  metadata: Keypair | undefined;
@@ -619,7 +619,7 @@ declare class SolanaStreamClient {
619
619
  * @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
620
620
  * @returns Multiple transaction information
621
621
  */
622
- buildCreateMultipleTransactions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamExt): Promise<{
622
+ buildCreateMultipleTransactions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamExt, applyCustomAfterInstructions?: boolean): Promise<{
623
623
  transactions: BatchItem[];
624
624
  metadatas: string[];
625
625
  metadataToRecipient: MetadataRecipientHashMap;
@@ -637,7 +637,7 @@ declare class SolanaStreamClient {
637
637
  * @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
638
638
  * @returns Multiple transaction information
639
639
  */
640
- createMultiple(data: ICreateMultipleStreamData, extParams: ICreateStreamExt): Promise<IMultiTransactionResult>;
640
+ createMultiple(data: ICreateMultipleStreamData[] | ICreateMultipleStreamData, extParams: ICreateStreamExt): Promise<IMultiTransactionResult>;
641
641
  /**
642
642
  * Creates multiple stream/vesting contracts, and send all transactions sequentially.
643
643
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
@@ -646,7 +646,7 @@ declare class SolanaStreamClient {
646
646
  * @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
647
647
  * @returns Multiple transaction information
648
648
  */
649
- createMultipleSequential(data: ICreateMultipleStreamData, extParams: ICreateStreamExt): Promise<IMultiTransactionResult>;
649
+ createMultipleSequential(data: ICreateMultipleStreamData[] | ICreateMultipleStreamData, extParams: ICreateStreamExt): Promise<IMultiTransactionResult>;
650
650
  /**
651
651
  * Attempts withdrawing from the specified stream.
652
652
  * @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
@@ -688,7 +688,7 @@ declare class SolanaStreamClient {
688
688
  * @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
689
689
  * @returns Transaction instructions
690
690
  */
691
- prepareCancelStreamInstructions({ id }: ICancelData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
691
+ prepareCancelLinearStream({ id }: ICancelData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
692
692
  /**
693
693
  * Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
694
694
  * Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
@@ -771,11 +771,11 @@ declare class SolanaStreamClient {
771
771
  */
772
772
  getDefaultStreamflowFee(): Promise<number>;
773
773
  /**
774
- * Returns total fee percent, streamflow fees + partner fees
775
- * @param getFeesData structure with address for which we need to derive fee, either sender or partner usually
776
- * @param chainSpecificParams additional parameters required by chain client
777
- * @returns fee as floating number, so if fee is 0.99%, it will return 0.99
778
- */
774
+ * Returns total fee percent, streamflow fees + partner fees
775
+ * @param getFeesData structure with address for which we need to derive fee, either sender or partner usually
776
+ * @param chainSpecificParams additional parameters required by chain client
777
+ * @returns fee as floating number, so if fee is 0.99%, it will return 0.99
778
+ */
779
779
  getTotalFee(getFeesData: IGetFeesData): Promise<number>;
780
780
  /**
781
781
  * Extracts error code from an error
@@ -784,9 +784,10 @@ declare class SolanaStreamClient {
784
784
  */
785
785
  extractErrorCode(err: Error): string | null;
786
786
  /**
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
- */
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
+ */
789
789
  isAlignedUnlock(streamPublicKey: PublicKey, senderPublicKey: PublicKey): boolean;
790
+ private flatBuildCreateMultipleTransactionInstructions;
790
791
  /**
791
792
  * Utility function to generate metadata for a Contract or return existing Pubkey
792
793
  */
@@ -879,7 +879,7 @@ var streamflow_aligned_unlocks_default = {
879
879
  address: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
880
880
  metadata: {
881
881
  name: "streamflow_aligned_unlocks",
882
- version: "1.3.0",
882
+ version: "1.4.0",
883
883
  spec: "0.1.0",
884
884
  description: "Proxy to update unlock amount within Streamflow vesting protocol according to Token performance and other metrics"
885
885
  },
@@ -1753,6 +1753,80 @@ var streamflow_aligned_unlocks_default = {
1753
1753
  ],
1754
1754
  args: []
1755
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
+ },
1756
1830
  {
1757
1831
  name: "update_test_oracle",
1758
1832
  discriminator: [
@@ -2348,6 +2422,32 @@ var streamflow_aligned_unlocks_default = {
2348
2422
  ]
2349
2423
  }
2350
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
+ },
2351
2451
  {
2352
2452
  name: "UpdateTestOracleParams",
2353
2453
  type: {
@@ -2538,7 +2638,7 @@ var SolanaStreamClient = class {
2538
2638
  return { ixs, txId: signature, metadataId };
2539
2639
  }
2540
2640
  async prepareCreateInstructions(streamParams, extParams) {
2541
- const { ixs, metadata, metadataPubKey } = isCreateAlignedStreamData(streamParams) ? await this.prepareCreateAlignedUnlockInstructions(streamParams, extParams) : await this.prepareCreateStreamInstructions(streamParams, extParams);
2641
+ const { ixs, metadata, metadataPubKey } = isCreateAlignedStreamData(streamParams) ? await this.prepareCreateAlignedUnlockInstructions(streamParams, extParams) : await this.prepareCreateLinearStreamInstructions(streamParams, extParams);
2542
2642
  return { ixs, metadata, metadataPubKey };
2543
2643
  }
2544
2644
  async prepareCreateAlignedUnlockInstructions(streamParams, extParams) {
@@ -2572,7 +2672,10 @@ var SolanaStreamClient = class {
2572
2672
  floorPrice
2573
2673
  } = streamParams;
2574
2674
  const { isNative, sender, computeLimit, computePrice, metadataPubKeys } = extParams;
2575
- 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
+ );
2576
2679
  assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
2577
2680
  const recipientPublicKey = new PublicKey(recipient);
2578
2681
  const mintPublicKey = isNative ? NATIVE_MINT : new PublicKey(mint);
@@ -2645,7 +2748,7 @@ var SolanaStreamClient = class {
2645
2748
  * @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
2646
2749
  * @returns Create stream instructions
2647
2750
  */
2648
- async prepareCreateStreamInstructions({
2751
+ async prepareCreateLinearStreamInstructions({
2649
2752
  recipient,
2650
2753
  tokenId: mint,
2651
2754
  start,
@@ -2747,10 +2850,7 @@ var SolanaStreamClient = class {
2747
2850
  * @returns Create result
2748
2851
  */
2749
2852
  async createUnchecked(data, extParams) {
2750
- const { ixs, metadata, metadataPubKey } = await this.prepareCreateUncheckedInstructions(
2751
- data,
2752
- extParams
2753
- );
2853
+ const { ixs, metadata, metadataPubKey } = await this.prepareCreateUncheckedInstructions(data, extParams);
2754
2854
  const { tx, hash, context } = await prepareTransaction(
2755
2855
  this.connection,
2756
2856
  ixs,
@@ -2869,14 +2969,13 @@ var SolanaStreamClient = class {
2869
2969
  * @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
2870
2970
  * @returns Create multiple transaction instructions
2871
2971
  */
2872
- async buildCreateMultipleTransactionInstructions(data, extParams) {
2972
+ async buildCreateMultipleTransactionInstructions(data, extParams, applyCustomAfterInstructions = true) {
2873
2973
  const { recipients, ...streamParams } = data;
2874
2974
  const { sender, metadataPubKeys: metadataPubKeysExt, isNative, customInstructions } = extParams;
2875
2975
  assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
2876
2976
  const metadatas = [];
2877
2977
  const metadataToRecipient = {};
2878
2978
  const instructionsBatch = [];
2879
- const metadataPubKeys = metadataPubKeysExt || [];
2880
2979
  const partnerPublicKey = data.partner ? new PublicKey(data.partner) : WITHDRAWOR_PUBLIC_KEY;
2881
2980
  const mintPublicKey = new PublicKey(data.tokenId);
2882
2981
  if (recipients.length === 0) {
@@ -2886,14 +2985,16 @@ var SolanaStreamClient = class {
2886
2985
  const recipientData = recipients[i];
2887
2986
  const createStreamData = { ...streamParams, ...recipientData };
2888
2987
  const createStreamExtParams = {
2889
- metadataPubKeys: metadataPubKeys[i] ? [metadataPubKeys[i]] : void 0,
2890
- ...extParams
2988
+ ...extParams,
2989
+ metadataPubKeys: metadataPubKeysExt?.[i] ? [metadataPubKeysExt[i]] : void 0
2891
2990
  };
2892
2991
  const { ixs, metadata, metadataPubKey } = await this.prepareCreateInstructions(
2893
2992
  createStreamData,
2894
2993
  createStreamExtParams
2895
2994
  );
2896
- await this.applyCustomAfterInstructions(ixs, customInstructions, metadataPubKey);
2995
+ if (applyCustomAfterInstructions) {
2996
+ await this.applyCustomAfterInstructions(ixs, customInstructions, metadataPubKey);
2997
+ }
2897
2998
  metadataToRecipient[metadataPubKey.toBase58()] = recipientData;
2898
2999
  metadatas.push(metadataPubKey.toBase58());
2899
3000
  instructionsBatch.push({
@@ -2902,19 +3003,10 @@ var SolanaStreamClient = class {
2902
3003
  recipient: recipientData.recipient
2903
3004
  });
2904
3005
  }
2905
- const prepareInstructions = await this.getCreateATAInstructions(
2906
- [partnerPublicKey],
2907
- mintPublicKey,
2908
- sender,
2909
- true
2910
- );
3006
+ const prepareInstructions = await this.getCreateATAInstructions([partnerPublicKey], mintPublicKey, sender, true);
2911
3007
  if (isNative) {
2912
3008
  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
- );
3009
+ const nativeInstructions = await prepareWrappedAccount(this.connection, sender.publicKey, totalDepositedAmount);
2918
3010
  prepareInstructions.push(...nativeInstructions);
2919
3011
  }
2920
3012
  return {
@@ -2950,9 +3042,9 @@ var SolanaStreamClient = class {
2950
3042
  * @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
2951
3043
  * @returns Multiple transaction information
2952
3044
  */
2953
- async buildCreateMultipleTransactions(data, extParams) {
3045
+ async buildCreateMultipleTransactions(data, extParams, applyCustomAfterInstructions = true) {
2954
3046
  const { sender } = extParams;
2955
- const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams);
3047
+ const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams, applyCustomAfterInstructions);
2956
3048
  const { value: hash, context } = await this.connection.getLatestBlockhashAndContext();
2957
3049
  const batch = [];
2958
3050
  for (const { ixs, metadata, recipient } of instructionsBatch) {
@@ -2983,7 +3075,7 @@ var SolanaStreamClient = class {
2983
3075
  if (!sender.publicKey) {
2984
3076
  throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
2985
3077
  }
2986
- const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams);
3078
+ const { instructionsBatch, metadatas, prepareInstructions, metadataToRecipient } = await this.flatBuildCreateMultipleTransactionInstructions(data, extParams);
2987
3079
  const errors = [];
2988
3080
  const signatures = [];
2989
3081
  const metadataPubKeys = metadataPubKeysExt || [];
@@ -3048,7 +3140,7 @@ var SolanaStreamClient = class {
3048
3140
  if (!sender.publicKey) {
3049
3141
  throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
3050
3142
  }
3051
- const { instructionsBatch, metadatas, metadataToRecipient, prepareInstructions } = await this.buildCreateMultipleTransactionInstructions(data, extParams);
3143
+ const { instructionsBatch, metadatas, prepareInstructions, metadataToRecipient } = await this.flatBuildCreateMultipleTransactionInstructions(data, extParams);
3052
3144
  const errors = [];
3053
3145
  const signatures = [];
3054
3146
  const batch = [];
@@ -3112,10 +3204,7 @@ var SolanaStreamClient = class {
3112
3204
  async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, extParams) {
3113
3205
  const { invoker, customInstructions } = extParams;
3114
3206
  assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
3115
- const ixs = await this.prepareWithdrawInstructions(
3116
- { id, amount },
3117
- extParams
3118
- );
3207
+ const ixs = await this.prepareWithdrawInstructions({ id, amount }, extParams);
3119
3208
  const metadata = new PublicKey(id);
3120
3209
  await this.applyCustomAfterInstructions(ixs, customInstructions, metadata);
3121
3210
  const { tx, hash, context } = await prepareTransaction(this.connection, ixs, invoker.publicKey);
@@ -3213,7 +3302,7 @@ var SolanaStreamClient = class {
3213
3302
  }
3214
3303
  const { sender: senderPublicKey } = decodeStream(account.data);
3215
3304
  const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, senderPublicKey);
3216
- const ixs = isAlignedUnlock ? await this.prepareCancelAlignedUnlockInstructions(cancelData, extParams) : await this.prepareCancelStreamInstructions(cancelData, extParams);
3305
+ const ixs = isAlignedUnlock ? await this.prepareCancelAlignedUnlockInstructions(cancelData, extParams) : await this.prepareCancelLinearStream(cancelData, extParams);
3217
3306
  return ixs;
3218
3307
  }
3219
3308
  /**
@@ -3261,7 +3350,7 @@ var SolanaStreamClient = class {
3261
3350
  * @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
3262
3351
  * @returns Transaction instructions
3263
3352
  */
3264
- async prepareCancelStreamInstructions({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
3353
+ async prepareCancelLinearStream({ id }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
3265
3354
  assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
3266
3355
  const streamPublicKey = new PublicKey(id);
3267
3356
  const escrowAcc = await this.connection.getAccountInfo(streamPublicKey);
@@ -3619,17 +3708,26 @@ var SolanaStreamClient = class {
3619
3708
  const streamPublicKey = new PublicKey(data.id);
3620
3709
  const escrow = await this.connection.getAccountInfo(streamPublicKey);
3621
3710
  invariant(escrow, "Couldn't get account info");
3711
+ const { sender: senderPublicKey } = decodeStream(escrow.data);
3712
+ const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, senderPublicKey);
3713
+ if (isAlignedUnlock && (data.enableAutomaticWithdrawal !== void 0 || data.amountPerPeriod !== void 0)) {
3714
+ throw new Error("Automatic withdrawal and rate update are not possible in price-based vesting!");
3715
+ }
3622
3716
  const ixs = prepareBaseInstructions(this.connection, {
3623
3717
  computePrice,
3624
3718
  computeLimit
3625
3719
  });
3626
3720
  ixs.push(
3627
- await updateStreamInstruction(data, this.programId, {
3721
+ await (isAlignedUnlock ? this.alignedProxyProgram.methods.updateContract({
3722
+ transferableBySender: data.transferableBySender ?? null,
3723
+ transferableByRecipient: data.transferableByRecipient ?? null,
3724
+ cancelableBySender: data.cancelableBySender ?? null
3725
+ }).accounts({ sender: invoker.publicKey, streamMetadata: streamPublicKey, withdrawor: WITHDRAWOR_PUBLIC_KEY }).accountsPartial({ streamflowProgram: this.programId }).instruction() : updateStreamInstruction(data, this.programId, {
3628
3726
  authority: invoker.publicKey,
3629
3727
  metadata: streamPublicKey,
3630
3728
  withdrawor: WITHDRAWOR_PUBLIC_KEY,
3631
3729
  systemProgram: SystemProgram.programId
3632
- })
3730
+ }))
3633
3731
  );
3634
3732
  return ixs;
3635
3733
  }
@@ -3665,11 +3763,11 @@ var SolanaStreamClient = class {
3665
3763
  return DEFAULT_STREAMFLOW_FEE;
3666
3764
  }
3667
3765
  /**
3668
- * Returns total fee percent, streamflow fees + partner fees
3669
- * @param getFeesData structure with address for which we need to derive fee, either sender or partner usually
3670
- * @param chainSpecificParams additional parameters required by chain client
3671
- * @returns fee as floating number, so if fee is 0.99%, it will return 0.99
3672
- */
3766
+ * Returns total fee percent, streamflow fees + partner fees
3767
+ * @param getFeesData structure with address for which we need to derive fee, either sender or partner usually
3768
+ * @param chainSpecificParams additional parameters required by chain client
3769
+ * @returns fee as floating number, so if fee is 0.99%, it will return 0.99
3770
+ */
3673
3771
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3674
3772
  async getTotalFee(getFeesData) {
3675
3773
  const fees = await this.getFees(getFeesData);
@@ -3688,12 +3786,27 @@ var SolanaStreamClient = class {
3688
3786
  return extractSolanaErrorCode(err.toString() ?? "Unknown error!", logs);
3689
3787
  }
3690
3788
  /**
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
- */
3789
+ * Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
3790
+ */
3693
3791
  isAlignedUnlock(streamPublicKey, senderPublicKey) {
3694
3792
  const pda = deriveContractPDA(this.alignedProxyProgram.programId, streamPublicKey);
3695
3793
  return senderPublicKey.equals(pda);
3696
3794
  }
3795
+ async flatBuildCreateMultipleTransactionInstructions(data, extParams) {
3796
+ const dataArray = Array.isArray(data) ? data : [data];
3797
+ const results = await Promise.all(
3798
+ dataArray.map((item, index) => this.buildCreateMultipleTransactionInstructions(item, extParams, index === 0))
3799
+ );
3800
+ return {
3801
+ instructionsBatch: results.flatMap((r) => r.instructionsBatch),
3802
+ metadatas: results.flatMap((r) => r.metadatas),
3803
+ prepareInstructions: results.flatMap((r) => r.prepareInstructions),
3804
+ metadataToRecipient: results.reduce(
3805
+ (acc, r) => Object.assign(acc, r.metadataToRecipient),
3806
+ {}
3807
+ )
3808
+ };
3809
+ }
3697
3810
  /**
3698
3811
  * Utility function to generate metadata for a Contract or return existing Pubkey
3699
3812
  */