哲学
本单元是对公共链条目录的不表示:
上游列表中的每个链都导出为冠名 eip155_<chainId> (每个链条一个文件). 与相机对等 encode_chain_id 从 @ethernauta/transport 生成一个 CAIP-2 联合国 每个以太上纳乌塔溶液厂都接受.
一个小的衍生工具—— runIndexer ——从上游仓库刷新目录.
模块
- 阿比比语 [国家预防机制[ . ]
- 链式 [国家预防机制[ . ]
- 语气 [国家预防机制[ . ]
- 核心项目 [国家预防机制[ . ]
- 密码 [国家预防机制[ . ]
- 叶 [国家预防机制[ . ]
- 单位 [国家预防机制[ . ]
- 埃尔克 [国家预防机制[ . ]
- 特尔 [国家预防机制[ . ]
- 反应 [国家预防机制[ . ]
- 交易 [国家预防机制[ . ]
- 运输 [国家预防机制[ . ]
- 倾斜 [国家预防机制[ . ]
- 钱包
API 密码
链轴-每条EIP-155链1个
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, … }
用 CAIP-2 代号对一链
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"
示马斯
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.
刷新目录
pnpm --filter @ethernauta/chain indexer
这个 indexer 脚本从 电子列表/链,每个对照 ChainSchema,然后每条链条写一个 TS 文件 src/chain/eip155/。 。 。 .