etherscan-api
    Preparing search index...

    Function resolveChainId

    • Resolve a chain name or numeric chainid to a numeric chainid.

      • null / undefined / '' defaults to Ethereum mainnet (1).
      • A number, an all-digit string, or a 0x hex string (the EIP-155 form that eth_chainId returns) is passed through once validated as a positive integer.
      • Surrounding whitespace in a string is ignored (values from env/config files).
      • A known name is mapped to its chainid.
      • A retired or unknown name throws — silently switching networks on a blockchain client is dangerous (wrong-chain reads look successful).

      Parameters

      • Optionalchain: string | number | null

      Returns number

      If the chain is invalid, retired or unknown.