-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eliminate polling for wallet account change #2295
Comments
You should be very careful about relying on any injected provider. Use the provider returned by Web3Modal. |
mm but where the injected provider come from? It's according the wallet you choose? |
Yes, from the wallet you choose in the Web3Modal UI |
So, if the injected web3 is set according the Web3ModalUI, what's the issue here? |
Sorry I wasn't clear: Web3Modal doesn't inject anything. It returns the provider (you can see this in arc.ts). Metamask has in the past injected a provider, but is ending that practice. |
Currently we poll every 2000ms for account change in MetaMask.
Instead, we can use a listener for account changes, like this:
See also https://docs.metamask.io/guide/ethereum-provider.html#events.
The text was updated successfully, but these errors were encountered: