btc-wallet 0.5.28-beta → 0.5.29-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
@@ -3857,8 +3857,10 @@ function getBtcGasPrice() {
3857
3857
  function getBtcUtxos(account) {
3858
3858
  return __async(this, null, function* () {
3859
3859
  const btcRpcUrl = yield getBtcRpcUrl();
3860
- const utxos = yield fetch(`${btcRpcUrl}/address/${account}/utxo`).then((res) => res.json());
3861
- return utxos;
3860
+ const utxos = yield fetch(
3861
+ `${btcRpcUrl}/address/${account}/utxo`
3862
+ ).then((res) => res.json());
3863
+ return utxos.filter((item) => item.status.confirmed);
3862
3864
  });
3863
3865
  }
3864
3866
  function calculateGasFee(account, amount, feeRate) {
@@ -4182,7 +4184,7 @@ function getWithdrawTransaction(_0) {
4182
4184
  methodName: "ft_transfer_call",
4183
4185
  args: {
4184
4186
  receiver_id: config.bridgeContractId,
4185
- amount: fromAmount,
4187
+ amount: fromAmount == null ? void 0 : fromAmount.toString(),
4186
4188
  msg: JSON.stringify(msg)
4187
4189
  },
4188
4190
  gas: "300000000000000",
@@ -4357,6 +4359,7 @@ function createIframe({
4357
4359
  document.body.appendChild(iframe);
4358
4360
  return iframe;
4359
4361
  }
4362
+ var currentMessageHandler = null;
4360
4363
  function setupButtonClickHandler(button, iframe, wallet, originalWallet) {
4361
4364
  return __async(this, null, function* () {
4362
4365
  var _a;
@@ -4376,7 +4379,11 @@ function setupButtonClickHandler(button, iframe, wallet, originalWallet) {
4376
4379
  executeBTCDepositAndAction,
4377
4380
  getWithdrawTransaction
4378
4381
  };
4379
- window.addEventListener("message", (event) => __async(this, null, function* () {
4382
+ if (currentMessageHandler) {
4383
+ window.removeEventListener("message", currentMessageHandler);
4384
+ currentMessageHandler = null;
4385
+ }
4386
+ const handleWalletMessage = (event) => __async(this, null, function* () {
4380
4387
  var _a2, _b;
4381
4388
  if (event.origin !== iframeSrc.origin)
4382
4389
  return;
@@ -4407,7 +4414,9 @@ function setupButtonClickHandler(button, iframe, wallet, originalWallet) {
4407
4414
  { targetOrigin: event.origin }
4408
4415
  );
4409
4416
  }
4410
- }));
4417
+ });
4418
+ currentMessageHandler = handleWalletMessage;
4419
+ window.addEventListener("message", handleWalletMessage);
4411
4420
  });
4412
4421
  }
4413
4422
  function removeWalletButton() {
@@ -4830,7 +4839,7 @@ function getGroup(state) {
4830
4839
 
4831
4840
  // src/index.ts
4832
4841
  var getVersion = () => {
4833
- return "0.5.28-beta";
4842
+ return "0.5.29-beta";
4834
4843
  };
4835
4844
  if (typeof window !== "undefined") {
4836
4845
  window.__BTC_WALLET_VERSION = getVersion();