Skip to content

normalizeChainId

Normalizes a chain ID to a number.

Import

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

Usage

Deprecated

Use Number instead.

ts
import { normalizeChainId } from '@wagmi/core' 
const chainId = normalizeChainId(123n) 
const chainId = Number(123n) 
import { normalizeChainId } from '@wagmi/core' 
const chainId = normalizeChainId(123n) 
const chainId = Number(123n) 
ts
import { normalizeChainId } from '@wagmi/core'

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

const result = normalizeChainId('0x1')

Parameters

chainId

bigint | number | string

The chain ID to normalize.

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

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

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

Return Type

number

The normalized chain ID.

Released under the MIT License.