Function getChain

Gets a chain by its identifier

Error if no chain matches the identifier

// Get by numeric ID
const eth = getChain(1)

// Get by hex ID
const polygon = getChain("0x89")

// Get by EIP-155 format
const bsc = getChain("eip155:56")

// Get by short name
const arbitrum = getChain("arb1")
  • Type Parameters

    • T extends string | number

    Parameters

    • identifier: T

      The chain identifier. Can be:

      • Chain ID as number (e.g. 1 for Ethereum mainnet)
      • Chain ID as hex string (e.g. "0x1")
      • EIP-155 formatted string (e.g. "eip155:1")
      • Chain short name (e.g. "eth" for Ethereum mainnet)

    Returns Chain

    The matching chain object