Defined in EIP-3085
Requests that the wallet tracks the given chain and adds it to the wallet’s UI. This method is used to suggest new networks to the user.
Parameters
The chain data object containing network information.Show Chain data properties
A 0x-prefixed hexadecimal string representing the chain ID.
The human-readable name of the chain.
An object describing the currency that is “native” to this chain.Show Native currency properties
The name of the native currency.
The symbol of the native currency.
The number of decimals for the native currency.
An array of RPC URL strings.
An array of block explorer URL strings (optional).
An array of icon URL strings (optional).
Returns
Returns null if successful.
{
"id": 1,
"jsonrpc": "2.0",
"method": "wallet_addEthereumChain",
"params": [{
"chainId": "0x2105",
"chainName": "Base Mainnet",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"rpcUrls": ["https://mainnet.base.org"],
"blockExplorerUrls": ["https://basescan.org"]
}]
}
{
"id": 1,
"jsonrpc": "2.0",
"result": null
}
Error Handling
Code | Message | Description |
---|
4001 | User rejected the request | User denied adding the chain |
4100 | Requested method not supported | The method is not supported by the wallet |
4902 | Unrecognized chain ID | The chain ID is not recognized |
Make sure to provide accurate RPC URLs and block explorer URLs. Incorrect URLs may cause connectivity issues.