• Core
  • Actions
  • getNetwork

getNetwork

Action for accessing network data, such as current connected chain and connector chains.

import { getNetwork } from '@wagmi/core'

Usage

import { getNetwork } from '@wagmi/core'
 
const { chain, chains } = getNetwork()

Tip: If you want the functionality to switch networks, check out switchNetwork.

Return Value

{
  chain?: Chain & { unsupported?: boolean }
  chains: Chain[]
}