@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.d.cts CHANGED
@@ -579,6 +579,9 @@ interface RainbowKitWalletOptions extends LiquidEvmOptions {
579
579
  declare class RainbowKitWallet extends LiquidEvmBaseWallet {
580
580
  protected options: RainbowKitWalletOptions;
581
581
  private _connecting;
582
+ private _disconnecting;
583
+ /** True while disconnect() is running. Used by the bridge to prevent re-entrancy. */
584
+ get isDisconnecting(): boolean;
582
585
  constructor(params: WalletConstructor<WalletId.RAINBOWKIT>);
583
586
  static defaultMetadata: {
584
587
  name: string;
package/dist/index.d.ts CHANGED
@@ -579,6 +579,9 @@ interface RainbowKitWalletOptions extends LiquidEvmOptions {
579
579
  declare class RainbowKitWallet extends LiquidEvmBaseWallet {
580
580
  protected options: RainbowKitWalletOptions;
581
581
  private _connecting;
582
+ private _disconnecting;
583
+ /** True while disconnect() is running. Used by the bridge to prevent re-entrancy. */
584
+ get isDisconnecting(): boolean;
582
585
  constructor(params: WalletConstructor<WalletId.RAINBOWKIT>);
583
586
  static defaultMetadata: {
584
587
  name: string;
package/dist/index.js CHANGED
@@ -8839,22 +8839,25 @@ import {
8839
8839
  } from "liquid-accounts-evm";
8840
8840
  var ICON13 = `data:image/svg+xml;base64,${btoa(`
8841
8841
  <svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
8842
- <rect width="120" height="120" rx="24" fill="url(#rk_bg)"/>
8843
- <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"/>
8844
- <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"/>
8845
- <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"/>
8846
- <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"/>
8847
- <defs>
8848
- <linearGradient id="rk_bg" x1="0" y1="0" x2="120" y2="120">
8849
- <stop stop-color="#1A1B23"/>
8850
- <stop offset="1" stop-color="#13141B"/>
8851
- </linearGradient>
8852
- </defs>
8842
+ <rect width="120" height="120" rx="24" fill="#627EEA"/>
8843
+ <svg x="30" y="11" width="60" height="98" viewBox="420.1 80.7 1079.8 1758.6">
8844
+ <path d="m959.8 80.7-539.7 895.6 539.7-245.3z" fill="white"/>
8845
+ <path d="m959.8 731-539.7 245.3 539.7 319.1z" fill="white" fill-opacity=".602"/>
8846
+ <path d="m1499.6 976.3-539.8-895.6v650.3z" fill="white" fill-opacity=".602"/>
8847
+ <path d="m959.8 1295.4 539.8-319.1-539.8-245.3z" fill="white" fill-opacity=".2"/>
8848
+ <path d="m420.1 1078.7 539.7 760.6v-441.7z" fill="white"/>
8849
+ <path d="m959.8 1397.6v441.7l540.1-760.6z" fill="white" fill-opacity=".602"/>
8850
+ </svg>
8853
8851
  </svg>
8854
8852
  `)}`;
8855
8853
  var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
8856
8854
  options;
8857
8855
  _connecting = false;
8856
+ _disconnecting = false;
8857
+ /** True while disconnect() is running. Used by the bridge to prevent re-entrancy. */
8858
+ get isDisconnecting() {
8859
+ return this._disconnecting;
8860
+ }
8858
8861
  constructor(params) {
8859
8862
  super(params);
8860
8863
  this.options = params.options || {};
@@ -9041,12 +9044,15 @@ var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
9041
9044
  }
9042
9045
  };
9043
9046
  disconnect = async () => {
9047
+ this._disconnecting = true;
9044
9048
  this.logger.info("Disconnecting...");
9045
9049
  try {
9046
9050
  const { disconnect: wagmiDisconnect } = await import("@wagmi/core");
9047
9051
  await wagmiDisconnect(this.wagmiConfig);
9048
9052
  } catch (error) {
9049
9053
  this.logger.warn("wagmi disconnect error:", error.message);
9054
+ } finally {
9055
+ this._disconnecting = false;
9050
9056
  }
9051
9057
  this.evmAddressMap.clear();
9052
9058
  this.updateMetadata(_RainbowKitWallet.defaultMetadata);
@@ -9073,8 +9079,8 @@ var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
9073
9079
  if (account.isConnected && account.address) {
9074
9080
  evmAddresses = account.addresses ? [...account.addresses] : [account.address];
9075
9081
  connectorInfo = _RainbowKitWallet.extractConnectorInfo(account);
9076
- } else {
9077
- this.logger.warn("EVM wallet not yet connected, resuming from persisted state");
9082
+ } else if (account.status === "reconnecting") {
9083
+ this.logger.warn("EVM wallet reconnecting, resuming from persisted state");
9078
9084
  evmAddresses = walletState.accounts.map((a) => a.metadata?.evmAddress).filter(Boolean);
9079
9085
  if (evmAddresses.length === 0) {
9080
9086
  this.logger.warn("No persisted EVM addresses, cannot resume");
@@ -9082,6 +9088,10 @@ var RainbowKitWallet = class _RainbowKitWallet extends LiquidEvmBaseWallet {
9082
9088
  return;
9083
9089
  }
9084
9090
  connectorInfo = {};
9091
+ } else {
9092
+ this.logger.warn("EVM wallet reconnect failed (status: disconnected), disconnecting");
9093
+ this.onDisconnect();
9094
+ return;
9085
9095
  }
9086
9096
  if (!connectorInfo.name && walletState.accounts.length > 0) {
9087
9097
  const first = walletState.accounts[0];