EIP-3085: wallet_addEthereumChain

This topic is for discussing EIP-3085. Discussion was originally located at this GitHub issue on the EIPs repository.

Discussion is expected to pick up again as 3085 moves to Review and then Last Call.

A draft PR is up for a related method, wallet_switchEthereumChain: https://github.com/ethereum/EIPs/pull/3326

Instead of decimals, consider requiring a scaling factor instead. This would allow chains that have scaling factors other than base 10 to be supported. Ethereum would be 10^18 but other-chain may be 2^32.

Oh, interesting idea. Something like scalingFactor: string matching RegEx /[1-9]\d*\^[1-9]\d*/? Or maybe scalingFactor: [base: number, exponent: number] where the tuple members are positive integers?

Then we could make scalingFactor mutually exclusive with decimals.

Scaling factor can just be a QUANTITY (hex string encoded number). No need for anything fancy here I think.

1 Like

Ah, naturally. I’ll PR that in the morning :+1:

Watch an overview of the proposal with @rekmarks

1 Like

Hello,

I am facing an issue while calling wallet_addEthereumChain.
I will appreciate it if you can help me to fix this issue.

ethereum.request({
method: ‘wallet_addEthereumChain’,
params: [{
“chainId”: “0x3”,
“chainName”: “Ropsten Network”,
“rpcUrls”: [
https://ropsten.infura.io/v3/4ee71c3a70404cf8b1241df95bbc1347”,
],
“iconUrls”: [
https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0/logo.png
],
“nativeCurrency”: {
“name”: “ETHER Token”,
“symbol”: “ETH”,
“decimals”: 18
}
}]

And this is the issue:
image

Thanks in advance.

Actually, I added blockExplorerUrls to the params. Sorry to forgot adding it to the code.
“blockExplorerUrls”: [
https://ropsten.etherscan.io
],

FYI, I confirmed that my Infura Project ID is working. This issue is definitely related to the “rpcUrls”.
When I change it to “https://dai.poa.network” with xDAI Chain, it perfectly worked.

I imagine you figured this out by now, but:

wallet_addEthereumChain doesn’t (or at least originally didn’t) support switching to a default network (any Ethereum network like Mainnet, Ropsten, etc.)

Now you can use a combination of wallet_addEthereumChain and wallet_switchEthereumChain in your dapp to add new networks for users if they do not have it in their MM already, and switch back to default chains like Ropsten afterwards.

You can read more here: