@debridge-finance/solana-utils 4.4.1 → 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.
@@ -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) === undefined ? false : 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
- ? (_a = connection.commitment) !== null && _a !== void 0 ? _a : "confirmed"
6674
+ ? (_b = connection.commitment) !== null && _b !== void 0 ? _b : "confirmed"
6675
6675
  : options.blockhashCommitment;
6676
- const convertIntoTxV0 = (options === null || options === void 0 ? void 0 : options.convertIntoTxV0) === undefined ? true : options.convertIntoTxV0;
6677
- const skipPreflight = (options === null || options === void 0 ? void 0 : options.skipPreflight) === undefined ? false : options.skipPreflight;
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,7 +6685,7 @@ 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, blockhashCommitment, wallet.publicKey, convertIntoTxV0, skipSign)));
6688
+ yield Promise.all(transactions.map((tx) => simulateTx(connection, tx, simulationCommitment, wallet.publicKey, convertIntoTxV0, skipSign)));
6687
6689
  }
6688
6690
  const blockhashResponse = yield connection.getLatestBlockhashAndContext({ commitment: blockhashCommitment });
6689
6691
  let signed = transactions;
@@ -6698,9 +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: blockhashCommitment,
6703
+ preflightCommitment: simulationCommitment,
6702
6704
  skipPreflight: false,
6703
- minContextSlot: blockhashResponse.context.slot + 1
6705
+ minContextSlot: useMinContextSlot ? blockhashResponse.context.slot + 1 : undefined,
6704
6706
  });
6705
6707
  }));
6706
6708
  }
@@ -6713,12 +6715,12 @@ function sendAll(connection, wallet, transactions, options) {
6713
6715
  ? options.signers[i]
6714
6716
  : undefined);
6715
6717
  if (!skipPreflight) {
6716
- yield simulateTx(connection, tx, blockhashCommitment, wallet.publicKey, convertIntoTxV0, skipSign);
6718
+ yield simulateTx(connection, tx, simulationCommitment, wallet.publicKey, convertIntoTxV0, skipSign);
6717
6719
  }
6718
6720
  const serialized = buffer.Buffer.from(signed.serialize()).toString("base64");
6719
- (_b = options === null || options === void 0 ? void 0 : options.logger) === null || _b === void 0 ? void 0 : _b.call(options, `Sending tx: ${serialized}`);
6721
+ (_g = options === null || options === void 0 ? void 0 : options.logger) === null || _g === void 0 ? void 0 : _g.call(options, `Sending tx: ${serialized}`);
6720
6722
  txIds.push(yield connection.sendEncodedTransaction(serialized, {
6721
- preflightCommitment: blockhashCommitment,
6723
+ preflightCommitment: simulationCommitment,
6722
6724
  skipPreflight: false,
6723
6725
  }));
6724
6726
  yield sleep(options.waitBetweenSend);