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.
@@ -9,3 +9,4 @@ export declare function retryOperation<T>(operation: () => Promise<T> | T, shoul
9
9
  maxRetries?: number;
10
10
  delayMs?: number;
11
11
  }): Promise<T>;
12
+ export declare function toHex(originalString: string): string;
package/esm/index.js CHANGED
@@ -1332,6 +1332,14 @@ function retryOperation(_0, _1) {
1332
1332
  throw new Error("Unexpected execution path");
1333
1333
  });
1334
1334
  }
1335
+ function toHex(originalString) {
1336
+ const charArray = originalString.split("");
1337
+ const asciiArray = charArray.map((char) => char.charCodeAt(0));
1338
+ const hexArray = asciiArray.map((code) => code.toString(16));
1339
+ let hexString = hexArray.join("");
1340
+ hexString = hexString.replace(/(^0+)/g, "");
1341
+ return hexString;
1342
+ }
1335
1343
 
1336
1344
  // src/utils/ethereumUtils.ts
1337
1345
  import {
@@ -2225,7 +2233,6 @@ var ConnectProvider = ({
2225
2233
  })
2226
2234
  })
2227
2235
  );
2228
- console.log("walletEntryPlugin init");
2229
2236
  }
2230
2237
  }, [options, evmSupportChainIds, accountContract]);
2231
2238
  useEffect5(() => {
@@ -2234,7 +2241,6 @@ var ConnectProvider = ({
2234
2241
  walletEntryPlugin.setWalletCore({
2235
2242
  ethereum: smartAccount.provider
2236
2243
  });
2237
- console.log("walletEntryPlugin setWalletCore");
2238
2244
  }
2239
2245
  }, [smartAccount, options]);
2240
2246
  useEffect5(() => {
@@ -2242,10 +2248,8 @@ var ConnectProvider = ({
2242
2248
  if (((_a2 = options.walletOptions) == null ? void 0 : _a2.visible) !== false) {
2243
2249
  if (evmAccount) {
2244
2250
  walletEntryPlugin.walletEntryCreate();
2245
- console.log("walletEntryPlugin walletEntryCreate");
2246
2251
  } else {
2247
2252
  walletEntryPlugin.walletEntryDestroy();
2248
- console.log("walletEntryPlugin walletEntryDestroy");
2249
2253
  }
2250
2254
  }
2251
2255
  }, [evmAccount, smartAccount, options]);
@@ -2983,7 +2987,7 @@ function checkBridgeTransactionStatus(url, txHash) {
2983
2987
  }
2984
2988
  function checkBtcTransactionStatus(url, sig) {
2985
2989
  return __async(this, null, function* () {
2986
- const { result_code, result_message, result_data } = yield request(`${url}/v1/btcTx?sig=${sig}`, {
2990
+ const { result_code, result_message, result_data } = yield request(`${url}/v1/btcTx?sig=${toHex(sig)}`, {
2987
2991
  timeout: 3e5,
2988
2992
  pollingInterval: 5e3,
2989
2993
  maxPollingAttempts: 60,
@@ -3182,8 +3186,7 @@ Dialog.style = `
3182
3186
  `;
3183
3187
 
3184
3188
  // src/core/btcUtils.ts
3185
- var MINIMUM_DEPOSIT_AMOUNT = 5e3;
3186
- var MINIMUM_DEPOSIT_AMOUNT_BASE = 1e3;
3189
+ var MINIMUM_DEPOSIT_AMOUNT_BASE = 0;
3187
3190
  var NEAR_STORAGE_DEPOSIT_AMOUNT = "1250000000000000000000";
3188
3191
  var NBTC_STORAGE_DEPOSIT_AMOUNT = 3e3;
3189
3192
  var GAS_LIMIT = "50000000000000";
@@ -3338,13 +3341,10 @@ function getDepositAmount(amount, option) {
3338
3341
  return __async(this, null, function* () {
3339
3342
  const config = yield getConfig((option == null ? void 0 : option.env) || "mainnet");
3340
3343
  const {
3341
- deposit_bridge_fee: { fee_min, fee_rate }
3342
- } = yield nearCall(
3343
- config.bridgeContractId,
3344
- "get_config",
3345
- {}
3346
- );
3347
- const depositAmount = (option == null ? void 0 : option.isEstimate) ? Number(amount) : Math.max(MINIMUM_DEPOSIT_AMOUNT + MINIMUM_DEPOSIT_AMOUNT_BASE, Number(amount));
3344
+ deposit_bridge_fee: { fee_min, fee_rate },
3345
+ min_deposit_amount
3346
+ } = yield nearCall(config.bridgeContractId, "get_config", {});
3347
+ const depositAmount = (option == null ? void 0 : option.isEstimate) ? Number(amount) : Math.max(Number(min_deposit_amount) + MINIMUM_DEPOSIT_AMOUNT_BASE, Number(amount));
3348
3348
  const fee = Math.max(Number(fee_min), Number(depositAmount) * fee_rate);
3349
3349
  const receiveAmount = new Big(depositAmount).minus(fee).minus(MINIMUM_DEPOSIT_AMOUNT_BASE).round(0, Big.roundDown).toNumber();
3350
3350
  console.log("getDepositAmount:", { depositAmount, receiveAmount, fee });
@@ -3550,6 +3550,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
3550
3550
  const accountId = state.getAccount();
3551
3551
  const btcContext = window.btcContext;
3552
3552
  if (accountId && btcContext.account) {
3553
+ removeWalletButton();
3553
3554
  setupWalletButton(env, wallet, btcContext);
3554
3555
  } else {
3555
3556
  removeWalletButton();
@@ -3920,14 +3921,6 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
3920
3921
  }
3921
3922
  return wallet;
3922
3923
  });
3923
- function toHex(originalString) {
3924
- const charArray = originalString.split("");
3925
- const asciiArray = charArray.map((char) => char.charCodeAt(0));
3926
- const hexArray = asciiArray.map((code) => code.toString(16));
3927
- let hexString = hexArray.join("");
3928
- hexString = hexString.replace(/(^0+)/g, "");
3929
- return hexString;
3930
- }
3931
3924
  function setupBTCWallet({
3932
3925
  iconUrl = "https://assets.deltatrade.ai/assets/chain/btc.svg",
3933
3926
  deprecated = false,
@@ -3959,7 +3952,7 @@ function setupBTCWallet({
3959
3952
 
3960
3953
  // src/index.ts
3961
3954
  var getVersion = () => {
3962
- return "0.3.30";
3955
+ return "0.3.32";
3963
3956
  };
3964
3957
  if (typeof window !== "undefined") {
3965
3958
  window.__BTC_WALLET_VERSION = getVersion();