@streamflow/stream 4.0.2 → 4.0.3
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/solana/StreamClient.js +7 -4
- package/dist/solana/utils.js +12 -8
- package/package.json +1 -1
|
@@ -343,7 +343,7 @@ var SolanaStreamClient = /** @class */ (function (_super) {
|
|
|
343
343
|
SolanaStreamClient.prototype.createMultiple = function (data, _a) {
|
|
344
344
|
var sender = _a.sender, _b = _a.partner, partner = _b === void 0 ? null : _b, _c = _a.isNative, isNative = _c === void 0 ? false : _c;
|
|
345
345
|
return __awaiter(this, void 0, void 0, function () {
|
|
346
|
-
var recipients, metadatas, metadataToRecipient, errors, signatures, batch, recipients_1, recipients_1_1, recipientData, _d, tx, metadata, metadataPubKey, e_1_1, totalDepositedAmount, nativeInstructions, commitment, hash, prepareTransaction,
|
|
346
|
+
var recipients, metadatas, metadataToRecipient, errors, signatures, batch, recipients_1, recipients_1_1, recipientData, _d, tx, metadata, metadataPubKey, e_1_1, totalDepositedAmount, nativeInstructions, commitment, hash, prepareTransaction, signedBatch, prepareTx, batchTransactionsCalls, responses, successes, failures;
|
|
347
347
|
var e_1, _e, _f;
|
|
348
348
|
var _this = this;
|
|
349
349
|
return __generator(this, function (_g) {
|
|
@@ -410,15 +410,18 @@ var SolanaStreamClient = /** @class */ (function (_super) {
|
|
|
410
410
|
_g.label = 11;
|
|
411
411
|
case 11: return [4 /*yield*/, (0, utils_1.signAllTransactionWithRecipients)(sender, batch)];
|
|
412
412
|
case 12:
|
|
413
|
-
|
|
413
|
+
signedBatch = _g.sent();
|
|
414
|
+
signedBatch.forEach(function (item, index) {
|
|
415
|
+
item.tx.lastValidBlockHeight = batch[index].tx.lastValidBlockHeight;
|
|
416
|
+
});
|
|
414
417
|
if (!isNative) return [3 /*break*/, 14];
|
|
415
|
-
prepareTx =
|
|
418
|
+
prepareTx = signedBatch.pop();
|
|
416
419
|
return [4 /*yield*/, (0, utils_1.sendAndConfirmStreamRawTransaction)(this.connection, prepareTx)];
|
|
417
420
|
case 13:
|
|
418
421
|
_g.sent();
|
|
419
422
|
_g.label = 14;
|
|
420
423
|
case 14:
|
|
421
|
-
batchTransactionsCalls =
|
|
424
|
+
batchTransactionsCalls = signedBatch.map(function (el) {
|
|
422
425
|
return (0, utils_1.sendAndConfirmStreamRawTransaction)(_this.connection, el);
|
|
423
426
|
});
|
|
424
427
|
return [4 /*yield*/, Promise.allSettled(batchTransactionsCalls)];
|
package/dist/solana/utils.js
CHANGED
|
@@ -227,14 +227,15 @@ exports.signAllTransactionWithRecipients = signAllTransactionWithRecipients;
|
|
|
227
227
|
* @return {Promise<BatchItemResult>} - Returns settled transaction item
|
|
228
228
|
*/
|
|
229
229
|
function sendAndConfirmStreamRawTransaction(connection, batchItem) {
|
|
230
|
+
var _a, _b;
|
|
230
231
|
return __awaiter(this, void 0, void 0, function () {
|
|
231
|
-
var rawTx,
|
|
232
|
-
return __generator(this, function (
|
|
233
|
-
switch (
|
|
232
|
+
var rawTx, _c, lastValidBlockHeight, signature, recentBlockhash, confirmationStrategy, completedTxSignature, error_1;
|
|
233
|
+
return __generator(this, function (_d) {
|
|
234
|
+
switch (_d.label) {
|
|
234
235
|
case 0:
|
|
235
|
-
|
|
236
|
+
_d.trys.push([0, 2, , 3]);
|
|
236
237
|
rawTx = batchItem.tx.serialize();
|
|
237
|
-
|
|
238
|
+
_c = batchItem.tx, lastValidBlockHeight = _c.lastValidBlockHeight, signature = _c.signature, recentBlockhash = _c.recentBlockhash;
|
|
238
239
|
if (!lastValidBlockHeight || !signature || !recentBlockhash)
|
|
239
240
|
throw { recipient: batchItem.recipient, error: "no recent blockhash" };
|
|
240
241
|
confirmationStrategy = {
|
|
@@ -244,11 +245,14 @@ function sendAndConfirmStreamRawTransaction(connection, batchItem) {
|
|
|
244
245
|
};
|
|
245
246
|
return [4 /*yield*/, (0, web3_js_1.sendAndConfirmRawTransaction)(connection, rawTx, confirmationStrategy)];
|
|
246
247
|
case 1:
|
|
247
|
-
completedTxSignature =
|
|
248
|
+
completedTxSignature = _d.sent();
|
|
248
249
|
return [2 /*return*/, __assign(__assign({}, batchItem), { signature: completedTxSignature })];
|
|
249
250
|
case 2:
|
|
250
|
-
error_1 =
|
|
251
|
-
throw {
|
|
251
|
+
error_1 = _d.sent();
|
|
252
|
+
throw {
|
|
253
|
+
recipient: batchItem.recipient,
|
|
254
|
+
error: (_b = (_a = error_1 === null || error_1 === void 0 ? void 0 : error_1.error) !== null && _a !== void 0 ? _a : error_1 === null || error_1 === void 0 ? void 0 : error_1.message) !== null && _b !== void 0 ? _b : error_1.toString(),
|
|
255
|
+
};
|
|
252
256
|
case 3: return [2 /*return*/];
|
|
253
257
|
}
|
|
254
258
|
});
|
package/package.json
CHANGED