@debridge-finance/solana-utils 4.4.0 → 4.4.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.
- package/dist/browser/index.js +15 -12
- package/dist/browser/index.js.map +1 -1
- package/dist/cjs/helpers.js +12 -9
- package/dist/cjs/helpers.js.map +1 -1
- package/dist/esm/helpers.js +15 -12
- package/dist/esm/helpers.js.map +1 -1
- package/dist/types/helpers.d.ts +15 -0
- package/dist/types/helpers.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -6667,14 +6667,16 @@ function simulateTx(connection, tx, commitment, feePayer, convertToV0, alreadySi
|
|
|
6667
6667
|
* @returns
|
|
6668
6668
|
*/
|
|
6669
6669
|
function sendAll(connection, wallet, transactions, options) {
|
|
6670
|
-
var _a, _b;
|
|
6670
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6671
6671
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6672
|
-
const skipSign = (options === null || options === void 0 ? void 0 : options.skipSign)
|
|
6672
|
+
const skipSign = (_a = options === null || options === void 0 ? void 0 : options.skipSign) !== null && _a !== void 0 ? _a : false;
|
|
6673
6673
|
const blockhashCommitment = (options === null || options === void 0 ? void 0 : options.blockhashCommitment) === undefined
|
|
6674
|
-
? (
|
|
6674
|
+
? (_b = connection.commitment) !== null && _b !== void 0 ? _b : "confirmed"
|
|
6675
6675
|
: options.blockhashCommitment;
|
|
6676
|
-
const
|
|
6677
|
-
const
|
|
6676
|
+
const simulationCommitment = (_c = options === null || options === void 0 ? void 0 : options.simulationCommtiment) !== null && _c !== void 0 ? _c : blockhashCommitment;
|
|
6677
|
+
const useMinContextSlot = (_d = options === null || options === void 0 ? void 0 : options.useMinContextSlot) !== null && _d !== void 0 ? _d : false;
|
|
6678
|
+
const convertIntoTxV0 = (_e = options === null || options === void 0 ? void 0 : options.convertIntoTxV0) !== null && _e !== void 0 ? _e : true;
|
|
6679
|
+
const skipPreflight = (_f = options === null || options === void 0 ? void 0 : options.skipPreflight) !== null && _f !== void 0 ? _f : false;
|
|
6678
6680
|
if (!Array.isArray(transactions))
|
|
6679
6681
|
transactions = [transactions];
|
|
6680
6682
|
if (convertIntoTxV0) {
|
|
@@ -6683,13 +6685,13 @@ function sendAll(connection, wallet, transactions, options) {
|
|
|
6683
6685
|
let txIds = [];
|
|
6684
6686
|
if ((options === null || options === void 0 ? void 0 : options.waitBetweenSend) === undefined || options.waitBetweenSend === 0) {
|
|
6685
6687
|
if (!skipPreflight) {
|
|
6686
|
-
yield Promise.all(transactions.map((tx) => simulateTx(connection, tx,
|
|
6688
|
+
yield Promise.all(transactions.map((tx) => simulateTx(connection, tx, simulationCommitment, wallet.publicKey, convertIntoTxV0, skipSign)));
|
|
6687
6689
|
}
|
|
6688
|
-
const
|
|
6690
|
+
const blockhashResponse = yield connection.getLatestBlockhashAndContext({ commitment: blockhashCommitment });
|
|
6689
6691
|
let signed = transactions;
|
|
6690
6692
|
if (!skipSign) {
|
|
6691
6693
|
// set real blockhash
|
|
6692
|
-
transactions.map((tx) => setBlockhash(tx, blockhash));
|
|
6694
|
+
transactions.map((tx) => setBlockhash(tx, blockhashResponse.value.blockhash));
|
|
6693
6695
|
// sign after setting correct blockhashes
|
|
6694
6696
|
signed = yield wallet.signAllTransactions(transactions, options === null || options === void 0 ? void 0 : options.signers);
|
|
6695
6697
|
}
|
|
@@ -6698,8 +6700,9 @@ function sendAll(connection, wallet, transactions, options) {
|
|
|
6698
6700
|
const serialized = buffer.Buffer.from(signedTx.serialize()).toString("base64");
|
|
6699
6701
|
(_a = options === null || options === void 0 ? void 0 : options.logger) === null || _a === void 0 ? void 0 : _a.call(options, `Sending tx: ${serialized}`);
|
|
6700
6702
|
return connection.sendEncodedTransaction(serialized, {
|
|
6701
|
-
preflightCommitment:
|
|
6703
|
+
preflightCommitment: simulationCommitment,
|
|
6702
6704
|
skipPreflight: false,
|
|
6705
|
+
minContextSlot: useMinContextSlot ? blockhashResponse.context.slot + 1 : undefined,
|
|
6703
6706
|
});
|
|
6704
6707
|
}));
|
|
6705
6708
|
}
|
|
@@ -6712,12 +6715,12 @@ function sendAll(connection, wallet, transactions, options) {
|
|
|
6712
6715
|
? options.signers[i]
|
|
6713
6716
|
: undefined);
|
|
6714
6717
|
if (!skipPreflight) {
|
|
6715
|
-
yield simulateTx(connection, tx,
|
|
6718
|
+
yield simulateTx(connection, tx, simulationCommitment, wallet.publicKey, convertIntoTxV0, skipSign);
|
|
6716
6719
|
}
|
|
6717
6720
|
const serialized = buffer.Buffer.from(signed.serialize()).toString("base64");
|
|
6718
|
-
(
|
|
6721
|
+
(_g = options === null || options === void 0 ? void 0 : options.logger) === null || _g === void 0 ? void 0 : _g.call(options, `Sending tx: ${serialized}`);
|
|
6719
6722
|
txIds.push(yield connection.sendEncodedTransaction(serialized, {
|
|
6720
|
-
preflightCommitment:
|
|
6723
|
+
preflightCommitment: simulationCommitment,
|
|
6721
6724
|
skipPreflight: false,
|
|
6722
6725
|
}));
|
|
6723
6726
|
yield sleep(options.waitBetweenSend);
|