@streamflow/stream 5.11.2 → 5.11.4

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.
@@ -176,7 +176,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
176
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, extParams.sender.publicKey, this.getCommitment(), metadata)];
179
+ return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.sender.publicKey, undefined, metadata)];
180
180
  case 2:
181
181
  _b = _c.sent(), tx = _b.tx, hash = _b.hash;
182
182
  return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extParams.sender, tx, hash)];
@@ -294,7 +294,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
294
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, extParams.sender.publicKey, this.getCommitment(), metadata)];
297
+ return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.sender.publicKey, undefined, metadata)];
298
298
  case 2:
299
299
  _b = _c.sent(), tx = _b.tx, hash = _b.hash;
300
300
  return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extParams.sender, tx, hash)];
@@ -397,7 +397,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
397
397
  SolanaStreamClient.prototype.createMultiple = function (data, _a) {
398
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
- 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;
400
+ var recipients, metadatas, metadataToRecipient, errors, signatures, batch, instructionsBatch, i, recipientData, _c, ixs, metadata, metadataPubKey, 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;
402
402
  var _this = this;
403
403
  return __generator(this, function (_s) {
@@ -434,9 +434,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
434
434
  case 3:
435
435
  i++;
436
436
  return [3 /*break*/, 1];
437
- case 4:
438
- commitment = typeof this.commitment == "string" ? this.commitment : this.commitment.commitment;
439
- return [4 /*yield*/, this.connection.getLatestBlockhash(commitment)];
437
+ case 4: return [4 /*yield*/, this.connection.getLatestBlockhash()];
440
438
  case 5:
441
439
  hash = _s.sent();
442
440
  try {
@@ -556,7 +554,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
556
554
  case 0: return [4 /*yield*/, this.prepareWithdrawInstructions({ id: id, amount: amount }, extParams)];
557
555
  case 1:
558
556
  ixs = _d.sent();
559
- return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey, this.getCommitment())];
557
+ return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey)];
560
558
  case 2:
561
559
  _c = _d.sent(), tx = _c.tx, hash = _c.hash;
562
560
  return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extParams.invoker, tx, hash)];
@@ -632,7 +630,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
632
630
  case 0: return [4 /*yield*/, this.prepareCancelInstructions({ id: id }, extParams)];
633
631
  case 1:
634
632
  ixs = _c.sent();
635
- return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey, this.getCommitment())];
633
+ return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey)];
636
634
  case 2:
637
635
  _b = _c.sent(), tx = _b.tx, hash = _b.hash;
638
636
  return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extParams.invoker, tx, hash)];
@@ -711,7 +709,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
711
709
  case 0: return [4 /*yield*/, this.prepareTransferInstructions({ id: id, newRecipient: newRecipient }, extParams)];
712
710
  case 1:
713
711
  ixs = _c.sent();
714
- return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey, this.getCommitment())];
712
+ return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey)];
715
713
  case 2:
716
714
  _b = _c.sent(), tx = _b.tx, hash = _b.hash;
717
715
  return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extParams.invoker, tx, hash)];
@@ -781,7 +779,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
781
779
  case 0: return [4 /*yield*/, this.prepareTopupInstructions({ id: id, amount: amount }, extParams)];
782
780
  case 1:
783
781
  ixs = _c.sent();
784
- return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey, this.getCommitment())];
782
+ return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey)];
785
783
  case 2:
786
784
  _b = _c.sent(), tx = _b.tx, hash = _b.hash;
787
785
  return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extParams.invoker, tx, hash)];
@@ -930,7 +928,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
930
928
  case 0: return [4 /*yield*/, this.prepareUpdateInstructions(data, extParams)];
931
929
  case 1:
932
930
  ixs = _b.sent();
933
- return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey, this.getCommitment())];
931
+ return [4 /*yield*/, (0, utils_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey)];
934
932
  case 2:
935
933
  _a = _b.sent(), tx = _a.tx, hash = _a.hash;
936
934
  return [4 /*yield*/, (0, utils_1.signAndExecuteTransaction)(this.connection, extParams.invoker, tx, hash)];
@@ -1022,16 +1020,19 @@ var SolanaStreamClient = /** @class */ (function (_super) {
1022
1020
  */
1023
1021
  SolanaStreamClient.prototype.prepareStreamInstructions = function (recipient, streamParams, extParams) {
1024
1022
  return __awaiter(this, void 0, void 0, function () {
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;
1023
+ var mint, start, period, cliff, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, _a, automaticWithdrawal, _b, withdrawalFrequency, partner, sender, metadataPubKeys, computeLimit, computePrice, ixs, recipientPublicKey, mintPublicKey, _c, metadata, metadataPubKey, _d, escrowTokens, senderTokens, recipientTokens, streamflowTreasuryTokens, partnerPublicKey, partnerTokens;
1026
1024
  return __generator(this, function (_e) {
1027
1025
  switch (_e.label) {
1028
1026
  case 0:
1029
1027
  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;
1030
- sender = extParams.sender, metadataPubKeys = extParams.metadataPubKeys;
1028
+ sender = extParams.sender, metadataPubKeys = extParams.metadataPubKeys, computeLimit = extParams.computeLimit, computePrice = extParams.computePrice;
1031
1029
  if (!sender.publicKey) {
1032
1030
  throw new Error("Sender's PublicKey is not available, check passed wallet adapter!");
1033
1031
  }
1034
- ixs = [];
1032
+ ixs = this.prepareBaseInstructions({
1033
+ computePrice: computePrice,
1034
+ computeLimit: computeLimit,
1035
+ });
1035
1036
  recipientPublicKey = new web3_js_1.PublicKey(recipient.recipient);
1036
1037
  mintPublicKey = new web3_js_1.PublicKey(mint);
1037
1038
  _c = this.getOrCreateStreamMetadata(metadataPubKeys), metadata = _c.metadata, metadataPubKey = _c.metadataPubKey;
@@ -25,7 +25,13 @@ export declare function isSignerWallet(walletOrKeypair: Keypair | SignerWalletAd
25
25
  */
26
26
  export declare function isSignerKeypair(walletOrKeypair: Keypair | SignerWalletAdapter): walletOrKeypair is Keypair;
27
27
  /**
28
- * Creates a Transaction with given instructions and optionally signs it
28
+ * Creates a Transaction with given instructions and optionally signs it.
29
+ * Be careful when passing `commitment` as for `confirmed` blockhash it always returns blockheight + 300 in `lastValidBlockHeight`
30
+ * And if you use this blockheight to confirm the transaction it could happen so that transaction is successfully executed
31
+ * But because `confirmTransaction` waits for only a minute it considers tx as expired as it could be that 300 blocks won't pass in a minute
32
+ * https://solana.stackexchange.com/questions/6238/why-is-lastvalidblockheight-300-blocks-ahead-than-current-blockheight-if-hashes
33
+ * https://solana.com/docs/core/transactions/retry
34
+ * It might be better to rely on `commitment` level that you pass to `Connection` instance of Solana client as it will be used when fetching blockheight on transaction confirmation
29
35
  * @param connection - Solana client connection
30
36
  * @param ixs - Instructions to add to the Transaction
31
37
  * @param payer - PublicKey of payer
@@ -189,7 +189,13 @@ function isSignerKeypair(walletOrKeypair) {
189
189
  }
190
190
  exports.isSignerKeypair = isSignerKeypair;
191
191
  /**
192
- * Creates a Transaction with given instructions and optionally signs it
192
+ * Creates a Transaction with given instructions and optionally signs it.
193
+ * Be careful when passing `commitment` as for `confirmed` blockhash it always returns blockheight + 300 in `lastValidBlockHeight`
194
+ * And if you use this blockheight to confirm the transaction it could happen so that transaction is successfully executed
195
+ * But because `confirmTransaction` waits for only a minute it considers tx as expired as it could be that 300 blocks won't pass in a minute
196
+ * https://solana.stackexchange.com/questions/6238/why-is-lastvalidblockheight-300-blocks-ahead-than-current-blockheight-if-hashes
197
+ * https://solana.com/docs/core/transactions/retry
198
+ * It might be better to rely on `commitment` level that you pass to `Connection` instance of Solana client as it will be used when fetching blockheight on transaction confirmation
193
199
  * @param connection - Solana client connection
194
200
  * @param ixs - Instructions to add to the Transaction
195
201
  * @param payer - PublicKey of payer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamflow/stream",
3
- "version": "5.11.2",
3
+ "version": "5.11.4",
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": "08187365d2ed2ec74cc63e418b2dfc5908b5424a",
14
+ "gitHead": "37ccf3707197e160979a340475f4fb1ec04d9eee",
15
15
  "devDependencies": {
16
16
  "@types/bn.js": "5.1.1",
17
17
  "@types/ethereum-checksum-address": "^0.0.0",