Skip to content

normalizeChainId

Normalizes a chain ID to a number.

Import

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

Usage

Deprecated

Use Number instead.

ts
import { normalizeChainId } from 'wagmi' 
const chainId = normalizeChainId(123n) 
const chainId = Number(123n) 
import { normalizeChainId } from 'wagmi' 
const chainId = normalizeChainId(123n) 
const chainId = Number(123n) 
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.