Coinbase Wallet SDK
wallet_switchEthereumChain
Switch the wallet to a different Ethereum chain
Defined in EIP-3326
Requests that the wallet switches its active Ethereum chain to one of the chains already added to the wallet.
Parameters
A 0x-prefixed hexadecimal string representing the chain ID of the chain to switch to.
Returns
Returns null if successful.
Error Handling
Code | Message | Description |
---|---|---|
4001 | User rejected the request | User denied switching chains |
4100 | Requested method not supported | The method is not supported by the wallet |
4902 | Unrecognized chain ID | The requested chain has not been added to the wallet |
If the chain is not already added to the wallet, use wallet_addEthereumChain
first.
Switching chains will affect all subsequent blockchain operations in your application.