Skip to main content

Switching to EVM compatible chains

Websites can request that the browser changes to a different chain by using the wallet_switchEthereumChain method.

async function switchEthereumChain(chainId) {
return await window.ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{
chainId
}]
})
}
console.log(await switchEthereumChain('0x3'))