@debridge-finance/solana-utils 4.0.1 → 4.1.0

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.
@@ -6632,11 +6632,11 @@ function setBlockhash(transaction, blockhash) {
6632
6632
  * @returns
6633
6633
  */
6634
6634
  function sendAll(connection, wallet, transactions, options) {
6635
- var _a;
6635
+ var _a, _b;
6636
6636
  return __awaiter(this, void 0, void 0, function* () {
6637
6637
  const blockhashCommitment = (options === null || options === void 0 ? void 0 : options.blockhashCommitment) === undefined ? "finalized" : options.blockhashCommitment;
6638
6638
  const convertIntoTxV0 = (options === null || options === void 0 ? void 0 : options.convertIntoTxV0) === undefined ? true : options.convertIntoTxV0;
6639
- const debug = (options === null || options === void 0 ? void 0 : options.debug) === undefined ? false : options.debug;
6639
+ (options === null || options === void 0 ? void 0 : options.debug) === undefined ? false : options.debug;
6640
6640
  const skipPreflight = (options === null || options === void 0 ? void 0 : options.skipPreflight) === undefined ? false : options.skipPreflight;
6641
6641
  const rpcCalls = (options === null || options === void 0 ? void 0 : options.rpcCalls) === undefined ? 3 : options.rpcCalls;
6642
6642
  if (!Array.isArray(transactions))
@@ -6647,7 +6647,7 @@ function sendAll(connection, wallet, transactions, options) {
6647
6647
  let txIds = [];
6648
6648
  if ((options === null || options === void 0 ? void 0 : options.waitBetweenSend) === undefined || options.waitBetweenSend === 0) {
6649
6649
  yield Promise.all(transactions.map((tx) => __awaiter(this, void 0, void 0, function* () {
6650
- var _b;
6650
+ var _c;
6651
6651
  let txV0;
6652
6652
  if (isVersionedTx(tx)) {
6653
6653
  tx.message.recentBlockhash = FAKE_BLOCKHASH;
@@ -6670,7 +6670,7 @@ function sendAll(connection, wallet, transactions, options) {
6670
6670
  commitment: "confirmed",
6671
6671
  });
6672
6672
  if (simulationResult.value.err !== null) {
6673
- throw new Error(`Tx simulation Error! Transaction message dump: ${buffer.Buffer.from(txV0.serialize()).toString("base64")}\n Error: ${JSON.stringify(simulationResult.value.err)}, logs:\n ${(_b = simulationResult.value.logs) === null || _b === void 0 ? void 0 : _b.join("\n")}`);
6673
+ throw new Error(`Tx simulation Error! Transaction message dump: ${buffer.Buffer.from(txV0.serialize()).toString("base64")}\n Error: ${JSON.stringify(simulationResult.value.err)}, logs:\n ${(_c = simulationResult.value.logs) === null || _c === void 0 ? void 0 : _c.join("\n")}`);
6674
6674
  }
6675
6675
  }
6676
6676
  })));
@@ -6680,9 +6680,9 @@ function sendAll(connection, wallet, transactions, options) {
6680
6680
  // sign after setting correct blockhashes
6681
6681
  const signed = yield wallet.signAllTransactions(transactions, options === null || options === void 0 ? void 0 : options.signers);
6682
6682
  txIds = yield Promise.all(signed.map((signedTx) => {
6683
+ var _a;
6683
6684
  const serialized = buffer.Buffer.from(signedTx.serialize());
6684
- if (debug)
6685
- console.debug(serialized.toString("base64"));
6685
+ (_a = options === null || options === void 0 ? void 0 : options.logger) === null || _a === void 0 ? void 0 : _a.call(options, `Sending tx: ${serialized.toString("base64")}`);
6686
6686
  return sendWithRetries(connection, serialized, lastValidBlockHeight, rpcCalls, blockhashCommitment);
6687
6687
  }));
6688
6688
  }
@@ -6717,8 +6717,7 @@ function sendAll(connection, wallet, transactions, options) {
6717
6717
  }
6718
6718
  }
6719
6719
  const serialized = buffer.Buffer.from(signed.serialize());
6720
- if (debug)
6721
- console.debug(serialized.toString("base64"));
6720
+ (_b = options === null || options === void 0 ? void 0 : options.logger) === null || _b === void 0 ? void 0 : _b.call(options, `Sending tx: ${serialized.toString("base64")}`);
6722
6721
  txIds.push(yield sendWithRetries(connection, serialized, lastValidBlockHeight, rpcCalls, blockhashCommitment));
6723
6722
  yield sleep(options.waitBetweenSend);
6724
6723
  }