@dashevo/dapi-client

中文文档
5.0.3发布于 2026/11/04MITCommonJS近 30 天下载 4829

Client library used to access Dash DAPI endpoints

原始使用文档
文档目录10 节
  1. Table of Contents
  2. Install
  3. Usage
  4. Basic
  5. Custom seed node
  6. Custom addresses
  7. Command specific options
  8. Documentation
  9. Contributing
  10. License

DAPI Client

NPM Version Build Status Release Date standard-readme compliant

Client library used to access Dash DAPI endpoints

This library enables HTTP-based interaction with the Dash blockchain and Dash Platform via the decentralized API (DAPI) hosted on Dash masternodes.

  • DAPI-Client provides automatic server (masternode) discovery using either a default seed node or a user-supplied one
  • DAPI-Client maps to DAPI's RPC and gRPC endpoints

Table of Contents

Install

npm install @dashevo/dapi-client

Usage

Basic

const DAPIClient = require('@dashevo/dapi-client');
const client = new DAPIClient();

client.core.getStatus().then((coreStatus) => {
  console.dir(coreStatus);
});

Custom seed node

Custom seed nodes are necessary for connecting the client to devnets since the client library is unaware of them otherwise.

const DAPIClient = require('@dashevo/dapi-client');

var client = new DAPIClient({
  seeds: [{
     host: 'seed-1.evonet.networks.dash.org',
     port: 443,
  }],
});

client.core.getBestBlockHash().then((r) => {
  console.log(r);
});

Note: The seed node shown above (seed-1.evonet.networks.dash.org) is for the Dash Evonet testing network.

Custom addresses

Custom addresses may be directly specified in cases where it is beneficial to know exactly what node(s) are being accessed (e.g. debugging, local development, etc.).

const DAPIClient = require('@dashevo/dapi-client');

var client = new DAPIClient({
  dapiAddresses: [
    '127.0.0.1:443',
    '127.0.0.2:443',
  ],
});

client.core.getBestBlockHash().then((r) => {
  console.log(r);
});

Command specific options

DAPI Client options can be passed directly to any command to override any predefined client options and modify the client's behavior for that specific call.

const DAPIClient = require('@dashevo/dapi-client');

// Set options to direct the request to a specific address and disable retries
const options = {
  dapiAddresses: ['127.0.0.1'],
  retries: 0,
};

client.core.getBestBlockHash(options).then((r) => {
  console.log(r);
});

Documentation

More extensive documentation available at https://dashpay.github.io/platform/DAPI-Client/.

Contributing

Feel free to dive in! Open an issue or submit PRs.

License

MIT © Dash Core Group, Inc.

版本与发布记录

@dashevo/dapi-client 共发布 518 个版本,首次发布于 2019/03/25;过去 12 个月发布了 72 个版本。

版本发布日期距今
5.0.3latest2026/11/047 天前
5.0.22026/11/029 天前
5.0.12026/10/2714 天前
5.0.02026/10/2715 天前
5.0.0-rc.82026/10/2319 天前
5.0.0-rc.72026/10/2220 天前

其他发布通道:dev → 0.12.0-dev.1,0.13-dev → 0.13.0-dev.3,0.14-dev → 0.14.0-dev.8,0.15-dev → 0.15.0-dev.6,0.16-dev → 0.16.0-dev.8,0.17-dev → 0.17.0-dev.5。

关于 @dashevo/dapi-client 的常见问题

@dashevo/dapi-client 是什么?

Client library used to access Dash DAPI endpoints

如何安装 @dashevo/dapi-client?

在项目目录运行 npm install @dashevo/dapi-client,或使用 pnpm add / yarn add / bun add。

@dashevo/dapi-client 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/dashevo__dapi-client 是否存在。

@dashevo/dapi-client 支持 ESM 还是 CommonJS?

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

@dashevo/dapi-client 需要什么版本的 Node.js?

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

@dashevo/dapi-client 可以商用吗?

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

@dashevo/dapi-client 的下载量有多少?

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

@dashevo/dapi-client 还在维护吗?

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