btc-wallet 0.3.30 → 0.3.32

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.js CHANGED
@@ -1392,6 +1392,14 @@ function retryOperation(_0, _1) {
1392
1392
  throw new Error("Unexpected execution path");
1393
1393
  });
1394
1394
  }
1395
+ function toHex(originalString) {
1396
+ const charArray = originalString.split("");
1397
+ const asciiArray = charArray.map((char) => char.charCodeAt(0));
1398
+ const hexArray = asciiArray.map((code) => code.toString(16));
1399
+ let hexString = hexArray.join("");
1400
+ hexString = hexString.replace(/(^0+)/g, "");
1401
+ return hexString;
1402
+ }
1395
1403
 
1396
1404
  // src/utils/ethereumUtils.ts
1397
1405
  var import_util2 = require("@ethereumjs/util");
@@ -2271,7 +2279,6 @@ var ConnectProvider = ({
2271
2279
  })
2272
2280
  })
2273
2281
  );
2274
- console.log("walletEntryPlugin init");
2275
2282
  }
2276
2283
  }, [options, evmSupportChainIds, accountContract]);
2277
2284
  (0, import_react10.useEffect)(() => {
@@ -2280,7 +2287,6 @@ var ConnectProvider = ({
2280
2287
  import_wallet.walletEntryPlugin.setWalletCore({
2281
2288
  ethereum: smartAccount.provider
2282
2289
  });
2283
- console.log("walletEntryPlugin setWalletCore");
2284
2290
  }
2285
2291
  }, [smartAccount, options]);
2286
2292
  (0, import_react10.useEffect)(() => {
@@ -2288,10 +2294,8 @@ var ConnectProvider = ({
2288
2294
  if (((_a2 = options.walletOptions) == null ? void 0 : _a2.visible) !== false) {
2289
2295
  if (evmAccount) {
2290
2296
  import_wallet.walletEntryPlugin.walletEntryCreate();
2291
- console.log("walletEntryPlugin walletEntryCreate");
2292
2297
  } else {
2293
2298
  import_wallet.walletEntryPlugin.walletEntryDestroy();
2294
- console.log("walletEntryPlugin walletEntryDestroy");
2295
2299
  }
2296
2300
  }
2297
2301
  }, [evmAccount, smartAccount, options]);
@@ -3029,7 +3033,7 @@ function checkBridgeTransactionStatus(url, txHash) {
3029
3033
  }
3030
3034
  function checkBtcTransactionStatus(url, sig) {
3031
3035
  return __async(this, null, function* () {
3032
- const { result_code, result_message, result_data } = yield request(`${url}/v1/btcTx?sig=${sig}`, {
3036
+ const { result_code, result_message, result_data } = yield request(`${url}/v1/btcTx?sig=${toHex(sig)}`, {
3033
3037
  timeout: 3e5,
3034
3038
  pollingInterval: 5e3,
3035
3039
  maxPollingAttempts: 60,
@@ -3228,8 +3232,7 @@ Dialog.style = `
3228
3232
  `;
3229
3233
 
3230
3234
  // src/core/btcUtils.ts
3231
- var MINIMUM_DEPOSIT_AMOUNT = 5e3;
3232
- var MINIMUM_DEPOSIT_AMOUNT_BASE = 1e3;
3235
+ var MINIMUM_DEPOSIT_AMOUNT_BASE = 0;
3233
3236
  var NEAR_STORAGE_DEPOSIT_AMOUNT = "1250000000000000000000";
3234
3237
  var NBTC_STORAGE_DEPOSIT_AMOUNT = 3e3;
3235
3238
  var GAS_LIMIT = "50000000000000";
@@ -3384,13 +3387,10 @@ function getDepositAmount(amount, option) {
3384
3387
  return __async(this, null, function* () {
3385
3388
  const config = yield getConfig((option == null ? void 0 : option.env) || "mainnet");
3386
3389
  const {
3387
- deposit_bridge_fee: { fee_min, fee_rate }
3388
- } = yield nearCall(
3389
- config.bridgeContractId,
3390
- "get_config",
3391
- {}
3392
- );
3393
- const depositAmount = (option == null ? void 0 : option.isEstimate) ? Number(amount) : Math.max(MINIMUM_DEPOSIT_AMOUNT + MINIMUM_DEPOSIT_AMOUNT_BASE, Number(amount));
3390
+ deposit_bridge_fee: { fee_min, fee_rate },
3391
+ min_deposit_amount
3392
+ } = yield nearCall(config.bridgeContractId, "get_config", {});
3393
+ const depositAmount = (option == null ? void 0 : option.isEstimate) ? Number(amount) : Math.max(Number(min_deposit_amount) + MINIMUM_DEPOSIT_AMOUNT_BASE, Number(amount));
3394
3394
  const fee = Math.max(Number(fee_min), Number(depositAmount) * fee_rate);
3395
3395
  const receiveAmount = new import_big.default(depositAmount).minus(fee).minus(MINIMUM_DEPOSIT_AMOUNT_BASE).round(0, import_big.default.roundDown).toNumber();
3396
3396
  console.log("getDepositAmount:", { depositAmount, receiveAmount, fee });
@@ -3596,6 +3596,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
3596
3596
  const accountId = state.getAccount();
3597
3597
  const btcContext = window.btcContext;
3598
3598
  if (accountId && btcContext.account) {
3599
+ removeWalletButton();
3599
3600
  setupWalletButton(env, wallet, btcContext);
3600
3601
  } else {
3601
3602
  removeWalletButton();
@@ -3966,14 +3967,6 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
3966
3967
  }
3967
3968
  return wallet;
3968
3969
  });
3969
- function toHex(originalString) {
3970
- const charArray = originalString.split("");
3971
- const asciiArray = charArray.map((char) => char.charCodeAt(0));
3972
- const hexArray = asciiArray.map((code) => code.toString(16));
3973
- let hexString = hexArray.join("");
3974
- hexString = hexString.replace(/(^0+)/g, "");
3975
- return hexString;
3976
- }
3977
3970
  function setupBTCWallet({
3978
3971
  iconUrl = "https://assets.deltatrade.ai/assets/chain/btc.svg",
3979
3972
  deprecated = false,
@@ -4005,7 +3998,7 @@ function setupBTCWallet({
4005
3998
 
4006
3999
  // src/index.ts
4007
4000
  var getVersion = () => {
4008
- return "0.3.30";
4001
+ return "0.3.32";
4009
4002
  };
4010
4003
  if (typeof window !== "undefined") {
4011
4004
  window.__BTC_WALLET_VERSION = getVersion();