addChain
Adds an EVM chain to the wallet.
Usage
ts
import { avalanche } from 'viem/chains'
import { walletClient } from './client'
await walletClient.addChain({ chain: avalanche })
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)
})
import { createWalletClient, custom } from 'viem'
import { mainnet } from 'viem/chains'
export const walletClient = createWalletClient({
chain: mainnet,
transport: custom(window.ethereum)
})
Parameters
chain
- Type:
Chain
The chain to add to the wallet.