@apibara/protocol

中文文档
2.1.3发布于 2026/05/12TypeScriptESM + CJS构建来源已验证近 30 天下载 3772

This package provides a gRPC client to interact with an Apibara streaming server.

原始使用文档
文档目录3 节
  1. Installation
  2. Usage
  3. License

@apibara/protocol

This package provides a gRPC client to interact with an Apibara streaming server.

Installation

npm add @apibara/protocol

Usage

The package exports a NodeClient used to interact with the server. The client has two methods:

  • status: returns the indexing status of the node.
  • streamMessages: returns a node.js Stream with the messages from the server.
import { NodeClient, credentials } from '@apibara/protocol'

async function main() {
  // create client connected to the StarkNet Goerli stream
  // the server uses ssl
  const node = new NodeClient(
    'goerli.starknet.stream.apibara.com:443',
    credentials.createSsl()
  )

  // check server status
  const status = await node.status()

  // stream all messages from the server
  // returns a promise resolved when it finishes
  // streaming from the server
  const messages = node.streamMessages()
  return new Promise((resolve, reject) => {
    messages.on('end', resolve)
    messages.on('error', reject)
    messages.on('data', (data) => {
      console.log(data)
    })
  })
}

License

Copyright 2022 GNC Labs Limited

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

版本与发布记录

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

版本发布日期距今
2.1.3latest2026/05/125 个月前
2.1.22026/05/046 个月前
2.1.12026/04/246 个月前
2.1.1-beta.02026/04/246 个月前
2.1.0-beta.60next2026/04/226 个月前
2.1.0-beta.592026/03/267 个月前

关于 @apibara/protocol 的常见问题

@apibara/protocol 是什么?

This package provides a gRPC client to interact with an Apibara streaming server.

如何安装 @apibara/protocol?

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

@apibara/protocol 支持 TypeScript 吗?

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

@apibara/protocol 支持 ESM 还是 CommonJS?

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

@apibara/protocol 可以商用吗?

@apibara/protocol 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@apibara/protocol 的下载量有多少?

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

@apibara/protocol 还在维护吗?

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