`useAccount` Hook Doesn't Update Wallet Address When Switching Metamask Accounts

Description:

Steps to Reproduce:

  1. Implement wagmi and web3auth-wagmi-connector in the project.
  2. Sign in using Metamask.
  3. Switch the Metamask account.

Expected Behavior:

The useAccount hook should update the wallet address in the application to reflect the switched account in Metamask.

Current Behavior:

The useAccount hook doesn’t update, keeping the initial Metamask account address.

Environment:

  • wagmi version: 1.3.10
  • @web3auth/web3auth-wagmi-connector version: 4.0.1
  • Browser: Chrome 116.0.5845.140
  • Metamask version: 10.34.5

This issue impacts the ability to manage multiple accounts within the application. Would appreciate any assistance or suggestions. Thank you.

The issue has been raised in Github.

Edit: I made a minimal reproducible example of the issue. You can find it in this repository.

1 Like

@raoulpicconi03 Welcome Aboard!

Your request has been forwarded to our team and will get back with further updates once more information becomes available.

While using wagmi, I won’t recommend using any external wallet with web3auth interface. I would recommend using their direct connectors for the specific wallet. This is because the web3auth wagmi connector basically extends the web3auth provider connection with the wagmi interface. It works well with social logins since they exactly follow the web3auth provider connections, however, external wallets basically extend their provider into web3auth, which in turn is extended to wagmi. There are chances that some features might be affected in that case.

Ideally while using wagmi, I’d recommend just using web3auth social logins. Rest all wallet interfaces can be used using their own connectors that are readily available.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.