#370: docs: add web sdk v0.5.0 ERC-4337 docs
Change request updated 1 year ago
Switch the blockchain network to another one
Last updated 2 years ago
Was this helpful?
It supports Ethereum/BSC/Polygon/Avalanche injected at window.ethereum. Blocto follows and will not reload the webpage after switching the network.
window.ethereum
// Switch to BSC const params = [{ chainId: '0x38' }] await window.ethereum.request({ method: 'wallet_switchEthereumChain', params: params })
Switching network will emit a chainChanged event.
chainChanged
window.ethereum.on('chainChanged', (chainId) => { console.log(chainId) // 0x38 if it's BSC })