btc-wallet 0.5.4-beta → 0.5.5-beta

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -3405,6 +3405,9 @@ function getCsnaAccountId(env) {
3405
3405
  const config = yield getConfig(env);
3406
3406
  const { getPublicKey } = getBtcProvider();
3407
3407
  const btcPublicKey = yield getPublicKey();
3408
+ if (!btcPublicKey) {
3409
+ throw new Error("BTC Public Key is not available.");
3410
+ }
3408
3411
  const csna = yield nearCall(
3409
3412
  config.accountContractId,
3410
3413
  "get_chain_signature_near_account_id",
@@ -3523,7 +3526,7 @@ function executeBTCDepositAndAction(_0) {
3523
3526
  }
3524
3527
  function checkSatoshiWhitelist(btcAccountId, env = "mainnet") {
3525
3528
  return __async(this, null, function* () {
3526
- if (env !== "private_mainnet")
3529
+ if (env !== "mainnet")
3527
3530
  return;
3528
3531
  const hasShownNotice = localStorage.getItem("btc-wallet-private-mainnet-notice");
3529
3532
  if (!hasShownNotice) {
@@ -4046,6 +4049,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
4046
4049
  yield checkBtcNetwork(walletNetwork);
4047
4050
  if (!state.isValid()) {
4048
4051
  state.clear();
4052
+ console.log("setupBtcContextListeners clear");
4049
4053
  }
4050
4054
  validateWalletState();
4051
4055
  const btcContext = window.btcContext;
@@ -4068,6 +4072,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
4068
4072
  context.on("updatePublicKey", (btcPublicKey) => __async(this, null, function* () {
4069
4073
  console.log("updatePublicKey");
4070
4074
  state.clear();
4075
+ console.log("updatePublicKey clear");
4071
4076
  try {
4072
4077
  const { nearAddress, nearPublicKey } = yield getNearAccountByBtcPublicKey(btcPublicKey);
4073
4078
  if (!nearAddress || !nearPublicKey) {
@@ -4079,8 +4084,6 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
4079
4084
  yield handleConnectionUpdate();
4080
4085
  } catch (error) {
4081
4086
  console.error("Error updating public key:", error);
4082
- state.clear();
4083
- emitter.emit("accountsChanged", { accounts: [] });
4084
4087
  }
4085
4088
  }));
4086
4089
  context.on("btcLoginError", () => __async(this, null, function* () {
@@ -4481,7 +4484,7 @@ function setupBTCWallet({
4481
4484
 
4482
4485
  // src/index.ts
4483
4486
  var getVersion = () => {
4484
- return "0.5.4-beta";
4487
+ return "0.5.5-beta";
4485
4488
  };
4486
4489
  if (typeof window !== "undefined") {
4487
4490
  window.__BTC_WALLET_VERSION = getVersion();