Skip to content
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

MetaMask: 'eth_accounts' unexpectedly updated accounts #1675

Closed
xmaysonnave opened this issue Jul 7, 2020 · 4 comments
Closed

MetaMask: 'eth_accounts' unexpectedly updated accounts #1675

xmaysonnave opened this issue Jul 7, 2020 · 4 comments
Labels
community Issues or PRs opened by the MM community type-bug Something isn't working

Comments

@xmaysonnave
Copy link

Metamask Mobile v0.2.19 (32)

Describe the bug

Unable to receive the selected eth_accounts once the user confirmed the current account on Metamask Mobile.

I started to remote debug the app and got the following exception :

MetaMask: 'eth_accounts' unexpectedly updated accounts. Please report this bug.

This app is working with Metamask extension on Chrome an used to work with Metamask Mobile.

Here the logic implemented :

      // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1102.md
      await provider.request({ method: 'eth_requestAccounts' })
      // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md
      accounts = await provider.request({ method: 'eth_accounts' })
      if (
        accounts === undefined ||
        accounts == null ||
        Array.isArray(accounts) === false ||
        accounts.length === 0
      ) {
        throw new Error('Unable to retrieve any Ethereum accounts...')
      }

The eth_requestAccounts triggers the UI. UX 'Connect to this site ?' Confirmed.
The eth_accounts generate the mentioned exception and the DApp receives an empty array.

Expected behavior
The eth_accounts call should send an array who contains the selected account.

Smartphone (please complete the following information):

  • Device: Redmi Note 7 Pro
  • OS: MIUI 11
  • Version 11.0.9.0

Thanks


to be added after bug submission by internal support / PM
Severity

  • How critical is the impact of this bug on a user?
  • Add stats if available on % of customers impacted
  • Is this visible to all users?
  • Is this tech debt?
@rickycodes
Copy link
Member

rickycodes commented Jul 14, 2020

@xmaysonnave I can't seem to reproduce this and I am wondering if it's still an issue for you? It's true that accounts = await ethereum.request({ method: 'eth_accounts' }) returns and empty array if the user hasn't connected to the dapp, but it seems to work fine once I am connected?:

> accounts = await ethereum.request({ method: 'eth_accounts' })
<- ["0xc7d3bfd..."]

this was on android, i also tested via our dapp which using the same methods here: https://metamask.github.io/test-dapp/

@xmaysonnave
Copy link
Author

@rickycodes Thanks for your feedback.
Here is to reproduce the error.
Clear your privacy data.
1 - await provider.request({method:'requestAccounts'})
The UI popup to connect the Dapp to the current account
2 - await provider.request({method:'eth_accounts'})
No errors, but return an empty array
3 - Once this problems occured I tested with an await provider.enable()
The UI popup a second time to connect the Dapp
No errors and enable returns a populated array.

@gantunesr gantunesr added the community Issues or PRs opened by the MM community label Sep 14, 2021
@AlexJupiter
Copy link

@xmaysonnave I'm going to close this issue since there hasn't been any update in a long time. If this issue still persists let us know and perhaps we can re-open.

@340rahul
Copy link

340rahul commented Jan 5, 2023

We're still facing this issue. Is there a workaround?

@rickycodes rickycodes removed their assignment Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Issues or PRs opened by the MM community type-bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants