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

[BUG]: wallet_addEthereumChain throws error: Error JSON PRC response: the method wallet_addEthereumChain does not exist/is not available #5682

Open
1 of 2 tasks
Songkeys opened this issue Sep 1, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@Songkeys
Copy link
Contributor

Songkeys commented Sep 1, 2024

Prerequisites
Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • I checked to make sure that this issue has not already been filed
  • I've asked for help in the OneKey Discord before filing this issue.

Describe the bug

wallet_addEthereumChain does not seem to work any more.

Example code:

  window.ethereum.request({
      method: 'wallet_addEthereumChain',
      params: [{
        chainId: '0x64',
        chainName: 'Gnosis Chain',
        nativeCurrency: {
          name: 'xDAI',
          symbol: 'xDAI',
          decimals: 18
        },
        rpcUrls: ['https://rpc.gnosischain.com/'],
        blockExplorerUrls: ['https://gnosisscan.io/']
      }]
    });

Error:

{
    "name": "Error",
    "message": "Error JSON PRC response: the method wallet_addEthereumChain does not exist/is not available",
    "stack": "Error: Error JSON PRC response: the method wallet_addEthereumChain does not exist/is not available\n    at parseRPCResponse (chrome-extension://jnmbobjmhlngoefaiojfljckilhhlhcj/background.bundle.js:8:3585179)\n    at chrome-extension://jnmbobjmhlngoefaiojfljckilhhlhcj/background.bundle.js:8:1453930\n    at Array.map (<anonymous>)\n    at ServiceDApp.<anonymous> (chrome-extension://jnmbobjmhlngoefaiojfljckilhhlhcj/background.bundle.js:8:1453890)\n    at Generator.next (<anonymous>)\n    at asyncGeneratorStep (chrome-extension://jnmbobjmhlngoefaiojfljckilhhlhcj/background.bundle.js:8:11373261)\n    at _next (chrome-extension://jnmbobjmhlngoefaiojfljckilhhlhcj/background.bundle.js:8:11373506)"
}

To Reproduce
Go to console and execute the above code or the sample code in your repo.

Expected behavior
This will prompt the "Add chain to wallet" window to appear.

Screenshots
The video below demonstrates me: 1) successfully using the same code to bring up Rainbow Wallet; 2) attempting to use the same code but failing to bring up OneKey Wallet.

Screen.Recording.2024-09-02.at.01.23.19.mov

Desktop (please complete the following information):

  • OS: macOS
  • Browser: arc
  • Version: latest

Additional context
I have just tested the Chrome extension. Some users are reporting that they are unable to do the same in the app too.


edit: I was trying to make a PR to fix this but found this endpoint is not open source? Btw, you should definitely fix the disturbing PRC typo.

@Songkeys Songkeys added the bug Something isn't working label Sep 1, 2024
@ByteZhang1024
Copy link
Member

There are no plans to support wallet_addEthereumChain in the near future.

@Songkeys
Copy link
Contributor Author

Songkeys commented Sep 2, 2024

Is there a public announcement available regarding this decision? Without it, users could become confused and our dapp developers might face inconvenience and queries from users.

By the way, I came across a tweet from the official Onekey account mentioning that it will be addressed in the upcoming version. Which statement is accurate? https://x.com/OneKeyCN/status/1829383704923496802

@ByteZhang1024
Copy link
Member

We will do it, but not that quickly. This adjustment is a very significant change.
You can first explain your requirements and which networks you need. We can initially embed them in the app.

@Songkeys
Copy link
Contributor Author

Songkeys commented Sep 2, 2024

I see.

I am a developer from @RSS3-Network. Our users are experiencing issues connecting to our chain using OneKey while they reported they could do so a while ago. If possible, could you kindly embed the rss3 chain in the app? Thank you!

You can find the chain config here:

@ByteZhang1024
Copy link
Member

If you need to transfer any assets, you can use https://app.onekey.so/ for now.
The requirement has been reported, and we will process the addition of the RSS3 network as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants
@Songkeys @ByteZhang1024 and others