@streamflow/stream 5.11.0 → 5.11.2

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.
@@ -17,7 +17,7 @@ export default class SolanaStreamClient extends BaseStreamClient {
17
17
  * Creates a new stream/vesting contract.
18
18
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
19
19
  */
20
- create(data: ICreateStreamData, extensions: ICreateStreamSolanaExt): Promise<ICreateResult>;
20
+ create(data: ICreateStreamData, extParams: ICreateStreamSolanaExt): Promise<ICreateResult>;
21
21
  /**
22
22
  * Creates a new stream/vesting contract.
23
23
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
@@ -37,7 +37,7 @@ export default class SolanaStreamClient extends BaseStreamClient {
37
37
  *
38
38
  * If you are not sure if you should use create or create_unchecked, go for create to be safer.
39
39
  */
40
- createUnchecked(data: ICreateStreamData, extensions: ICreateStreamSolanaExt): Promise<ICreateResult>;
40
+ createUnchecked(data: ICreateStreamData, extParams: ICreateStreamSolanaExt): Promise<ICreateResult>;
41
41
  /**
42
42
  * Create Transaction instructions for `createUnchecked`
43
43
  */
@@ -50,19 +50,19 @@ export default class SolanaStreamClient extends BaseStreamClient {
50
50
  * Creates multiple stream/vesting contracts.
51
51
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
52
52
  */
53
- createMultiple(data: ICreateMultipleStreamData, { sender, metadataPubKeys, isNative }: ICreateStreamSolanaExt): Promise<IMultiTransactionResult>;
53
+ createMultiple(data: ICreateMultipleStreamData, { sender, metadataPubKeys, isNative, computePrice, computeLimit, }: ICreateStreamSolanaExt): Promise<IMultiTransactionResult>;
54
54
  /**
55
55
  * Attempts withdrawing from the specified stream.
56
56
  */
57
- withdraw({ id, amount }: IWithdrawData, { invoker, checkTokenAccounts }: IInteractStreamSolanaExt): Promise<ITransactionResult>;
57
+ withdraw({ id, amount }: IWithdrawData, extParams: IInteractStreamSolanaExt): Promise<ITransactionResult>;
58
58
  /**
59
59
  * Creates Transaction Instructions for withdrawal
60
60
  */
61
- prepareWithdawInstructions({ id, amount }: IWithdrawData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IInteractStreamSolanaExt): Promise<TransactionInstruction[]>;
61
+ prepareWithdrawInstructions({ id, amount }: IWithdrawData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IInteractStreamSolanaExt): Promise<TransactionInstruction[]>;
62
62
  /**
63
63
  * Attempts canceling the specified stream.
64
64
  */
65
- cancel({ id }: ICancelData, extensions: IInteractStreamSolanaExt): Promise<ITransactionResult>;
65
+ cancel({ id }: ICancelData, extParams: IInteractStreamSolanaExt): Promise<ITransactionResult>;
66
66
  /**
67
67
  * Creates Transaction Instructions for cancel
68
68
  */
@@ -71,7 +71,7 @@ export default class SolanaStreamClient extends BaseStreamClient {
71
71
  * Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
72
72
  * Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
73
73
  */
74
- transfer({ id, newRecipient }: ITransferData, extensions: IInteractStreamSolanaExt): Promise<ITransactionResult>;
74
+ transfer({ id, newRecipient }: ITransferData, extParams: IInteractStreamSolanaExt): Promise<ITransactionResult>;
75
75
  /**
76
76
  * Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
77
77
  * Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
@@ -80,7 +80,7 @@ export default class SolanaStreamClient extends BaseStreamClient {
80
80
  /**
81
81
  * Tops up stream account with specified amount.
82
82
  */
83
- topup({ id, amount }: ITopUpData, extensions: ITopUpStreamSolanaExt): Promise<ITransactionResult>;
83
+ topup({ id, amount }: ITopUpData, extParams: ITopUpStreamSolanaExt): Promise<ITransactionResult>;
84
84
  /**
85
85
  * Create Transaction instructions for topup
86
86
  */
@@ -97,7 +97,7 @@ export default class SolanaStreamClient extends BaseStreamClient {
97
97
  /**
98
98
  * Attempts updating the stream auto withdrawal params and amount per period
99
99
  */
100
- update(data: IUpdateData, extensions: IInteractStreamSolanaExt): Promise<ITransactionResult>;
100
+ update(data: IUpdateData, extParams: IInteractStreamSolanaExt): Promise<ITransactionResult>;
101
101
  /**
102
102
  * Create Transaction instructions for update
103
103
  */
@@ -168,18 +168,18 @@ var SolanaStreamClient = /** @class */ (function (_super) {
168
168
  * Creates a new stream/vesting contract.
169
169
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
170
170
  */
171
- SolanaStreamClient.prototype.create = function (data, extensions) {
171
+ SolanaStreamClient.prototype.create = function (data, extParams) {
172
172
  return __awaiter(this, void 0, void 0, function () {
173
173
  var _a, ixs, metadata, metadataPubKey, _b, tx, hash, signature;
174
174
  return __generator(this, function (_c) {
175
175
  switch (_c.label) {
176
- case 0: return [4 /*yield*/, this.prepareCreateInstructions(data, extensions)];
176
+ case 0: return [4 /*yield*/, this.prepareCreateInstructions(data, extParams)];
177
177
  case 1:
178
178
  _a = _c.sent(), ixs = _a.ixs, metadata = _a.metadata, metadataPubKey = _a.metadataPubKey;
179
- return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extensions.sender.publicKey, this.getCommitment(), metadata)];
179
+ return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.sender.publicKey, this.getCommitment(), metadata)];
180
180
  case 2:
181
181
  _b = _c.sent(), tx = _b.tx, hash = _b.hash;
182
- return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extensions.sender, tx, hash)];
182
+ return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extParams.sender, tx, hash)];
183
183
  case 3:
184
184
  signature = _c.sent();
185
185
  return [2 /*return*/, { ixs: ixs, txId: signature, metadataId: metadataPubKey.toBase58() }];
@@ -286,18 +286,18 @@ var SolanaStreamClient = /** @class */ (function (_super) {
286
286
  *
287
287
  * If you are not sure if you should use create or create_unchecked, go for create to be safer.
288
288
  */
289
- SolanaStreamClient.prototype.createUnchecked = function (data, extensions) {
289
+ SolanaStreamClient.prototype.createUnchecked = function (data, extParams) {
290
290
  return __awaiter(this, void 0, void 0, function () {
291
291
  var _a, ixs, metadata, metadataPubKey, _b, tx, hash, signature;
292
292
  return __generator(this, function (_c) {
293
293
  switch (_c.label) {
294
- case 0: return [4 /*yield*/, this.prepareCreateUncheckedInstructions(data, extensions)];
294
+ case 0: return [4 /*yield*/, this.prepareCreateUncheckedInstructions(data, extParams)];
295
295
  case 1:
296
296
  _a = _c.sent(), ixs = _a.ixs, metadata = _a.metadata, metadataPubKey = _a.metadataPubKey;
297
- return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extensions.sender.publicKey, this.getCommitment(), metadata)];
297
+ return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.sender.publicKey, this.getCommitment(), metadata)];
298
298
  case 2:
299
299
  _b = _c.sent(), tx = _b.tx, hash = _b.hash;
300
- return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extensions.sender, tx, hash)];
300
+ return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extParams.sender, tx, hash)];
301
301
  case 3:
302
302
  signature = _c.sent();
303
303
  return [2 /*return*/, { ixs: ixs, txId: signature, metadataId: metadataPubKey.toBase58() }];
@@ -395,7 +395,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
395
395
  * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
396
396
  */
397
397
  SolanaStreamClient.prototype.createMultiple = function (data, _a) {
398
- var sender = _a.sender, metadataPubKeys = _a.metadataPubKeys, _b = _a.isNative, isNative = _b === void 0 ? false : _b;
398
+ var sender = _a.sender, metadataPubKeys = _a.metadataPubKeys, _b = _a.isNative, isNative = _b === void 0 ? false : _b, computePrice = _a.computePrice, computeLimit = _a.computeLimit;
399
399
  return __awaiter(this, void 0, void 0, function () {
400
400
  var recipients, metadatas, metadataToRecipient, errors, signatures, batch, instructionsBatch, i, recipientData, _c, ixs, metadata, metadataPubKey, commitment, hash, instructionsBatch_1, instructionsBatch_1_1, _d, ixs, metadata, recipient, tx, totalDepositedAmount, nativeInstructions, prepareTransaction_1, signedBatch, prepareTx, responses, signedBatch_1, signedBatch_1_1, batchTx, _e, _f, _g, _h, e_1_1, batchTransactionsCalls, _j, _k, _l, _m, successes, failures;
401
401
  var e_2, _o, _p, _q, e_1, _r;
@@ -422,6 +422,8 @@ var SolanaStreamClient = /** @class */ (function (_super) {
422
422
  return [4 /*yield*/, this.prepareStreamInstructions(recipientData, data, {
423
423
  sender: sender,
424
424
  metadataPubKeys: metadataPubKeys[i] ? [metadataPubKeys[i]] : undefined,
425
+ computePrice: computePrice,
426
+ computeLimit: computeLimit,
425
427
  })];
426
428
  case 2:
427
429
  _c = _s.sent(), ixs = _c.ixs, metadata = _c.metadata, metadataPubKey = _c.metadataPubKey;
@@ -545,22 +547,21 @@ var SolanaStreamClient = /** @class */ (function (_super) {
545
547
  /**
546
548
  * Attempts withdrawing from the specified stream.
547
549
  */
548
- SolanaStreamClient.prototype.withdraw = function (_a, _b) {
549
- var id = _a.id, _c = _a.amount, amount = _c === void 0 ? constants_2.WITHDRAW_AVAILABLE_AMOUNT : _c;
550
- var invoker = _b.invoker, checkTokenAccounts = _b.checkTokenAccounts;
550
+ SolanaStreamClient.prototype.withdraw = function (_a, extParams) {
551
+ var id = _a.id, _b = _a.amount, amount = _b === void 0 ? constants_2.WITHDRAW_AVAILABLE_AMOUNT : _b;
551
552
  return __awaiter(this, void 0, void 0, function () {
552
- var ixs, _d, tx, hash, signature;
553
- return __generator(this, function (_e) {
554
- switch (_e.label) {
555
- case 0: return [4 /*yield*/, this.prepareWithdawInstructions({ id: id, amount: amount }, { invoker: invoker, checkTokenAccounts: checkTokenAccounts })];
553
+ var ixs, _c, tx, hash, signature;
554
+ return __generator(this, function (_d) {
555
+ switch (_d.label) {
556
+ case 0: return [4 /*yield*/, this.prepareWithdrawInstructions({ id: id, amount: amount }, extParams)];
556
557
  case 1:
557
- ixs = _e.sent();
558
- return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, invoker.publicKey, this.getCommitment())];
558
+ ixs = _d.sent();
559
+ return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey, this.getCommitment())];
559
560
  case 2:
560
- _d = _e.sent(), tx = _d.tx, hash = _d.hash;
561
- return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, invoker, tx, hash)];
561
+ _c = _d.sent(), tx = _c.tx, hash = _c.hash;
562
+ return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extParams.invoker, tx, hash)];
562
563
  case 3:
563
- signature = _e.sent();
564
+ signature = _d.sent();
564
565
  return [2 /*return*/, { ixs: ixs, txId: signature }];
565
566
  }
566
567
  });
@@ -569,7 +570,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
569
570
  /**
570
571
  * Creates Transaction Instructions for withdrawal
571
572
  */
572
- SolanaStreamClient.prototype.prepareWithdawInstructions = function (_a, _b) {
573
+ SolanaStreamClient.prototype.prepareWithdrawInstructions = function (_a, _b) {
573
574
  var id = _a.id, _c = _a.amount, amount = _c === void 0 ? constants_2.WITHDRAW_AVAILABLE_AMOUNT : _c;
574
575
  var invoker = _b.invoker, checkTokenAccounts = _b.checkTokenAccounts, computePrice = _b.computePrice, computeLimit = _b.computeLimit;
575
576
  return __awaiter(this, void 0, void 0, function () {
@@ -622,19 +623,19 @@ var SolanaStreamClient = /** @class */ (function (_super) {
622
623
  /**
623
624
  * Attempts canceling the specified stream.
624
625
  */
625
- SolanaStreamClient.prototype.cancel = function (_a, extensions) {
626
+ SolanaStreamClient.prototype.cancel = function (_a, extParams) {
626
627
  var id = _a.id;
627
628
  return __awaiter(this, void 0, void 0, function () {
628
629
  var ixs, _b, tx, hash, signature;
629
630
  return __generator(this, function (_c) {
630
631
  switch (_c.label) {
631
- case 0: return [4 /*yield*/, this.prepareCancelInstructions({ id: id }, extensions)];
632
+ case 0: return [4 /*yield*/, this.prepareCancelInstructions({ id: id }, extParams)];
632
633
  case 1:
633
634
  ixs = _c.sent();
634
- return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extensions.invoker.publicKey, this.getCommitment())];
635
+ return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey, this.getCommitment())];
635
636
  case 2:
636
637
  _b = _c.sent(), tx = _b.tx, hash = _b.hash;
637
- return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extensions.invoker, tx, hash)];
638
+ return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extParams.invoker, tx, hash)];
638
639
  case 3:
639
640
  signature = _c.sent();
640
641
  return [2 /*return*/, { ixs: ixs, txId: signature }];
@@ -701,19 +702,19 @@ var SolanaStreamClient = /** @class */ (function (_super) {
701
702
  * Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
702
703
  * Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
703
704
  */
704
- SolanaStreamClient.prototype.transfer = function (_a, extensions) {
705
+ SolanaStreamClient.prototype.transfer = function (_a, extParams) {
705
706
  var id = _a.id, newRecipient = _a.newRecipient;
706
707
  return __awaiter(this, void 0, void 0, function () {
707
708
  var ixs, _b, tx, hash, signature;
708
709
  return __generator(this, function (_c) {
709
710
  switch (_c.label) {
710
- case 0: return [4 /*yield*/, this.prepareTransferInstructions({ id: id, newRecipient: newRecipient }, extensions)];
711
+ case 0: return [4 /*yield*/, this.prepareTransferInstructions({ id: id, newRecipient: newRecipient }, extParams)];
711
712
  case 1:
712
713
  ixs = _c.sent();
713
- return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extensions.invoker.publicKey, this.getCommitment())];
714
+ return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey, this.getCommitment())];
714
715
  case 2:
715
716
  _b = _c.sent(), tx = _b.tx, hash = _b.hash;
716
- return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extensions.invoker, tx, hash)];
717
+ return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extParams.invoker, tx, hash)];
717
718
  case 3:
718
719
  signature = _c.sent();
719
720
  return [2 /*return*/, { ixs: ixs, txId: signature }];
@@ -771,19 +772,19 @@ var SolanaStreamClient = /** @class */ (function (_super) {
771
772
  /**
772
773
  * Tops up stream account with specified amount.
773
774
  */
774
- SolanaStreamClient.prototype.topup = function (_a, extensions) {
775
+ SolanaStreamClient.prototype.topup = function (_a, extParams) {
775
776
  var id = _a.id, amount = _a.amount;
776
777
  return __awaiter(this, void 0, void 0, function () {
777
778
  var ixs, _b, tx, hash, signature;
778
779
  return __generator(this, function (_c) {
779
780
  switch (_c.label) {
780
- case 0: return [4 /*yield*/, this.prepareTopupInstructions({ id: id, amount: amount }, extensions)];
781
+ case 0: return [4 /*yield*/, this.prepareTopupInstructions({ id: id, amount: amount }, extParams)];
781
782
  case 1:
782
783
  ixs = _c.sent();
783
- return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extensions.invoker.publicKey, this.getCommitment())];
784
+ return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey, this.getCommitment())];
784
785
  case 2:
785
786
  _b = _c.sent(), tx = _b.tx, hash = _b.hash;
786
- return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extensions.invoker, tx, hash)];
787
+ return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extParams.invoker, tx, hash)];
787
788
  case 3:
788
789
  signature = _c.sent();
789
790
  return [2 /*return*/, { ixs: ixs, txId: signature }];
@@ -921,18 +922,18 @@ var SolanaStreamClient = /** @class */ (function (_super) {
921
922
  /**
922
923
  * Attempts updating the stream auto withdrawal params and amount per period
923
924
  */
924
- SolanaStreamClient.prototype.update = function (data, extensions) {
925
+ SolanaStreamClient.prototype.update = function (data, extParams) {
925
926
  return __awaiter(this, void 0, void 0, function () {
926
927
  var ixs, _a, tx, hash, signature;
927
928
  return __generator(this, function (_b) {
928
929
  switch (_b.label) {
929
- case 0: return [4 /*yield*/, this.prepareUpdateInstructions(data, extensions)];
930
+ case 0: return [4 /*yield*/, this.prepareUpdateInstructions(data, extParams)];
930
931
  case 1:
931
932
  ixs = _b.sent();
932
- return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extensions.invoker.publicKey, this.getCommitment())];
933
+ return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey, this.getCommitment())];
933
934
  case 2:
934
935
  _a = _b.sent(), tx = _a.tx, hash = _a.hash;
935
- return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extensions.invoker, tx, hash)];
936
+ return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extParams.invoker, tx, hash)];
936
937
  case 3:
937
938
  signature = _b.sent();
938
939
  return [2 /*return*/, {
@@ -1019,14 +1020,14 @@ var SolanaStreamClient = /** @class */ (function (_super) {
1019
1020
  /**
1020
1021
  * Forms instructions from params, creates a raw transaction and fetch recent blockhash.
1021
1022
  */
1022
- SolanaStreamClient.prototype.prepareStreamInstructions = function (recipient, streamParams, solanaExtendedConfig) {
1023
+ SolanaStreamClient.prototype.prepareStreamInstructions = function (recipient, streamParams, extParams) {
1023
1024
  return __awaiter(this, void 0, void 0, function () {
1024
1025
  var mint, start, period, cliff, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, _a, automaticWithdrawal, _b, withdrawalFrequency, partner, sender, metadataPubKeys, ixs, recipientPublicKey, mintPublicKey, _c, metadata, metadataPubKey, _d, escrowTokens, senderTokens, recipientTokens, streamflowTreasuryTokens, partnerPublicKey, partnerTokens;
1025
1026
  return __generator(this, function (_e) {
1026
1027
  switch (_e.label) {
1027
1028
  case 0:
1028
1029
  mint = streamParams.tokenId, start = streamParams.start, period = streamParams.period, cliff = streamParams.cliff, canTopup = streamParams.canTopup, cancelableBySender = streamParams.cancelableBySender, cancelableByRecipient = streamParams.cancelableByRecipient, transferableBySender = streamParams.transferableBySender, transferableByRecipient = streamParams.transferableByRecipient, _a = streamParams.automaticWithdrawal, automaticWithdrawal = _a === void 0 ? false : _a, _b = streamParams.withdrawalFrequency, withdrawalFrequency = _b === void 0 ? 0 : _b, partner = streamParams.partner;
1029
- sender = solanaExtendedConfig.sender, metadataPubKeys = solanaExtendedConfig.metadataPubKeys;
1030
+ sender = extParams.sender, metadataPubKeys = extParams.metadataPubKeys;
1030
1031
  if (!sender.publicKey) {
1031
1032
  throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
1032
1033
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/stream",
3
- "version": "5.11.0",
3
+ "version": "5.11.2",
4
4
  "description": "JavaScript SDK to interact with Streamflow protocol.",
5
5
  "homepage": "https://github.com/streamflow-finance/js-sdk/",
6
6
  "main": "dist/index.js",
@@ -11,7 +11,7 @@
11
11
  "lint": "eslint .",
12
12
  "prepublishOnly": "npm run lint && npm test && npm run build"
13
13
  },
14
- "gitHead": "67681d9c64d1983631e2a5782d3f601ee19f666e",
14
+ "gitHead": "08187365d2ed2ec74cc63e418b2dfc5908b5424a",
15
15
  "devDependencies": {
16
16
  "@types/bn.js": "5.1.1",
17
17
  "@types/ethereum-checksum-address": "^0.0.0",