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

NetworkControllers chainId list breaks Optimism on Mobile. #740

Closed
patniemeyer opened this issue Mar 22, 2022 · 4 comments
Closed

NetworkControllers chainId list breaks Optimism on Mobile. #740

patniemeyer opened this issue Mar 22, 2022 · 4 comments
Assignees
Labels
bug Something isn't working team-wallet-framework

Comments

@patniemeyer
Copy link

patniemeyer commented Mar 22, 2022

Metamask Mobile throws an exception on wallet_switchEthereumChain for Optimism and suggests adding the chain. However NetworksChainId in NetworkControllers.ts inconsistently includes Optimism, which causes MetaMask Mobile to fail onwallet_addEthereumChain. So it appears that there is currently no way to use Optimism from MetaMask mobile.

https://github.com/MetaMask/controllers/blob/365191875a22ab5c94d81b464734e8adff7dbad3/src/network/NetworkController.ts#L23-L33

EDIT: Note that MetaMask extension does not reference NetworkControllers in this way and does not suffer from this problem. (It is possible to add and switch to Optimism on desktop).

@mcmire
Copy link
Contributor

mcmire commented Mar 23, 2022

I looked in our company Slack and it looks like this is a known issue (as of a month ago). I was looking at NetworkController recently and noticed that optimism and optimismTest aren't valid subdomains on Infura. According to https://docs.infura.io/infura/networks/optimism/getting-started/send-request, it should be optimism-mainnet and optimism-kovan. It's possible this is why it's failing.

@desi
Copy link
Contributor

desi commented Nov 14, 2024

@mcmire can you take a look and see if this can be closed?

@kantagara
Copy link

This is still happening unfortunately.

@mcmire
Copy link
Contributor

mcmire commented Feb 7, 2025

I am not able to reproduce this. It is true that when using wallet_switchEthereumChain to switch to Optimism, the request will fail if the network is not present. However, it is possible to add the chain via wallet_addEthereumChain. It is also possible to add "OP Mainnet" from the network switcher in Mobile.

Since this issue was filed, NetworkController has been updated to use eth-json-rpc-infura to get a list of valid subdomains for the Infura RPC URL. So we aren't using optimism and optimismTest anymore. And since this commit this package has always allowed the correct subdomains for Optimism.

So I don't think this is an issue anymore.

@mcmire mcmire closed this as completed Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working team-wallet-framework
Projects
None yet
Development

No branches or pull requests

4 participants