@across-protocol/sdk

中文文档
4.4.25发布于 2026/11/07AGPL-3.0TypeScriptESM + CJS近 30 天下载 1.6万

Across is a system that quickly moves tokens across chains. This repository contains shareable code and libraries for Across.

原始使用文档
文档目录15 节
  1. Modules
  2. TSDX User Guide
  3. Commands
  4. Configuration
  5. Jest
  6. Bundle Analysis
  7. Rollup
  8. TypeScript
  9. Continuous Integration
  10. GitHub Actions
  11. Optimizations
  12. Module Formats
  13. Named Exports
  14. Including Styles
  15. Publishing a new version

Across SDK

Across is a system that quickly moves tokens across chains. This repository contains shareable code and libraries for Across.

Modules

NameDescriptionREADMESource Code
LP Fee CalculatorCalculate LP fee for transfersREADMESource Code
Merkle DistributorACX token distributionREADMESource Code

TSDX User Guide

This project was bootstrapped with tsdx. Read below for more instructions or check out the repository

Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.

This TSDX setup is meant for developing libraries (not apps!) that can be published to NPM. If you’re looking to build a Node app, you could use ts-node-dev, plain ts-node, or simple tsc.

If you’re new to TypeScript, checkout this handy cheatsheet

Commands

TSDX scaffolds your new library inside /src.

To run TSDX, use:

npm start # or yarn start

This builds to /dist and runs the project in watch mode so any edits you save inside src causes a rebuild to /dist.

To do a one-off build, use npm run build or yarn build.

To run tests, use npm test or yarn test.

Configuration

Code quality is set up for you with prettier, husky, and lint-staged. Adjust the respective fields in package.json accordingly.

Jest

Jest tests are set up to run with npm test or yarn test.

Bundle Analysis

size-limit is set up to calculate the real cost of your library with npm run size and visualize the bundle with npm run analyze.

Setup Files

This is the folder structure we set up for you:

/src
  index.tsx       # EDIT THIS
/test
  blah.test.tsx   # EDIT THIS
.gitignore
package.json
README.md         # EDIT THIS
tsconfig.json

Rollup

TSDX uses Rollup as a bundler and generates multiple rollup configs for various module formats and build settings. See Optimizations for details.

TypeScript

tsconfig.json is set up to interpret dom and esnext types, as well as react for jsx. Adjust according to your needs.

Continuous Integration

GitHub Actions

Two actions are added by default:

  • main which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
  • size which comments cost comparison of your library on every pull request using size-limit

Optimizations

Please see the main tsdx optimizations docs. In particular, know that you can take advantage of development-only optimizations:

// ./types/index.d.ts
declare var __DEV__: boolean;

// inside your code...
if (__DEV__) {
  console.log('foo');
}

You can also choose to install and use invariant and warning functions.

Module Formats

CJS, ESModules, and UMD module formats are supported.

The appropriate paths are configured in package.json and dist/index.js accordingly. Please report if any issues are found.

Named Exports

Per Palmer Group guidelines, always use named exports. Code split inside your React app instead of your React library.

Including Styles

There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.

For vanilla CSS, you can include it at the root directory and add it to the files section in your package.json, so that it can be imported separately by your users and run through their bundler's loader.

Publishing a new version

  1. Bump version in package.json and merge to master. Example: https://github.com/across-protocol/sdk/pull/67
  2. Create a new release with a new tag (version number should be incremented): https://github.com/across-protocol/sdk/releases
  3. Update any upstream repos/binaries that depend on the sdk such as https://github.com/across-protocol/frontend. Example: https://github.com/across-protocol/frontend/pull/202

版本与发布记录

@across-protocol/sdk 共发布 549 个版本,首次发布于 2024/05/31;过去 12 个月发布了 183 个版本。

版本发布日期距今
4.4.25latest2026/11/071 天前
5.0.0-svm-clients.4svm-clients2026/11/053 天前
4.4.242026/11/043 天前
5.0.0-svm-clients.32026/11/043 天前
4.4.232026/11/043 天前
5.0.0-svm-clients.22026/10/2711 天前

其他发布通道:hotfix → 4.1.32-hotfix.1,beta → 4.3.165-beta.1,alpha → 4.4.19-alpha.0,svm-clients → 5.0.0-svm-clients.4。

关于 @across-protocol/sdk 的常见问题

@across-protocol/sdk 是什么?

Across is a system that quickly moves tokens across chains. This repository contains shareable code and libraries for Across.

如何安装 @across-protocol/sdk?

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

@across-protocol/sdk 支持 TypeScript 吗?

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

@across-protocol/sdk 支持 ESM 还是 CommonJS?

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

@across-protocol/sdk 需要什么版本的 Node.js?

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

@across-protocol/sdk 可以商用吗?

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

@across-protocol/sdk 的下载量有多少?

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

@across-protocol/sdk 还在维护吗?

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