A TypeScript library that provides chain definitions for various blockchain networks, with a focus on Eco ecosystem support. The library extends viem's chain interfaces and provides utilities for managing RPC connections with API key replacements.
# Using pnpm
pnpm add @eco-foundation/chains
# Using yarn
yarn add @eco-foundation/chains
# Using npm
npm install @eco-foundation/chainsimport { EcoChains, ethereum, eco } from '@eco-foundation/chains'
// Initialize EcoChains with API keys
const chains = new EcoChains({
infuraKey: 'your-infura-key',
alchemyKey: 'your-alchemy-key',
})
// Get a specific chain with updated RPC URLs
const ethereumChain = chains.getChain(ethereum)
// Access chain properties
console.log(ethereumChain.id) // Chain ID
console.log(ethereumChain.name) // Chain name
console.log(ethereumChain.rpcUrls) // RPC endpoints with API keys insertedarbitrum- Arbitrum Onebase- Baseeco- Eco Chainethereum- Ethereum Mainnetgoerli- Ethereum Goerli Testnethelix- Helixmantle- Mantleoptimism- Optimismpolygon- Polygon
- Extends viem's Chain interface
- Supports API key replacements in RPC URLs
- Includes WebSocket endpoints with validation
- Provides comprehensive chain metadata
- Type-safe with TypeScript and runtime validation
# Install dependencies
pnpm install
# Build the project
pnpm build
# Run tests
pnpm test# Run linter
pnpm lint
# Fix linting issues
pnpm lint:fix
# Check formatting
pnpm format:check
# Format code
pnpm formatThis project uses Semantic Versioning and Conventional Commits: fix:/perf:/addChain: commits cut a patch, feat: a minor, BREAKING CHANGE: a major.
On every merge to main, semantic-release computes the version, updates CHANGELOG.md and package.json, tags vX.Y.Z, creates the GitHub Release, and stages the package on npm with npm stage publish. Staged is not published: nobody can install it until a maintainer approves it with a 2FA challenge (npm >= 11.15.0 locally):
npm stage list @eco-foundation/chains
npm stage approve <stage-id> # or: npm stage reject <stage-id>See CONTRIBUTING.md for the full flow and the token setup.
MIT