@streamflow/stream 13.3.1 → 13.4.0
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.
- package/dist/cjs/{index-B2NHAfM3.d.cts → index-BqHEM38f.d.cts} +1 -0
- package/dist/cjs/index.cjs +36 -10
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -2
- package/dist/cjs/solana/api/index.cjs +34 -10
- package/dist/cjs/solana/api/index.cjs.map +1 -1
- package/dist/cjs/solana/api/index.d.cts +1 -1
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.d.cts +11 -0
- package/dist/cjs/solana/index.cjs +36 -10
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +15 -3
- package/dist/esm/{index-aMPWxsk6.d.ts → index-CYAitoQO.d.ts} +1 -0
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +108 -84
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/api/index.d.ts +1 -1
- package/dist/esm/solana/api/index.js +107 -83
- package/dist/esm/solana/api/index.js.map +1 -1
- package/dist/esm/solana/descriptor/idl/streamflow_aligned_unlocks.json +12 -1
- package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.d.ts +11 -0
- package/dist/esm/solana/index.d.ts +15 -3
- package/dist/esm/solana/index.js +108 -84
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { k as BatchCreationItem, l as BatchExecuteResult, m as BatchInstructionResult, p as BuildTransactionFn, q as BuildTransactionOptions, r as BuiltTransaction, C as CancelFn, w as CreateBatchFn, x as CreateFn, y as CreateInstructionResult, F as Env, G as ExecuteBatchFn, H as ExecuteBatchSequentialFn, J as ExecuteFn, K as ExecutionEnv, T as ICreateLockBatchParams, U as ICreateLockParams, a0 as ICreateVestingBatchParams, a1 as ICreateVestingParams, a8 as ILockBatchRecipient, aj as IVestingBatchRecipient, am as InstructionResult, an as Invoker, aq as NativeOptions, at as SignFn, az as TopupFn, aB as TransferFn, aC as UpdateFn, aE as WithdrawFn, aF as buildLockBatchParams, aG as buildLockParams, aH as buildTransaction, aI as buildVestingBatchParams, aJ as buildVestingParams, aK as cancel, aL as computeAmountPerPeriod, aM as create, aN as createBatch, aO as createClientFromEnv, aP as createLock, aQ as createLockBatch, aR as createVesting, aS as createVestingBatch, aT as execute, aU as executeBatch, aV as executeBatchSequential, aW as resolveConnection, aX as resolveDuration, aY as sign, aZ as topup, a_ as transfer, a$ as update, b0 as withdraw } from '../../index-
|
|
1
|
+
export { k as BatchCreationItem, l as BatchExecuteResult, m as BatchInstructionResult, p as BuildTransactionFn, q as BuildTransactionOptions, r as BuiltTransaction, C as CancelFn, w as CreateBatchFn, x as CreateFn, y as CreateInstructionResult, F as Env, G as ExecuteBatchFn, H as ExecuteBatchSequentialFn, J as ExecuteFn, K as ExecutionEnv, T as ICreateLockBatchParams, U as ICreateLockParams, a0 as ICreateVestingBatchParams, a1 as ICreateVestingParams, a8 as ILockBatchRecipient, aj as IVestingBatchRecipient, am as InstructionResult, an as Invoker, aq as NativeOptions, at as SignFn, az as TopupFn, aB as TransferFn, aC as UpdateFn, aE as WithdrawFn, aF as buildLockBatchParams, aG as buildLockParams, aH as buildTransaction, aI as buildVestingBatchParams, aJ as buildVestingParams, aK as cancel, aL as computeAmountPerPeriod, aM as create, aN as createBatch, aO as createClientFromEnv, aP as createLock, aQ as createLockBatch, aR as createVesting, aS as createVestingBatch, aT as execute, aU as executeBatch, aV as executeBatchSequential, aW as resolveConnection, aX as resolveDuration, aY as sign, aZ as topup, a_ as transfer, a$ as update, b0 as withdraw } from '../../index-CYAitoQO.js';
|
|
2
2
|
import '@solana/wallet-adapter-base';
|
|
3
3
|
import '@solana/web3.js';
|
|
4
4
|
import '@streamflow/common';
|
|
@@ -2,7 +2,7 @@ import { PublicKey, Connection, Keypair, SystemProgram, TransactionMessage, Vers
|
|
|
2
2
|
import { ICluster, prepareBaseInstructions, prepareTransaction, executeTransaction, executeMultipleTransactions, buildSendThrottler, assertHasPublicKey, prepareWrappedAccount, signAndExecuteTransaction, invariant, getMintAndProgram, ata, getBN, createVersionedTransaction, getMultipleAccountsInfoBatched, getProgramAccounts, isDev, checkOrCreateAtaBatch, pk, isSignerKeypair, isSignerWallet, getNumberFromBN } from '@streamflow/common';
|
|
3
3
|
import BN3 from 'bn.js';
|
|
4
4
|
import bs58 from 'bs58';
|
|
5
|
-
import { Buffer } from 'buffer';
|
|
5
|
+
import { Buffer as Buffer$1 } from 'buffer';
|
|
6
6
|
import { NATIVE_MINT, TOKEN_2022_PROGRAM_ID, getTransferHook, addExtraAccountMetasForExecute, ASSOCIATED_TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
|
7
7
|
import * as borsh from 'borsh';
|
|
8
8
|
import { Program } from '@coral-xyz/anchor';
|
|
@@ -197,15 +197,15 @@ var FEE_ORACLE_PUBLIC_KEY = {
|
|
|
197
197
|
[ICluster.Local]: "Aa2JJfFzUN3V54DXUHRBJowFw416xfZHpPk9DaNy3iYs"
|
|
198
198
|
};
|
|
199
199
|
var ALIGNED_COMPUTE_LIMIT = 3e5;
|
|
200
|
-
var CONTRACT_SEED = Buffer.from("contract", "utf-8");
|
|
201
|
-
var ESCROW_SEED = Buffer.from("strm", "utf-8");
|
|
202
|
-
var TEST_ORACLE_SEED = Buffer.from("test-oracle", "utf-8");
|
|
203
|
-
var METADATA_SEED = Buffer.from("strm-met", "utf-8");
|
|
204
|
-
Buffer.from("strm-rep", "utf-8");
|
|
200
|
+
var CONTRACT_SEED = Buffer$1.from("contract", "utf-8");
|
|
201
|
+
var ESCROW_SEED = Buffer$1.from("strm", "utf-8");
|
|
202
|
+
var TEST_ORACLE_SEED = Buffer$1.from("test-oracle", "utf-8");
|
|
203
|
+
var METADATA_SEED = Buffer$1.from("strm-met", "utf-8");
|
|
204
|
+
Buffer$1.from("strm-rep", "utf-8");
|
|
205
205
|
var STREAMFLOW_TREASURY_PUBLIC_KEY = new PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
|
|
206
206
|
var WITHDRAWOR = "wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u";
|
|
207
207
|
var WITHDRAWOR_PUBLIC_KEY = new PublicKey(WITHDRAWOR);
|
|
208
|
-
Buffer.from("strm_fees");
|
|
208
|
+
Buffer$1.from("strm_fees");
|
|
209
209
|
var DEFAULT_CREATION_FEE_SOL = 9e7;
|
|
210
210
|
var DEFAULT_AUTO_CLAIM_FEE_SOL = 19e7;
|
|
211
211
|
var DEFAULT_STREAMFLOW_FEE = 0.19;
|
|
@@ -448,7 +448,13 @@ var encodeUpdateStream = (values, data) => {
|
|
|
448
448
|
structs.push(BufferLayout.u8("cancelable_by_sender_exists"));
|
|
449
449
|
structs.push(BufferLayout.u8("cancelable_by_sender"));
|
|
450
450
|
} else {
|
|
451
|
-
structs.push(BufferLayout.u8("
|
|
451
|
+
structs.push(BufferLayout.u8("cancelable_by_sender_exists"));
|
|
452
|
+
}
|
|
453
|
+
if (values.stream_name) {
|
|
454
|
+
structs.push(BufferLayout.u8("stream_name_exists"));
|
|
455
|
+
structs.push(BufferLayout.blob(64, "stream_name"));
|
|
456
|
+
} else {
|
|
457
|
+
structs.push(BufferLayout.u8("stream_name_exists"));
|
|
452
458
|
}
|
|
453
459
|
return BufferLayout.struct(structs).encode(
|
|
454
460
|
{
|
|
@@ -463,7 +469,9 @@ var encodeUpdateStream = (values, data) => {
|
|
|
463
469
|
transferable_by_recipient_exists: values.transferable_by_recipient !== void 0 ? 1 : 0,
|
|
464
470
|
transferable_by_recipient: values.transferable_by_recipient ?? 0,
|
|
465
471
|
cancelable_by_sender_exists: values.cancelable_by_sender !== void 0 ? 1 : 0,
|
|
466
|
-
cancelable_by_sender: values.cancelable_by_sender ?? 0
|
|
472
|
+
cancelable_by_sender: values.cancelable_by_sender ?? 0,
|
|
473
|
+
stream_name_exists: values.stream_name ? 1 : 0,
|
|
474
|
+
stream_name: values.stream_name ?? 0
|
|
467
475
|
},
|
|
468
476
|
data
|
|
469
477
|
);
|
|
@@ -480,6 +488,13 @@ var calculateTotalAmountToDeposit = (depositedAmount, totalFee) => {
|
|
|
480
488
|
const totalFeeNormalized = new BN3(totalFee * FEE_NORMALIZER);
|
|
481
489
|
return depositedAmount.mul(totalFeeNormalized.add(FEE_MULTIPLIER)).div(FEE_MULTIPLIER);
|
|
482
490
|
};
|
|
491
|
+
var encodeStreamName = (name) => {
|
|
492
|
+
const encoded = new TextEncoder().encode(name);
|
|
493
|
+
return Buffer.alloc(64).fill(encoded, 0, encoded.byteLength);
|
|
494
|
+
};
|
|
495
|
+
var encodeStreamNameAsArray = (name) => {
|
|
496
|
+
return Array.from(encodeStreamName(name));
|
|
497
|
+
};
|
|
483
498
|
var decodeStream = (buf) => {
|
|
484
499
|
const raw = streamLayout.decode(buf);
|
|
485
500
|
return {
|
|
@@ -622,16 +637,14 @@ var createStreamInstruction = async (data, programId, accounts) => {
|
|
|
622
637
|
if (accounts.partnerLink) {
|
|
623
638
|
keys.push({ pubkey: accounts.partnerLink.pubkey, isSigner: accounts.partnerLink.isSigner, isWritable: false });
|
|
624
639
|
}
|
|
625
|
-
let bufferData = Buffer.alloc(createStreamLayout.span);
|
|
626
|
-
const encodedUIntArray = new TextEncoder().encode(data.name);
|
|
627
|
-
const streamNameBuffer = Buffer.alloc(64).fill(encodedUIntArray, 0, encodedUIntArray.byteLength);
|
|
640
|
+
let bufferData = Buffer$1.alloc(createStreamLayout.span);
|
|
628
641
|
const decodedData = {
|
|
629
|
-
start_time: data.start.toArrayLike(Buffer, "le", 8),
|
|
630
|
-
net_amount_deposited: data.depositedAmount.toArrayLike(Buffer, "le", 8),
|
|
631
|
-
period: data.period.toArrayLike(Buffer, "le", 8),
|
|
632
|
-
amount_per_period: data.amountPerPeriod.toArrayLike(Buffer, "le", 8),
|
|
633
|
-
cliff: data.cliff.toArrayLike(Buffer, "le", 8),
|
|
634
|
-
cliff_amount: data.cliffAmount.toArrayLike(Buffer, "le", 8),
|
|
642
|
+
start_time: data.start.toArrayLike(Buffer$1, "le", 8),
|
|
643
|
+
net_amount_deposited: data.depositedAmount.toArrayLike(Buffer$1, "le", 8),
|
|
644
|
+
period: data.period.toArrayLike(Buffer$1, "le", 8),
|
|
645
|
+
amount_per_period: data.amountPerPeriod.toArrayLike(Buffer$1, "le", 8),
|
|
646
|
+
cliff: data.cliff.toArrayLike(Buffer$1, "le", 8),
|
|
647
|
+
cliff_amount: data.cliffAmount.toArrayLike(Buffer$1, "le", 8),
|
|
635
648
|
cancelable_by_sender: Number(data.cancelableBySender),
|
|
636
649
|
cancelable_by_recipient: Number(data.cancelableByRecipient),
|
|
637
650
|
automatic_withdrawal: Number(data.automaticWithdrawal),
|
|
@@ -642,15 +655,15 @@ var createStreamInstruction = async (data, programId, accounts) => {
|
|
|
642
655
|
can_update_rate: Number(data.canUpdateRate),
|
|
643
656
|
_can_update_rate_discriminator: 1,
|
|
644
657
|
pausable: Number(data.canPause),
|
|
645
|
-
stream_name:
|
|
646
|
-
withdraw_frequency: data.withdrawFrequency.toArrayLike(Buffer, "le", 8)
|
|
658
|
+
stream_name: encodeStreamName(data.name),
|
|
659
|
+
withdraw_frequency: data.withdrawFrequency.toArrayLike(Buffer$1, "le", 8)
|
|
647
660
|
};
|
|
648
661
|
const encodeLength = createStreamLayout.encode(decodedData, bufferData);
|
|
649
662
|
bufferData = bufferData.slice(0, encodeLength);
|
|
650
|
-
bufferData = Buffer.concat([
|
|
651
|
-
Buffer.from(await sha256.digest("global:create")).slice(0, 8),
|
|
663
|
+
bufferData = Buffer$1.concat([
|
|
664
|
+
Buffer$1.from(await sha256.digest("global:create")).slice(0, 8),
|
|
652
665
|
bufferData,
|
|
653
|
-
Buffer.alloc(10)
|
|
666
|
+
Buffer$1.alloc(10)
|
|
654
667
|
]);
|
|
655
668
|
return new TransactionInstruction({
|
|
656
669
|
keys,
|
|
@@ -682,16 +695,16 @@ var createUncheckedStreamInstruction = async (data, programId, accounts) => {
|
|
|
682
695
|
isWritable: true
|
|
683
696
|
});
|
|
684
697
|
}
|
|
685
|
-
let bufferData = Buffer.alloc(createUncheckedStreamLayout.span);
|
|
698
|
+
let bufferData = Buffer$1.alloc(createUncheckedStreamLayout.span);
|
|
686
699
|
const encodedUIntArray = new TextEncoder().encode(data.name);
|
|
687
|
-
const streamNameBuffer = Buffer.alloc(64).fill(encodedUIntArray, 0, encodedUIntArray.byteLength);
|
|
700
|
+
const streamNameBuffer = Buffer$1.alloc(64).fill(encodedUIntArray, 0, encodedUIntArray.byteLength);
|
|
688
701
|
const decodedData = {
|
|
689
|
-
start_time: data.start.toArrayLike(Buffer, "le", 8),
|
|
690
|
-
net_amount_deposited: data.depositedAmount.toArrayLike(Buffer, "le", 8),
|
|
691
|
-
period: data.period.toArrayLike(Buffer, "le", 8),
|
|
692
|
-
amount_per_period: data.amountPerPeriod.toArrayLike(Buffer, "le", 8),
|
|
693
|
-
cliff: data.cliff.toArrayLike(Buffer, "le", 8),
|
|
694
|
-
cliff_amount: data.cliffAmount.toArrayLike(Buffer, "le", 8),
|
|
702
|
+
start_time: data.start.toArrayLike(Buffer$1, "le", 8),
|
|
703
|
+
net_amount_deposited: data.depositedAmount.toArrayLike(Buffer$1, "le", 8),
|
|
704
|
+
period: data.period.toArrayLike(Buffer$1, "le", 8),
|
|
705
|
+
amount_per_period: data.amountPerPeriod.toArrayLike(Buffer$1, "le", 8),
|
|
706
|
+
cliff: data.cliff.toArrayLike(Buffer$1, "le", 8),
|
|
707
|
+
cliff_amount: data.cliffAmount.toArrayLike(Buffer$1, "le", 8),
|
|
695
708
|
cancelable_by_sender: Number(data.cancelableBySender),
|
|
696
709
|
cancelable_by_recipient: Number(data.cancelableByRecipient),
|
|
697
710
|
automatic_withdrawal: Number(data.automaticWithdrawal),
|
|
@@ -699,7 +712,7 @@ var createUncheckedStreamInstruction = async (data, programId, accounts) => {
|
|
|
699
712
|
transferable_by_recipient: Number(data.transferableByRecipient),
|
|
700
713
|
can_topup: Number(data.canTopup),
|
|
701
714
|
stream_name: streamNameBuffer,
|
|
702
|
-
withdraw_frequency: data.withdrawFrequency.toArrayLike(Buffer, "le", 8),
|
|
715
|
+
withdraw_frequency: data.withdrawFrequency.toArrayLike(Buffer$1, "le", 8),
|
|
703
716
|
recipient: data.recipient.toBuffer(),
|
|
704
717
|
partner: data.partner.toBuffer(),
|
|
705
718
|
pausable: Number(data.canPause),
|
|
@@ -708,7 +721,7 @@ var createUncheckedStreamInstruction = async (data, programId, accounts) => {
|
|
|
708
721
|
const encodeLength = createUncheckedStreamLayout.encode(decodedData, bufferData);
|
|
709
722
|
bufferData = bufferData.slice(0, encodeLength);
|
|
710
723
|
const digest = accounts.payer ? await sha256.digest("global:create_unchecked_with_payer") : await sha256.digest("global:create_unchecked");
|
|
711
|
-
bufferData = Buffer.concat([Buffer.from(digest).slice(0, 8), bufferData, Buffer.alloc(10)]);
|
|
724
|
+
bufferData = Buffer$1.concat([Buffer$1.from(digest).slice(0, 8), bufferData, Buffer$1.alloc(10)]);
|
|
712
725
|
return new TransactionInstruction({
|
|
713
726
|
keys,
|
|
714
727
|
programId,
|
|
@@ -751,18 +764,18 @@ var createStreamV2Instruction = async (data, programId, accounts) => {
|
|
|
751
764
|
if (accounts.partnerLink) {
|
|
752
765
|
keys.push({ pubkey: accounts.partnerLink.pubkey, isSigner: accounts.partnerLink.isSigner, isWritable: false });
|
|
753
766
|
}
|
|
754
|
-
let bufferData = Buffer.alloc(createStreamV2Layout.span);
|
|
767
|
+
let bufferData = Buffer$1.alloc(createStreamV2Layout.span);
|
|
755
768
|
const encodedUIntArray = new TextEncoder().encode(data.name);
|
|
756
|
-
const streamNameBuffer = Buffer.alloc(64).fill(encodedUIntArray, 0, encodedUIntArray.byteLength);
|
|
757
|
-
const nonceBuffer = Buffer.alloc(4);
|
|
769
|
+
const streamNameBuffer = Buffer$1.alloc(64).fill(encodedUIntArray, 0, encodedUIntArray.byteLength);
|
|
770
|
+
const nonceBuffer = Buffer$1.alloc(4);
|
|
758
771
|
nonceBuffer.writeUInt32LE(data.nonce);
|
|
759
772
|
const decodedData = {
|
|
760
|
-
start_time: data.start.toArrayLike(Buffer, "le", 8),
|
|
761
|
-
net_amount_deposited: data.depositedAmount.toArrayLike(Buffer, "le", 8),
|
|
762
|
-
period: data.period.toArrayLike(Buffer, "le", 8),
|
|
763
|
-
amount_per_period: data.amountPerPeriod.toArrayLike(Buffer, "le", 8),
|
|
764
|
-
cliff: data.cliff.toArrayLike(Buffer, "le", 8),
|
|
765
|
-
cliff_amount: data.cliffAmount.toArrayLike(Buffer, "le", 8),
|
|
773
|
+
start_time: data.start.toArrayLike(Buffer$1, "le", 8),
|
|
774
|
+
net_amount_deposited: data.depositedAmount.toArrayLike(Buffer$1, "le", 8),
|
|
775
|
+
period: data.period.toArrayLike(Buffer$1, "le", 8),
|
|
776
|
+
amount_per_period: data.amountPerPeriod.toArrayLike(Buffer$1, "le", 8),
|
|
777
|
+
cliff: data.cliff.toArrayLike(Buffer$1, "le", 8),
|
|
778
|
+
cliff_amount: data.cliffAmount.toArrayLike(Buffer$1, "le", 8),
|
|
766
779
|
cancelable_by_sender: Number(data.cancelableBySender),
|
|
767
780
|
cancelable_by_recipient: Number(data.cancelableByRecipient),
|
|
768
781
|
automatic_withdrawal: Number(data.automaticWithdrawal),
|
|
@@ -770,17 +783,17 @@ var createStreamV2Instruction = async (data, programId, accounts) => {
|
|
|
770
783
|
transferable_by_recipient: Number(data.transferableByRecipient),
|
|
771
784
|
can_topup: Number(data.canTopup),
|
|
772
785
|
stream_name: streamNameBuffer,
|
|
773
|
-
withdraw_frequency: data.withdrawFrequency.toArrayLike(Buffer, "le", 8),
|
|
786
|
+
withdraw_frequency: data.withdrawFrequency.toArrayLike(Buffer$1, "le", 8),
|
|
774
787
|
pausable: Number(data.canPause),
|
|
775
788
|
can_update_rate: Number(data.canUpdateRate),
|
|
776
789
|
nonce: nonceBuffer
|
|
777
790
|
};
|
|
778
791
|
const encodeLength = createStreamV2Layout.encode(decodedData, bufferData);
|
|
779
792
|
bufferData = bufferData.slice(0, encodeLength);
|
|
780
|
-
bufferData = Buffer.concat([
|
|
781
|
-
Buffer.from(await sha256.digest("global:create_v2")).slice(0, 8),
|
|
793
|
+
bufferData = Buffer$1.concat([
|
|
794
|
+
Buffer$1.from(await sha256.digest("global:create_v2")).slice(0, 8),
|
|
782
795
|
bufferData,
|
|
783
|
-
Buffer.alloc(10)
|
|
796
|
+
Buffer$1.alloc(10)
|
|
784
797
|
]);
|
|
785
798
|
return new TransactionInstruction({
|
|
786
799
|
keys,
|
|
@@ -812,18 +825,18 @@ var createUncheckedStreamV2Instruction = async (data, programId, accounts) => {
|
|
|
812
825
|
isWritable: true
|
|
813
826
|
});
|
|
814
827
|
}
|
|
815
|
-
let bufferData = Buffer.alloc(createUncheckedStreamV2Layout.span);
|
|
828
|
+
let bufferData = Buffer$1.alloc(createUncheckedStreamV2Layout.span);
|
|
816
829
|
const encodedUIntArray = new TextEncoder().encode(data.name);
|
|
817
|
-
const streamNameBuffer = Buffer.alloc(64).fill(encodedUIntArray, 0, encodedUIntArray.byteLength);
|
|
818
|
-
const nonceBuffer = Buffer.alloc(4);
|
|
830
|
+
const streamNameBuffer = Buffer$1.alloc(64).fill(encodedUIntArray, 0, encodedUIntArray.byteLength);
|
|
831
|
+
const nonceBuffer = Buffer$1.alloc(4);
|
|
819
832
|
nonceBuffer.writeUInt32LE(data.nonce);
|
|
820
833
|
const decodedData = {
|
|
821
|
-
start_time: data.start.toArrayLike(Buffer, "le", 8),
|
|
822
|
-
net_amount_deposited: data.depositedAmount.toArrayLike(Buffer, "le", 8),
|
|
823
|
-
period: data.period.toArrayLike(Buffer, "le", 8),
|
|
824
|
-
amount_per_period: data.amountPerPeriod.toArrayLike(Buffer, "le", 8),
|
|
825
|
-
cliff: data.cliff.toArrayLike(Buffer, "le", 8),
|
|
826
|
-
cliff_amount: data.cliffAmount.toArrayLike(Buffer, "le", 8),
|
|
834
|
+
start_time: data.start.toArrayLike(Buffer$1, "le", 8),
|
|
835
|
+
net_amount_deposited: data.depositedAmount.toArrayLike(Buffer$1, "le", 8),
|
|
836
|
+
period: data.period.toArrayLike(Buffer$1, "le", 8),
|
|
837
|
+
amount_per_period: data.amountPerPeriod.toArrayLike(Buffer$1, "le", 8),
|
|
838
|
+
cliff: data.cliff.toArrayLike(Buffer$1, "le", 8),
|
|
839
|
+
cliff_amount: data.cliffAmount.toArrayLike(Buffer$1, "le", 8),
|
|
827
840
|
cancelable_by_sender: Number(data.cancelableBySender),
|
|
828
841
|
cancelable_by_recipient: Number(data.cancelableByRecipient),
|
|
829
842
|
automatic_withdrawal: Number(data.automaticWithdrawal),
|
|
@@ -831,7 +844,7 @@ var createUncheckedStreamV2Instruction = async (data, programId, accounts) => {
|
|
|
831
844
|
transferable_by_recipient: Number(data.transferableByRecipient),
|
|
832
845
|
can_topup: Number(data.canTopup),
|
|
833
846
|
stream_name: streamNameBuffer,
|
|
834
|
-
withdraw_frequency: data.withdrawFrequency.toArrayLike(Buffer, "le", 8),
|
|
847
|
+
withdraw_frequency: data.withdrawFrequency.toArrayLike(Buffer$1, "le", 8),
|
|
835
848
|
recipient: data.recipient.toBuffer(),
|
|
836
849
|
partner: data.partner.toBuffer(),
|
|
837
850
|
pausable: Number(data.canPause),
|
|
@@ -841,7 +854,7 @@ var createUncheckedStreamV2Instruction = async (data, programId, accounts) => {
|
|
|
841
854
|
const encodeLength = createUncheckedStreamV2Layout.encode(decodedData, bufferData);
|
|
842
855
|
bufferData = bufferData.slice(0, encodeLength);
|
|
843
856
|
const digest = accounts.payer ? await sha256.digest("global:create_unchecked_with_payer_v2") : await sha256.digest("global:create_unchecked_v2");
|
|
844
|
-
bufferData = Buffer.concat([Buffer.from(digest).slice(0, 8), bufferData, Buffer.alloc(10)]);
|
|
857
|
+
bufferData = Buffer$1.concat([Buffer$1.from(digest).slice(0, 8), bufferData, Buffer$1.alloc(10)]);
|
|
845
858
|
return new TransactionInstruction({
|
|
846
859
|
keys,
|
|
847
860
|
programId,
|
|
@@ -878,11 +891,11 @@ var withdrawStreamInstruction = async (amount, programId, {
|
|
|
878
891
|
{ pubkey: mint, isSigner: false, isWritable: true },
|
|
879
892
|
{ pubkey: tokenProgram, isSigner: false, isWritable: false }
|
|
880
893
|
];
|
|
881
|
-
let data = Buffer.alloc(withdrawStreamLayout.span);
|
|
882
|
-
const decodedData = { amount: amount.toArrayLike(Buffer, "le", 8) };
|
|
894
|
+
let data = Buffer$1.alloc(withdrawStreamLayout.span);
|
|
895
|
+
const decodedData = { amount: amount.toArrayLike(Buffer$1, "le", 8) };
|
|
883
896
|
const encodeLength = withdrawStreamLayout.encode(decodedData, data);
|
|
884
897
|
data = data.slice(0, encodeLength);
|
|
885
|
-
data = Buffer.concat([Buffer.from(await sha256.digest("global:withdraw")).slice(0, 8), data, Buffer.alloc(10)]);
|
|
898
|
+
data = Buffer$1.concat([Buffer$1.from(await sha256.digest("global:withdraw")).slice(0, 8), data, Buffer$1.alloc(10)]);
|
|
886
899
|
return new TransactionInstruction({
|
|
887
900
|
keys,
|
|
888
901
|
programId,
|
|
@@ -896,18 +909,19 @@ var updateStreamInstruction = async (params, programId, { authority, metadata, w
|
|
|
896
909
|
{ pubkey: withdrawor, isSigner: false, isWritable: true },
|
|
897
910
|
{ pubkey: systemProgram, isSigner: false, isWritable: false }
|
|
898
911
|
];
|
|
899
|
-
let data = Buffer.alloc(100);
|
|
912
|
+
let data = Buffer$1.alloc(100);
|
|
900
913
|
const decodedData = {
|
|
901
914
|
enable_automatic_withdrawal: Number(params.enableAutomaticWithdrawal),
|
|
902
|
-
withdraw_frequency: params.withdrawFrequency ? params.withdrawFrequency.toArrayLike(Buffer, "le", 8) : void 0,
|
|
903
|
-
amount_per_period: params.amountPerPeriod ? params.amountPerPeriod.toArrayLike(Buffer, "le", 8) : void 0,
|
|
915
|
+
withdraw_frequency: params.withdrawFrequency ? params.withdrawFrequency.toArrayLike(Buffer$1, "le", 8) : void 0,
|
|
916
|
+
amount_per_period: params.amountPerPeriod ? params.amountPerPeriod.toArrayLike(Buffer$1, "le", 8) : void 0,
|
|
904
917
|
transferable_by_sender: params.transferableBySender !== void 0 ? Number(params.transferableBySender) : void 0,
|
|
905
918
|
transferable_by_recipient: params.transferableByRecipient !== void 0 ? Number(params.transferableByRecipient) : void 0,
|
|
906
|
-
cancelable_by_sender: params.cancelableBySender !== void 0 ? Number(params.cancelableBySender) : void 0
|
|
919
|
+
cancelable_by_sender: params.cancelableBySender !== void 0 ? Number(params.cancelableBySender) : void 0,
|
|
920
|
+
stream_name: params.name !== void 0 ? encodeStreamName(params.name) : void 0
|
|
907
921
|
};
|
|
908
922
|
const encodeLength = encodeUpdateStream(decodedData, data);
|
|
909
923
|
data = data.slice(0, encodeLength);
|
|
910
|
-
data = Buffer.concat([Buffer.from(await sha256.digest("global:update")).slice(0, 8), data, Buffer.alloc(20)]);
|
|
924
|
+
data = Buffer$1.concat([Buffer$1.from(await sha256.digest("global:update")).slice(0, 8), data, Buffer$1.alloc(20)]);
|
|
911
925
|
return new TransactionInstruction({
|
|
912
926
|
keys,
|
|
913
927
|
programId,
|
|
@@ -948,7 +962,7 @@ var cancelStreamInstruction = async (programId, {
|
|
|
948
962
|
{ pubkey: mint, isSigner: false, isWritable: true },
|
|
949
963
|
{ pubkey: tokenProgram, isSigner: false, isWritable: false }
|
|
950
964
|
];
|
|
951
|
-
const data = Buffer.concat([Buffer.from(await sha256.digest("global:cancel")).slice(0, 8), Buffer.alloc(10)]);
|
|
965
|
+
const data = Buffer$1.concat([Buffer$1.from(await sha256.digest("global:cancel")).slice(0, 8), Buffer$1.alloc(10)]);
|
|
952
966
|
return new TransactionInstruction({
|
|
953
967
|
keys,
|
|
954
968
|
programId,
|
|
@@ -977,9 +991,9 @@ var transferStreamInstruction = async (programId, {
|
|
|
977
991
|
{ pubkey: associatedTokenProgram, isSigner: false, isWritable: false },
|
|
978
992
|
{ pubkey: systemProgram, isSigner: false, isWritable: false }
|
|
979
993
|
];
|
|
980
|
-
const data = Buffer.concat([
|
|
981
|
-
Buffer.from(await sha256.digest("global:transfer_recipient")).slice(0, 8),
|
|
982
|
-
Buffer.alloc(10)
|
|
994
|
+
const data = Buffer$1.concat([
|
|
995
|
+
Buffer$1.from(await sha256.digest("global:transfer_recipient")).slice(0, 8),
|
|
996
|
+
Buffer$1.alloc(10)
|
|
983
997
|
]);
|
|
984
998
|
return new TransactionInstruction({
|
|
985
999
|
keys,
|
|
@@ -1007,10 +1021,10 @@ var claimRoutedFeeStreamInstruction = async (destination, programId, {
|
|
|
1007
1021
|
{ pubkey: mint, isSigner: false, isWritable: true },
|
|
1008
1022
|
{ pubkey: tokenProgram, isSigner: false, isWritable: false }
|
|
1009
1023
|
];
|
|
1010
|
-
const data = Buffer.concat([
|
|
1011
|
-
Buffer.from(await sha256.digest("global:claim_routed_fee")).slice(0, 8),
|
|
1012
|
-
Buffer.from([destination === "treasury" ? 0 : 1]),
|
|
1013
|
-
Buffer.alloc(10)
|
|
1024
|
+
const data = Buffer$1.concat([
|
|
1025
|
+
Buffer$1.from(await sha256.digest("global:claim_routed_fee")).slice(0, 8),
|
|
1026
|
+
Buffer$1.from([destination === "treasury" ? 0 : 1]),
|
|
1027
|
+
Buffer$1.alloc(10)
|
|
1014
1028
|
]);
|
|
1015
1029
|
return new TransactionInstruction({
|
|
1016
1030
|
keys,
|
|
@@ -1050,11 +1064,11 @@ var topupStreamInstruction = async (amount, programId, {
|
|
|
1050
1064
|
{ pubkey: tokenProgram, isSigner: false, isWritable: false },
|
|
1051
1065
|
{ pubkey: systemProgram, isSigner: false, isWritable: false }
|
|
1052
1066
|
];
|
|
1053
|
-
let data = Buffer.alloc(topupStreamLayout.span);
|
|
1054
|
-
const decodedData = { amount: amount.toArrayLike(Buffer, "le", 8) };
|
|
1067
|
+
let data = Buffer$1.alloc(topupStreamLayout.span);
|
|
1068
|
+
const decodedData = { amount: amount.toArrayLike(Buffer$1, "le", 8) };
|
|
1055
1069
|
const encodeLength = topupStreamLayout.encode(decodedData, data);
|
|
1056
1070
|
data = data.slice(0, encodeLength);
|
|
1057
|
-
data = Buffer.concat([Buffer.from(await sha256.digest("global:topup")).slice(0, 8), data, Buffer.alloc(10)]);
|
|
1071
|
+
data = Buffer$1.concat([Buffer$1.from(await sha256.digest("global:topup")).slice(0, 8), data, Buffer$1.alloc(10)]);
|
|
1058
1072
|
return new TransactionInstruction({
|
|
1059
1073
|
keys,
|
|
1060
1074
|
programId,
|
|
@@ -3030,6 +3044,17 @@ var streamflow_aligned_unlocks_default = {
|
|
|
3030
3044
|
type: {
|
|
3031
3045
|
option: "bool"
|
|
3032
3046
|
}
|
|
3047
|
+
},
|
|
3048
|
+
{
|
|
3049
|
+
name: "stream_name",
|
|
3050
|
+
type: {
|
|
3051
|
+
option: {
|
|
3052
|
+
array: [
|
|
3053
|
+
"u8",
|
|
3054
|
+
64
|
|
3055
|
+
]
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
3033
3058
|
}
|
|
3034
3059
|
]
|
|
3035
3060
|
}
|
|
@@ -3071,7 +3096,7 @@ var deriveTestOraclePDA = (programId, mint, creator) => {
|
|
|
3071
3096
|
};
|
|
3072
3097
|
var deriveStreamMetadataPDA = (programId, mint, sender, nonce) => {
|
|
3073
3098
|
return PublicKey.findProgramAddressSync(
|
|
3074
|
-
[METADATA_SEED, mint.toBuffer(), sender.toBuffer(), new BN3(nonce).toArrayLike(Buffer, "be", 4)],
|
|
3099
|
+
[METADATA_SEED, mint.toBuffer(), sender.toBuffer(), new BN3(nonce).toArrayLike(Buffer$1, "be", 4)],
|
|
3075
3100
|
programId
|
|
3076
3101
|
)[0];
|
|
3077
3102
|
};
|
|
@@ -3467,8 +3492,6 @@ var SolanaStreamClient = class {
|
|
|
3467
3492
|
...await this.getCreateATAInstructions([recipientPublicKey], mintPublicKey, sender, true, tokenProgramId)
|
|
3468
3493
|
);
|
|
3469
3494
|
}
|
|
3470
|
-
const encodedUIntArray = new TextEncoder().encode(streamName);
|
|
3471
|
-
const streamNameArray = Array.from(encodedUIntArray);
|
|
3472
3495
|
const createMethod = this.alignedProxyProgram.methods.create({
|
|
3473
3496
|
startTime: new BN3(start),
|
|
3474
3497
|
netAmountDeposited: depositedAmount,
|
|
@@ -3482,7 +3505,7 @@ var SolanaStreamClient = class {
|
|
|
3482
3505
|
cancelableBySender,
|
|
3483
3506
|
canTopup,
|
|
3484
3507
|
oracleType: !!oracleType ? { [oracleType]: {} } : { none: {} },
|
|
3485
|
-
streamName:
|
|
3508
|
+
streamName: encodeStreamNameAsArray(streamName),
|
|
3486
3509
|
minPrice: typeof minPrice === "number" ? getBN(minPrice, ALIGNED_PRECISION_FACTOR_POW2) : minPrice,
|
|
3487
3510
|
maxPrice: typeof maxPrice === "number" ? getBN(maxPrice, ALIGNED_PRECISION_FACTOR_POW2) : maxPrice,
|
|
3488
3511
|
minPercentage: typeof minPercentage === "number" ? getBN(minPercentage, ALIGNED_PRECISION_FACTOR_POW2) : minPercentage,
|
|
@@ -3566,7 +3589,7 @@ var SolanaStreamClient = class {
|
|
|
3566
3589
|
({ metadata, metadataPubKey } = this.getOrCreateStreamMetadata(metadataPubKeys));
|
|
3567
3590
|
}
|
|
3568
3591
|
const [escrowTokens] = PublicKey.findProgramAddressSync(
|
|
3569
|
-
[Buffer.from("strm"), metadataPubKey.toBuffer()],
|
|
3592
|
+
[Buffer$1.from("strm"), metadataPubKey.toBuffer()],
|
|
3570
3593
|
this.programId
|
|
3571
3594
|
);
|
|
3572
3595
|
const { mint: mintAccount, tokenProgramId: detectedTokenProgramId } = await getMintAndProgram(
|
|
@@ -3700,7 +3723,7 @@ var SolanaStreamClient = class {
|
|
|
3700
3723
|
({ metadata, metadataPubKey } = this.getOrCreateStreamMetadata(metadataPubKeys));
|
|
3701
3724
|
}
|
|
3702
3725
|
const [escrowTokens] = PublicKey.findProgramAddressSync(
|
|
3703
|
-
[Buffer.from("strm"), metadataPubKey.toBuffer()],
|
|
3726
|
+
[Buffer$1.from("strm"), metadataPubKey.toBuffer()],
|
|
3704
3727
|
this.programId
|
|
3705
3728
|
);
|
|
3706
3729
|
const { mint: mintAccount, tokenProgramId } = await getMintAndProgram(this.connection, mintPublicKey);
|
|
@@ -4704,7 +4727,8 @@ var SolanaStreamClient = class {
|
|
|
4704
4727
|
await (isAlignedUnlock ? this.alignedProxyProgram.methods.updateContract({
|
|
4705
4728
|
transferableBySender: data.transferableBySender ?? null,
|
|
4706
4729
|
transferableByRecipient: data.transferableByRecipient ?? null,
|
|
4707
|
-
cancelableBySender: data.cancelableBySender ?? null
|
|
4730
|
+
cancelableBySender: data.cancelableBySender ?? null,
|
|
4731
|
+
streamName: data.name !== void 0 ? encodeStreamNameAsArray(data.name) : null
|
|
4708
4732
|
}).accounts({ sender: invoker.publicKey, streamMetadata: streamPublicKey, withdrawor: WITHDRAWOR_PUBLIC_KEY }).accountsPartial({ streamflowProgram: this.programId }).instruction() : updateStreamInstruction(data, this.programId, {
|
|
4709
4733
|
authority: invoker.publicKey,
|
|
4710
4734
|
metadata: streamPublicKey,
|