Skip to content

getChains

Action for getting configured chains.

Import

ts
import { getChains } from '@wagmi/core'

Usage

ts
import { getChains } from '@wagmi/core'
import { config } from './config'

const chains = getChains(config)
ts
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'

export const config = createConfig({
  chains: [mainnet, sepolia],
  transports: {
    [mainnet.id]: http(),
    [sepolia.id]: http(),
  },
})

Return Type

ts
import { type GetChainsReturnType } from '@wagmi/core'

readonly [Chain, ...Chain[]]

Chains from config.chains.

Released under the MIT License.