@celo/contractkit

中文文档
11.0.0发布于 2026/06/16Apache-2.0TypeScriptCommonJS构建来源已验证近 30 天下载 2.9万

Celo's ContractKit to interact with Celo network

原始使用文档
文档目录7 节
  1. User Guide
  2. Getting Started
  3. Examples
  4. Show locked Celo balance for account
  5. More Information
  6. How we work
  7. Debugging

ContractKit

Celo's ContractKit is a library to help developers and validators to interact with the Celo blockchain.

ContractKit supports the following functionality:

  • Interact with json RPC API
  • Send Transaction with celo's extra fields: (feeCurrency)
  • Build apps to interact with governance and staking

User Guide

[!TIP] You might not need the ContractKit. For new projects we recommened viem or web3 optionally with our celo plugin.

Getting Started

To install you will need Node.js v18.14.2. or greater. v20 reccomended.

npm install @celo/contractkit
// or
yarn add @celo/contractkit

Examples

To start working with contractkit you need a kit instance:

import { newKit } from '@celo/contractkit' // or import { newKit } from '@celo/contractkit/lib/mini-kit'

const kit = newKit("https://forno.celo-sepolia.celo-testnet.org")

List Registered ValidatorGroups


const validatorsContractWrapper = await kit.contracts.getValidators()
const validatorGroups = await validatorsContractWrapper.getRegisteredValidatorGroups()

Show locked Celo balance for account

const lockedGoldContractWrapper = await kit.contracts.getLockedGold()

const accountAddress = kit.defaultAccount 
const summary = lockedGoldContractWrapper.getAccountSummary(accountAddress!)

More Information

You can find more information about the ContractKit in the Celo docs at https://docs.celo.org/developer-guide/contractkit.

How we work

We are a GitHub-first team, which means we have a strong preference for communicating via GitHub. Please use GitHub to:

🐞 File a bug report

💬 Ask a question

✨ Suggest a feature

🧑‍💻 Contribute!

🚔 Report a security vulnerability

[!TIP]

Please avoid messaging us via Slack, Telegram, or email. We are more likely to respond to you on GitHub than if you message us anywhere else. We actively monitor GitHub, and will get back to you shortly 🌟

Debugging

If you need to debug kit, we use the well known debug node library.

So set the environment variable DEBUG as:

DEBUG="kit:*,

版本与发布记录

@celo/contractkit 共发布 203 个版本,首次发布于 2019/07/10;过去 12 个月发布了 2 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
11.0.0latest2026/06/164 个月前
10.0.32026/01/0710 个月前
10.0.22025/10/211.1 年前
10.0.2-alpha.02025/10/131.1 年前
10.0.12025/08/291.2 年前
10.0.1-beta.12025/08/061.3 年前

其他发布通道:3c1fe1b → 0.1.2,6a8986e7d204203057229d55677d2a224359a481 → 0.2.9,18336d1b986cdfd4b35ec0220e12e995aff85ca0 → 0.2.10-beta1,3dacf31ed5ee05e2e6e7e83e3732279b718a37aa → 0.2.10,13b56152faf0ec092da2f186c28a331c39e1b17f → 0.2.11-baklava2,34bb7ca7ad925ad83dbaa368da636e129e376a1d → 0.3.4。

关于 @celo/contractkit 的常见问题

@celo/contractkit 是什么?

Celo's ContractKit to interact with Celo network

如何安装 @celo/contractkit?

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

@celo/contractkit 支持 TypeScript 吗?

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

@celo/contractkit 支持 ESM 还是 CommonJS?

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

@celo/contractkit 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@celo/contractkit 可以商用吗?

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

@celo/contractkit 的下载量有多少?

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

@celo/contractkit 还在维护吗?

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