@eternl/network-id

中文文档
0.55.0发布于 2026/11/10BUSL-1.1TypeScriptESM + CJS近 30 天下载 2605

Network identifiers and network-level metadata for Eternl packages

原始使用文档
文档目录6 节
  1. Install
  2. Usage
  3. Caller-supplied slot timelines
  4. Musashi development network
  5. Exports
  6. License

@eternl/network-id

Network identifiers and network-level metadata for Eternl packages.

Install

npm install @eternl/network-id

Usage

import {
  NETWORK_ID,
  type NetworkId,
  isSupportedNetworkId,
  isTestnetNetwork,
  getNetworkCurrencyCode
} from '@eternl/network-id'

const id: NetworkId = NETWORK_ID.MAINNET

if (isSupportedNetworkId(id)) {
  console.log(isTestnetNetwork(id))
  console.log(getNetworkCurrencyCode(id))
}

Caller-supplied slot timelines

@eternl/network-id/timeline provides createSlotTimeline for a caller's explicit era boundaries. It snapshots and freezes the supplied data, checks continuity, and rejects unsafe integers. It does not register networks or select endpoints.

import { createSlotTimeline } from '@eternl/network-id/timeline'

const timeline = createSlotTimeline([
  { firstSlot: 0, startTimeMs: Date.UTC(2026, 0, 1), slotLengthMs: 1000 }
])
const time = timeline.timestampAtSlot(42)
const firstSlot = timeline.slotAtOrAfter(time + 1) // 43

Times are nonnegative Unix milliseconds. slotAtOrAfter clamps timestamps before genesis to slot zero; it rounds up, so the inclusive last slot in [start, end) is slotAtOrAfter(end) - 1. Results beyond the safe integer range throw. The timeline utility does not change registered-network helpers or select frontend networks.

Musashi development network

NETWORK_ID.MUSASHI is the canonical musashi ID, with magic 164, testnet address bit 0 and genesis at 2026-10-18T00:00:00Z. Slots last one second and epochs contain 21,600 slots. Normal availability follows the backend's advertised network map. isDevelopmentNetwork is a descriptive classification, not an extra opt-in gate. Musashi has its own wallet/cache namespace.

@eternl/network-id/network/musashi/profile exports immutable MUSASHI genesis pins, decoder family and timeline. Current rc-2026w44 configuration retains those genesis bytes; decoderProfile is dijkstra. A future chain reset must change its pinned identity and rebuild affected state, without renaming the public network ID. See provenance.

This public package contains no API, explorer or faucet URLs. Feature availability belongs to @eternl/network-feature and the consuming application's host discovery.

Exports

  • NETWORK_ID
  • NetworkId
  • networkIdList
  • networkIdx
  • networkGroups
  • networkAddressPrefix
  • networkStakeAddressPrefix
  • networkCurrencyCode
  • networkCurrencySymbol
  • isSupportedNetworkId
  • getNetworkId
  • getNetworkDecimals
  • isTestnetNetwork
  • isDevelopmentNetwork
  • isCustomNetwork
  • getNetworkCurrencyCode
  • getNetworkCurrencySymbol

License

Business Source License 1.1 (BUSL-1.1).

Additional Use Grant: None. Commercial use requires a separate license from Tastenkunst. Contact: https://tastenkunst.com/

版本与发布记录

@eternl/network-id 共发布 105 个版本,首次发布于 2026/02/11;过去 12 个月发布了 105 个版本。

版本发布日期距今
0.55.0latest2026/11/103 天前
0.54.02026/11/103 天前
0.53.02026/11/103 天前
0.52.02026/11/103 天前
0.51.02026/11/104 天前
0.50.02026/11/094 天前

关于 @eternl/network-id 的常见问题

@eternl/network-id 是什么?

Network identifiers and network-level metadata for Eternl packages

如何安装 @eternl/network-id?

在项目目录运行 npm install @eternl/network-id,或使用 pnpm add / yarn add / bun add。

@eternl/network-id 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@eternl/network-id 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@eternl/network-id 可以商用吗?

@eternl/network-id 使用 BUSL-1.1 许可。声明的许可为 BUSL-1.1,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@eternl/network-id 的下载量有多少?

根据 npm 官方下载统计,@eternl/network-id 在 2026/10/14 – 2026/11/12 这 30 天内被下载 2,605 次,日均约 87 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@eternl/network-id 还在维护吗?

最新版本 0.55.0 发布于 2026/11/10(3 天前);至今共发布 105 个版本,其中过去 12 个月发布了 105 个;首次发布于 2026/02/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。