Skip to content

normalizeChainId ​

Normalizes a chain ID to a number.

Import ​

ts
import { normalizeChainId } from 'wagmi'
import { normalizeChainId } from 'wagmi'

Usage ​

ts
import { normalizeChainId } from 'wagmi'

const result = normalizeChainId('0x1')
import { normalizeChainId } from 'wagmi'

const result = normalizeChainId('0x1')

Parameters ​

chainId ​

bigint | number | string

The chain ID to normalize.

ts
import { normalizeChainId } from 'wagmi'

normalizeChainId(1n)
normalizeChainId(1)
normalizeChainId('0x1')
import { normalizeChainId } from 'wagmi'

normalizeChainId(1n)
normalizeChainId(1)
normalizeChainId('0x1')

Return Type ​

number

The normalized chain ID.

Released under the MIT License.