Chains
wagmi exports the Mainnet (mainnet
) & Goerli (goerli
) chains out-of-the-box.
import { mainnet, goerli } from 'wagmi'
If you wish to extend to other EVM-compatible chains (like Polygon, Optimism, BSC, Avalanche, etc), you can either import the chain directly from the wagmi/chains
entrypoint, or build it yourself.
wagmi/chains
The wagmi/chains
entrypoint proxies the @wagmi/chains
NPM package, an official wagmi package which contains references to popular EVM-compatible chains such as: Polygon, Optimism, Avalanche, and more.
Usage
Import your chains from the entrypoint and use them in your wagmi app:
import { configureChains } from 'wagmi'
import { avalanche, bsc, mainnet } from 'wagmi/chains'
const { chains, provider } = configureChains(
[mainnet, avalanche, bsc],
...
)
Read more on configuring chains
Supported chains
mainnet
goerli
arbitrum
arbitrumGoerli
avalanche
avalancheFuji
bsc
bscTestnet
evmos
evmosTestnet
fantom
fantomTestnet
gnosis
optimism
optimismGoerli
polygon
polygonMumbai
sepolia
taraxa
taraxaTestnet
foundry
hardhat
localhost
Want to add a chain that's not listed here? Head to the wagmi References monorepo and read the Contributing Guide before opening a pull request.
Build your own
You can also extend wagmi to support other EVM-compatible chains by building your own chain object that inherits the Chain
type.
import { Chain } from 'wagmi'
export const avalanche: Chain = {
id: 43_114,
name: 'Avalanche',
network: 'avalanche',
nativeCurrency: {
decimals: 18,
name: 'Avalanche',
symbol: 'AVAX',
},
rpcUrls: {
default: { http: ['https://api.avax.network/ext/bc/C/rpc'] },
},
blockExplorers: {
etherscan: { name: 'SnowTrace', url: 'https://snowtrace.io' },
default: { name: 'SnowTrace', url: 'https://snowtrace.io' },
},
contracts: {
multicall3: {
address: '0xca11bde05977b3631167028862be2a173976ca11',
blockCreated: 11907934,
},
},
}