Blocto
About portto
Blog
Search…
📣
Introduction
Give Feedback
Blocto
Overview
Web3.js Integration (Ethereum / BSC / Polygon / Avalanche / Tron)
Sign Message
Batch Transaction
Switch Chain
Getting Started
Connect to Blocto wallet
Sign Message
Send Transaction
Web3.js Integration (Solana)
Deep Linking
Push Notification
Rewards
Token Listing
BLOCTO SDK
Overview
Register App ID
Javascript SDK
Android SDK
iOS SDK
Technical Documents
Contract Wallet
Key Management
Community
Discord
Twitter
Facebook
Powered By
GitBook
Switch Chain
Switch the blockchain network to another one
Introduction
It supports Ethereum/BSC/Polygon/Avalanche injected at
window.ethereum
. Blocto follows
eip-3326
and will not reload the webpage after switching the network.
Usage
1
// Switch to BSC
2
const
params
=
[{
chainId
:
'0x38'
}]
3
await
window
.
ethereum
.
request
({
4
method
:
'wallet_switchEthereumChain'
,
5
params
:
params
6
})
Copied!
Switching network will emit a
chainChanged
event.
1
window
.
ethereum
.
on
(
'chainChanged'
,
(
chainId
)
=>
{
2
console
.
log
(
chainId
)
// 0x38 if it's BSC
3
})
Copied!
Previous
Batch Transaction
Next
Getting Started
Last modified
9mo ago
Copy link
Contents
Introduction
Usage