@dydxprotocol/v4-client-js

中文文档
3.6.0发布于 2026/03/05AGPL-3.0TypeScriptESM + CJS构建来源已验证近 30 天下载 29.6万

General client library for the new dYdX system (v4 decentralized)

原始使用文档
文档目录6 节
  1. Development
  2. 1. Clone or fork the V4 clients repo
  3. 2. Go to one of the examples
  4. 3. Run the scripts with node
  5. Single-JS for mobile apps
  6. Release

dYdX Chain Client for Javascript

The v4-Client Typescript client is used for placing transactions and querying the dYdX chain.

Development

v4-client-js uses node v18 for development, see the .nvmrc file here. You can use nvm to manage different versions of node.

nvm install
nvm use
nvm alias default $(nvm version) # optional

You can run the following commands to ensure that you are running the correct node and npm versions.

node -v # expected: v20.x.x (should match .nvmrc)
npm -v  # expected: 10.x.x

1. Clone or fork the V4 clients repo

git clone [email protected]:dydxprotocol/v4-clients.git

2. Go to one of the examples

  • Go to v4-client-js/examples
cd v4-client-js/examples

These examples by default use a test account with DYDX_TEST_MNEMONIC from the TS client library under v4-client-js/examples/constants, but you can use any test address that you own.

3. Run the scripts with node

npm install
npm run build

You should now see a /build/examples dir generated with JS files. We will use node to run these scripts

  • Open a terminal to run an example, e.g. account_endpoints.
node ../build/examples/composite_example.js

Everytime you change the TS code, you need to run npm run build again, before you execute using node.

Single-JS for mobile apps

Mobile apps needs to load JS as a single JS file. To build, run

npm run webpack

The file is generated in native/ios/v4-native-client.js Pending: Different configurations may be needed to generate JS for Android app

Release

Using the npm version command will update the appropriate version tags within the package locks and also will add a git tag with the version number.. For example npm version minor will perform the necessary changes for a minor version release. After the change is merged, a GitHub action will publish the new release.

版本与发布记录

@dydxprotocol/v4-client-js 共发布 167 个版本,首次发布于 2023/08/23;过去 12 个月发布了 9 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.6.0latest2026/03/058 个月前
3.5.02026/02/248 个月前
3.4.12026/01/279 个月前
1.22.12026/01/279 个月前
1.15.22026/01/279 个月前
1.0.312026/01/279 个月前

其他发布通道:test-release → 1.3.16。

关于 @dydxprotocol/v4-client-js 的常见问题

@dydxprotocol/v4-client-js 是什么?

General client library for the new dYdX system (v4 decentralized)

如何安装 @dydxprotocol/v4-client-js?

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

@dydxprotocol/v4-client-js 支持 TypeScript 吗?

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

@dydxprotocol/v4-client-js 支持 ESM 还是 CommonJS?

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

@dydxprotocol/v4-client-js 可以商用吗?

@dydxprotocol/v4-client-js 使用 AGPL-3.0 许可。最严格的 Copyleft:除分发外,通过网络向用户提供基于它的服务也需要开源对应源码。闭源 SaaS 使用前务必评估。以上为概括,不构成法律意见,请以许可原文为准。

@dydxprotocol/v4-client-js 的下载量有多少?

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

@dydxprotocol/v4-client-js 还在维护吗?

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