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

Allow wallet_addEthereumChain for Ethereum networks #13269

Closed
kurushdubash opened this issue Jan 10, 2022 · 8 comments
Closed

Allow wallet_addEthereumChain for Ethereum networks #13269

kurushdubash opened this issue Jan 10, 2022 · 8 comments

Comments

@kurushdubash
Copy link
Contributor

With EIP-3085, we're able to programmatically add new networks / chains to metamask which is a great experience for users versus having to manually add a custom RPC.

However, Metamask doesn't allow adding/updating chains programmatically that have a chain id that corresponds to any of the default MetaMask chains (basically the Ethereum networks). Although adding a custom RPC will allow you to add an RPC with any of the default chain ids.

This would be really useful for allowing custom RPCs in a programmatic way or at the least be able to add duplicate Eth networks.

An example to validate:

const params = [{
    chainId: '0x1',
    chainName: 'Ethereum Mainnet (Localhost)',
    nativeCurrency: {
      name: 'Eth',
      symbol: 'Eth',
      decimals: 18
    },
    rpcUrls: ['https://localhost:8000'],
    blockExplorerUrls: ['https://etherscan.io/']
  }]

const args = { 
  method: 'wallet_addEthereumChain', 
  params: params
}
window.ethereum.request(args)

will result in

MetaMask - RPC Error: May not specify default MetaMask chain. {code: -32602, message: 'May not specify default MetaMask chain.'}

Note: I'm not able to create a feature request on community.metamask.io - there does not seem to be a way to post new topics.

@kurushdubash

This comment was marked as duplicate.

@BrennerSpear

This comment was marked as duplicate.

@Mirado97

This comment was marked as duplicate.

@the42
Copy link

the42 commented Apr 18, 2022

Just so I understand correctly: With this limitation in place, it is essentially not possible to run a full/light node and connect to it right?

@kurushdubash
Copy link
Contributor Author

Not programatically - you will have to manually configure the RPC through the Metamask UI.

@the42
Copy link

the42 commented Apr 18, 2022

Because of #13168 and #13167 it is actually completely impossible for me to add any local network.

@AntonyHatchet

This comment was marked as duplicate.

@adonesky1
Copy link
Contributor

This is resolved by #16733

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants