MetaMask / MetaMask/metamask-extension
on("accountsChanged") not firing
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
An application may request accounts from the user using the `eth_requestAccounts` RPC method.
The user may refresh this page, leaving a pending account request on MetaMask.
When the user later finishes accepting this account request, the `accountsChanged` event does not trigger on the page.
Therefore, there is no way of determining if the user has accepted an account request after a page reload has occurred in-between.
Temporary solution which should work: Poll the `eth_accounts` RPC method every few seconds and if an account appears then it is clear that the user has accepted the account request. This method does not allow you to detect if account request denied.
I assume the purpose of event handlers is to avoid polling like this, so I hope that the event logic gets changed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the sequence involving eth_requestAccounts, a page refresh, and later completion of the pending request. Trace the implementation of the accountsChanged event and verify that it fires after the request is accepted following a reload, rather than requiring polling eth_accounts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100