btc-wallet 0.5.16-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/dist/index.d.ts CHANGED
@@ -4,4 +4,5 @@ export * from './hooks';
4
4
  export * from './core/btcWalletSelectorContext';
5
5
  export * from './core/setupBTCWallet/index';
6
6
  export * from './core/btcUtils';
7
+ export * from './config';
7
8
  export declare const getVersion: () => string;
package/dist/index.js CHANGED
@@ -91,6 +91,7 @@ __export(src_exports, {
91
91
  UnisatConnector: () => UnisatConnector,
92
92
  WizzConnector: () => WizzConnector,
93
93
  XverseConnector: () => XverseConnector,
94
+ btcRpcUrls: () => btcRpcUrls,
94
95
  checkGasTokenDebt: () => checkGasTokenDebt,
95
96
  checkSatoshiWhitelist: () => checkSatoshiWhitelist,
96
97
  estimateDepositAmount: () => estimateDepositAmount,
@@ -100,7 +101,9 @@ __export(src_exports, {
100
101
  getCsnaAccountId: () => getCsnaAccountId,
101
102
  getDepositAmount: () => getDepositAmount,
102
103
  getVersion: () => getVersion,
104
+ getWalletConfig: () => getWalletConfig,
103
105
  getWithdrawTransaction: () => getWithdrawTransaction,
106
+ nearRpcUrls: () => nearRpcUrls,
104
107
  sendBitcoin: () => sendBitcoin,
105
108
  setupBTCWallet: () => setupBTCWallet,
106
109
  useAccountContract: () => useAccountContract,
@@ -109,7 +112,8 @@ __export(src_exports, {
109
112
  useBtcWalletSelector: () => useBtcWalletSelector,
110
113
  useConnectModal: () => useConnectModal,
111
114
  useConnector: () => useConnector,
112
- useETHProvider: () => useETHProvider
115
+ useETHProvider: () => useETHProvider,
116
+ walletConfig: () => walletConfig
113
117
  });
114
118
  module.exports = __toCommonJS(src_exports);
115
119
 
@@ -3512,21 +3516,15 @@ function calculateGasStrategy(_0) {
3512
3516
  console.log("perTxFee:", perTxFee);
3513
3517
  const protocolFee = new import_big.default(perTxFee || "0").mul(convertTx.length).toFixed(0);
3514
3518
  console.log("protocolFee:", protocolFee);
3515
- if (new import_big.default(gasTokenBalance).gte(protocolFee)) {
3516
- console.log("use near pay gas and enough gas token balance");
3517
- return { useNearPayGas: true, gasLimit: protocolFee };
3518
- } else {
3519
- console.log("use near pay gas and not enough gas token balance");
3520
- const transferTx = yield createGasTokenTransfer({ csna, amount: protocolFee, env });
3521
- return recalculateGasWithTransfer({
3522
- csna,
3523
- transferTx,
3524
- transactions: convertTx,
3525
- useNearPayGas: true,
3526
- perTxFee: perTxFee.toString(),
3527
- env
3528
- });
3529
- }
3519
+ const transferTx = yield createGasTokenTransfer({ csna, amount: protocolFee, env });
3520
+ return recalculateGasWithTransfer({
3521
+ csna,
3522
+ transferTx,
3523
+ transactions: convertTx,
3524
+ useNearPayGas: true,
3525
+ perTxFee: perTxFee.toString(),
3526
+ env
3527
+ });
3530
3528
  } else {
3531
3529
  console.log("near balance is not enough, predict the gas token amount required");
3532
3530
  const adjustedGas = yield getPredictedGasAmount({
@@ -3535,20 +3533,14 @@ function calculateGasStrategy(_0) {
3535
3533
  transactions: convertTx.map((t) => t.txHex),
3536
3534
  env
3537
3535
  });
3538
- if (new import_big.default(gasTokenBalance).gte(adjustedGas)) {
3539
- console.log("use gas token and gas token balance is enough");
3540
- return { useNearPayGas: false, gasLimit: adjustedGas };
3541
- } else {
3542
- console.log("use gas token and gas token balance is not enough, need to transfer");
3543
- const transferTx = yield createGasTokenTransfer({ csna, amount: adjustedGas, env });
3544
- return recalculateGasWithTransfer({
3545
- csna,
3546
- transferTx,
3547
- transactions: convertTx,
3548
- useNearPayGas: false,
3549
- env
3550
- });
3551
- }
3536
+ const transferTx = yield createGasTokenTransfer({ csna, amount: adjustedGas, env });
3537
+ return recalculateGasWithTransfer({
3538
+ csna,
3539
+ transferTx,
3540
+ transactions: convertTx,
3541
+ useNearPayGas: false,
3542
+ env
3543
+ });
3552
3544
  }
3553
3545
  });
3554
3546
  }
@@ -4632,7 +4624,6 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
4632
4624
  const btcContext = window.btcContext;
4633
4625
  const csna = state_default.getAccount();
4634
4626
  const accountInfo = yield getAccountInfo({ csna, env });
4635
- yield checkGasTokenDebt(csna, env, true);
4636
4627
  const trans = [...params.transactions];
4637
4628
  console.log("signAndSendTransactions raw trans:", trans);
4638
4629
  const { transferGasTransaction, useNearPayGas, gasLimit } = yield calculateGasStrategy({
@@ -4733,7 +4724,7 @@ function setupBTCWallet({
4733
4724
 
4734
4725
  // src/index.ts
4735
4726
  var getVersion = () => {
4736
- return "0.5.16-beta";
4727
+ return "0.5.18-beta";
4737
4728
  };
4738
4729
  if (typeof window !== "undefined") {
4739
4730
  window.__BTC_WALLET_VERSION = getVersion();