Skip to main content

@cowprotocol/sdk-config

Installation

npm install @cowprotocol/sdk-config

Supported Chains

SupportedChainId

Enum of all EVM chains where CoW Protocol is fully supported (you can sell tokens).
enum SupportedChainId {
  MAINNET = 1,
  BNB = 56,
  GNOSIS_CHAIN = 100,
  POLYGON = 137,
  LENS = 232,
  BASE = 8453,
  PLASMA = 9745,
  ARBITRUM_ONE = 42161,
  AVALANCHE = 43114,
  INK = 57073,
  LINEA = 59144,
  SEPOLIA = 11155111
}
import { SupportedChainId } from '@cowprotocol/sdk-config'

const chainId = SupportedChainId.MAINNET // 1

AdditionalTargetChainId

Chains where you can bridge to, but cannot sell tokens from (not directly supported by CoW Protocol).
enum AdditionalTargetChainId {
  OPTIMISM = 10,
  BITCOIN = 1000000000,
  SOLANA = 1000000001
}

EvmChains

All EVM chains (both fully supported and bridge targets).
enum EvmChains {
  MAINNET = 1,
  BNB = 56,
  GNOSIS_CHAIN = 100,
  POLYGON = 137,
  LENS = 232,
  BASE = 8453,
  PLASMA = 9745,
  ARBITRUM_ONE = 42161,
  AVALANCHE = 43114,
  INK = 57073,
  LINEA = 59144,
  SEPOLIA = 11155111,
  OPTIMISM = 10
}

NonEvmChains

Non-EVM chains available for bridging.
enum NonEvmChains {
  BITCOIN = 1000000000,
  SOLANA = 1000000001
}

Chain Information

ChainInfo

Comprehensive chain metadata.
interface EvmChainInfo {
  readonly id: ChainId
  readonly label: string
  readonly eip155Label: string
  readonly addressPrefix: string
  readonly nativeCurrency: TokenInfo
  readonly isTestnet: boolean
  readonly color: string
  readonly logo: ThemedImage
  readonly docs: WebUrl
  readonly website: WebUrl
  readonly blockExplorer: WebUrl
  readonly bridges?: WebUrl[]
  readonly isUnderDevelopment?: boolean
  readonly isDeprecated?: boolean
  readonly contracts: ChainContracts
  readonly rpcUrls: {
    [key: string]: ChainRpcUrls
    default: ChainRpcUrls
  }
  readonly isZkSync?: boolean
}

interface NonEvmChainInfo {
  readonly id: ChainId
  readonly label: string
  readonly addressPrefix: string
  readonly nativeCurrency: TokenInfo
  readonly isTestnet: boolean
  readonly color: string
  readonly logo: ThemedImage
  readonly docs: WebUrl
  readonly website: WebUrl
  readonly blockExplorer: WebUrl
  readonly bridges?: WebUrl[]
}

type ChainInfo = EvmChainInfo | NonEvmChainInfo

Chain Constants

// Map of all supported chains
const ALL_SUPPORTED_CHAINS_MAP: Record<SupportedChainId, ChainInfo>

// Array of all supported chains
const ALL_SUPPORTED_CHAINS: ChainInfo[]

// Array of all supported chain IDs
const ALL_SUPPORTED_CHAIN_IDS: SupportedChainId[]

// Chains where trading is allowed (excludes deprecated)
const TRADABLE_SUPPORTED_CHAINS: ChainInfo[]
const TRADABLE_SUPPORTED_CHAIN_IDS: SupportedChainId[]

// Additional bridge-only chains
const ADDITIONAL_TARGET_CHAINS_MAP: Record<AdditionalTargetChainId, ChainInfo>
const ALL_ADDITIONAL_TARGET_CHAINS: ChainInfo[]
const ALL_ADDITIONAL_TARGET_CHAIN_IDS: AdditionalTargetChainId[]

// All chains (supported + bridge targets)
const ALL_CHAINS: ChainInfo[]
const ALL_CHAINS_IDS: TargetChainId[]
import {
  ALL_SUPPORTED_CHAINS_MAP,
  SupportedChainId,
  TRADABLE_SUPPORTED_CHAIN_IDS
} from '@cowprotocol/sdk-config'

// Get Ethereum mainnet info
const mainnet = ALL_SUPPORTED_CHAINS_MAP[SupportedChainId.MAINNET]
console.log(mainnet.label) // 'Ethereum'
console.log(mainnet.nativeCurrency.symbol) // 'ETH'

// Get all tradable chains
console.log(TRADABLE_SUPPORTED_CHAIN_IDS)
// [1, 56, 100, 137, ...]

Contract Addresses

Settlement Contract

const COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS: Record<SupportedChainId, string>
CoW Protocol settlement contract addresses for each supported chain. Default address: 0x9008D19f58AAbD9eD0D60971565AA8510560ab41

Vault Relayer

const COW_PROTOCOL_VAULT_RELAYER_ADDRESS: Record<SupportedChainId, string>
Vault relayer contract addresses. Default address: 0xC92E8bdf79f0507f65a392b0ab4667716BFE0110

Extensible Fallback Handler

const EXTENSIBLE_FALLBACK_HANDLER_CONTRACT_ADDRESS: Record<SupportedChainId, string>
Default address: 0x2f55e8b20D0B9FEFA187AA7d00B6Cbe563605bF5

Composable CoW

const COMPOSABLE_COW_CONTRACT_ADDRESS: Record<SupportedChainId, string>
Default address: 0xfdaFc9d1902f4e0b84f65F49f244b32b31013b74

ETH Flow Contracts

const ETH_FLOW_ADDRESSES: Record<SupportedChainId, string>
const BARN_ETH_FLOW_ADDRESSES: Record<SupportedChainId, string>
ETH flow contract addresses for production and barn (staging) environments.
import {
  COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS,
  SupportedChainId
} from '@cowprotocol/sdk-config'

const settlementAddress = COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS[
  SupportedChainId.MAINNET
]
console.log(settlementAddress)
// '0x9008D19f58AAbD9eD0D60971565AA8510560ab41'

Special Addresses

// Native ETH marker address
const ETH_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'

// Maximum valid timestamp for orders
const MAX_VALID_TO_EPOCH = 4294967295 // Feb 07 2106 07:28:15 GMT+0100

Utility Functions

mapSupportedNetworks

Maps a value or function across all supported networks.
function mapSupportedNetworks<T>(
  value: T | ((chainId: SupportedChainId) => T)
): Record<SupportedChainId, T>
import { mapSupportedNetworks, SupportedChainId } from '@cowprotocol/sdk-config'

// Map same value to all chains
const sameValue = mapSupportedNetworks('0x123...')

// Map different values based on chain
const customValues = mapSupportedNetworks((chainId) => {
  return chainId === SupportedChainId.MAINNET ? '0xabc...' : '0xdef...'
})

mapAllNetworks

Maps a value across all networks (including bridge targets).
function mapAllNetworks<T>(
  value: T | ((chainId: TargetChainId) => T)
): Record<TargetChainId, T>

mapAddressToSupportedNetworks

Maps a contract address to all supported networks.
function mapAddressToSupportedNetworks(
  address: string
): Record<SupportedChainId, string>

Chain Details

Individual chain configurations are exported:
import {
  mainnet,
  gnosisChain,
  arbitrumOne,
  base,
  avalanche,
  polygon,
  lens,
  bnb,
  optimism,
  linea,
  plasma,
  ink,
  bitcoin,
  solana,
  sepolia
} from '@cowprotocol/sdk-config'
Each export follows the ChainInfo interface:
import { mainnet } from '@cowprotocol/sdk-config'

console.log(mainnet.label) // 'Ethereum'
console.log(mainnet.rpcUrls.default.http) // ['https://eth.merkle.io']
console.log(mainnet.blockExplorer.url)

Types

type ChainId = number
type TargetChainId = SupportedChainId | AdditionalTargetChainId
type HttpsString = `https://${string}`
type WssString = `wss://${string}`
Last modified on March 4, 2026