I use walletconnect/ethereum-provider@2.9.0 together with ethers@5.7.2.
The setup is very simple:
const provider = await EthereumProvider.init({
// params
});
const web3provider = new Web3Provider(provider);
I subscribe to events, call connect, etc. – everything works fine. I'm able to scan the qr-code and connect from the app (Metamask mobile).
But when I switch accounts in the app, while accountsChanged
event gets fired with the new account, the call web3provider.getSigner()
still returns the original account, with which I initially connected. Therefore, I can only send transactions from the original account no matter to which account I switch.
I'm wondering if it's by design? Should I disconnect and generate a new qr-code every time accountsChanged
gets fired?