Skip to content

Chains

Single source of truth for PancakeSwap chain identifiers and network metadata. All other PancakeSwap packages import chain IDs from here.

Installation

npm install @pancakeswap/chains

Quick start

import { ChainId, chainNames, testnetChainIds } from '@pancakeswap/chains'
 
// Use chain IDs
const bscId = ChainId.BSC             // 56
const ethId = ChainId.ETHEREUM        // 1
const arbId = ChainId.ARBITRUM_ONE    // 42161
 
// Human-readable name
console.log(chainNames[ChainId.BASE]) // "base"
 
// Check for testnet
if (testnetChainIds.includes(chainId)) {
  console.warn('Connected to a testnet')
}

Supported chains

Active mainnets (ChainId)

NameValue
ETHEREUM1
BSC56
ARBITRUM_ONE42161
BASE8453
ZKSYNC324
LINEA59144
OPBNB204
MONAD_MAINNET143

Non-EVM chains (NonEVMChainId)

NameValue
SOLANA8000001001
APTOS8000002000

Sunset chains (SunsetChainId)

NameValueNote
POLYGON_ZKEVM1101Deprecated — do not use in new code

Key exports

ExportTypeDescription
ChainIdenumEVM chain IDs
NonEVMChainIdenumNon-EVM chain IDs
SunsetChainIdenumDeprecated chain IDs
chainNamesRecord<ChainId, string>Lowercase chain names
testnetChainIdsChainId[]All testnet chain IDs
averageChainBlockTimesRecord<ChainId, number>Block time in milliseconds