Skip to content

switchChain

Switch the target chain in a wallet.

Usage

example.ts
import { avalanche } from 'viem/chains'
import { walletClient } from './client'
 
await walletClient.switchChain({ id: avalanche.id }) 

Parameters

id

  • Type: number

The Chain ID.

JSON-RPC Methods

eth_switchEthereumChain