Skip to main content
All CollectionsDevelop with Core
Core API Calls: wallet_switchEthereumChain
Core API Calls: wallet_switchEthereumChain
A
Written by Ana
Updated this week

Requests that the wallet switches its active Ethereum chain. Introduced by EIP-3326.

Params

1. SwitchEthereumChainParameter (required)

chainId string (required)

The 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": "0x1"
}
]
});

Result

"null"

For any additional questions, please view our other knowledge base articles or contact a Product Support team member via the chat button. Examples are for illustrative purposes only.

Did this answer your question?