@streamflow/stream 11.1.0-alpha.p335.b571df3 → 11.2.0-alpha.p342.ccd18cf

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.
@@ -180,12 +180,16 @@ var Contract = class {
180
180
  this.canTopup = stream.canTopup;
181
181
  this.name = stream.name;
182
182
  this.withdrawalFrequency = stream.withdrawFrequency.toNumber();
183
+ this.isPda = stream.isPda;
184
+ this.nonce = stream.nonce;
183
185
  this.closed = stream.closed;
184
186
  this.currentPauseStart = stream.currentPauseStart.toNumber();
185
187
  this.pauseCumulative = stream.pauseCumulative;
186
188
  this.lastRateChangeTime = stream.lastRateChangeTime.toNumber();
187
189
  this.fundsUnlockedAtLastRateChange = stream.fundsUnlockedAtLastRateChange;
188
190
  this.oldMetadata = stream.oldMetadata;
191
+ this.payer = stream.payer.toBase58();
192
+ this.bump = stream.bump;
189
193
  this.type = buildStreamType(this);
190
194
  this.isAligned = false;
191
195
  }
@@ -240,7 +244,7 @@ var STREAM_STRUCT_OFFSETS = {
240
244
  sender: STREAM_STRUCT_OFFSET_SENDER,
241
245
  closed: STREAM_STRUCT_OFFSET_CLOSED
242
246
  };
243
- var CREATE_PARAMS_PADDING = 126;
247
+ var CREATE_PARAMS_PADDING = 121;
244
248
  var PROGRAM_ID = {
245
249
  [common.ICluster.Devnet]: "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
246
250
  [common.ICluster.Mainnet]: "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m",
@@ -271,6 +275,7 @@ var TEST_ORACLE_DISCRIMINATOR = [198, 49, 63, 134, 232, 251, 168, 28];
271
275
  var CONTRACT_SEED = buffer.Buffer.from("contract", "utf-8");
272
276
  var ESCROW_SEED = buffer.Buffer.from("strm", "utf-8");
273
277
  var TEST_ORACLE_SEED = buffer.Buffer.from("test-oracle", "utf-8");
278
+ var METADATA_SEED = buffer.Buffer.from("strm-met", "utf-8");
274
279
  var REPOPULATED_METADATA_SEED = buffer.Buffer.from("strm-rep", "utf-8");
275
280
  var STREAMFLOW_TREASURY_PUBLIC_KEY = new web3_js.PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
276
281
  var WITHDRAWOR = "wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u";
@@ -374,7 +379,9 @@ var streamLayout = BufferLayout__namespace.struct([
374
379
  BufferLayout__namespace.blob(4, "ghost"),
375
380
  BufferLayout__namespace.u8("pausable"),
376
381
  BufferLayout__namespace.u8("can_update_rate"),
377
- BufferLayout__namespace.blob(4, "create_stream_params_padding_length"),
382
+ BufferLayout__namespace.blob(4, "ghost2"),
383
+ BufferLayout__namespace.u8("is_pda"),
384
+ BufferLayout__namespace.u32("nonce"),
378
385
  BufferLayout__namespace.seq(BufferLayout__namespace.u8(), CREATE_PARAMS_PADDING, "create_params_padding"),
379
386
  BufferLayout__namespace.u8("closed"),
380
387
  BufferLayout__namespace.blob(8, "current_pause_start"),
@@ -385,7 +392,9 @@ var streamLayout = BufferLayout__namespace.struct([
385
392
  BufferLayout__namespace.u8("creation_fee_claimed"),
386
393
  BufferLayout__namespace.u32("auto_claim_fee"),
387
394
  BufferLayout__namespace.u8("auto_claim_fee_claimed"),
388
- BufferLayout__namespace.blob(32, "old_metadata")
395
+ BufferLayout__namespace.blob(32, "old_metadata"),
396
+ BufferLayout__namespace.blob(32, "payer"),
397
+ BufferLayout__namespace.u8("bump")
389
398
  ]);
390
399
  BufferLayout__namespace.struct([
391
400
  BufferLayout__namespace.blob(32, "pubkey"),
@@ -414,6 +423,25 @@ var createStreamLayout = BufferLayout__namespace.struct([
414
423
  BufferLayout__namespace.u8("_can_update_rate_discriminator"),
415
424
  BufferLayout__namespace.u8("can_update_rate")
416
425
  ]);
426
+ var createStreamV2Layout = BufferLayout__namespace.struct([
427
+ BufferLayout__namespace.blob(8, "start_time"),
428
+ BufferLayout__namespace.blob(8, "net_amount_deposited"),
429
+ BufferLayout__namespace.blob(8, "period"),
430
+ BufferLayout__namespace.blob(8, "amount_per_period"),
431
+ BufferLayout__namespace.blob(8, "cliff"),
432
+ BufferLayout__namespace.blob(8, "cliff_amount"),
433
+ BufferLayout__namespace.u8("cancelable_by_sender"),
434
+ BufferLayout__namespace.u8("cancelable_by_recipient"),
435
+ BufferLayout__namespace.u8("automatic_withdrawal"),
436
+ BufferLayout__namespace.u8("transferable_by_sender"),
437
+ BufferLayout__namespace.u8("transferable_by_recipient"),
438
+ BufferLayout__namespace.u8("can_topup"),
439
+ BufferLayout__namespace.blob(64, "stream_name"),
440
+ BufferLayout__namespace.blob(8, "withdraw_frequency"),
441
+ BufferLayout__namespace.u8("pausable"),
442
+ BufferLayout__namespace.u8("can_update_rate"),
443
+ BufferLayout__namespace.blob(4, "nonce")
444
+ ]);
417
445
  var createUncheckedStreamLayout = BufferLayout__namespace.struct([
418
446
  BufferLayout__namespace.blob(8, "start_time"),
419
447
  BufferLayout__namespace.blob(8, "net_amount_deposited"),
@@ -434,6 +462,27 @@ var createUncheckedStreamLayout = BufferLayout__namespace.struct([
434
462
  BufferLayout__namespace.u8("pausable"),
435
463
  BufferLayout__namespace.u8("can_update_rate")
436
464
  ]);
465
+ var createUncheckedStreamV2Layout = BufferLayout__namespace.struct([
466
+ BufferLayout__namespace.blob(8, "start_time"),
467
+ BufferLayout__namespace.blob(8, "net_amount_deposited"),
468
+ BufferLayout__namespace.blob(8, "period"),
469
+ BufferLayout__namespace.blob(8, "amount_per_period"),
470
+ BufferLayout__namespace.blob(8, "cliff"),
471
+ BufferLayout__namespace.blob(8, "cliff_amount"),
472
+ BufferLayout__namespace.u8("cancelable_by_sender"),
473
+ BufferLayout__namespace.u8("cancelable_by_recipient"),
474
+ BufferLayout__namespace.u8("automatic_withdrawal"),
475
+ BufferLayout__namespace.u8("transferable_by_sender"),
476
+ BufferLayout__namespace.u8("transferable_by_recipient"),
477
+ BufferLayout__namespace.u8("can_topup"),
478
+ BufferLayout__namespace.blob(64, "stream_name"),
479
+ BufferLayout__namespace.blob(8, "withdraw_frequency"),
480
+ BufferLayout__namespace.blob(32, "recipient"),
481
+ BufferLayout__namespace.blob(32, "partner"),
482
+ BufferLayout__namespace.u8("pausable"),
483
+ BufferLayout__namespace.u8("can_update_rate"),
484
+ BufferLayout__namespace.blob(4, "nonce")
485
+ ]);
437
486
  var withdrawStreamLayout = BufferLayout__namespace.struct([
438
487
  BufferLayout__namespace.blob(8, "amount")
439
488
  ]);
@@ -551,12 +600,16 @@ var decodeStream = (buf) => {
551
600
  canTopup: Boolean(raw.can_topup),
552
601
  name: decoder.decode(raw.stream_name),
553
602
  withdrawFrequency: new BN3__default.default(raw.withdraw_frequency, LE),
603
+ isPda: Boolean(raw.is_pda),
604
+ nonce: raw.nonce,
554
605
  closed: Boolean(raw.closed),
555
606
  currentPauseStart: new BN3__default.default(raw.current_pause_start, LE),
556
607
  pauseCumulative: new BN3__default.default(raw.pause_cumulative, LE),
557
608
  lastRateChangeTime: new BN3__default.default(raw.last_rate_change_time, LE),
558
609
  fundsUnlockedAtLastRateChange: new BN3__default.default(raw.funds_unlocked_at_last_rate_change, LE),
559
- oldMetadata: new web3_js.PublicKey(raw.old_metadata)
610
+ oldMetadata: new web3_js.PublicKey(raw.old_metadata),
611
+ payer: new web3_js.PublicKey(raw.payer),
612
+ bump: raw.bump
560
613
  };
561
614
  };
562
615
  async function signAllTransactionWithRecipients(sender, items) {
@@ -747,6 +800,133 @@ var createUncheckedStreamInstruction = async (data, programId, accounts) => {
747
800
  data: bufferData
748
801
  });
749
802
  };
803
+ var createStreamV2Instruction = async (data, programId, accounts) => {
804
+ const keys = [
805
+ { pubkey: accounts.sender, isSigner: true, isWritable: true },
806
+ { pubkey: accounts.senderTokens, isSigner: false, isWritable: true },
807
+ { pubkey: accounts.recipient, isSigner: false, isWritable: true },
808
+ { pubkey: accounts.metadata, isSigner: false, isWritable: true },
809
+ { pubkey: accounts.escrowTokens, isSigner: false, isWritable: true },
810
+ { pubkey: accounts.recipientTokens, isSigner: false, isWritable: true },
811
+ {
812
+ pubkey: accounts.streamflowTreasury,
813
+ isSigner: false,
814
+ isWritable: true
815
+ },
816
+ {
817
+ pubkey: accounts.streamflowTreasuryTokens,
818
+ isSigner: false,
819
+ isWritable: true
820
+ },
821
+ { pubkey: accounts.withdrawor, isSigner: false, isWritable: true },
822
+ { pubkey: accounts.partner, isSigner: false, isWritable: true },
823
+ { pubkey: accounts.partnerTokens, isSigner: false, isWritable: true },
824
+ { pubkey: accounts.mint, isSigner: false, isWritable: false },
825
+ { pubkey: accounts.feeOracle, isSigner: false, isWritable: false },
826
+ { pubkey: accounts.rent, isSigner: false, isWritable: false },
827
+ { pubkey: accounts.timelockProgram, isSigner: false, isWritable: false },
828
+ { pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
829
+ {
830
+ pubkey: accounts.associatedTokenProgram,
831
+ isSigner: false,
832
+ isWritable: false
833
+ },
834
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false }
835
+ ];
836
+ let bufferData = buffer.Buffer.alloc(createStreamV2Layout.span);
837
+ const encodedUIntArray = new TextEncoder().encode(data.name);
838
+ const streamNameBuffer = buffer.Buffer.alloc(64).fill(encodedUIntArray, 0, encodedUIntArray.byteLength);
839
+ const nonceBuffer = buffer.Buffer.alloc(4);
840
+ nonceBuffer.writeUInt32LE(data.nonce);
841
+ const decodedData = {
842
+ start_time: data.start.toArrayLike(buffer.Buffer, "le", 8),
843
+ net_amount_deposited: data.depositedAmount.toArrayLike(buffer.Buffer, "le", 8),
844
+ period: data.period.toArrayLike(buffer.Buffer, "le", 8),
845
+ amount_per_period: data.amountPerPeriod.toArrayLike(buffer.Buffer, "le", 8),
846
+ cliff: data.cliff.toArrayLike(buffer.Buffer, "le", 8),
847
+ cliff_amount: data.cliffAmount.toArrayLike(buffer.Buffer, "le", 8),
848
+ cancelable_by_sender: Number(data.cancelableBySender),
849
+ cancelable_by_recipient: Number(data.cancelableByRecipient),
850
+ automatic_withdrawal: Number(data.automaticWithdrawal),
851
+ transferable_by_sender: Number(data.transferableBySender),
852
+ transferable_by_recipient: Number(data.transferableByRecipient),
853
+ can_topup: Number(data.canTopup),
854
+ stream_name: streamNameBuffer,
855
+ withdraw_frequency: data.withdrawFrequency.toArrayLike(buffer.Buffer, "le", 8),
856
+ pausable: Number(data.canPause),
857
+ can_update_rate: Number(data.canUpdateRate),
858
+ nonce: nonceBuffer
859
+ };
860
+ const encodeLength = createStreamV2Layout.encode(decodedData, bufferData);
861
+ bufferData = bufferData.slice(0, encodeLength);
862
+ bufferData = buffer.Buffer.concat([
863
+ buffer.Buffer.from(await sha256.digest("global:create_v2")).slice(0, 8),
864
+ bufferData,
865
+ buffer.Buffer.alloc(10)
866
+ ]);
867
+ return new web3_js.TransactionInstruction({
868
+ keys,
869
+ programId,
870
+ data: bufferData
871
+ });
872
+ };
873
+ var createUncheckedStreamV2Instruction = async (data, programId, accounts) => {
874
+ const keys = [
875
+ { pubkey: accounts.sender, isSigner: true, isWritable: true },
876
+ { pubkey: accounts.senderTokens, isSigner: false, isWritable: true },
877
+ { pubkey: accounts.metadata, isSigner: false, isWritable: true },
878
+ { pubkey: accounts.escrowTokens, isSigner: false, isWritable: true },
879
+ { pubkey: accounts.withdrawor, isSigner: false, isWritable: true },
880
+ { pubkey: accounts.mint, isSigner: false, isWritable: false },
881
+ { pubkey: accounts.feeOracle, isSigner: false, isWritable: false },
882
+ { pubkey: accounts.rent, isSigner: false, isWritable: false },
883
+ { pubkey: accounts.timelockProgram, isSigner: false, isWritable: false },
884
+ { pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
885
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false }
886
+ ];
887
+ if (accounts.payer) {
888
+ keys.unshift({
889
+ pubkey: accounts.payer,
890
+ isSigner: true,
891
+ isWritable: true
892
+ });
893
+ }
894
+ let bufferData = buffer.Buffer.alloc(createUncheckedStreamV2Layout.span);
895
+ const encodedUIntArray = new TextEncoder().encode(data.name);
896
+ const streamNameBuffer = buffer.Buffer.alloc(64).fill(encodedUIntArray, 0, encodedUIntArray.byteLength);
897
+ const nonceBuffer = buffer.Buffer.alloc(4);
898
+ nonceBuffer.writeUInt32LE(data.nonce);
899
+ const decodedData = {
900
+ start_time: data.start.toArrayLike(buffer.Buffer, "le", 8),
901
+ net_amount_deposited: data.depositedAmount.toArrayLike(buffer.Buffer, "le", 8),
902
+ period: data.period.toArrayLike(buffer.Buffer, "le", 8),
903
+ amount_per_period: data.amountPerPeriod.toArrayLike(buffer.Buffer, "le", 8),
904
+ cliff: data.cliff.toArrayLike(buffer.Buffer, "le", 8),
905
+ cliff_amount: data.cliffAmount.toArrayLike(buffer.Buffer, "le", 8),
906
+ cancelable_by_sender: Number(data.cancelableBySender),
907
+ cancelable_by_recipient: Number(data.cancelableByRecipient),
908
+ automatic_withdrawal: Number(data.automaticWithdrawal),
909
+ transferable_by_sender: Number(data.transferableBySender),
910
+ transferable_by_recipient: Number(data.transferableByRecipient),
911
+ can_topup: Number(data.canTopup),
912
+ stream_name: streamNameBuffer,
913
+ withdraw_frequency: data.withdrawFrequency.toArrayLike(buffer.Buffer, "le", 8),
914
+ recipient: data.recipient.toBuffer(),
915
+ partner: data.partner.toBuffer(),
916
+ pausable: Number(data.canPause),
917
+ can_update_rate: Number(data.canUpdateRate),
918
+ nonce: nonceBuffer
919
+ };
920
+ const encodeLength = createUncheckedStreamV2Layout.encode(decodedData, bufferData);
921
+ bufferData = bufferData.slice(0, encodeLength);
922
+ const digest = accounts.payer ? await sha256.digest("global:create_unchecked_with_payer_v2") : await sha256.digest("global:create_unchecked_v2");
923
+ bufferData = buffer.Buffer.concat([buffer.Buffer.from(digest).slice(0, 8), bufferData, buffer.Buffer.alloc(10)]);
924
+ return new web3_js.TransactionInstruction({
925
+ keys,
926
+ programId,
927
+ data: bufferData
928
+ });
929
+ };
750
930
  var withdrawStreamInstruction = async (amount, programId, {
751
931
  authority,
752
932
  recipient,
@@ -2539,10 +2719,163 @@ var deriveEscrowPDA = (programId, streamMetadata) => {
2539
2719
  var deriveTestOraclePDA = (programId, mint, creator) => {
2540
2720
  return web3_js.PublicKey.findProgramAddressSync([TEST_ORACLE_SEED, mint.toBuffer(), creator.toBuffer()], programId)[0];
2541
2721
  };
2722
+ var deriveStreamMetadataPDA = (programId, mint, sender, nonce) => {
2723
+ const nonceBuffer = buffer.Buffer.alloc(4);
2724
+ nonceBuffer.writeUInt32BE(nonce);
2725
+ return web3_js.PublicKey.findProgramAddressSync(
2726
+ [METADATA_SEED, mint.toBuffer(), sender.toBuffer(), nonceBuffer],
2727
+ programId
2728
+ );
2729
+ };
2542
2730
  var deriveRepopulatedMetadataPDA = (programId, streamMetadata) => {
2543
2731
  return web3_js.PublicKey.findProgramAddressSync([REPOPULATED_METADATA_SEED, streamMetadata.toBuffer()], programId)[0];
2544
2732
  };
2545
2733
 
2734
+ // solana/api-public/client.ts
2735
+ var DEFAULT_API_URL = "https://api-public.streamflow.finance";
2736
+ var DEFAULT_DEVNET_API_URL = "https://api-public-staging.streamflow.finance";
2737
+ var createClient = (options) => {
2738
+ const apiUrl = options?.apiUrl ?? options?.cluster === "mainnet" ? DEFAULT_API_URL : DEFAULT_DEVNET_API_URL;
2739
+ const fetchFn = options?.fetchFn ?? fetch;
2740
+ const fetchResource = async (url, options2) => {
2741
+ const res = await fetchFn(url, {
2742
+ method: "GET",
2743
+ headers: { "Content-Type": "application/json" },
2744
+ ...{}
2745
+ });
2746
+ if (!res.ok) {
2747
+ const text = await res.text().catch(() => "");
2748
+ throw new Error(`Tabularium API error`, {
2749
+ cause: new Error(`: ${res.status} ${res.statusText}${text ? ` - ${text}` : ""}`)
2750
+ });
2751
+ }
2752
+ return res.json();
2753
+ };
2754
+ return {
2755
+ getContracts: async (opts) => {
2756
+ const params = new URLSearchParams();
2757
+ if (opts?.sender) params.set("sender", opts.sender);
2758
+ if (opts?.recipient) params.set("recipient", opts.recipient);
2759
+ const url = `${apiUrl}/v2/api/contracts/tabularium/${params.toString() ? `?${params.toString()}` : ""}`;
2760
+ return fetchResource(url);
2761
+ },
2762
+ getContract: async (address) => {
2763
+ const url = `${apiUrl}/v2/api/contracts/tabularium/${encodeURIComponent(address)}`;
2764
+ return fetchResource(url);
2765
+ }
2766
+ };
2767
+ };
2768
+ var isoToUnix = (iso) => {
2769
+ if (!iso) return 0;
2770
+ const time = new Date(iso).getTime();
2771
+ return Number.isNaN(time) ? 0 : Math.floor(time / 1e3);
2772
+ };
2773
+ var toBN = (value) => new BN3__default.default(value);
2774
+ var mapOracleType = (apiType) => {
2775
+ if (!apiType) return { none: {} };
2776
+ const mapping = {
2777
+ TEST: { test: {} },
2778
+ PYTH: { pyth: {} },
2779
+ SWITCHBOARD: { switchboard: {} }
2780
+ };
2781
+ return mapping[apiType] ?? { none: {} };
2782
+ };
2783
+ async function toDecodedStream(schema) {
2784
+ const mint = common.pk(schema.mint);
2785
+ const sender = common.pk(schema.sender);
2786
+ const recipient = common.pk(schema.recipient);
2787
+ const partner = schema.partner ? common.pk(schema.partner) : sender;
2788
+ const payer = schema.payer ? common.pk(schema.payer) : web3_js.PublicKey.default;
2789
+ const [senderTokens, recipientTokens, partnerTokens, streamflowTreasuryTokens] = await Promise.all([
2790
+ common.ata(mint, sender),
2791
+ common.ata(mint, recipient),
2792
+ common.ata(mint, partner),
2793
+ common.ata(mint, STREAMFLOW_TREASURY_PUBLIC_KEY)
2794
+ ]);
2795
+ return {
2796
+ magic: toBN(4),
2797
+ version: toBN(4),
2798
+ createdAt: toBN(isoToUnix(schema.createdDt)),
2799
+ withdrawnAmount: toBN(schema.claimedAmount),
2800
+ canceledAt: toBN(isoToUnix(schema.canceledDt)),
2801
+ end: toBN(isoToUnix(schema.endDt)),
2802
+ lastWithdrawnAt: toBN(isoToUnix(schema.lastClaimedDt)),
2803
+ sender,
2804
+ senderTokens,
2805
+ recipient,
2806
+ recipientTokens,
2807
+ mint,
2808
+ escrowTokens: schema.escrow ? common.pk(schema.escrow) : web3_js.PublicKey.default,
2809
+ streamflowTreasury: STREAMFLOW_TREASURY_PUBLIC_KEY,
2810
+ streamflowTreasuryTokens,
2811
+ streamflowFeeTotal: toBN(schema.streamflowFee),
2812
+ streamflowFeeWithdrawn: toBN(schema.streamflowFeeWithdrawn),
2813
+ streamflowFeePercent: parseFloat(schema.streamflowFeePercentage) || 0,
2814
+ partnerFeeTotal: toBN(schema.partnerFee),
2815
+ partnerFeeWithdrawn: toBN(schema.partnerFeeWithdrawn),
2816
+ partnerFeePercent: parseFloat(schema.partnerFeePercentage) || 0,
2817
+ partner,
2818
+ partnerTokens,
2819
+ start: toBN(isoToUnix(schema.startDt)),
2820
+ depositedAmount: toBN(schema.amount),
2821
+ period: toBN(schema.period),
2822
+ amountPerPeriod: toBN(schema.amountPerPeriod),
2823
+ cliff: toBN(isoToUnix(schema.startDt)),
2824
+ cliffAmount: toBN(schema.cliffAmount),
2825
+ cancelableBySender: schema.isCancelableBySender,
2826
+ cancelableByRecipient: schema.isCancelableByRecipient,
2827
+ automaticWithdrawal: schema.hasAutoClaim,
2828
+ transferableBySender: schema.isTransferableBySender,
2829
+ transferableByRecipient: schema.isTransferableByRecipient,
2830
+ canTopup: schema.canTopup,
2831
+ name: schema.name,
2832
+ withdrawFrequency: toBN(schema.autoClaimPeriod),
2833
+ isPda: schema.isPda,
2834
+ nonce: schema.nonce ? schema.nonce : 0,
2835
+ closed: schema.isClosed,
2836
+ currentPauseStart: toBN(0),
2837
+ pauseCumulative: toBN(schema.pauseCumulative),
2838
+ lastRateChangeTime: toBN(isoToUnix(schema.lastRateUpdateDt)),
2839
+ fundsUnlockedAtLastRateChange: toBN(schema.amountUnlockedAtLastRateUpdate),
2840
+ oldMetadata: web3_js.PublicKey.default,
2841
+ payer,
2842
+ bump: schema.bump ? schema.bump : 0
2843
+ };
2844
+ }
2845
+ function toPrecisionBN(value, precision = ALIGNED_PRECISION_FACTOR_POW2) {
2846
+ return common.getBN(typeof value === "number" ? value : parseFloat(value), precision);
2847
+ }
2848
+ function toAlignedProxy(dynamic) {
2849
+ const proxy = {
2850
+ sender: common.pk(dynamic.sender),
2851
+ minPrice: toPrecisionBN(dynamic.minPrice),
2852
+ maxPrice: toPrecisionBN(dynamic.maxPrice),
2853
+ minPercentage: toPrecisionBN(dynamic.minPercentage),
2854
+ maxPercentage: toPrecisionBN(dynamic.maxPercentage),
2855
+ priceOracleType: mapOracleType(dynamic.priceOracleType),
2856
+ priceOracle: dynamic.priceOracleAddress ? common.pk(dynamic.priceOracleAddress) : web3_js.PublicKey.default,
2857
+ tickSize: toPrecisionBN(dynamic.tickSize),
2858
+ initialAmountPerPeriod: toBN(dynamic.initialAmountPerPeriod),
2859
+ initialPrice: toPrecisionBN(dynamic.initialPrice),
2860
+ lastPrice: toPrecisionBN(dynamic.lastPrice),
2861
+ lastAmountUpdateTime: toBN(isoToUnix(dynamic.expiryDt)),
2862
+ initialNetAmount: toBN(dynamic.initialAmount),
2863
+ expiryTime: toBN(isoToUnix(dynamic.expiryDt)),
2864
+ expiryPercentage: toPrecisionBN(dynamic.expiryPercentage),
2865
+ floorPrice: toPrecisionBN(dynamic.floorPrice),
2866
+ streamCanceledTime: dynamic.streamCanceledTime ? toBN(dynamic.streamCanceledTime) : toBN(0)
2867
+ };
2868
+ return proxy;
2869
+ }
2870
+ var transformContract = async (schema) => {
2871
+ const decodedStream = await toDecodedStream(schema);
2872
+ if (schema.dynamicContract) {
2873
+ const alignedProxy = toAlignedProxy(schema.dynamicContract);
2874
+ return new AlignedContract(decodedStream, alignedProxy);
2875
+ }
2876
+ return new Contract(decodedStream);
2877
+ };
2878
+
2546
2879
  // solana/StreamClient.ts
2547
2880
  var METADATA_ACC_SIZE = 1104;
2548
2881
  var ALIGNED_METADATA_ACC_SIZE = 320;
@@ -2585,6 +2918,9 @@ var SolanaStreamClient = class {
2585
2918
  address: streamflow_aligned_unlocks_default.address
2586
2919
  };
2587
2920
  this.alignedProxyProgram = new anchor.Program(alignedUnlocksProgram, { connection: this.connection });
2921
+ this.apiClient = createClient(
2922
+ typeof optionsOrClusterUrl === "object" && optionsOrClusterUrl.cluster !== common.ICluster.Mainnet ? { cluster: "devnet" } : { cluster: "mainnet" }
2923
+ );
2588
2924
  }
2589
2925
  getConnection() {
2590
2926
  return this.connection;
@@ -2831,7 +3167,8 @@ var SolanaStreamClient = class {
2831
3167
  automaticWithdrawal = false,
2832
3168
  withdrawalFrequency = 0,
2833
3169
  partner,
2834
- tokenProgramId: streamTokenProgramId
3170
+ tokenProgramId: streamTokenProgramId,
3171
+ nonce
2835
3172
  }, { sender, metadataPubKeys, isNative = false, computePrice, computeLimit }) {
2836
3173
  common.assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
2837
3174
  const ixs = common.prepareBaseInstructions(this.connection, {
@@ -2840,7 +3177,13 @@ var SolanaStreamClient = class {
2840
3177
  });
2841
3178
  const mintPublicKey = isNative ? splToken.NATIVE_MINT : new web3_js.PublicKey(mint);
2842
3179
  const recipientPublicKey = new web3_js.PublicKey(recipient);
2843
- const { metadata, metadataPubKey } = this.getOrCreateStreamMetadata(metadataPubKeys);
3180
+ let metadata;
3181
+ let metadataPubKey;
3182
+ if (nonce != null) {
3183
+ [metadataPubKey] = deriveStreamMetadataPDA(this.programId, mintPublicKey, sender.publicKey, nonce);
3184
+ } else {
3185
+ ({ metadata, metadataPubKey } = this.getOrCreateStreamMetadata(metadataPubKeys));
3186
+ }
2844
3187
  const [escrowTokens] = web3_js.PublicKey.findProgramAddressSync(
2845
3188
  [buffer.Buffer.from("strm"), metadataPubKey.toBuffer()],
2846
3189
  this.programId
@@ -2854,49 +3197,49 @@ var SolanaStreamClient = class {
2854
3197
  const streamflowTreasuryTokens = await common.ata(mintPublicKey, STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
2855
3198
  const partnerPublicKey = partner ? new web3_js.PublicKey(partner) : sender.publicKey;
2856
3199
  const partnerTokens = await common.ata(mintPublicKey, partnerPublicKey, tokenProgramId);
2857
- ixs.push(
2858
- await createStreamInstruction(
2859
- {
2860
- start: new BN3__default.default(start),
2861
- depositedAmount,
2862
- period: new BN3__default.default(period),
2863
- amountPerPeriod,
2864
- cliff: new BN3__default.default(cliff),
2865
- cliffAmount: new BN3__default.default(cliffAmount),
2866
- cancelableBySender,
2867
- cancelableByRecipient,
2868
- automaticWithdrawal,
2869
- transferableBySender,
2870
- transferableByRecipient,
2871
- canTopup,
2872
- canUpdateRate: !!canUpdateRate,
2873
- canPause: !!canPause,
2874
- name,
2875
- withdrawFrequency: new BN3__default.default(automaticWithdrawal ? withdrawalFrequency : period)
2876
- },
2877
- this.programId,
2878
- {
2879
- sender: sender.publicKey,
2880
- senderTokens,
2881
- recipient: new web3_js.PublicKey(recipient),
2882
- metadata: metadataPubKey,
2883
- escrowTokens,
2884
- recipientTokens,
2885
- streamflowTreasury: STREAMFLOW_TREASURY_PUBLIC_KEY,
2886
- streamflowTreasuryTokens,
2887
- partner: partnerPublicKey,
2888
- partnerTokens,
2889
- mint: new web3_js.PublicKey(mint),
2890
- feeOracle: this.feeOraclePublicKey,
2891
- rent: web3_js.SYSVAR_RENT_PUBKEY,
2892
- timelockProgram: this.programId,
2893
- tokenProgram: tokenProgramId,
2894
- associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
2895
- withdrawor: WITHDRAWOR_PUBLIC_KEY,
2896
- systemProgram: web3_js.SystemProgram.programId
2897
- }
2898
- )
2899
- );
3200
+ const accounts = {
3201
+ sender: sender.publicKey,
3202
+ senderTokens,
3203
+ recipient: new web3_js.PublicKey(recipient),
3204
+ metadata: metadataPubKey,
3205
+ escrowTokens,
3206
+ recipientTokens,
3207
+ streamflowTreasury: STREAMFLOW_TREASURY_PUBLIC_KEY,
3208
+ streamflowTreasuryTokens,
3209
+ partner: partnerPublicKey,
3210
+ partnerTokens,
3211
+ mint: new web3_js.PublicKey(mint),
3212
+ feeOracle: this.feeOraclePublicKey,
3213
+ rent: web3_js.SYSVAR_RENT_PUBKEY,
3214
+ timelockProgram: this.programId,
3215
+ tokenProgram: tokenProgramId,
3216
+ associatedTokenProgram: splToken.ASSOCIATED_TOKEN_PROGRAM_ID,
3217
+ withdrawor: WITHDRAWOR_PUBLIC_KEY,
3218
+ systemProgram: web3_js.SystemProgram.programId
3219
+ };
3220
+ const baseData = {
3221
+ start: new BN3__default.default(start),
3222
+ depositedAmount,
3223
+ period: new BN3__default.default(period),
3224
+ amountPerPeriod,
3225
+ cliff: new BN3__default.default(cliff),
3226
+ cliffAmount: new BN3__default.default(cliffAmount),
3227
+ cancelableBySender,
3228
+ cancelableByRecipient,
3229
+ automaticWithdrawal,
3230
+ transferableBySender,
3231
+ transferableByRecipient,
3232
+ canTopup,
3233
+ canUpdateRate: !!canUpdateRate,
3234
+ canPause: !!canPause,
3235
+ name,
3236
+ withdrawFrequency: new BN3__default.default(automaticWithdrawal ? withdrawalFrequency : period)
3237
+ };
3238
+ if (nonce != null) {
3239
+ ixs.push(await createStreamV2Instruction({ ...baseData, nonce }, this.programId, accounts));
3240
+ } else {
3241
+ ixs.push(await createStreamInstruction(baseData, this.programId, accounts));
3242
+ }
2900
3243
  return { ixs, metadata, metadataPubKey };
2901
3244
  }
2902
3245
  /**
@@ -2956,20 +3299,19 @@ var SolanaStreamClient = class {
2956
3299
  transferableByRecipient,
2957
3300
  automaticWithdrawal = false,
2958
3301
  withdrawalFrequency = 0,
2959
- partner
3302
+ partner,
3303
+ nonce
2960
3304
  }, { sender, metadataPubKeys, isNative = false, computePrice, computeLimit }) {
2961
3305
  common.assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
2962
3306
  const mintPublicKey = new web3_js.PublicKey(mint);
2963
3307
  const recipientPublicKey = new web3_js.PublicKey(recipient);
2964
- const { metadata, metadataPubKey } = this.getOrCreateStreamMetadata(metadataPubKeys);
2965
- const rentToExempt = await this.connection.getMinimumBalanceForRentExemption(METADATA_ACC_SIZE);
2966
- const createMetadataInstruction = web3_js.SystemProgram.createAccount({
2967
- programId: this.programId,
2968
- space: METADATA_ACC_SIZE,
2969
- lamports: rentToExempt,
2970
- fromPubkey: sender.publicKey,
2971
- newAccountPubkey: metadataPubKey
2972
- });
3308
+ let metadata;
3309
+ let metadataPubKey;
3310
+ if (nonce != null) {
3311
+ [metadataPubKey] = deriveStreamMetadataPDA(this.programId, mintPublicKey, sender.publicKey, nonce);
3312
+ } else {
3313
+ ({ metadata, metadataPubKey } = this.getOrCreateStreamMetadata(metadataPubKeys));
3314
+ }
2973
3315
  const [escrowTokens] = web3_js.PublicKey.findProgramAddressSync(
2974
3316
  [buffer.Buffer.from("strm"), metadataPubKey.toBuffer()],
2975
3317
  this.programId
@@ -2986,43 +3328,58 @@ var SolanaStreamClient = class {
2986
3328
  const totalAmount = calculateTotalAmountToDeposit(depositedAmount, totalFee);
2987
3329
  ixs.push(...await common.prepareWrappedAccount(this.connection, sender.publicKey, totalAmount));
2988
3330
  }
2989
- const createInstruction = await createUncheckedStreamInstruction(
2990
- {
2991
- start: new BN3__default.default(start),
2992
- depositedAmount,
2993
- period: new BN3__default.default(period),
2994
- amountPerPeriod,
2995
- cliff: new BN3__default.default(cliff),
2996
- cliffAmount: new BN3__default.default(cliffAmount),
2997
- cancelableBySender,
2998
- cancelableByRecipient,
2999
- automaticWithdrawal,
3000
- transferableBySender,
3001
- transferableByRecipient,
3002
- canTopup,
3003
- canUpdateRate: !!canUpdateRate,
3004
- canPause: !!canPause,
3005
- name,
3006
- withdrawFrequency: new BN3__default.default(automaticWithdrawal ? withdrawalFrequency : period),
3007
- recipient: recipientPublicKey,
3008
- partner: partnerPublicKey
3009
- },
3010
- this.programId,
3011
- {
3012
- sender: sender.publicKey,
3013
- senderTokens,
3014
- metadata: metadataPubKey,
3015
- escrowTokens,
3016
- mint: new web3_js.PublicKey(mint),
3017
- feeOracle: this.feeOraclePublicKey,
3018
- rent: web3_js.SYSVAR_RENT_PUBKEY,
3019
- timelockProgram: this.programId,
3020
- tokenProgram: tokenProgramId,
3021
- withdrawor: WITHDRAWOR_PUBLIC_KEY,
3022
- systemProgram: web3_js.SystemProgram.programId
3023
- }
3024
- );
3025
- ixs.push(createMetadataInstruction, createInstruction);
3331
+ const accounts = {
3332
+ sender: sender.publicKey,
3333
+ senderTokens,
3334
+ metadata: metadataPubKey,
3335
+ escrowTokens,
3336
+ mint: new web3_js.PublicKey(mint),
3337
+ feeOracle: this.feeOraclePublicKey,
3338
+ rent: web3_js.SYSVAR_RENT_PUBKEY,
3339
+ timelockProgram: this.programId,
3340
+ tokenProgram: tokenProgramId,
3341
+ withdrawor: WITHDRAWOR_PUBLIC_KEY,
3342
+ systemProgram: web3_js.SystemProgram.programId
3343
+ };
3344
+ const baseData = {
3345
+ start: new BN3__default.default(start),
3346
+ depositedAmount,
3347
+ period: new BN3__default.default(period),
3348
+ amountPerPeriod,
3349
+ cliff: new BN3__default.default(cliff),
3350
+ cliffAmount: new BN3__default.default(cliffAmount),
3351
+ cancelableBySender,
3352
+ cancelableByRecipient,
3353
+ automaticWithdrawal,
3354
+ transferableBySender,
3355
+ transferableByRecipient,
3356
+ canTopup,
3357
+ canUpdateRate: !!canUpdateRate,
3358
+ canPause: !!canPause,
3359
+ name,
3360
+ withdrawFrequency: new BN3__default.default(automaticWithdrawal ? withdrawalFrequency : period),
3361
+ recipient: recipientPublicKey,
3362
+ partner: partnerPublicKey
3363
+ };
3364
+ if (nonce != null) {
3365
+ const createInstruction = await createUncheckedStreamV2Instruction(
3366
+ { ...baseData, nonce },
3367
+ this.programId,
3368
+ accounts
3369
+ );
3370
+ ixs.push(createInstruction);
3371
+ } else {
3372
+ const rentToExempt = await this.connection.getMinimumBalanceForRentExemption(METADATA_ACC_SIZE);
3373
+ const createMetadataInstruction = web3_js.SystemProgram.createAccount({
3374
+ programId: this.programId,
3375
+ space: METADATA_ACC_SIZE,
3376
+ lamports: rentToExempt,
3377
+ fromPubkey: sender.publicKey,
3378
+ newAccountPubkey: metadataPubKey
3379
+ });
3380
+ const createInstruction = await createUncheckedStreamInstruction(baseData, this.programId, accounts);
3381
+ ixs.push(createMetadataInstruction, createInstruction);
3382
+ }
3026
3383
  return { ixs, metadata, metadataPubKey };
3027
3384
  }
3028
3385
  /**
@@ -3364,7 +3721,7 @@ var SolanaStreamClient = class {
3364
3721
  throw new Error("Impossible to cancel a stream contract that does not exist");
3365
3722
  }
3366
3723
  const decoded = decodeStream(account.data);
3367
- const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, decoded.sender, decoded.oldMetadata);
3724
+ const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, decoded.sender);
3368
3725
  const ixs = isAlignedUnlock ? await this.prepareCancelAlignedUnlockInstructions(cancelData, extParams) : await this.prepareCancelLinearStream(cancelData, extParams);
3369
3726
  return ixs;
3370
3727
  }
@@ -3600,17 +3957,21 @@ var SolanaStreamClient = class {
3600
3957
  }
3601
3958
  ]
3602
3959
  });
3603
- if (migrated.length === 0) {
3604
- throw new Error("Couldn't get account info.");
3960
+ if (migrated.length > 0) {
3961
+ return this.decodeStreamAccount(migrated[0].pubkey, migrated[0].account.data);
3962
+ }
3963
+ try {
3964
+ const contract = await this.apiClient.getContract(id);
3965
+ return await transformContract(contract);
3966
+ } catch (cause) {
3967
+ throw new Error(`Couldn't get account info from chain or Tabularium`, { cause });
3605
3968
  }
3606
- return this.decodeStreamAccount(migrated[0].pubkey, migrated[0].account.data);
3607
3969
  }
3608
3970
  async decodeStreamAccount(pubkey, data) {
3609
3971
  const stream = decodeStream(data);
3610
- const metadataKey = getMetadataKey(pubkey, stream.oldMetadata);
3611
- if (this.isAlignedUnlock(pubkey, stream.sender, stream.oldMetadata)) {
3972
+ if (this.isAlignedUnlock(pubkey, stream.sender)) {
3612
3973
  const alignedProxy = await this.alignedProxyProgram.account.contract.fetch(
3613
- deriveContractPDA(this.alignedProxyProgram.programId, metadataKey)
3974
+ deriveContractPDA(this.alignedProxyProgram.programId, pubkey)
3614
3975
  );
3615
3976
  if (!alignedProxy) {
3616
3977
  throw new Error("Couldn't get proxy account info.");
@@ -3651,9 +4012,7 @@ var SolanaStreamClient = class {
3651
4012
  const streams = {};
3652
4013
  const alignedStreamsPubKeys = Object.keys(streamRecord);
3653
4014
  const alignedProxyPDAs = alignedStreamsPubKeys.map((streamPubKey) => {
3654
- const pubkey = new web3_js.PublicKey(streamPubKey);
3655
- const metadataKey = getMetadataKey(pubkey, streamRecord[streamPubKey].oldMetadata);
3656
- return deriveContractPDA(this.alignedProxyProgram.programId, metadataKey);
4015
+ return deriveContractPDA(this.alignedProxyProgram.programId, new web3_js.PublicKey(streamPubKey));
3657
4016
  });
3658
4017
  const alignedProxyAccounts = await common.getMultipleAccountsInfoBatched(this.connection, alignedProxyPDAs);
3659
4018
  alignedProxyAccounts.forEach((account, index) => {
@@ -3676,7 +4035,8 @@ var SolanaStreamClient = class {
3676
4035
  async get({
3677
4036
  address,
3678
4037
  type = "all" /* All */,
3679
- direction = "all" /* All */
4038
+ direction = "all" /* All */,
4039
+ filters
3680
4040
  }) {
3681
4041
  const publicKey = new web3_js.PublicKey(address);
3682
4042
  let streams = {};
@@ -3706,7 +4066,7 @@ var SolanaStreamClient = class {
3706
4066
  const allIncomingStreams = allIncomingAccounts.map((account) => decodeStream(account.account.data));
3707
4067
  const alignedDecoded = {};
3708
4068
  allIncomingAccounts.forEach((account, index) => {
3709
- if (this.isAlignedUnlock(account.pubkey, allIncomingStreams[index].sender, allIncomingStreams[index].oldMetadata)) {
4069
+ if (this.isAlignedUnlock(account.pubkey, allIncomingStreams[index].sender)) {
3710
4070
  alignedDecoded[account.pubkey.toBase58()] = allIncomingStreams[index];
3711
4071
  } else {
3712
4072
  streams[account.pubkey.toBase58()] = new Contract(allIncomingStreams[index]);
@@ -3717,6 +4077,10 @@ var SolanaStreamClient = class {
3717
4077
  streams = { ...streams, ...incomingAlignedStreams };
3718
4078
  }
3719
4079
  }
4080
+ if (filters?.closed) {
4081
+ const closedStreams = await this.getClosedStreams(address, direction);
4082
+ streams = { ...streams, ...closedStreams };
4083
+ }
3720
4084
  const sortedStreams = Object.entries(streams).sort(([, stream1], [, stream2]) => stream2.start - stream1.start);
3721
4085
  if (type === "all" /* All */) return sortedStreams;
3722
4086
  return sortedStreams.filter((stream) => stream[1].type === type);
@@ -3751,9 +4115,8 @@ var SolanaStreamClient = class {
3751
4115
  collectAlignedEntries(decoded) {
3752
4116
  const entries = [];
3753
4117
  decoded.forEach(({ pubkey, stream }, index) => {
3754
- if (this.isAlignedUnlock(pubkey, stream.sender, stream.oldMetadata)) {
3755
- const metadataKey = getMetadataKey(pubkey, stream.oldMetadata);
3756
- entries.push({ index, pda: deriveContractPDA(this.alignedProxyProgram.programId, metadataKey) });
4118
+ if (this.isAlignedUnlock(pubkey, stream.sender)) {
4119
+ entries.push({ index, pda: deriveContractPDA(this.alignedProxyProgram.programId, pubkey) });
3757
4120
  }
3758
4121
  });
3759
4122
  return entries;
@@ -3814,7 +4177,7 @@ var SolanaStreamClient = class {
3814
4177
  const escrow = await this.connection.getAccountInfo(streamPublicKey);
3815
4178
  common.invariant(escrow, "Couldn't get account info");
3816
4179
  const decoded = decodeStream(escrow.data);
3817
- const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, decoded.sender, decoded.oldMetadata);
4180
+ const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, decoded.sender);
3818
4181
  if (isAlignedUnlock && (data.enableAutomaticWithdrawal !== void 0 || data.amountPerPeriod !== void 0)) {
3819
4182
  throw new Error("Automatic withdrawal and rate update are not possible in price-based vesting!");
3820
4183
  }
@@ -3908,9 +4271,8 @@ var SolanaStreamClient = class {
3908
4271
  * Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA.
3909
4272
  * For migrated streams, the PDA was derived from the old metadata key.
3910
4273
  */
3911
- isAlignedUnlock(streamPublicKey, senderPublicKey, oldMetadata) {
3912
- const metadataKey = oldMetadata ? getMetadataKey(streamPublicKey, oldMetadata) : streamPublicKey;
3913
- const pda = deriveContractPDA(this.alignedProxyProgram.programId, metadataKey);
4274
+ isAlignedUnlock(streamPublicKey, senderPublicKey) {
4275
+ const pda = deriveContractPDA(this.alignedProxyProgram.programId, streamPublicKey);
3914
4276
  return senderPublicKey.equals(pda);
3915
4277
  }
3916
4278
  async flatBuildCreateMultipleTransactionInstructions(data, extParams) {
@@ -3928,6 +4290,40 @@ var SolanaStreamClient = class {
3928
4290
  )
3929
4291
  };
3930
4292
  }
4293
+ /**
4294
+ * Gets closed streams for a given owner and direction
4295
+ * @param owner - Owner address
4296
+ * @param direction - Stream direction
4297
+ * @returns Record of closed streams
4298
+ */
4299
+ async getClosedStreams(owner, direction = "all" /* All */) {
4300
+ const streams = {};
4301
+ try {
4302
+ const tabulariumContracts = await this.apiClient.getContracts({
4303
+ sender: direction !== "incoming" /* Incoming */ ? owner : void 0,
4304
+ recipient: direction !== "outgoing" /* Outgoing */ ? owner : void 0
4305
+ });
4306
+ for (const contract of tabulariumContracts) {
4307
+ if (!streams[contract.address]) {
4308
+ try {
4309
+ const transformed = await transformContract(contract);
4310
+ streams[contract.address] = transformed;
4311
+ } catch (cause) {
4312
+ if (common.isDev) {
4313
+ throw new Error(`Failed to transform contract ${contract.address}:`, { cause });
4314
+ }
4315
+ console.warn(new Error(`Failed to transform contract ${contract.address}:`, { cause }));
4316
+ }
4317
+ }
4318
+ }
4319
+ } catch (cause) {
4320
+ if (common.isDev) {
4321
+ throw new Error("Failed to get data from the service", { cause });
4322
+ }
4323
+ console.warn(new Error("Failed to get data from the service", { cause }));
4324
+ }
4325
+ return streams;
4326
+ }
3931
4327
  /**
3932
4328
  * Utility function to generate metadata for a Contract or return existing Pubkey
3933
4329
  */
@@ -4422,6 +4818,7 @@ exports.ESCROW_SEED = ESCROW_SEED;
4422
4818
  exports.FEES_METADATA_SEED = FEES_METADATA_SEED;
4423
4819
  exports.FEE_ORACLE_PUBLIC_KEY = FEE_ORACLE_PUBLIC_KEY;
4424
4820
  exports.MAX_SAFE_UNIX_TIME_VALUE = MAX_SAFE_UNIX_TIME_VALUE2;
4821
+ exports.METADATA_SEED = METADATA_SEED;
4425
4822
  exports.ORIGINAL_CONTRACT_SENDER_OFFSET = ORIGINAL_CONTRACT_SENDER_OFFSET;
4426
4823
  exports.PARTNERS_SCHEMA = PARTNERS_SCHEMA;
4427
4824
  exports.PARTNER_ORACLE_PROGRAM_ID = PARTNER_ORACLE_PROGRAM_ID;
@@ -4450,13 +4847,17 @@ exports.buildStreamType = buildStreamType;
4450
4847
  exports.calculateTotalAmountToDeposit = calculateTotalAmountToDeposit;
4451
4848
  exports.calculateUnlockedAmount = calculateUnlockedAmount;
4452
4849
  exports.cancelStreamInstruction = cancelStreamInstruction;
4850
+ exports.createClient = createClient;
4453
4851
  exports.createStreamInstruction = createStreamInstruction;
4852
+ exports.createStreamV2Instruction = createStreamV2Instruction;
4454
4853
  exports.createUncheckedStreamInstruction = createUncheckedStreamInstruction;
4854
+ exports.createUncheckedStreamV2Instruction = createUncheckedStreamV2Instruction;
4455
4855
  exports.decodeEndTime = decodeEndTime;
4456
4856
  exports.decodeStream = decodeStream;
4457
4857
  exports.deriveContractPDA = deriveContractPDA;
4458
4858
  exports.deriveEscrowPDA = deriveEscrowPDA;
4459
4859
  exports.deriveRepopulatedMetadataPDA = deriveRepopulatedMetadataPDA;
4860
+ exports.deriveStreamMetadataPDA = deriveStreamMetadataPDA;
4460
4861
  exports.deriveTestOraclePDA = deriveTestOraclePDA;
4461
4862
  exports.extractSolanaErrorCode = extractSolanaErrorCode;
4462
4863
  exports.getMetadataKey = getMetadataKey;
@@ -4472,6 +4873,7 @@ exports.signAllTransactionWithRecipients = signAllTransactionWithRecipients;
4472
4873
  exports.timelockIDL = timelockIDL_default;
4473
4874
  exports.topupStreamInstruction = topupStreamInstruction;
4474
4875
  exports.transferStreamInstruction = transferStreamInstruction;
4876
+ exports.transformContract = transformContract;
4475
4877
  exports.updateStreamInstruction = updateStreamInstruction;
4476
4878
  exports.withdrawStreamInstruction = withdrawStreamInstruction;
4477
4879
  //# sourceMappingURL=index.cjs.map