Chain Registry
The @monolythium/chain-registry package provides typed chain configuration for every network in the Monolythium ecosystem. It covers pure EVM chains, Cosmos EVM chains (Ethermint-based), and standard Cosmos chains. The package is ESM-only, has zero runtime dependencies, and is written in pure TypeScript.
Installation
npm install @monolythium/chain-registry
Requires TypeScript 5+ and ES2022 target. The package ships compiled JavaScript alongside source files.
Quick Start
import { getChain, getChainByEvmId, allChains } from "@monolythium/chain-registry";
// Look up by string ID
const sprintnet = getChain("monolythium-sprintnet");
console.log(sprintnet?.evm_chain_id); // 262146
// Look up by EVM chain ID
const sei = getChainByEvmId(1329);
console.log(sei?.chain_name); // "Sei"
// List all 16 chains
const chains = allChains();
console.log(chains.length); // 16
API Reference
getChain(id: string)
Returns a ChainConfig by its string identifier, or undefined if not found.
const chain = getChain("cronos");
// chain.chain_name === "Cronos"
// chain.evm_chain_id === 25
getChainByEvmId(evmChainId: number)
Returns a ChainConfig by its EVM chain ID. Works for both pure EVM and Cosmos EVM chains.
const chain = getChainByEvmId(43114);
// chain.chain_name === "Avalanche"
getChainByCosmosId(cosmosChainId: string)
Returns a ChainConfig by its Cosmos chain ID. Works for both Cosmos EVM and pure Cosmos chains.
const chain = getChainByCosmosId("cosmoshub-4");
// chain.chain_name === "Cosmos Hub"
allChains()
Returns a read-only array of all 16 built-in chain configurations.
const chains = allChains();
// Returns: ChainConfig[]
getTestnetChains()
Returns all chains where testnet === true.
const testnets = getTestnetChains();
// Sprintnet, Testnet, Avalanche Fuji, Linea Sepolia, Sei Testnet,
// Cronos Testnet, Kava Testnet, Injective Testnet
getMainnetChains()
Returns all chains where testnet === false.
const mainnets = getMainnetChains();
// Avalanche, Linea, Sei, Cronos, Kava, Injective, Cosmos Hub, Osmosis
getEvmChains()
Returns all chains that support EVM (both Evm and CosmosEvm types).
const evmChains = getEvmChains();
// All chains except Cosmos Hub and Osmosis
getCosmosChains()
Returns all chains that support Cosmos (both Cosmos and CosmosEvm types).
const cosmosChains = getCosmosChains();
// All chains except Avalanche, Avalanche Fuji, Linea, Linea Sepolia
Direct Chain Imports
Each chain is also available as a named export through the chains namespace:
import { chains } from "@monolythium/chain-registry";
chains.sprintnet; // CosmosEvmChainConfig
chains.testnet; // CosmosEvmChainConfig
chains.avalanche; // EvmChainConfig
chains.avalancheFuji; // EvmChainConfig
chains.linea; // EvmChainConfig
chains.lineaSepolia; // EvmChainConfig
chains.sei; // CosmosEvmChainConfig
chains.seiTestnet; // CosmosEvmChainConfig
chains.cronos; // CosmosEvmChainConfig
chains.cronosTestnet; // CosmosEvmChainConfig
chains.kava; // CosmosEvmChainConfig
chains.kavaTestnet; // CosmosEvmChainConfig
chains.injective; // CosmosEvmChainConfig
chains.injectiveTestnet; // CosmosEvmChainConfig
chains.cosmosHub; // CosmosChainConfig
chains.osmosis; // CosmosChainConfig
TypeScript Types
ChainConfig (Union)
The top-level union type that covers all chain variants:
type ChainConfig = EvmChainConfig | CosmosEvmChainConfig | CosmosChainConfig;
Use the chain_type discriminator to narrow:
import type { ChainConfig } from "@monolythium/chain-registry";
function getEvmRpc(chain: ChainConfig): string | undefined {
if (chain.chain_type === "Evm") {
return chain.rpc_endpoints.evm_rpc[0];
}
if (chain.chain_type === "CosmosEvm") {
return chain.rpc_endpoints.evm_rpc[0];
}
return undefined; // Pure Cosmos chain, no EVM RPC
}
EvmChainConfig
For pure EVM chains (Avalanche, Linea).
interface EvmChainConfig {
id: string; // e.g. "avalanche"
chain_name: string; // e.g. "Avalanche"
chain_type: "Evm";
evm_chain_id: number; // e.g. 43114
denom: DenomConfig;
rpc_endpoints: Pick<RpcEndpoints, "evm_rpc" | "evm_ws">;
explorer: ExplorerConfig | null;
gas_config: GasConfig;
features: string[]; // e.g. ["evm"]
source: ChainSource;
testnet: boolean;
}
CosmosEvmChainConfig
For Ethermint-based chains that expose both Cosmos and EVM interfaces (Sprintnet, Sei, Cronos, Kava, Injective).
interface CosmosEvmChainConfig {
id: string; // e.g. "monolythium-sprintnet"
chain_name: string; // e.g. "Sprintnet"
chain_type: "CosmosEvm";
cosmos_chain_id: string; // e.g. "mono-sprint-1"
evm_chain_id: number; // e.g. 262146
bech32_prefix: string; // e.g. "mono"
denom: DenomConfig;
coin_type: number; // HD derivation coin type (60 for ETH)
hd_path: string; // e.g. "m/44'/60'/0'/0/0"
key_algorithm: KeyAlgorithm; // "EthSecp256k1" or "Secp256k1"
rpc_endpoints: RpcEndpoints; // All four endpoint types
explorer: ExplorerConfig | null;
gas_config: GasConfig;
staking: StakingConfig;
features: string[];
source: ChainSource;
testnet: boolean;
}
CosmosChainConfig
For standard Cosmos SDK chains (Cosmos Hub, Osmosis).
interface CosmosChainConfig {
id: string; // e.g. "cosmos-hub"
chain_name: string; // e.g. "Cosmos Hub"
chain_type: "Cosmos";
cosmos_chain_id: string; // e.g. "cosmoshub-4"
bech32_prefix: string; // e.g. "cosmos"
denom: DenomConfig;
coin_type: number; // 118 for ATOM
hd_path: string; // e.g. "m/44'/118'/0'/0/0"
key_algorithm: KeyAlgorithm; // "Secp256k1"
rpc_endpoints: Pick<RpcEndpoints, "cosmos_rpc" | "cosmos_rest">;
explorer: ExplorerConfig | null;
gas_config: GasConfig;
staking: StakingConfig;
features: string[];
source: ChainSource;
testnet: boolean;
}
Supporting Types
type ChainType = "Evm" | "CosmosEvm" | "Cosmos";
type ChainSource = "BuiltIn" | "Registry" | "Custom";
type KeyAlgorithm = "EthSecp256k1" | "Secp256k1";
interface RpcEndpoints {
evm_rpc: string[];
evm_ws: string[];
cosmos_rpc: string[];
cosmos_rest: string[];
}
interface ExplorerConfig {
name: string;
tx_url: string; // Template with {hash} placeholder
address_url: string; // Template with {address} placeholder
}
interface DenomConfig {
base: string; // e.g. "alyth", "usei", "wei"
display: string; // e.g. "LYTH", "SEI", "AVAX"
decimals: number;
}
interface GasConfig {
default_gas_limit: number;
min_gas_price: string;
}
interface StakingConfig {
unbonding_days: number;
max_validators: number;
}
Supported Chains
| Chain | ID | Type | EVM Chain ID | Cosmos Chain ID | Testnet |
|---|---|---|---|---|---|
| Sprintnet | monolythium-sprintnet | CosmosEvm | 262146 | mono-sprint-1 | Yes |
| Testnet | monolythium-testnet | CosmosEvm | 6940 | mono_6940-1 | Yes |
| Avalanche | avalanche | Evm | 43114 | -- | No |
| Avalanche Fuji | avalanche-fuji | Evm | 43113 | -- | Yes |
| Linea | linea | Evm | 59144 | -- | No |
| Linea Sepolia | linea-sepolia | Evm | 59141 | -- | Yes |
| Sei | sei | CosmosEvm | 1329 | pacific-1 | No |
| Sei Testnet | sei-testnet | CosmosEvm | 1328 | atlantic-2 | Yes |
| Cronos | cronos | CosmosEvm | 25 | cronosmainnet_25-1 | No |
| Cronos Testnet | cronos-testnet | CosmosEvm | 338 | cronostestnet_338-3 | Yes |
| Kava | kava | CosmosEvm | 2222 | kava_2222-10 | No |
| Kava Testnet | kava-testnet | CosmosEvm | 2221 | kava_2221-16000 | Yes |
| Injective | injective | CosmosEvm | 1776 | injective-1 | No |
| Injective Testnet | injective-testnet | CosmosEvm | 1439 | injective-888 | Yes |
| Cosmos Hub | cosmos-hub | Cosmos | -- | cosmoshub-4 | No |
| Osmosis | osmosis | Cosmos | -- | osmosis-1 | No |
Usage Examples
Get RPC URL for a Chain
import { getChainByEvmId } from "@monolythium/chain-registry";
const chain = getChainByEvmId(262146);
if (chain && (chain.chain_type === "Evm" || chain.chain_type === "CosmosEvm")) {
const rpcUrl = chain.rpc_endpoints.evm_rpc[0];
console.log(rpcUrl); // "https://evm.sprintnet.mononodes.xyz"
}
Build Explorer Links
import { getChain } from "@monolythium/chain-registry";
const chain = getChain("sei");
if (chain?.explorer) {
const txUrl = chain.explorer.tx_url.replace("{hash}", "0xabc...");
const addrUrl = chain.explorer.address_url.replace("{address}", "0xdef...");
}
Filter Chains by Feature
import { allChains } from "@monolythium/chain-registry";
const stakingChains = allChains().filter((c) => c.features.includes("staking"));
const ibcChains = allChains().filter((c) => c.features.includes("ibc"));
Use with viem
import { getChainByEvmId } from "@monolythium/chain-registry";
import { createPublicClient, http, defineChain } from "viem";
const config = getChainByEvmId(262146);
if (config && config.chain_type === "CosmosEvm") {
const chain = defineChain({
id: config.evm_chain_id,
name: config.chain_name,
nativeCurrency: {
decimals: config.denom.decimals,
name: config.denom.display,
symbol: config.denom.display,
},
rpcUrls: {
default: { http: config.rpc_endpoints.evm_rpc },
},
});
const client = createPublicClient({ chain, transport: http() });
}