SDK
WIP SDK for Balancer Protocol. Interfaces may have frequent breaking changes until a stable release.
Local Setup
pnpm install
Requirements
Polyfill
If your platform does not support one of the required features, it is also possible to import a polyfill.
Testing
pnpm test
Testing runs against a local anvil fork and requires the following RPC URL to be configured in your .env file:
ETHEREUM_RPC_URL
POLYGON_RPC_URL
FANTOM_RPC_URL
SEPOLIA_RPC_URL
Anvil Client
To download and install the anvil client, run the following commands (MacOS):
curl -L https://foundry.paradigm.xyz | bash
brew install libusb
source /Users/$(whoami)/.zshenv
foundryup
Documentation
In-depth documentation on this SDK is available at docs-v3.balancer.fi/developer-reference/sdk .
关于 @balancer/sdk 的常见问题@balancer/sdk 是什么? SDK for interacting with the Balancer protocol注意:该包已被作者标记为弃用——Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
如何安装 @balancer/sdk? 在项目目录运行 npm install @balancer/sdk,或使用 pnpm add / yarn add / bun add。
@balancer/sdk 支持 TypeScript 吗? 支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。
@balancer/sdk 支持 ESM 还是 CommonJS? 同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。
@balancer/sdk 需要什么版本的 Node.js? package.json 的 engines 字段要求 Node.js >=20.x。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。
@balancer/sdk 可以商用吗? @balancer/sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。
@balancer/sdk 的下载量有多少? 根据 npm 官方下载统计,@balancer/sdk 在 2026/10/08 – 2026/11/06 这 30 天内被下载 12,157 次,日均约 405 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。
@balancer/sdk 还在维护吗? 最新版本 6.2.1 发布于 2026/10/26(12 天前);至今共发布 136 个版本,其中过去 12 个月发布了 22 个;首次发布于 2023/04/08。作者已将其标记为弃用,新项目建议寻找替代方案。