[@walletconnect/ethereum-provider] accounts
array is not updated after switching the chain
#5706
Labels
type: bug
Something isn't working
Describe the bug
The internal
accounts
array remains the same after switching the chain. This results in theaccounts
array containing incorrect addresses if different EVM chains use different addresses.SDK Version (if relevant)
To Reproduce
Steps to reproduce the behavior:
Example of a confirmed WalletConnect session namespaces:
As you can see, different chains use different addresses.
Expected behavior
The account address is displayed correctly after switching the chain.
Additional context
At first, I thought it was an issue on the dApp side and created the following two issues:
After that, I realized that the issue is deeper and affects many dApps that use Wagmi:
useAccount
does not update the provided address after switching the chain wevm/wagmi#4577And finally, I am here. Search for a solution has led me back to the WalletConnect library.
The accounts array is populated only once upon connection:
walletconnect-monorepo/providers/ethereum-provider/src/EthereumProvider.ts
Line 333 in 1d75e0f
After the dApp page refresh:
walletconnect-monorepo/providers/ethereum-provider/src/EthereumProvider.ts
Line 654 in 1d75e0f
But the accounts array does not update when switching the chain...
The text was updated successfully, but these errors were encountered: