btc-wallet 0.5.4-beta → 0.5.5-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
@@ -3355,6 +3355,9 @@ function getCsnaAccountId(env) {
3355
3355
  const config = yield getConfig(env);
3356
3356
  const { getPublicKey } = getBtcProvider();
3357
3357
  const btcPublicKey = yield getPublicKey();
3358
+ if (!btcPublicKey) {
3359
+ throw new Error("BTC Public Key is not available.");
3360
+ }
3358
3361
  const csna = yield nearCall(
3359
3362
  config.accountContractId,
3360
3363
  "get_chain_signature_near_account_id",
@@ -3473,7 +3476,7 @@ function executeBTCDepositAndAction(_0) {
3473
3476
  }
3474
3477
  function checkSatoshiWhitelist(btcAccountId, env = "mainnet") {
3475
3478
  return __async(this, null, function* () {
3476
- if (env !== "private_mainnet")
3479
+ if (env !== "mainnet")
3477
3480
  return;
3478
3481
  const hasShownNotice = localStorage.getItem("btc-wallet-private-mainnet-notice");
3479
3482
  if (!hasShownNotice) {
@@ -3996,6 +3999,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
3996
3999
  yield checkBtcNetwork(walletNetwork);
3997
4000
  if (!state.isValid()) {
3998
4001
  state.clear();
4002
+ console.log("setupBtcContextListeners clear");
3999
4003
  }
4000
4004
  validateWalletState();
4001
4005
  const btcContext = window.btcContext;
@@ -4018,6 +4022,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
4018
4022
  context.on("updatePublicKey", (btcPublicKey) => __async(this, null, function* () {
4019
4023
  console.log("updatePublicKey");
4020
4024
  state.clear();
4025
+ console.log("updatePublicKey clear");
4021
4026
  try {
4022
4027
  const { nearAddress, nearPublicKey } = yield getNearAccountByBtcPublicKey(btcPublicKey);
4023
4028
  if (!nearAddress || !nearPublicKey) {
@@ -4029,8 +4034,6 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
4029
4034
  yield handleConnectionUpdate();
4030
4035
  } catch (error) {
4031
4036
  console.error("Error updating public key:", error);
4032
- state.clear();
4033
- emitter.emit("accountsChanged", { accounts: [] });
4034
4037
  }
4035
4038
  }));
4036
4039
  context.on("btcLoginError", () => __async(this, null, function* () {
@@ -4431,7 +4434,7 @@ function setupBTCWallet({
4431
4434
 
4432
4435
  // src/index.ts
4433
4436
  var getVersion = () => {
4434
- return "0.5.4-beta";
4437
+ return "0.5.5-beta";
4435
4438
  };
4436
4439
  if (typeof window !== "undefined") {
4437
4440
  window.__BTC_WALLET_VERSION = getVersion();