@streamflow/stream 3.0.0-test.3 → 3.0.1-test.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/StreamClient.d.ts +1 -3
- package/dist/StreamClient.js +7 -7
- package/dist/instructions.js +9 -9
- package/dist/types.d.ts +3 -2
- package/package.json +1 -1
package/dist/StreamClient.d.ts
CHANGED
|
@@ -45,8 +45,6 @@ export default class StreamClient {
|
|
|
45
45
|
* @param {number} data.start - Timestamp (in seconds) when the stream/token vesting starts.
|
|
46
46
|
* @param {number} data.period - Time step (period) in seconds per which the unlocking occurs.
|
|
47
47
|
* @param {number} data.cliff - Vesting contract "cliff" timestamp in seconds.
|
|
48
|
-
* @param {BN} data.cliffAmount - Amount unlocked at the "cliff".
|
|
49
|
-
* @param {BN} data.amountPerPeriod - Amount unlocked per each period.
|
|
50
48
|
* @param {boolean} data.canTopup - TRUE for streams, FALSE for vesting contracts.
|
|
51
49
|
* @param {boolean} data.cancelableBySender - Whether or not sender can cancel the stream.
|
|
52
50
|
* @param {boolean} data.cancelableByRecipient - Whether or not recipient can cancel the stream.
|
|
@@ -56,7 +54,7 @@ export default class StreamClient {
|
|
|
56
54
|
* @param {number} [data.withdrawalFrequency = 0] - Relevant when automatic withdrawal is enabled. If greater than 0 our withdrawor will take care of withdrawals. If equal to 0 our withdrawor will skip, but everyone else can initiate withdrawals.
|
|
57
55
|
* @param {string | null} [data.partner = null] - Partner's wallet address (optional).
|
|
58
56
|
*/
|
|
59
|
-
createMultiple({ sender, recipientsData, mint, start, period, cliff,
|
|
57
|
+
createMultiple({ sender, recipientsData, mint, start, period, cliff, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, partner, }: CreateMultiParams): Promise<CreateMultiResponse>;
|
|
60
58
|
/**
|
|
61
59
|
* Attempts withdrawal from the specified stream.
|
|
62
60
|
* @param {WithdrawParams} data
|
package/dist/StreamClient.js
CHANGED
|
@@ -228,8 +228,6 @@ var StreamClient = /** @class */ (function () {
|
|
|
228
228
|
* @param {number} data.start - Timestamp (in seconds) when the stream/token vesting starts.
|
|
229
229
|
* @param {number} data.period - Time step (period) in seconds per which the unlocking occurs.
|
|
230
230
|
* @param {number} data.cliff - Vesting contract "cliff" timestamp in seconds.
|
|
231
|
-
* @param {BN} data.cliffAmount - Amount unlocked at the "cliff".
|
|
232
|
-
* @param {BN} data.amountPerPeriod - Amount unlocked per each period.
|
|
233
231
|
* @param {boolean} data.canTopup - TRUE for streams, FALSE for vesting contracts.
|
|
234
232
|
* @param {boolean} data.cancelableBySender - Whether or not sender can cancel the stream.
|
|
235
233
|
* @param {boolean} data.cancelableByRecipient - Whether or not recipient can cancel the stream.
|
|
@@ -240,9 +238,9 @@ var StreamClient = /** @class */ (function () {
|
|
|
240
238
|
* @param {string | null} [data.partner = null] - Partner's wallet address (optional).
|
|
241
239
|
*/
|
|
242
240
|
StreamClient.prototype.createMultiple = function (_a) {
|
|
243
|
-
var sender = _a.sender, recipientsData = _a.recipientsData, mint = _a.mint, start = _a.start, period = _a.period, cliff = _a.cliff,
|
|
241
|
+
var sender = _a.sender, recipientsData = _a.recipientsData, mint = _a.mint, start = _a.start, period = _a.period, cliff = _a.cliff, canTopup = _a.canTopup, cancelableBySender = _a.cancelableBySender, cancelableByRecipient = _a.cancelableByRecipient, transferableBySender = _a.transferableBySender, transferableByRecipient = _a.transferableByRecipient, _b = _a.automaticWithdrawal, automaticWithdrawal = _b === void 0 ? false : _b, _c = _a.withdrawalFrequency, withdrawalFrequency = _c === void 0 ? 0 : _c, _d = _a.partner, partner = _d === void 0 ? null : _d;
|
|
244
242
|
return __awaiter(this, void 0, void 0, function () {
|
|
245
|
-
var mintPublicKey, batch, commitment, recipientsData_1, recipientsData_1_1, recipient, ixs, recipientPublicKey, metadata, _e, escrowTokens, senderTokens, recipientTokens, streamflowTreasuryTokens, partnerPublicKey, partnerTokens, hash, tx, e_1_1, signed_batch, sigs, i, buf, signature;
|
|
243
|
+
var mintPublicKey, batch, commitment, metadatas, recipientsData_1, recipientsData_1_1, recipient, ixs, recipientPublicKey, metadata, _e, escrowTokens, senderTokens, recipientTokens, streamflowTreasuryTokens, partnerPublicKey, partnerTokens, hash, tx, e_1_1, signed_batch, sigs, i, buf, signature;
|
|
246
244
|
var e_1, _f, _g;
|
|
247
245
|
return __generator(this, function (_h) {
|
|
248
246
|
switch (_h.label) {
|
|
@@ -252,6 +250,7 @@ var StreamClient = /** @class */ (function () {
|
|
|
252
250
|
commitment = typeof this.commitment == "string"
|
|
253
251
|
? this.commitment
|
|
254
252
|
: this.commitment.commitment;
|
|
253
|
+
metadatas = [];
|
|
255
254
|
_h.label = 1;
|
|
256
255
|
case 1:
|
|
257
256
|
_h.trys.push([1, 11, 12, 13]);
|
|
@@ -263,6 +262,7 @@ var StreamClient = /** @class */ (function () {
|
|
|
263
262
|
ixs = [];
|
|
264
263
|
recipientPublicKey = new web3_js_1.PublicKey(recipient.recipient);
|
|
265
264
|
metadata = web3_js_1.Keypair.generate();
|
|
265
|
+
metadatas.push(metadata);
|
|
266
266
|
return [4 /*yield*/, anchor_1.web3.PublicKey.findProgramAddress([buffer_1.Buffer.from("strm"), metadata.publicKey.toBuffer()], this.programId)];
|
|
267
267
|
case 3:
|
|
268
268
|
_e = __read.apply(void 0, [_h.sent(), 1]), escrowTokens = _e[0];
|
|
@@ -285,9 +285,9 @@ var StreamClient = /** @class */ (function () {
|
|
|
285
285
|
start: new bn_js_1.default(start),
|
|
286
286
|
depositedAmount: recipient.depositedAmount,
|
|
287
287
|
period: new bn_js_1.default(period),
|
|
288
|
-
amountPerPeriod: amountPerPeriod,
|
|
288
|
+
amountPerPeriod: recipient.amountPerPeriod,
|
|
289
289
|
cliff: new bn_js_1.default(cliff),
|
|
290
|
-
cliffAmount: cliffAmount,
|
|
290
|
+
cliffAmount: recipient.cliffAmount,
|
|
291
291
|
cancelableBySender: cancelableBySender,
|
|
292
292
|
cancelableByRecipient: cancelableByRecipient,
|
|
293
293
|
automaticWithdrawal: automaticWithdrawal,
|
|
@@ -371,7 +371,7 @@ var StreamClient = /** @class */ (function () {
|
|
|
371
371
|
case 20:
|
|
372
372
|
i++;
|
|
373
373
|
return [3 /*break*/, 18];
|
|
374
|
-
case 21: return [2 /*return*/, { txs: sigs }];
|
|
374
|
+
case 21: return [2 /*return*/, { txs: sigs, metadatas: metadatas }];
|
|
375
375
|
}
|
|
376
376
|
});
|
|
377
377
|
});
|
package/dist/instructions.js
CHANGED
|
@@ -61,12 +61,12 @@ var createStreamInstruction = function (data, programId, accounts) {
|
|
|
61
61
|
var encodedUIntArray = new TextEncoder().encode(data.name);
|
|
62
62
|
var streamNameBuffer = buffer_1.Buffer.alloc(64).fill(encodedUIntArray, 0, encodedUIntArray.byteLength);
|
|
63
63
|
var decodedData = {
|
|
64
|
-
start_time: data.start.toArrayLike(buffer_1.Buffer, "le"),
|
|
65
|
-
net_amount_deposited: data.depositedAmount.toArrayLike(buffer_1.Buffer, "le"),
|
|
66
|
-
period: data.period.toArrayLike(buffer_1.Buffer, "le"),
|
|
67
|
-
amount_per_period: data.amountPerPeriod.toArrayLike(buffer_1.Buffer, "le"),
|
|
68
|
-
cliff: data.cliff.toArrayLike(buffer_1.Buffer, "le"),
|
|
69
|
-
cliff_amount: data.cliffAmount.toArrayLike(buffer_1.Buffer, "le"),
|
|
64
|
+
start_time: data.start.toArrayLike(buffer_1.Buffer, "le", 8),
|
|
65
|
+
net_amount_deposited: data.depositedAmount.toArrayLike(buffer_1.Buffer, "le", 8),
|
|
66
|
+
period: data.period.toArrayLike(buffer_1.Buffer, "le", 8),
|
|
67
|
+
amount_per_period: data.amountPerPeriod.toArrayLike(buffer_1.Buffer, "le", 8),
|
|
68
|
+
cliff: data.cliff.toArrayLike(buffer_1.Buffer, "le", 8),
|
|
69
|
+
cliff_amount: data.cliffAmount.toArrayLike(buffer_1.Buffer, "le", 8),
|
|
70
70
|
cancelable_by_sender: data.cancelableBySender,
|
|
71
71
|
cancelable_by_recipient: data.cancelableByRecipient,
|
|
72
72
|
automatic_withdrawal: data.automaticWithdrawal,
|
|
@@ -74,7 +74,7 @@ var createStreamInstruction = function (data, programId, accounts) {
|
|
|
74
74
|
transferable_by_recipient: data.transferableByRecipient,
|
|
75
75
|
can_topup: data.canTopup,
|
|
76
76
|
stream_name: streamNameBuffer,
|
|
77
|
-
withdraw_frequency: data.withdrawFrequency.toArrayLike(buffer_1.Buffer, "le"),
|
|
77
|
+
withdraw_frequency: data.withdrawFrequency.toArrayLike(buffer_1.Buffer, "le", 8),
|
|
78
78
|
};
|
|
79
79
|
var encodeLength = Layout.createStreamLayout.encode(decodedData, bufferData);
|
|
80
80
|
bufferData = bufferData.slice(0, encodeLength);
|
|
@@ -109,7 +109,7 @@ var withdrawStreamInstruction = function (amount, programId, _a) {
|
|
|
109
109
|
{ pubkey: tokenProgram, isSigner: false, isWritable: false },
|
|
110
110
|
];
|
|
111
111
|
var data = buffer_1.Buffer.alloc(Layout.withdrawStreamLayout.span);
|
|
112
|
-
var decodedData = { amount: amount.toArrayLike(buffer_1.Buffer, "le") };
|
|
112
|
+
var decodedData = { amount: amount.toArrayLike(buffer_1.Buffer, "le", 8) };
|
|
113
113
|
var encodeLength = Layout.withdrawStreamLayout.encode(decodedData, data);
|
|
114
114
|
data = data.slice(0, encodeLength);
|
|
115
115
|
data = buffer_1.Buffer.concat([
|
|
@@ -194,7 +194,7 @@ var topupStreamInstruction = function (amount, programId, _a) {
|
|
|
194
194
|
{ pubkey: systemProgram, isSigner: false, isWritable: false },
|
|
195
195
|
];
|
|
196
196
|
var data = buffer_1.Buffer.alloc(Layout.topupStreamLayout.span);
|
|
197
|
-
var decodedData = { amount: amount.toArrayLike(buffer_1.Buffer, "le") };
|
|
197
|
+
var decodedData = { amount: amount.toArrayLike(buffer_1.Buffer, "le", 8) };
|
|
198
198
|
var encodeLength = Layout.topupStreamLayout.encode(decodedData, data);
|
|
199
199
|
data = data.slice(0, encodeLength);
|
|
200
200
|
data = buffer_1.Buffer.concat([
|
package/dist/types.d.ts
CHANGED
|
@@ -44,6 +44,8 @@ export interface MultiRecipient {
|
|
|
44
44
|
recipient: string;
|
|
45
45
|
depositedAmount: BN;
|
|
46
46
|
name: string;
|
|
47
|
+
cliffAmount: BN;
|
|
48
|
+
amountPerPeriod: BN;
|
|
47
49
|
}
|
|
48
50
|
export interface CreateMultiData {
|
|
49
51
|
recipientsData: MultiRecipient[];
|
|
@@ -51,8 +53,6 @@ export interface CreateMultiData {
|
|
|
51
53
|
start: number;
|
|
52
54
|
period: number;
|
|
53
55
|
cliff: number;
|
|
54
|
-
cliffAmount: BN;
|
|
55
|
-
amountPerPeriod: BN;
|
|
56
56
|
canTopup: boolean;
|
|
57
57
|
cancelableBySender: boolean;
|
|
58
58
|
cancelableByRecipient: boolean;
|
|
@@ -231,4 +231,5 @@ export interface CreateResponse extends TxResponse {
|
|
|
231
231
|
}
|
|
232
232
|
export interface CreateMultiResponse {
|
|
233
233
|
txs: TransactionSignature[];
|
|
234
|
+
metadatas: Keypair[];
|
|
234
235
|
}
|
package/package.json
CHANGED