btc-wallet 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
package/esm/index.js CHANGED
@@ -2197,6 +2197,7 @@ function InitBtcWalletSelectorContext() {
2197
2197
  return null;
2198
2198
  }
2199
2199
  function useBtcWalletSelector() {
2200
+ console.log("useBtcWalletSelector");
2200
2201
  const { openConnectModal, openConnectModalAsync, disconnect, requestDirectAccount } = useConnectModal();
2201
2202
  const { accounts, sendBitcoin: sendBitcoin2, getPublicKey, provider, signMessage, connector } = useBTCProvider();
2202
2203
  const publicKey = useRef(null);
@@ -2260,7 +2261,10 @@ function useBtcWalletSelector() {
2260
2261
  });
2261
2262
  }),
2262
2263
  logout: () => {
2263
- disconnect && disconnect();
2264
+ const accountId = accounts && accounts.length ? accounts[0] : null;
2265
+ if (!accountId)
2266
+ return;
2267
+ disconnect == null ? void 0 : disconnect();
2264
2268
  context.emit("btcLogOut");
2265
2269
  },
2266
2270
  account: accounts && accounts.length ? accounts[0] : null,
@@ -2711,6 +2715,11 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
2711
2715
  }
2712
2716
  function signOut() {
2713
2717
  return __async(this, null, function* () {
2718
+ const accountId = state.getAccount();
2719
+ const publicKey = state.getPublicKey();
2720
+ if (!(accountId && publicKey)) {
2721
+ return;
2722
+ }
2714
2723
  const btcContext = window.btcContext;
2715
2724
  if (metadata.syncLogOut) {
2716
2725
  btcContext.logout();
@@ -3055,7 +3064,7 @@ function executeBurrowSupply(_0) {
3055
3064
 
3056
3065
  // src/index.ts
3057
3066
  var getVersion = () => {
3058
- return "0.2.8";
3067
+ return "0.2.9";
3059
3068
  };
3060
3069
  if (typeof window !== "undefined") {
3061
3070
  window.__PARTICLE_BTC_CONNECT_VERSION = getVersion();