@streamflow/stream 2.1.1 → 3.0.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.
@@ -8,5 +8,8 @@ export declare const PROGRAM_ID: {
8
8
  testnet: string;
9
9
  local: string;
10
10
  };
11
+ export declare const STREAMFLOW_PROGRAM_ID = "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m";
12
+ export declare const STREAMFLOW_DEVNET_PROGRAM_ID = "FGjLaVo5zLGdzCxMo9gu9tXr1kzTToKd8C8K7YS5hNM1";
11
13
  export declare const STREAMFLOW_TREASURY_PUBLIC_KEY: PublicKey;
12
14
  export declare const WITHDRAWOR_PUBLIC_KEY: PublicKey;
15
+ export declare const FEE_ORACLE_PUBLIC_KEY: PublicKey;
package/dist/constants.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.WITHDRAWOR_PUBLIC_KEY = exports.STREAMFLOW_TREASURY_PUBLIC_KEY = exports.PROGRAM_ID = exports.STREAM_STRUCT_OFFSET_RECIPIENT = exports.STREAM_STRUCT_OFFSET_SENDER = exports.TX_FINALITY_CONFIRMED = void 0;
4
+ exports.FEE_ORACLE_PUBLIC_KEY = exports.WITHDRAWOR_PUBLIC_KEY = exports.STREAMFLOW_TREASURY_PUBLIC_KEY = exports.STREAMFLOW_DEVNET_PROGRAM_ID = exports.STREAMFLOW_PROGRAM_ID = exports.PROGRAM_ID = exports.STREAM_STRUCT_OFFSET_RECIPIENT = exports.STREAM_STRUCT_OFFSET_SENDER = exports.TX_FINALITY_CONFIRMED = void 0;
5
5
  var web3_js_1 = require("@solana/web3.js");
6
6
  var types_1 = require("./types");
7
7
  exports.TX_FINALITY_CONFIRMED = "confirmed";
@@ -13,5 +13,8 @@ exports.PROGRAM_ID = (_a = {},
13
13
  _a[types_1.Cluster.Testnet] = "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
14
14
  _a[types_1.LocalCluster.Local] = "HqDGZjaVRXJ9MGRQEw7qDc2rAr6iH1n1kAQdCZaCMfMZ",
15
15
  _a);
16
+ exports.STREAMFLOW_PROGRAM_ID = "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m";
17
+ exports.STREAMFLOW_DEVNET_PROGRAM_ID = "FGjLaVo5zLGdzCxMo9gu9tXr1kzTToKd8C8K7YS5hNM1";
16
18
  exports.STREAMFLOW_TREASURY_PUBLIC_KEY = new web3_js_1.PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
17
19
  exports.WITHDRAWOR_PUBLIC_KEY = new web3_js_1.PublicKey("wdrwhnCv4pzW8beKsbPa4S2UDZrXenjg16KJdKSpb5u");
20
+ exports.FEE_ORACLE_PUBLIC_KEY = new web3_js_1.PublicKey("B743wFVk2pCYhV91cn287e1xY7f1vt4gdY48hhNiuQmT");
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- export { default } from "./sdk";
1
+ export { default } from "./Stream";
2
+ export { default as StreamClient } from "./StreamClient";
2
3
  export * from "./utils";
3
4
  export * from "./types";
4
- export { BN } from "@project-serum/anchor";
5
+ export * from "./instructions";
6
+ export { u64 as BN } from "@solana/spl-token";
package/dist/index.js CHANGED
@@ -13,10 +13,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  return (mod && mod.__esModule) ? mod : { "default": mod };
14
14
  };
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.BN = exports.default = void 0;
17
- var sdk_1 = require("./sdk");
18
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(sdk_1).default; } });
16
+ exports.BN = exports.StreamClient = exports.default = void 0;
17
+ var Stream_1 = require("./Stream");
18
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Stream_1).default; } });
19
+ var StreamClient_1 = require("./StreamClient");
20
+ Object.defineProperty(exports, "StreamClient", { enumerable: true, get: function () { return __importDefault(StreamClient_1).default; } });
19
21
  __exportStar(require("./utils"), exports);
20
22
  __exportStar(require("./types"), exports);
21
- var anchor_1 = require("@project-serum/anchor");
22
- Object.defineProperty(exports, "BN", { enumerable: true, get: function () { return anchor_1.BN; } });
23
+ __exportStar(require("./instructions"), exports);
24
+ var spl_token_1 = require("@solana/spl-token");
25
+ Object.defineProperty(exports, "BN", { enumerable: true, get: function () { return spl_token_1.u64; } });
@@ -0,0 +1,97 @@
1
+ import { PublicKey, TransactionInstruction } from "@solana/web3.js";
2
+ import { u64 } from "@solana/spl-token";
3
+ interface CreateStreamData {
4
+ start: u64;
5
+ depositedAmount: u64;
6
+ period: u64;
7
+ amountPerPeriod: u64;
8
+ cliff: u64;
9
+ cliffAmount: u64;
10
+ cancelableBySender: boolean;
11
+ cancelableByRecipient: boolean;
12
+ automaticWithdrawal: boolean;
13
+ transferableBySender: boolean;
14
+ transferableByRecipient: boolean;
15
+ canTopup: boolean;
16
+ name: string;
17
+ withdrawFrequency: u64;
18
+ }
19
+ interface CreateStreamAccounts {
20
+ sender: PublicKey;
21
+ senderTokens: PublicKey;
22
+ recipient: PublicKey;
23
+ recipientTokens: PublicKey;
24
+ metadata: PublicKey;
25
+ escrowTokens: PublicKey;
26
+ streamflowTreasury: PublicKey;
27
+ streamflowTreasuryTokens: PublicKey;
28
+ partner: PublicKey;
29
+ partnerTokens: PublicKey;
30
+ mint: PublicKey;
31
+ feeOracle: PublicKey;
32
+ rent: PublicKey;
33
+ timelockProgram: PublicKey;
34
+ tokenProgram: PublicKey;
35
+ associatedTokenProgram: PublicKey;
36
+ withdrawor: PublicKey;
37
+ systemProgram: PublicKey;
38
+ }
39
+ export declare const createStreamInstruction: (data: CreateStreamData, programId: PublicKey, accounts: CreateStreamAccounts) => TransactionInstruction;
40
+ interface WithdrawAccounts {
41
+ authority: PublicKey;
42
+ recipient: PublicKey;
43
+ recipientTokens: PublicKey;
44
+ metadata: PublicKey;
45
+ escrowTokens: PublicKey;
46
+ streamflowTreasury: PublicKey;
47
+ streamflowTreasuryTokens: PublicKey;
48
+ partner: PublicKey;
49
+ partnerTokens: PublicKey;
50
+ mint: PublicKey;
51
+ tokenProgram: PublicKey;
52
+ }
53
+ export declare const withdrawStreamInstruction: (amount: u64, programId: PublicKey, { authority, recipient, recipientTokens, metadata, escrowTokens, streamflowTreasury, streamflowTreasuryTokens, partner, partnerTokens, mint, tokenProgram, }: WithdrawAccounts) => TransactionInstruction;
54
+ interface CancelAccounts {
55
+ authority: PublicKey;
56
+ sender: PublicKey;
57
+ senderTokens: PublicKey;
58
+ recipient: PublicKey;
59
+ recipientTokens: PublicKey;
60
+ metadata: PublicKey;
61
+ escrowTokens: PublicKey;
62
+ streamflowTreasury: PublicKey;
63
+ streamflowTreasuryTokens: PublicKey;
64
+ partner: PublicKey;
65
+ partnerTokens: PublicKey;
66
+ mint: PublicKey;
67
+ tokenProgram: PublicKey;
68
+ }
69
+ export declare const cancelStreamInstruction: (programId: PublicKey, { authority, sender, senderTokens, recipient, recipientTokens, metadata, escrowTokens, streamflowTreasury, streamflowTreasuryTokens, partner, partnerTokens, mint, tokenProgram, }: CancelAccounts) => TransactionInstruction;
70
+ interface TransferAccounts {
71
+ authority: PublicKey;
72
+ newRecipient: PublicKey;
73
+ newRecipientTokens: PublicKey;
74
+ metadata: PublicKey;
75
+ mint: PublicKey;
76
+ rent: PublicKey;
77
+ tokenProgram: PublicKey;
78
+ associatedTokenProgram: PublicKey;
79
+ systemProgram: PublicKey;
80
+ }
81
+ export declare const transferStreamInstruction: (programId: PublicKey, { authority, newRecipient, newRecipientTokens, metadata, mint, rent, tokenProgram, associatedTokenProgram, systemProgram, }: TransferAccounts) => TransactionInstruction;
82
+ interface TopupAccounts {
83
+ sender: PublicKey;
84
+ senderTokens: PublicKey;
85
+ metadata: PublicKey;
86
+ escrowTokens: PublicKey;
87
+ streamflowTreasury: PublicKey;
88
+ streamflowTreasuryTokens: PublicKey;
89
+ partner: PublicKey;
90
+ partnerTokens: PublicKey;
91
+ mint: PublicKey;
92
+ tokenProgram: PublicKey;
93
+ withdrawor: PublicKey;
94
+ systemProgram: PublicKey;
95
+ }
96
+ export declare const topupStreamInstruction: (amount: u64, programId: PublicKey, { sender, senderTokens, metadata, escrowTokens, streamflowTreasury, streamflowTreasuryTokens, partner, partnerTokens, mint, tokenProgram, withdrawor, systemProgram, }: TopupAccounts) => TransactionInstruction;
97
+ export {};
@@ -0,0 +1,210 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.topupStreamInstruction = exports.transferStreamInstruction = exports.cancelStreamInstruction = exports.withdrawStreamInstruction = exports.createStreamInstruction = void 0;
23
+ var buffer_1 = require("buffer");
24
+ var web3_js_1 = require("@solana/web3.js");
25
+ var js_sha256_1 = require("js-sha256");
26
+ var Layout = __importStar(require("./layout"));
27
+ var createStreamInstruction = function (data, programId, accounts) {
28
+ var keys = [
29
+ { pubkey: accounts.sender, isSigner: true, isWritable: true },
30
+ { pubkey: accounts.senderTokens, isSigner: false, isWritable: true },
31
+ { pubkey: accounts.recipient, isSigner: false, isWritable: true },
32
+ { pubkey: accounts.metadata, isSigner: true, isWritable: true },
33
+ { pubkey: accounts.escrowTokens, isSigner: false, isWritable: true },
34
+ { pubkey: accounts.recipientTokens, isSigner: false, isWritable: true },
35
+ {
36
+ pubkey: accounts.streamflowTreasury,
37
+ isSigner: false,
38
+ isWritable: true,
39
+ },
40
+ {
41
+ pubkey: accounts.streamflowTreasuryTokens,
42
+ isSigner: false,
43
+ isWritable: true,
44
+ },
45
+ { pubkey: accounts.withdrawor, isSigner: false, isWritable: true },
46
+ { pubkey: accounts.partner, isSigner: false, isWritable: true },
47
+ { pubkey: accounts.partnerTokens, isSigner: false, isWritable: true },
48
+ { pubkey: accounts.mint, isSigner: false, isWritable: false },
49
+ { pubkey: accounts.feeOracle, isSigner: false, isWritable: false },
50
+ { pubkey: accounts.rent, isSigner: false, isWritable: false },
51
+ { pubkey: accounts.timelockProgram, isSigner: false, isWritable: false },
52
+ { pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
53
+ {
54
+ pubkey: accounts.associatedTokenProgram,
55
+ isSigner: false,
56
+ isWritable: false,
57
+ },
58
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
59
+ ];
60
+ var bufferData = buffer_1.Buffer.alloc(Layout.createStreamLayout.span);
61
+ var encodedUIntArray = new TextEncoder().encode(data.name);
62
+ var streamNameBuffer = buffer_1.Buffer.alloc(64).fill(encodedUIntArray, 0, encodedUIntArray.byteLength);
63
+ var decodedData = {
64
+ start_time: data.start.toBuffer(),
65
+ net_amount_deposited: data.depositedAmount.toBuffer(),
66
+ period: data.period.toBuffer(),
67
+ amount_per_period: data.amountPerPeriod.toBuffer(),
68
+ cliff: data.cliff.toBuffer(),
69
+ cliff_amount: data.cliffAmount.toBuffer(),
70
+ cancelable_by_sender: data.cancelableBySender,
71
+ cancelable_by_recipient: data.cancelableByRecipient,
72
+ automatic_withdrawal: data.automaticWithdrawal,
73
+ transferable_by_sender: data.transferableBySender,
74
+ transferable_by_recipient: data.transferableByRecipient,
75
+ can_topup: data.canTopup,
76
+ stream_name: streamNameBuffer,
77
+ withdraw_frequency: data.withdrawFrequency.toBuffer(),
78
+ };
79
+ var encodeLength = Layout.createStreamLayout.encode(decodedData, bufferData);
80
+ bufferData = bufferData.slice(0, encodeLength);
81
+ bufferData = buffer_1.Buffer.concat([
82
+ buffer_1.Buffer.from(js_sha256_1.sha256.digest("global:create")).slice(0, 8),
83
+ bufferData,
84
+ ]);
85
+ return new web3_js_1.TransactionInstruction({
86
+ keys: keys,
87
+ programId: programId,
88
+ data: bufferData,
89
+ });
90
+ };
91
+ exports.createStreamInstruction = createStreamInstruction;
92
+ var withdrawStreamInstruction = function (amount, programId, _a) {
93
+ var authority = _a.authority, recipient = _a.recipient, recipientTokens = _a.recipientTokens, metadata = _a.metadata, escrowTokens = _a.escrowTokens, streamflowTreasury = _a.streamflowTreasury, streamflowTreasuryTokens = _a.streamflowTreasuryTokens, partner = _a.partner, partnerTokens = _a.partnerTokens, mint = _a.mint, tokenProgram = _a.tokenProgram;
94
+ var keys = [
95
+ { pubkey: authority, isSigner: true, isWritable: true },
96
+ { pubkey: recipient, isSigner: false, isWritable: true },
97
+ { pubkey: recipientTokens, isSigner: false, isWritable: true },
98
+ { pubkey: metadata, isSigner: false, isWritable: true },
99
+ { pubkey: escrowTokens, isSigner: false, isWritable: true },
100
+ {
101
+ pubkey: streamflowTreasury,
102
+ isSigner: false,
103
+ isWritable: true,
104
+ },
105
+ { pubkey: streamflowTreasuryTokens, isSigner: false, isWritable: true },
106
+ { pubkey: partner, isSigner: false, isWritable: true },
107
+ { pubkey: partnerTokens, isSigner: false, isWritable: true },
108
+ { pubkey: mint, isSigner: false, isWritable: false },
109
+ { pubkey: tokenProgram, isSigner: false, isWritable: false },
110
+ ];
111
+ var data = buffer_1.Buffer.alloc(Layout.withdrawStreamLayout.span);
112
+ var decodedData = { amount: amount.toBuffer() };
113
+ var encodeLength = Layout.withdrawStreamLayout.encode(decodedData, data);
114
+ data = data.slice(0, encodeLength);
115
+ data = buffer_1.Buffer.concat([
116
+ buffer_1.Buffer.from(js_sha256_1.sha256.digest("global:withdraw")).slice(0, 8),
117
+ data,
118
+ ]);
119
+ return new web3_js_1.TransactionInstruction({
120
+ keys: keys,
121
+ programId: programId,
122
+ data: data,
123
+ });
124
+ };
125
+ exports.withdrawStreamInstruction = withdrawStreamInstruction;
126
+ var cancelStreamInstruction = function (programId, _a) {
127
+ var authority = _a.authority, sender = _a.sender, senderTokens = _a.senderTokens, recipient = _a.recipient, recipientTokens = _a.recipientTokens, metadata = _a.metadata, escrowTokens = _a.escrowTokens, streamflowTreasury = _a.streamflowTreasury, streamflowTreasuryTokens = _a.streamflowTreasuryTokens, partner = _a.partner, partnerTokens = _a.partnerTokens, mint = _a.mint, tokenProgram = _a.tokenProgram;
128
+ var keys = [
129
+ { pubkey: authority, isSigner: true, isWritable: false },
130
+ { pubkey: sender, isSigner: false, isWritable: true },
131
+ { pubkey: senderTokens, isSigner: false, isWritable: true },
132
+ { pubkey: recipient, isSigner: false, isWritable: true },
133
+ { pubkey: recipientTokens, isSigner: false, isWritable: true },
134
+ { pubkey: metadata, isSigner: false, isWritable: true },
135
+ { pubkey: escrowTokens, isSigner: false, isWritable: true },
136
+ {
137
+ pubkey: streamflowTreasury,
138
+ isSigner: false,
139
+ isWritable: true,
140
+ },
141
+ { pubkey: streamflowTreasuryTokens, isSigner: false, isWritable: true },
142
+ { pubkey: partner, isSigner: false, isWritable: true },
143
+ { pubkey: partnerTokens, isSigner: false, isWritable: true },
144
+ { pubkey: mint, isSigner: false, isWritable: false },
145
+ { pubkey: tokenProgram, isSigner: false, isWritable: false },
146
+ ];
147
+ var data = buffer_1.Buffer.from(js_sha256_1.sha256.digest("global:cancel")).slice(0, 8);
148
+ return new web3_js_1.TransactionInstruction({
149
+ keys: keys,
150
+ programId: programId,
151
+ data: data,
152
+ });
153
+ };
154
+ exports.cancelStreamInstruction = cancelStreamInstruction;
155
+ var transferStreamInstruction = function (programId, _a) {
156
+ var authority = _a.authority, newRecipient = _a.newRecipient, newRecipientTokens = _a.newRecipientTokens, metadata = _a.metadata, mint = _a.mint, rent = _a.rent, tokenProgram = _a.tokenProgram, associatedTokenProgram = _a.associatedTokenProgram, systemProgram = _a.systemProgram;
157
+ var keys = [
158
+ { pubkey: authority, isSigner: true, isWritable: true },
159
+ { pubkey: newRecipient, isSigner: false, isWritable: true },
160
+ { pubkey: newRecipientTokens, isSigner: false, isWritable: true },
161
+ { pubkey: metadata, isSigner: false, isWritable: true },
162
+ { pubkey: mint, isSigner: false, isWritable: false },
163
+ { pubkey: rent, isSigner: false, isWritable: false },
164
+ { pubkey: tokenProgram, isSigner: false, isWritable: false },
165
+ { pubkey: associatedTokenProgram, isSigner: false, isWritable: false },
166
+ { pubkey: systemProgram, isSigner: false, isWritable: false },
167
+ ];
168
+ var data = buffer_1.Buffer.from(js_sha256_1.sha256.digest("global:transfer_recipient")).slice(0, 8);
169
+ return new web3_js_1.TransactionInstruction({
170
+ keys: keys,
171
+ programId: programId,
172
+ data: data,
173
+ });
174
+ };
175
+ exports.transferStreamInstruction = transferStreamInstruction;
176
+ var topupStreamInstruction = function (amount, programId, _a) {
177
+ var sender = _a.sender, senderTokens = _a.senderTokens, metadata = _a.metadata, escrowTokens = _a.escrowTokens, streamflowTreasury = _a.streamflowTreasury, streamflowTreasuryTokens = _a.streamflowTreasuryTokens, partner = _a.partner, partnerTokens = _a.partnerTokens, mint = _a.mint, tokenProgram = _a.tokenProgram, withdrawor = _a.withdrawor, systemProgram = _a.systemProgram;
178
+ var keys = [
179
+ { pubkey: sender, isSigner: true, isWritable: true },
180
+ { pubkey: senderTokens, isSigner: false, isWritable: true },
181
+ { pubkey: metadata, isSigner: false, isWritable: true },
182
+ { pubkey: escrowTokens, isSigner: false, isWritable: true },
183
+ {
184
+ pubkey: streamflowTreasury,
185
+ isSigner: false,
186
+ isWritable: true,
187
+ },
188
+ { pubkey: streamflowTreasuryTokens, isSigner: false, isWritable: true },
189
+ { pubkey: withdrawor, isSigner: false, isWritable: true },
190
+ { pubkey: partner, isSigner: false, isWritable: true },
191
+ { pubkey: partnerTokens, isSigner: false, isWritable: true },
192
+ { pubkey: mint, isSigner: false, isWritable: false },
193
+ { pubkey: tokenProgram, isSigner: false, isWritable: false },
194
+ { pubkey: systemProgram, isSigner: false, isWritable: false },
195
+ ];
196
+ var data = buffer_1.Buffer.alloc(Layout.topupStreamLayout.span);
197
+ var decodedData = { amount: amount.toBuffer() };
198
+ var encodeLength = Layout.topupStreamLayout.encode(decodedData, data);
199
+ data = data.slice(0, encodeLength);
200
+ data = buffer_1.Buffer.concat([
201
+ buffer_1.Buffer.from(js_sha256_1.sha256.digest("global:topup")).slice(0, 8),
202
+ data,
203
+ ]);
204
+ return new web3_js_1.TransactionInstruction({
205
+ keys: keys,
206
+ programId: programId,
207
+ data: data,
208
+ });
209
+ };
210
+ exports.topupStreamInstruction = topupStreamInstruction;
@@ -0,0 +1,18 @@
1
+ declare const BufferLayout: any;
2
+ /**
3
+ * Stream layout
4
+ */
5
+ export declare const streamLayout: typeof BufferLayout.Structure;
6
+ /**
7
+ * Create stream instruction layout
8
+ */
9
+ export declare const createStreamLayout: typeof BufferLayout.Structure;
10
+ /**
11
+ * Withdraw stream instruction layout
12
+ */
13
+ export declare const withdrawStreamLayout: typeof BufferLayout.Structure;
14
+ /**
15
+ * Topup stream instruction layout
16
+ */
17
+ export declare const topupStreamLayout: typeof BufferLayout.Structure;
18
+ export {};
package/dist/layout.js ADDED
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.topupStreamLayout = exports.withdrawStreamLayout = exports.createStreamLayout = exports.streamLayout = void 0;
4
+ var BufferLayout = require("buffer-layout");
5
+ /**
6
+ * Stream layout
7
+ */
8
+ exports.streamLayout = BufferLayout.struct([
9
+ BufferLayout.blob(8, "magic"),
10
+ BufferLayout.blob(1, "version"),
11
+ BufferLayout.blob(8, "created_at"),
12
+ BufferLayout.blob(8, "withdrawn_amount"),
13
+ BufferLayout.blob(8, "canceled_at"),
14
+ BufferLayout.blob(8, "end_time"),
15
+ BufferLayout.blob(8, "last_withdrawn_at"),
16
+ BufferLayout.blob(32, "sender"),
17
+ BufferLayout.blob(32, "sender_tokens"),
18
+ BufferLayout.blob(32, "recipient"),
19
+ BufferLayout.blob(32, "recipient_tokens"),
20
+ BufferLayout.blob(32, "mint"),
21
+ BufferLayout.blob(32, "escrow_tokens"),
22
+ BufferLayout.blob(32, "streamflow_treasury"),
23
+ BufferLayout.blob(32, "streamflow_treasury_tokens"),
24
+ BufferLayout.blob(8, "streamflow_fee_total"),
25
+ BufferLayout.blob(8, "streamflow_fee_withdrawn"),
26
+ BufferLayout.f32("streamflow_fee_percent"),
27
+ BufferLayout.blob(32, "partner"),
28
+ BufferLayout.blob(32, "partner_tokens"),
29
+ BufferLayout.blob(8, "partner_fee_total"),
30
+ BufferLayout.blob(8, "partner_fee_withdrawn"),
31
+ BufferLayout.f32("partner_fee_percent"),
32
+ BufferLayout.blob(8, "start_time"),
33
+ BufferLayout.blob(8, "net_amount_deposited"),
34
+ BufferLayout.blob(8, "period"),
35
+ BufferLayout.blob(8, "amount_per_period"),
36
+ BufferLayout.blob(8, "cliff"),
37
+ BufferLayout.blob(8, "cliff_amount"),
38
+ BufferLayout.u8("cancelable_by_sender"),
39
+ BufferLayout.u8("cancelable_by_recipient"),
40
+ BufferLayout.u8("automatic_withdrawal"),
41
+ BufferLayout.u8("transferable_by_sender"),
42
+ BufferLayout.u8("transferable_by_recipient"),
43
+ BufferLayout.u8("can_topup"),
44
+ BufferLayout.blob(64, "stream_name"),
45
+ BufferLayout.blob(8, "withdraw_frequency"),
46
+ ]);
47
+ /**
48
+ * Create stream instruction layout
49
+ */
50
+ exports.createStreamLayout = BufferLayout.struct([
51
+ BufferLayout.blob(8, "start_time"),
52
+ BufferLayout.blob(8, "net_amount_deposited"),
53
+ BufferLayout.blob(8, "period"),
54
+ BufferLayout.blob(8, "amount_per_period"),
55
+ BufferLayout.blob(8, "cliff"),
56
+ BufferLayout.blob(8, "cliff_amount"),
57
+ BufferLayout.u8("cancelable_by_sender"),
58
+ BufferLayout.u8("cancelable_by_recipient"),
59
+ BufferLayout.u8("automatic_withdrawal"),
60
+ BufferLayout.u8("transferable_by_sender"),
61
+ BufferLayout.u8("transferable_by_recipient"),
62
+ BufferLayout.u8("can_topup"),
63
+ BufferLayout.blob(64, "stream_name"),
64
+ BufferLayout.blob(8, "withdraw_frequency"),
65
+ ]);
66
+ /**
67
+ * Withdraw stream instruction layout
68
+ */
69
+ exports.withdrawStreamLayout = BufferLayout.struct([BufferLayout.blob(8, "amount")]);
70
+ /**
71
+ * Topup stream instruction layout
72
+ */
73
+ exports.topupStreamLayout = BufferLayout.struct([BufferLayout.blob(8, "amount")]);