Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Built-in chain presets

@tevm/common exports ready-to-use EVM chain configurations with chain IDs, hardfork histories, and RPC metadata. Reach for a preset when creating a Tevm client for a known network instead of assembling Common options by hand.

Working example

This complete example was run with @tevm/common@1.0.0-rc.151 and viem@2.49.3.

import assert from 'node:assert/strict'
import { anvil, arbitrum, base, mainnet, optimism, sepolia } from '@tevm/common'
 
const chains = [mainnet, sepolia, anvil, arbitrum, optimism, base]
assert.deepEqual(
	chains.map((chain) => [chain.name, chain.id]),
	[
		['Ethereum', 1],
		['Sepolia', 11155111],
		['Anvil', 31337],
		['Arbitrum One', 42161],
		['OP Mainnet', 10],
		['Base', 8453],
	],
)
 
console.log(chains.map((chain) => `${chain.name}: ${chain.id}`).join('\n'))
Ethereum: 1
Sepolia: 11155111
Anvil: 31337
Arbitrum One: 42161
OP Mainnet: 10
Base: 8453

Preset exports

The generated presets/index.ts is the complete export list. These are the primary presets covered by this feature:

ExportChain IDUse
mainnet1Ethereum mainnet
sepolia11155111Ethereum Sepolia
anvil31337Foundry Anvil
arbitrum42161Arbitrum One
optimism10OP Mainnet
base8453Base mainnet

Every preset is a Common configuration and can be passed as the common option to createTevmNode or createMemoryClient.

Neighbours

Common reference · Create a node · Forking