btc-wallet 0.2.7 → 0.2.9

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/dist/index.js CHANGED
@@ -2166,6 +2166,7 @@ function BtcWalletSelectorContextProvider({
2166
2166
  autoConnect = false
2167
2167
  }) {
2168
2168
  const [isProcessing, setIsProcessing] = (0, import_react11.useState)(false);
2169
+ const connectors = [new UnisatConnector(), new XverseConnector()];
2169
2170
  const walletSelectorContextValue = (0, import_react11.useMemo)(() => {
2170
2171
  const simpleFn = {};
2171
2172
  return {
@@ -2205,7 +2206,7 @@ function BtcWalletSelectorContextProvider({
2205
2206
  }
2206
2207
  },
2207
2208
  autoConnect: false,
2208
- connectors: [new UnisatConnector()],
2209
+ connectors,
2209
2210
  children: [
2210
2211
  children,
2211
2212
  isProcessing && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
@@ -2231,6 +2232,7 @@ function InitBtcWalletSelectorContext() {
2231
2232
  return null;
2232
2233
  }
2233
2234
  function useBtcWalletSelector() {
2235
+ console.log("useBtcWalletSelector");
2234
2236
  const { openConnectModal, openConnectModalAsync, disconnect, requestDirectAccount } = useConnectModal();
2235
2237
  const { accounts, sendBitcoin: sendBitcoin2, getPublicKey, provider, signMessage, connector } = useBTCProvider();
2236
2238
  const publicKey = (0, import_react11.useRef)(null);
@@ -2294,7 +2296,10 @@ function useBtcWalletSelector() {
2294
2296
  });
2295
2297
  }),
2296
2298
  logout: () => {
2297
- disconnect && disconnect();
2299
+ const accountId = accounts && accounts.length ? accounts[0] : null;
2300
+ if (!accountId)
2301
+ return;
2302
+ disconnect == null ? void 0 : disconnect();
2298
2303
  context.emit("btcLogOut");
2299
2304
  },
2300
2305
  account: accounts && accounts.length ? accounts[0] : null,
@@ -2745,6 +2750,11 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
2745
2750
  }
2746
2751
  function signOut() {
2747
2752
  return __async(this, null, function* () {
2753
+ const accountId = state.getAccount();
2754
+ const publicKey = state.getPublicKey();
2755
+ if (!(accountId && publicKey)) {
2756
+ return;
2757
+ }
2748
2758
  const btcContext = window.btcContext;
2749
2759
  if (metadata.syncLogOut) {
2750
2760
  btcContext.logout();
@@ -3089,7 +3099,7 @@ function executeBurrowSupply(_0) {
3089
3099
 
3090
3100
  // src/index.ts
3091
3101
  var getVersion = () => {
3092
- return "0.2.7";
3102
+ return "0.2.9";
3093
3103
  };
3094
3104
  if (typeof window !== "undefined") {
3095
3105
  window.__PARTICLE_BTC_CONNECT_VERSION = getVersion();