@streamflow/stream 3.0.8 → 3.0.9
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.js +35 -24
- package/package.json +1 -1
package/dist/StreamClient.js
CHANGED
|
@@ -211,15 +211,16 @@ var StreamClient = /** @class */ (function () {
|
|
|
211
211
|
commitment = typeof this.commitment == "string"
|
|
212
212
|
? this.commitment
|
|
213
213
|
: this.commitment.commitment;
|
|
214
|
-
return [4 /*yield*/, this.connection.
|
|
214
|
+
return [4 /*yield*/, this.connection.getLatestBlockhash(commitment)];
|
|
215
215
|
case 6:
|
|
216
216
|
hash = _g.sent();
|
|
217
217
|
tx = (_f = new web3_js_1.Transaction({
|
|
218
218
|
feePayer: sender.publicKey,
|
|
219
|
-
|
|
219
|
+
blockhash: hash.blockhash,
|
|
220
|
+
lastValidBlockHeight: hash.lastValidBlockHeight,
|
|
220
221
|
})).add.apply(_f, __spreadArray([], __read(ixs), false));
|
|
221
222
|
tx.partialSign(metadata);
|
|
222
|
-
return [4 /*yield*/, this.sign(sender, tx)];
|
|
223
|
+
return [4 /*yield*/, this.sign(sender, tx, hash)];
|
|
223
224
|
case 7:
|
|
224
225
|
signature = _g.sent();
|
|
225
226
|
return [2 /*return*/, { ixs: ixs, tx: signature, metadata: metadata }];
|
|
@@ -393,14 +394,15 @@ var StreamClient = /** @class */ (function () {
|
|
|
393
394
|
commitment = typeof this.commitment == "string"
|
|
394
395
|
? this.commitment
|
|
395
396
|
: this.commitment.commitment;
|
|
396
|
-
return [4 /*yield*/, this.connection.
|
|
397
|
+
return [4 /*yield*/, this.connection.getLatestBlockhash(commitment)];
|
|
397
398
|
case 4:
|
|
398
399
|
hash = _c.sent();
|
|
399
400
|
tx = (_b = new web3_js_1.Transaction({
|
|
400
401
|
feePayer: invoker.publicKey,
|
|
401
|
-
|
|
402
|
+
blockhash: hash.blockhash,
|
|
403
|
+
lastValidBlockHeight: hash.lastValidBlockHeight,
|
|
402
404
|
})).add.apply(_b, __spreadArray([], __read(ixs), false));
|
|
403
|
-
return [4 /*yield*/, this.sign(invoker, tx)];
|
|
405
|
+
return [4 /*yield*/, this.sign(invoker, tx, hash)];
|
|
404
406
|
case 5:
|
|
405
407
|
signature = _c.sent();
|
|
406
408
|
return [2 /*return*/, { ixs: ixs, tx: signature }];
|
|
@@ -455,14 +457,15 @@ var StreamClient = /** @class */ (function () {
|
|
|
455
457
|
commitment = typeof this.commitment == "string"
|
|
456
458
|
? this.commitment
|
|
457
459
|
: this.commitment.commitment;
|
|
458
|
-
return [4 /*yield*/, this.connection.
|
|
460
|
+
return [4 /*yield*/, this.connection.getLatestBlockhash(commitment)];
|
|
459
461
|
case 4:
|
|
460
462
|
hash = _c.sent();
|
|
461
463
|
tx = (_b = new web3_js_1.Transaction({
|
|
462
464
|
feePayer: invoker.publicKey,
|
|
463
|
-
|
|
465
|
+
blockhash: hash.blockhash,
|
|
466
|
+
lastValidBlockHeight: hash.lastValidBlockHeight,
|
|
464
467
|
})).add.apply(_b, __spreadArray([], __read(ixs), false));
|
|
465
|
-
return [4 /*yield*/, this.sign(invoker, tx)];
|
|
468
|
+
return [4 /*yield*/, this.sign(invoker, tx, hash)];
|
|
466
469
|
case 5:
|
|
467
470
|
signature = _c.sent();
|
|
468
471
|
return [2 /*return*/, { ixs: ixs, tx: signature }];
|
|
@@ -513,14 +516,15 @@ var StreamClient = /** @class */ (function () {
|
|
|
513
516
|
commitment = typeof this.commitment == "string"
|
|
514
517
|
? this.commitment
|
|
515
518
|
: this.commitment.commitment;
|
|
516
|
-
return [4 /*yield*/, this.connection.
|
|
519
|
+
return [4 /*yield*/, this.connection.getLatestBlockhash(commitment)];
|
|
517
520
|
case 3:
|
|
518
521
|
hash = _c.sent();
|
|
519
522
|
tx = (_b = new web3_js_1.Transaction({
|
|
520
523
|
feePayer: invoker.publicKey,
|
|
521
|
-
|
|
524
|
+
blockhash: hash.blockhash,
|
|
525
|
+
lastValidBlockHeight: hash.lastValidBlockHeight,
|
|
522
526
|
})).add.apply(_b, __spreadArray([], __read(ixs), false));
|
|
523
|
-
return [4 /*yield*/, this.sign(invoker, tx)];
|
|
527
|
+
return [4 /*yield*/, this.sign(invoker, tx, hash)];
|
|
524
528
|
case 4:
|
|
525
529
|
signature = _c.sent();
|
|
526
530
|
return [2 /*return*/, { ixs: ixs, tx: signature }];
|
|
@@ -575,14 +579,15 @@ var StreamClient = /** @class */ (function () {
|
|
|
575
579
|
commitment = typeof this.commitment == "string"
|
|
576
580
|
? this.commitment
|
|
577
581
|
: this.commitment.commitment;
|
|
578
|
-
return [4 /*yield*/, this.connection.
|
|
582
|
+
return [4 /*yield*/, this.connection.getLatestBlockhash(commitment)];
|
|
579
583
|
case 4:
|
|
580
584
|
hash = _d.sent();
|
|
581
585
|
tx = (_c = new web3_js_1.Transaction({
|
|
582
586
|
feePayer: invoker.publicKey,
|
|
583
|
-
|
|
587
|
+
blockhash: hash.blockhash,
|
|
588
|
+
lastValidBlockHeight: hash.lastValidBlockHeight,
|
|
584
589
|
})).add.apply(_c, __spreadArray([], __read(ixs), false));
|
|
585
|
-
return [4 /*yield*/, this.sign(invoker, tx)];
|
|
590
|
+
return [4 /*yield*/, this.sign(invoker, tx, hash)];
|
|
586
591
|
case 5:
|
|
587
592
|
signature = _d.sent();
|
|
588
593
|
return [2 /*return*/, { ixs: ixs, tx: signature }];
|
|
@@ -664,24 +669,30 @@ var StreamClient = /** @class */ (function () {
|
|
|
664
669
|
});
|
|
665
670
|
});
|
|
666
671
|
};
|
|
667
|
-
StreamClient.prototype.sign = function (invoker, tx) {
|
|
672
|
+
StreamClient.prototype.sign = function (invoker, tx, hash) {
|
|
668
673
|
return __awaiter(this, void 0, void 0, function () {
|
|
669
|
-
var rawTx, signature;
|
|
674
|
+
var rawTx, confirmationStrategy, signature;
|
|
670
675
|
return __generator(this, function (_a) {
|
|
671
676
|
switch (_a.label) {
|
|
672
677
|
case 0:
|
|
673
|
-
if (!(invoker
|
|
674
|
-
tx.partialSign(invoker);
|
|
675
|
-
return [3 /*break*/, 3];
|
|
676
|
-
case 1:
|
|
677
|
-
if (!(invoker === null || invoker === void 0 ? void 0 : invoker.signTransaction)) return [3 /*break*/, 3];
|
|
678
|
+
if (!isAnchorWallet(invoker)) return [3 /*break*/, 2];
|
|
678
679
|
return [4 /*yield*/, invoker.signTransaction(tx)];
|
|
679
|
-
case
|
|
680
|
+
case 1:
|
|
680
681
|
_a.sent();
|
|
682
|
+
return [3 /*break*/, 3];
|
|
683
|
+
case 2:
|
|
684
|
+
tx.partialSign(invoker);
|
|
681
685
|
_a.label = 3;
|
|
682
686
|
case 3:
|
|
683
687
|
rawTx = tx.serialize();
|
|
684
|
-
|
|
688
|
+
if (!hash.lastValidBlockHeight || !tx.signature || !hash.blockhash)
|
|
689
|
+
throw Error("Error with transaction parameters.");
|
|
690
|
+
confirmationStrategy = {
|
|
691
|
+
lastValidBlockHeight: hash.lastValidBlockHeight,
|
|
692
|
+
signature: (0, bs58_1.encode)(tx.signature),
|
|
693
|
+
blockhash: hash.blockhash,
|
|
694
|
+
};
|
|
695
|
+
return [4 /*yield*/, (0, web3_js_1.sendAndConfirmRawTransaction)(this.connection, rawTx, confirmationStrategy)];
|
|
685
696
|
case 4:
|
|
686
697
|
signature = _a.sent();
|
|
687
698
|
return [2 /*return*/, signature];
|
package/package.json
CHANGED