@chainlink/ccip-read-server

中文文档
0.2.1发布于 2022/01/28MITTypeScriptESM + CJS近 30 天下载 5346

Server framework for ccip-read, a secure protocol for offchain data retrieval

原始使用文档

CCIP-read server framework

This package implements a straightforward server framework for creating CCIP-read gateway servers.

A CCIP-read gateway server accepts ABI-encoded function calls and responds to them in the same manner as a smart contract, but has access to any external resources it needs. Onchain contracts implementing CCIP-read can request that the client send a query to a gateway server and supply the results back to the contract in a subsequent call.

Typical usage would be a gateway server providing data from a database of some kind, alongside signatures or merkle proofs allowing the calling contract to verify the data's authenticity. With this model, contracts can effectively request data from an external database as part of a contract call or transaction.

Example usage:

const ccipread = require('@chainlink/ccip-read-server');
const server = new ccipread.Server();
const abi = [
  'function getSignedBalance(address addr) public view returns(uint256 balance, bytes memory sig)',
];
server.add(abi, [
  {
    type: 'getSignedBalance',
    func: async (contractAddress, [addr]) => {
      const balance = getBalance(addr);
      const sig = signMessage([addr, balance]);
      return [balance, sig];
    }
  }
]);
const app = server.makeApp();
app.listen(8080);

版本与发布记录

@chainlink/ccip-read-server 共发布 3 个版本,首次发布于 2021/12/18;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.2.1latest2022/01/284 年前
0.2.02022/01/114 年前
0.1.02021/12/184 年前

关于 @chainlink/ccip-read-server 的常见问题

@chainlink/ccip-read-server 是什么?

Server framework for ccip-read, a secure protocol for offchain data retrieval

如何安装 @chainlink/ccip-read-server?

在项目目录运行 npm install @chainlink/ccip-read-server,或使用 pnpm add / yarn add / bun add。

@chainlink/ccip-read-server 支持 TypeScript 吗?

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

@chainlink/ccip-read-server 支持 ESM 还是 CommonJS?

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

@chainlink/ccip-read-server 需要什么版本的 Node.js?

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

@chainlink/ccip-read-server 可以商用吗?

@chainlink/ccip-read-server 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@chainlink/ccip-read-server 的下载量有多少?

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

@chainlink/ccip-read-server 还在维护吗?

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