Developer Docs
Search
K

Switch Chain Network

React
Next
import { useWallet } from "@xircus-web3/react"
export default function Index() {
const wallet = useWallet()
const handleSwitchNetwork = () => {
wallet.switchNetwork(56)
// or wallet.switchNetwork("bsc")
}
if (wallet.status == "connected") {
return (
<div>
<div>{wallet.account}</div>
<div>{wallet.balance}</div>
<button onClick={wallet.disconnect}>Disconnect</button>
<button onClick={handleSwitchNetwork}>Switch To BSC</button>
</div>
)
}
return (
<div>
<button onClick={wallet.connectMetamask}>Connect Metamask</button>
</div>
)
}