btc-wallet 0.5.17-beta → 0.5.18-beta

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/esm/index.js CHANGED
@@ -3466,21 +3466,15 @@ function calculateGasStrategy(_0) {
3466
3466
  console.log("perTxFee:", perTxFee);
3467
3467
  const protocolFee = new Big(perTxFee || "0").mul(convertTx.length).toFixed(0);
3468
3468
  console.log("protocolFee:", protocolFee);
3469
- if (new Big(gasTokenBalance).gte(protocolFee)) {
3470
- console.log("use near pay gas and enough gas token balance");
3471
- return { useNearPayGas: true, gasLimit: protocolFee };
3472
- } else {
3473
- console.log("use near pay gas and not enough gas token balance");
3474
- const transferTx = yield createGasTokenTransfer({ csna, amount: protocolFee, env });
3475
- return recalculateGasWithTransfer({
3476
- csna,
3477
- transferTx,
3478
- transactions: convertTx,
3479
- useNearPayGas: true,
3480
- perTxFee: perTxFee.toString(),
3481
- env
3482
- });
3483
- }
3469
+ const transferTx = yield createGasTokenTransfer({ csna, amount: protocolFee, env });
3470
+ return recalculateGasWithTransfer({
3471
+ csna,
3472
+ transferTx,
3473
+ transactions: convertTx,
3474
+ useNearPayGas: true,
3475
+ perTxFee: perTxFee.toString(),
3476
+ env
3477
+ });
3484
3478
  } else {
3485
3479
  console.log("near balance is not enough, predict the gas token amount required");
3486
3480
  const adjustedGas = yield getPredictedGasAmount({
@@ -3489,20 +3483,14 @@ function calculateGasStrategy(_0) {
3489
3483
  transactions: convertTx.map((t) => t.txHex),
3490
3484
  env
3491
3485
  });
3492
- if (new Big(gasTokenBalance).gte(adjustedGas)) {
3493
- console.log("use gas token and gas token balance is enough");
3494
- return { useNearPayGas: false, gasLimit: adjustedGas };
3495
- } else {
3496
- console.log("use gas token and gas token balance is not enough, need to transfer");
3497
- const transferTx = yield createGasTokenTransfer({ csna, amount: adjustedGas, env });
3498
- return recalculateGasWithTransfer({
3499
- csna,
3500
- transferTx,
3501
- transactions: convertTx,
3502
- useNearPayGas: false,
3503
- env
3504
- });
3505
- }
3486
+ const transferTx = yield createGasTokenTransfer({ csna, amount: adjustedGas, env });
3487
+ return recalculateGasWithTransfer({
3488
+ csna,
3489
+ transferTx,
3490
+ transactions: convertTx,
3491
+ useNearPayGas: false,
3492
+ env
3493
+ });
3506
3494
  }
3507
3495
  });
3508
3496
  }
@@ -4586,7 +4574,6 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
4586
4574
  const btcContext = window.btcContext;
4587
4575
  const csna = state_default.getAccount();
4588
4576
  const accountInfo = yield getAccountInfo({ csna, env });
4589
- yield checkGasTokenDebt(csna, env, true);
4590
4577
  const trans = [...params.transactions];
4591
4578
  console.log("signAndSendTransactions raw trans:", trans);
4592
4579
  const { transferGasTransaction, useNearPayGas, gasLimit } = yield calculateGasStrategy({
@@ -4687,7 +4674,7 @@ function setupBTCWallet({
4687
4674
 
4688
4675
  // src/index.ts
4689
4676
  var getVersion = () => {
4690
- return "0.5.17-beta";
4677
+ return "0.5.18-beta";
4691
4678
  };
4692
4679
  if (typeof window !== "undefined") {
4693
4680
  window.__BTC_WALLET_VERSION = getVersion();