@bosonprotocol/common

中文文档
1.35.0发布于 2026/09/09Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 7333

Common configs, types, interfaces and utilities shared by the core components of the Boson Protocol.

原始使用文档
文档目录5 节
  1. Install
  2. Usage
  3. ABIs
  4. Default configs
  5. Interfaces and types

@bosonprotocol/common

JS lib with common types, interfaces and utilities shared by the core components of the Boson Protocol.

Install

npm install @bosonprotocol/common

# OR

yarn add @bosonprotocol/common

Usage

ABIs

Useful ABIs can be imported.

import { abis } from "@bosonprotocol/common";

const { ProtocolDiamondABI } = abis;

Default configs

We provide default configurations for multiple environments that can be used for easier interaction.

import { getDefaultConfig } from "@bosonprotocol/common";

const defaultConfigOnRopsten = getDefaultConfig("staging");
// {
//   ...otherConfigParameters,
//   subgraphUrl: "https://api.thegraph.com/subgraphs/name/bosonprotocol/ccropsten",
//   contracts: {
//     protocolDiamond: "0x5E3f5127e320aD0C38a21970E327eefEf12561E5"
//   }
// }

Interfaces and types

Interfaces and types can also be imported. This might be useful for implementing custom a Web3LibAdapter or MetadataStorage.

import { Web3LibAdapter, MetadataStorage } from "@bosonprotocol/common";

class CustomWeb3LibAdapter implements Web3LibAdapter {
  // implementation
}

class CustomMetadataStorage implements MetadataStorage {
  // implementation
}

Web3LibAdapter

The core-sdk has the following features:

  • web3 lib agnostic
  • lightweight
  • consists of composable building blocks
  • leverages existing tools, such as TypeChain

To achieve these, we use an adapter pattern with Web3LibAdapter being the interface.

An example implementation is the EthersAdapter targeting the ethers library.

版本与发布记录

@bosonprotocol/common 共发布 617 个版本,首次发布于 2022/04/21;过去 12 个月发布了 24 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.35.0latest2026/09/091 个月前
1.35.0-alpha.1alpha2026/09/081 个月前
1.35.0-alpha.02026/09/082 个月前
1.34.02026/08/282 个月前
1.34.0-alpha.32026/08/272 个月前
1.34.0-alpha.22026/08/272 个月前

关于 @bosonprotocol/common 的常见问题

@bosonprotocol/common 是什么?

Common configs, types, interfaces and utilities shared by the core components of the Boson Protocol.

如何安装 @bosonprotocol/common?

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

@bosonprotocol/common 支持 TypeScript 吗?

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

@bosonprotocol/common 支持 ESM 还是 CommonJS?

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

@bosonprotocol/common 可以商用吗?

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

@bosonprotocol/common 的下载量有多少?

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

@bosonprotocol/common 还在维护吗?

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