@ethernauta/chain
v0.0.48
Published
500+ EIP-155 chain definitions for Ethernauta, indexed by chain_id.
Downloads
11,259
Maintainers
Readme
Philosophy
This module is an un-opinionated representation of the public chain catalogue:
Every chain in the upstream list is exported as a const named eip155_<chainId> (one file per chain). Pair the const with encode_chain_id from @ethernauta/transport to produce a CAIP-2 identifier that every Ethernauta resolver factory accepts.
A small derivation tool — runIndexer — refreshes the catalogue from the upstream repository.
Modules
- abi [NPM]
- chain [NPM]
- cli [NPM]
- core [NPM]
- crypto [NPM]
- eip [NPM]
- ens [NPM]
- erc [NPM]
- eth [NPM]
- react [NPM]
- transaction [NPM]
- transport [NPM]
- utils [NPM]
- wallet
API
Chain consts — one per EIP-155 chain
import {
eip155_1, // Ethereum Mainnet
eip155_10, // OP Mainnet
eip155_8453, // Base
eip155_42161, // Arbitrum One
eip155_11155111, // Sepolia
// …500+ exports
} from "@ethernauta/chain"
// Each const exposes the upstream `ChainSchema` shape:
// { name, shortName, chainId, networkId, nativeCurrency,
// rpc, explorers, … }Pair a chain with a CAIP-2 id
import { eip155_11155111 } from "@ethernauta/chain"
import { decode_chain_id, encode_chain_id } from "@ethernauta/transport"
const chain_id = encode_chain_id({
namespace: "eip155",
reference: eip155_11155111.chainId,
})
console.log(chain_id) // "eip155:11155111"
const { namespace, reference } = decode_chain_id(chain_id)
console.log(namespace) // "eip155"
console.log(reference) // "11155111"Schemas
import {
type Chain,
ChainSchema,
type Feature,
type NativeCurrency,
type Explorer,
type Bridge,
type Parent,
type EnsRegistry,
type ShortName,
ShortNameSchema,
type RedFlagSchema,
} from "@ethernauta/chain"
// `ChainSchema` matches the upstream JSON schema and is what
// every `eip155_*` export validates against at build time.Refresh the catalogue
pnpm --filter @ethernauta/chain indexerThe indexer script pulls the latest definitions from ethereum-lists/chains, validates each against ChainSchema, and writes one TS file per chain under src/chain/eip155/.
