@d13co/use-wallet 4.5.6 → 4.5.7

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.cjs CHANGED
@@ -8881,22 +8881,25 @@ var LiquidEvmBaseWallet = class extends BaseWallet {
8881
8881
  var import_liquid_accounts_evm = require("liquid-accounts-evm");
8882
8882
  var ICON13 = `data:image/svg+xml;base64,${btoa(`
8883
8883
  <svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
8884
- <rect width="120" height="120" rx="24" fill="url(#rk_bg)"/>
8885
- <path d="M24 86V76.8C24 55.9 40.9 39 61.8 39H66C70.418 39 74 42.582 74 47V86" stroke="#FF4000" stroke-width="8" stroke-linecap="round" fill="none"/>
8886
- <path d="M36 86V76.8C36 62.3 47.7 50.6 62.2 50.6H64C67.314 50.6 70 53.286 70 56.6V86" stroke="#FF9500" stroke-width="8" stroke-linecap="round" fill="none"/>
8887
- <path d="M48 86V76.8C48 68.8 54.5 62.3 62.5 62.3H62.7C65.461 62.3 67.7 64.539 67.7 67.3V86" stroke="#00C853" stroke-width="8" stroke-linecap="round" fill="none"/>
8888
- <path d="M60 86V76.8C60 75 61.5 73.5 63.3 73.5C65.1 73.5 66.6 75 66.6 76.8V86" stroke="#2979FF" stroke-width="8" stroke-linecap="round" fill="none"/>
8889
- <defs>
8890
- <linearGradient id="rk_bg" x1="0" y1="0" x2="120" y2="120">
8891
- <stop stop-color="#1A1B23"/>
8892
- <stop offset="1" stop-color="#13141B"/>
8893
- </linearGradient>
8894
- </defs>
8884
+ <rect width="120" height="120" rx="24" fill="#627EEA"/>
8885
+ <svg x="30" y="11" width="60" height="98" viewBox="420.1 80.7 1079.8 1758.6">
8886
+ <path d="m959.8 80.7-539.7 895.6 539.7-245.3z" fill="white"/>
8887
+ <path d="m959.8 731-539.7 245.3 539.7 319.1z" fill="white" fill-opacity=".602"/>
8888
+ <path d="m1499.6 976.3-539.8-895.6v650.3z" fill="white" fill-opacity=".602"/>
8889
+ <path d="m959.8 1295.4 539.8-319.1-539.8-245.3z" fill="white" fill-opacity=".2"/>
8890
+ <path d="m420.1 1078.7 539.7 760.6v-441.7z" fill="white"/>
8891
+ <path d="m959.8 1397.6v441.7l540.1-760.6z" fill="white" fill-opacity=".602"/>
8892
+ </svg>
8895
8893
  </svg>
8896
8894
  `)}`;
8897
8895
  var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
8898
8896
  options;
8899
8897
  _connecting = false;
8898
+ _disconnecting = false;
8899
+ /** True while disconnect() is running. Used by the bridge to prevent re-entrancy. */
8900
+ get isDisconnecting() {
8901
+ return this._disconnecting;
8902
+ }
8900
8903
  constructor(params) {
8901
8904
  super(params);
8902
8905
  this.options = params.options || {};
@@ -9083,12 +9086,15 @@ var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
9083
9086
  }
9084
9087
  };
9085
9088
  disconnect = async () => {
9089
+ this._disconnecting = true;
9086
9090
  this.logger.info("Disconnecting...");
9087
9091
  try {
9088
9092
  const { disconnect: wagmiDisconnect } = await import("@wagmi/core");
9089
9093
  await wagmiDisconnect(this.wagmiConfig);
9090
9094
  } catch (error) {
9091
9095
  this.logger.warn("wagmi disconnect error:", error.message);
9096
+ } finally {
9097
+ this._disconnecting = false;
9092
9098
  }
9093
9099
  this.evmAddressMap.clear();
9094
9100
  this.updateMetadata(_RainbowKitWallet.defaultMetadata);
@@ -9115,8 +9121,8 @@ var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
9115
9121
  if (account.isConnected && account.address) {
9116
9122
  evmAddresses = account.addresses ? [...account.addresses] : [account.address];
9117
9123
  connectorInfo = _RainbowKitWallet.extractConnectorInfo(account);
9118
- } else {
9119
- this.logger.warn("EVM wallet not yet connected, resuming from persisted state");
9124
+ } else if (account.status === "reconnecting") {
9125
+ this.logger.warn("EVM wallet reconnecting, resuming from persisted state");
9120
9126
  evmAddresses = walletState.accounts.map((a) => a.metadata?.evmAddress).filter(Boolean);
9121
9127
  if (evmAddresses.length === 0) {
9122
9128
  this.logger.warn("No persisted EVM addresses, cannot resume");
@@ -9124,6 +9130,10 @@ var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
9124
9130
  return;
9125
9131
  }
9126
9132
  connectorInfo = {};
9133
+ } else {
9134
+ this.logger.warn("EVM wallet reconnect failed (status: disconnected), disconnecting");
9135
+ this.onDisconnect();
9136
+ return;
9127
9137
  }
9128
9138
  if (!connectorInfo.name && walletState.accounts.length > 0) {
9129
9139
  const first = walletState.accounts[0];