wallet_switchEthereumChain
Requests that the wallet switches its active Ethereum chain. Introduced by EIP-3326.
Params
(1)1. SwitchEthereumChainParameter (required)
chainId
stringThe chain ID as a 0x
-prefixed hexadecimal string, per the eth_chainId
method.
Result
(SwitchEthereumChainResult)null
Errors
Code | Message |
---|---|
4902 | Unrecognized chain ID. Try adding the chain using wallet_addEthereumChain first. |
Example
Request
await window.ethereum.request({
"method": "wallet_switchEthereumChain",
"params": [
{
"chainId": "0x64"
}
]
});
Result
"null"