@avaprotocol/types

中文文档
5.2.4发布于 2026/11/07Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 1729

Type definitions for Ava Protocol's AVS REST API (v4) — generated from api/openapi.yaml.

原始使用文档
文档目录5 节
  1. Installation
  2. Getting Started
  3. Contributing
  4. License
  5. Workflow write outcomes (REST v4)

Ava SDK for JavaScript/TypeScript

@avaprotocol/types is the TypeScript types for the @avaprotocol/sdk-js library and is intended to be used on the client side of a web app to interpret data.

Installation

To install @avaprotocol/types, run the following command:

npm install @avaprotocol/types

Or with Yarn:

yarn add @avaprotocol/types

Getting Started

Here’s a quick example of how to use the types library to get started with Ava Protocol:

import { ExecutionErrorCode, type ExecutionStep } from "@avaprotocol/types";

function needsConfirmationCheck(step: ExecutionStep): boolean {
  return step.errorCode === ExecutionErrorCode.USER_OP_CONFIRMATION_UNRESOLVED;
}

Contributing

We welcome contributions! Feel free to submit pull requests or open issues for any bugs or feature requests.

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for more details.

Workflow write outcomes (REST v4)

ExecutionStep.errorCode is an open string. ExecutionErrorCode exports these known values; the numbers in parentheses are the gateway's protobuf values, not the strings returned over REST:

  • USER_OP_CONFIRMATION_UNRESOLVED (4006): submitted, outcome unknown. Check the stored userOpHash before retrying; a failed workflow does not prove no funds moved.
  • USER_OP_EXECUTION_REVERTED (4007): confirmed UserOperation or outer transaction revert.
  • WRITE_PREREQUISITE_FAILED (4008): this dependent write was never submitted.

Metadata has four shapes, selected by node type and outcome:

Stepmetadata shapeRelevant fields
Native transferFlat objectuserOpHash, transactionHash, receiptStatus (pending, confirmed, failed), optional revertData
Contract write{ results: [...] }Each method retains methodName, success, error, and receipt with operation/transaction hashes, status, executionStatus, optional revertData
Write loop{ confirmationOutcomes: [...] } when an iteration has a confirmation failureEach outcome has id, error, errorCode, and its original metadata; contract iteration metadata is the internal results array, native metadata is flat. Other loop metadata may coexist.
Skipped write{ skipped: true, prerequisiteNodeId, prerequisiteError }No transaction or gas was submitted for this step; the original prerequisite retains its receipt.

For contract writes, receipt.status describes the outer Ethereum transaction. An inner UserOperation can revert while the outer receipt has status: "0x1". Use step success, errorCode, and receipt executionStatus to determine whether that action succeeded. Pending hashes stay available after an unresolved outcome. Gas totals (gasUsed, gasPrice, totalGasCost) are top-level execution-step fields when available; contract receipt metadata does not flatten these fields. Reports and independent branches continue after a skipped write.

版本与发布记录

@avaprotocol/types 共发布 108 个版本,首次发布于 2025/01/05;过去 12 个月发布了 31 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
5.2.4latest2026/11/073 天前
5.2.32026/11/063 天前
5.2.22026/11/054 天前
5.2.12026/11/045 天前
5.2.02026/11/045 天前
5.1.02026/10/2713 天前

其他发布通道:dev → 4.0.0-dev.0。

关于 @avaprotocol/types 的常见问题

@avaprotocol/types 是什么?

Type definitions for Ava Protocol's AVS REST API (v4) — generated from api/openapi.yaml.

如何安装 @avaprotocol/types?

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

@avaprotocol/types 支持 TypeScript 吗?

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

@avaprotocol/types 支持 ESM 还是 CommonJS?

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

@avaprotocol/types 需要什么版本的 Node.js?

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

@avaprotocol/types 可以商用吗?

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

@avaprotocol/types 的下载量有多少?

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

@avaprotocol/types 还在维护吗?

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