Skip to content
On this page

addChain โ€‹

Adds an EVM chain to the wallet.

Usage โ€‹

ts
import { avalanche } from 'viem/chains'
import { walletClient } from './client'
 
await walletClient.addChain({ chain: avalanche }) 
ts
import { createWalletClient, custom } from 'viem'
import { mainnet } from 'viem/chains'

export const walletClient = createWalletClient({
  chain: mainnet,
  transport: custom(window.ethereum)
})

Parameters โ€‹

chain โ€‹

The chain to add to the wallet.

JSON-RPC Methods โ€‹

eth_addEthereumChain

Released under the MIT License.