@streamflow/stream 3.0.0-test.4 → 3.0.1-test.1

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.
@@ -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, cliffAmount, amountPerPeriod, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, partner, }: CreateMultiParams): Promise<CreateMultiResponse>;
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
@@ -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, cliffAmount = _a.cliffAmount, amountPerPeriod = _a.amountPerPeriod, 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;
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, metadataToRecipient, recipientsData_1, recipientsData_1_1, recipient, ixs, recipientPublicKey, metadata, metadataPubKey, _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,8 @@ var StreamClient = /** @class */ (function () {
252
250
  commitment = typeof this.commitment == "string"
253
251
  ? this.commitment
254
252
  : this.commitment.commitment;
253
+ metadatas = [];
254
+ metadataToRecipient = {};
255
255
  _h.label = 1;
256
256
  case 1:
257
257
  _h.trys.push([1, 11, 12, 13]);
@@ -263,6 +263,9 @@ var StreamClient = /** @class */ (function () {
263
263
  ixs = [];
264
264
  recipientPublicKey = new web3_js_1.PublicKey(recipient.recipient);
265
265
  metadata = web3_js_1.Keypair.generate();
266
+ metadatas.push(metadata);
267
+ metadataPubKey = metadata.publicKey.toBase58();
268
+ metadataToRecipient[metadataPubKey] = recipient;
266
269
  return [4 /*yield*/, anchor_1.web3.PublicKey.findProgramAddress([buffer_1.Buffer.from("strm"), metadata.publicKey.toBuffer()], this.programId)];
267
270
  case 3:
268
271
  _e = __read.apply(void 0, [_h.sent(), 1]), escrowTokens = _e[0];
@@ -285,9 +288,9 @@ var StreamClient = /** @class */ (function () {
285
288
  start: new bn_js_1.default(start),
286
289
  depositedAmount: recipient.depositedAmount,
287
290
  period: new bn_js_1.default(period),
288
- amountPerPeriod: amountPerPeriod,
291
+ amountPerPeriod: recipient.amountPerPeriod,
289
292
  cliff: new bn_js_1.default(cliff),
290
- cliffAmount: cliffAmount,
293
+ cliffAmount: recipient.cliffAmount,
291
294
  cancelableBySender: cancelableBySender,
292
295
  cancelableByRecipient: cancelableByRecipient,
293
296
  automaticWithdrawal: automaticWithdrawal,
@@ -371,7 +374,7 @@ var StreamClient = /** @class */ (function () {
371
374
  case 20:
372
375
  i++;
373
376
  return [3 /*break*/, 18];
374
- case 21: return [2 /*return*/, { txs: sigs }];
377
+ case 21: return [2 /*return*/, { txs: sigs, metadatas: metadatas, metadataToRecipient: metadataToRecipient }];
375
378
  }
376
379
  });
377
380
  });
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;
@@ -229,6 +229,11 @@ export interface TxResponse {
229
229
  export interface CreateResponse extends TxResponse {
230
230
  metadata: Keypair;
231
231
  }
232
+ export interface MetadataRecipientHashMap {
233
+ [metadataPubKey: string]: MultiRecipient;
234
+ }
232
235
  export interface CreateMultiResponse {
233
236
  txs: TransactionSignature[];
237
+ metadatas: Keypair[];
238
+ metadataToRecipient: MetadataRecipientHashMap;
234
239
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/stream",
3
- "version": "3.0.0-test.4",
3
+ "version": "3.0.1-test.1",
4
4
  "description": "JavaScript SDK to interact with Streamflow protocol.",
5
5
  "main": "dist/index.js",
6
6
  "homepage": "https://github.com/streamflow-finance/js-sdk/",