@bitgo/statics

中文文档
59.29.0发布于 2026/11/06Apache-2.0TypeScriptCommonJS零依赖构建来源已验证近 30 天下载 10.8万

dependency-free static configuration for the bitgo platform

原始使用文档
文档目录10 节
  1. Static config for the BitGo platform
  2. Goals
  3. Examples
  4. Get the number of decimal places in a Bitcoin
  5. Get the contract address for the OmiseGo ERC20 Token
  6. List full names of all defined coins
  7. Repo Status
  8. Project Structure
  9. Installation + Building
  10. Tests

@bitgo/statics

Static config for the BitGo platform

Goals

  • Provide an "encyclopedia" of all relevant constants which are sprinkled throughout the BitGo stack.
  • Separate static config data from dynamic config data
  • Strong typing for static config properties, with full type information for configuration items
  • Ability to export static configuration as JSON for consumption by non-javascript projects

Examples

Get the number of decimal places in a Bitcoin

JavaScript

const { coins } = require('@bitgo/statics');

const btc = coins.get('btc');
console.log(btc.decimalPlaces);

TypeScript

import { coins } from '@bitgo/statics';

const btc = coins.get('btc');
console.log(btc.decimalPlaces);

Get the contract address for the OmiseGo ERC20 Token

JavaScript

const { coins } = require('@bitgo/statics');

const omg = coins.get('omg');
console.log(omg.contractAddress);

TypeScript

import { coins, Erc20Coin } from '@bitgo/statics';

const omg = coins.get('omg');
if (omg instanceof Erc20Coin) {
  console.log(omg.contractAddress);
}

List full names of all defined coins

JavaScript

const { coins } = require('@bitgo/statics');

coins.forEach((coin) => {
  console.log(coin.fullName);
});

TypeScript

import { coins } from '@bitgo/statics';

coins.forEach((coin) => {
  console.log(coin.fullName);
});

Repo Status

  • UTXO and account base types are defined
  • Documentation is mostly source code comments and README examples
  • This library can be depended on, but expect some changes going forward

Project Structure

  • src/base.ts: Interfaces and enums used by coin implementation classes.
  • src/coins.ts: Coin definitions.
  • src/networks.ts: Network interfaces and implementation classes.
  • src/utxo.ts: Unspent Transaction Output (UTXO) based coin classes and factory function.
  • src/account.ts: Account-based coin classes and factory methods. Includes ERC20 factory functions.
  • src/errors.ts: Custom Error classes.

Installation + Building

To install the project locally, run the following steps:

$ # clone the project locally
$ git clone [email protected]:BitGo/statics.git

$ # npm install dependencies (optionally use node >8.6.0)
$ # (optionally) nvm install 8.6.0 -- required to run the linter which is executed pre-commit
$ # (optionally) nvm use 8.6.0
$ npm install

To build the project (from TypeScript to JavaScript):

$ npm run build

This builds the JavaScript and adds it to dist/src/. You will receive compilation errors if you have invalid syntax.

Tests

To run tests:

$ npm run test

版本与发布记录

@bitgo/statics 共发布 547 个版本,首次发布于 2019/05/22;过去 12 个月发布了 77 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
59.29.0latest2026/11/062 天前
59.28.02026/11/044 天前
59.27.02026/10/309 天前
59.26.02026/10/2711 天前
59.25.02026/10/2316 天前
59.24.02026/10/2118 天前

其他发布通道:alpha → 3.4.5-alpha.0,hbar → 5.1.1-hbar.0,node12 → 6.15.1-node12.2,dev → 6.18.0-dev.0,rc → 8.0.0-rc.23。

关于 @bitgo/statics 的常见问题

@bitgo/statics 是什么?

dependency-free static configuration for the bitgo platform

如何安装 @bitgo/statics?

在项目目录运行 npm install @bitgo/statics,或使用 pnpm add / yarn add / bun add。

@bitgo/statics 支持 TypeScript 吗?

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

@bitgo/statics 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@bitgo/statics 可以商用吗?

@bitgo/statics 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@bitgo/statics 的下载量有多少?

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

@bitgo/statics 还在维护吗?

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