From 5b6b17e64f1ab419e821b8052db615bf20a50840 Mon Sep 17 00:00:00 2001 From: tomiir Date: Thu, 4 Jan 2024 08:29:36 -0600 Subject: [PATCH] fix: eip6963 connection issues (#1700) Co-authored-by: Sven <38101365+svenvoskamp@users.noreply.github.com> --- packages/wagmi/src/connectors/EIP6963Connector.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/wagmi/src/connectors/EIP6963Connector.ts b/packages/wagmi/src/connectors/EIP6963Connector.ts index 8cae8f406c..4c5808da62 100644 --- a/packages/wagmi/src/connectors/EIP6963Connector.ts +++ b/packages/wagmi/src/connectors/EIP6963Connector.ts @@ -71,10 +71,16 @@ export class EIP6963Connector extends InjectedConnector { public override async isAuthorized(eip6963Wallet?: EIP6963Wallet) { const connectedEIP6963Rdns = this.storage?.getItem(connectedRdnsKey) if (connectedEIP6963Rdns) { - if (!eip6963Wallet || connectedEIP6963Rdns !== eip6963Wallet.info.rdns) { - return true + if (this.#eip6963Wallet && connectedEIP6963Rdns === this.#eip6963Wallet.info.rdns) { + const provider = this.#eip6963Wallet.provider + const accounts = await provider.request({ method: 'eth_accounts' }) + if (accounts.length) { + return true + } + } + if (eip6963Wallet) { + this.#eip6963Wallet = eip6963Wallet } - this.#eip6963Wallet = eip6963Wallet } return super.isAuthorized()