# @chainlink/external-adapter-framework 中文文档

规范地址：https://npmcn.com/package/%40chainlink/external-adapter-framework/

版本：2\.20\.0
npm 元数据更新时间：2026-09-16T23:42:20.544Z
中文译文更新时间：2026-11-09T09:46:26.211Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40chainlink/external-adapter-framework
原文对照：https://npmcn.com/package/%40chainlink/external-adapter-framework/?lang=original
项目主页：https://github.com/smartcontractkit/ea-framework-js#readme
源码仓库：https://github.com/smartcontractkit/ea-framework-js

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：28.7 MB，6836 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- 运行依赖：14 个
- 首次发布：2022-09-01T22:57:37.980Z
- 最新版本发布：2026-09-16T23:42:20.220Z
- 近 30 天下载量：3467（2026-10-10 至 2026-11-08，npm 官方下载统计）
- 已发布版本数：236（近 12 个月 30 个）

## 中文简介

[![NPM version](https://img.shields.io/npm/v/@chainlink/external-adapter-framework.svg?style=flat)](https://www.npmjs.com/package/@chainlink/external-adapter-framework) ![Coverage](https://img.shields.io/badge/coverage-98.84%25-green)

## 安装

```sh
npm install @chainlink/external-adapter-framework
```

也可以使用：`pnpm add @chainlink/external-adapter-framework`、`yarn add @chainlink/external-adapter-framework`、`bun add @chainlink/external-adapter-framework`

## README

# EA 框架 v3

[![NPM version](https://img.shields.io/npm/v/@chainlink/external-adapter-framework.svg?style=flat)](https://www.npmjs.com/package/@chainlink/external-adapter-framework) ![Coverage](https://img.shields.io/badge/coverage-98.84%25-green)

创建外部适配器的框架,微服务作为中间软件来方便链路节点和数据提供者(DP)之间的连接.

## 所需资源

-   节点.js 22+
-   雅伦

### 可选开发工具

如果有的话,请考虑建立下列发展环境:

-   ESLint 语录
-   高级

注意上述两种都没有必要,但提交给repo的公关将会被阻止合并,除非它们遵守了林入和格式化规则.

## 设置

```sh
yarn # Install yarn dependencies
```

## 指南和文档

-   [基本情况](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs/basics.md)
-   构成部分
    -   [适配器](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs/components/adapter.md)
    -   [终点](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs/components/endpoints.md)
    -   [测试](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs/components/tests.md)
    -   [运输](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs/components/transports.md)
    -   运输类型
        -   [HTTP 密码](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs/components/transport-types/http-transport.md)
        -   [网络安全套](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs/components/transport-types/websocket-transport.md)
        -   [证监会](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs/components/transport-types/sse-transport.md)
        -   [订阅](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs/components/transport-types/subscription-transport.md)
        -   [流线](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs/components/transport-types/streaming-transport.md)
        -   [自定义](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs/components/transport-types/custom-transport.md)
        -   [复合](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs/components/transport-types/composite-transport.md)
-   指南
    -   [将 v2 EA 移植到 v3](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs/guides/porting-a-v2-ea-to-v3.md)
    -   [创建新 v3 EA](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs/guides/creating-a-new-v3-ea.md)
-   参考表格
    -   [EA 设置](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs//reference-tables/ea-settings.md)
    -   [计量](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs/reference-tables/metrics.md)

## 测试

EA框架通过一套集成测试进行测试 [这里](https://npmcn.com/package/%40chainlink/external-adapter-framework/test)。 。 。 .

```
yarn test
```

## 新闻稿

### 自动

发布发行版的正常流程是通过一个系列o GitHub动作,当PR通过与基分支合并而关闭后会被触发. 关于我们工作流程的全部细节,请参见: [文档](https://npmcn.com/package/%40chainlink/external-adapter-framework/docs/github_workflows.md)19\. 我们出版工作流程摘要如下:

1.  关闭包含您更改的 PR
2.  如果 PR 被合并, 如果它包含一个版本标签指示( patch, 次要, major, 无) , 则将创建一个包含运行结果的新 PR `npm version LABEL` 主要与原PR作者指定为审查员.
3.  与新创建的版本凸起 PR 的链接将添加到您的原始 PR 中 。 点击该链接,批准将其合并.
4.  关闭该版本的凸起 PR 。 如果合并,软件包将会被发布到npm.
5.  发布工作流程完成后, 将会在 shum PR 版本中添加一个注释, 说明它是否成功运行

这增加了一个额外的步骤(批准一个版本的凸起PR),每次合并一个PR时都必须采取. 这很烦人,但它是针对受保护分支运行时权限问题的有效绕行,并消除了公关作者通过提及主机手动更新其分支版本的必要性.

## 常见问题

### 如何安装 @chainlink/external-adapter-framework？

在项目目录运行 npm install @chainlink/external-adapter-framework，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 create-external-adapter，可以用 npx create-external-adapter 直接运行。

### @chainlink/external-adapter-framework 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/chainlink\_\_external-adapter-framework 是否存在。

### @chainlink/external-adapter-framework 支持 ESM 还是 CommonJS？

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

### @chainlink/external-adapter-framework 可以商用吗？

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

### @chainlink/external-adapter-framework 的下载量有多少？

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

### @chainlink/external-adapter-framework 还在维护吗？

最新版本 2\.20\.0 发布于 2026/09/17（1 个月前）；至今共发布 236 个版本，其中过去 12 个月发布了 30 个；首次发布于 2022/09/02。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

