question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong return value for eth_requestAccounts

See original GitHub issue

The documentation says the method eth_requestAccounts returns an array of accounts, however it returns a JSON-RPC response as of MetaMask 7.4.0. Probably a bug of MetaMask.

To reproduce

In any page containing an EthereumProvider for a browser installed MetaMask 7.4.0, evaluate the following statement:

ethereum.send('eth_requestAccounts').then(console.log)
// {id: 1, jsonrpc: "2.0", result: ['0x1234...']}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
danfinlaycommented, Apr 9, 2020

Yes, this would’ve been a breaking change, and so there was a very recent change to EIP-1193:

  • The current send() behavior which returns Promise<{ results: <any> }> will remain.
  • A new method request() will be added, which returns the intended result Promise<any>.

https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md

So this is indeed a problem with he docs: @BboyAkers is correct, and we should change to match his description.

1reaction
BboyAkerscommented, Apr 9, 2020

I’ll create a pull request and change it in the docs

Read more comments on GitHub >

github_iconTop Results From Across the Web

RPC API - MetaMask Docs
Returns a Promise that resolves to an array of a single Ethereum address string. If the user denies the request, the Promise will...
Read more >
Understanding and resolving MetaMask error codes
This error is returned when the user's MetaMask wallet is not connected to any chain ... from: accounts[0], to: paymentAddress, value: web3.
Read more >
requesting Metamask with "eth_requestAccounts" does not ...
First <Button onClick={() => { // this is logging. console.log("clicked to send request to Metamask"); connect; }} > Connect </Button>.
Read more >
web3.eth — web3.js 1.0.0 documentation
The revert reason string and the signature does exist as property on the returned error. Returns¶. boolean : The current value of handleRevert...
Read more >
MetaMask - Internal JSON-RPC error
Smart Contract Error: Returned values aren't valid, did it run Out of Gas? 0 · Getting Metamask Error Message into web3.js DApp after...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found