@streamflow/stream 3.0.17 → 3.0.19
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 +20 -17
- package/package.json +1 -1
package/dist/StreamClient.js
CHANGED
|
@@ -450,6 +450,9 @@ var StreamClient = /** @class */ (function () {
|
|
|
450
450
|
case 11: return [4 /*yield*/, signAllTransactionWithRecipients(sender, batch)];
|
|
451
451
|
case 12:
|
|
452
452
|
signed_batch = _d.sent();
|
|
453
|
+
signed_batch.forEach(function (item, index) {
|
|
454
|
+
item.tx.lastValidBlockHeight = batch[index].tx.lastValidBlockHeight;
|
|
455
|
+
});
|
|
453
456
|
if (!data.isNative) return [3 /*break*/, 14];
|
|
454
457
|
prepareTx = signed_batch.pop();
|
|
455
458
|
return [4 /*yield*/, sendAndConfirmStreamRawTransaction(this.connection, prepareTx)];
|
|
@@ -811,25 +814,26 @@ var StreamClient = /** @class */ (function () {
|
|
|
811
814
|
};
|
|
812
815
|
StreamClient.prototype.sign = function (invoker, tx, hash) {
|
|
813
816
|
return __awaiter(this, void 0, void 0, function () {
|
|
814
|
-
var rawTx, confirmationStrategy, signature;
|
|
817
|
+
var signedTransaction, rawTx, confirmationStrategy, signature;
|
|
815
818
|
return __generator(this, function (_a) {
|
|
816
819
|
switch (_a.label) {
|
|
817
820
|
case 0:
|
|
818
821
|
if (!isAnchorWallet(invoker)) return [3 /*break*/, 2];
|
|
819
822
|
return [4 /*yield*/, invoker.signTransaction(tx)];
|
|
820
823
|
case 1:
|
|
821
|
-
_a.sent();
|
|
824
|
+
signedTransaction = _a.sent();
|
|
822
825
|
return [3 /*break*/, 3];
|
|
823
826
|
case 2:
|
|
824
827
|
tx.partialSign(invoker);
|
|
828
|
+
signedTransaction = tx;
|
|
825
829
|
_a.label = 3;
|
|
826
830
|
case 3:
|
|
827
|
-
rawTx =
|
|
828
|
-
if (!hash.lastValidBlockHeight || !
|
|
831
|
+
rawTx = signedTransaction.serialize();
|
|
832
|
+
if (!hash.lastValidBlockHeight || !signedTransaction.signature || !hash.blockhash)
|
|
829
833
|
throw Error("Error with transaction parameters.");
|
|
830
834
|
confirmationStrategy = {
|
|
831
835
|
lastValidBlockHeight: hash.lastValidBlockHeight,
|
|
832
|
-
signature: (0, bs58_1.encode)(
|
|
836
|
+
signature: (0, bs58_1.encode)(signedTransaction.signature),
|
|
833
837
|
blockhash: hash.blockhash,
|
|
834
838
|
};
|
|
835
839
|
return [4 /*yield*/, (0, web3_js_1.sendAndConfirmRawTransaction)(this.connection, rawTx, confirmationStrategy)];
|
|
@@ -961,28 +965,27 @@ function isAnchorWallet(wallet) {
|
|
|
961
965
|
}
|
|
962
966
|
function signAllTransactionWithRecipients(sender, batch) {
|
|
963
967
|
return __awaiter(this, void 0, void 0, function () {
|
|
964
|
-
var
|
|
968
|
+
var isKeypair, isWallet, signedTxs_1;
|
|
965
969
|
return __generator(this, function (_a) {
|
|
966
970
|
switch (_a.label) {
|
|
967
971
|
case 0:
|
|
968
|
-
signed_batch = [];
|
|
969
972
|
isKeypair = sender instanceof web3_js_1.Keypair;
|
|
970
973
|
isWallet = isAnchorWallet(sender);
|
|
971
|
-
if (!isKeypair && !isWallet)
|
|
972
|
-
return [2 /*return*/, signed_batch];
|
|
973
974
|
if (!isKeypair) return [3 /*break*/, 1];
|
|
974
|
-
batch.map(function (t) {
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
return [3 /*break*/, 3];
|
|
975
|
+
return [2 /*return*/, batch.map(function (t) {
|
|
976
|
+
t.tx.partialSign(sender);
|
|
977
|
+
return { tx: t.tx, recipient: t.recipient };
|
|
978
|
+
})];
|
|
979
979
|
case 1:
|
|
980
980
|
if (!isWallet) return [3 /*break*/, 3];
|
|
981
981
|
return [4 /*yield*/, sender.signAllTransactions(batch.map(function (t) { return t.tx; }))];
|
|
982
982
|
case 2:
|
|
983
|
-
_a.sent();
|
|
984
|
-
|
|
985
|
-
|
|
983
|
+
signedTxs_1 = _a.sent();
|
|
984
|
+
return [2 /*return*/, batch.map(function (item, index) { return ({
|
|
985
|
+
recipient: item.recipient,
|
|
986
|
+
tx: signedTxs_1[index],
|
|
987
|
+
}); })];
|
|
988
|
+
case 3: return [2 /*return*/, []];
|
|
986
989
|
}
|
|
987
990
|
});
|
|
988
991
|
});
|
package/package.json
CHANGED