@defisaver/automation-sdk

中文文档
3.3.25发布于 2026/11/05ISCTypeScriptESM + CJS构建来源已验证近 30 天下载 2727

Fetch strategies data from the blockchain, and parse it into a readable format. Use one of the following classes to fetch data for strategies: EthereumStrategies, OptimismStrategies, ArbitrumStrategies or BaseStrategies. Use one of the following classes t

原始使用文档
文档目录3 节
  1. Usage
  2. Development - How to add new strategies?
  3. Testing

SDK for fetching DeFi Saver strategies data from the blockchain.

Fetch strategies data from the blockchain, and parse it into a readable format. Use one of the following classes to fetch data for strategies: EthereumStrategies, OptimismStrategies, ArbitrumStrategies or BaseStrategies. Use one of the following classes to fetch data for legacy automation: LegacyMakerAutomation, LegacyAaveAutomation, or LegacyCompoundAutomation. Various services and constants also available for use.

Usage

const ethereumStrategies = new EthereumStrategies({
  provider: WEB3_PROVIDER_HERE,
});

const subscriptions = await ethereumStrategies.getSubscriptionsFor(
  // Pass one or multiple owner addresses, or use getSubscriptions method to fetch all subscriptions
  ['0x000000000000000000000000000000000000dEaD'],
  {
    fromBlock: 0,
    toBlock: 'latest',
    mergeSubs: true, // Used for merging subscriptions with same strategy ID (e.g. boost and repay)
    enabledOnly: true,
    unexpiredOnly: true, // Referring to exchange subscriptions
  }
);

// Do what you would like with subscriptions

Development - How to add new strategies?

  • Add strategy/bundle ID to ./src/types/enums.ts, and create Identifiers if needed
  • Add strategy/bundle info to ./src/constants/index.ts
  • Add encoding/decoding to the following files:
    • ./src/services/strategySubService.ts
    • ./src/services/subDataService.ts
    • ./src/services/triggerService.ts
  • Write parsing for the strategy in ./src/services/strategeiesService.ts and add assign it to const parsingMethodsMapping
  • Write tests for each method
  • Run tests with yarn test or yarn test fileName for a specific file (e.g. yarn test utils)
  • Congrats! 🥳

Testing

npm run test - Run all tests

npm run test-single --name=your_test_name - Run single test for specified name e.g. for MyTest.test.ts test name is MyTest

版本与发布记录

@defisaver/automation-sdk 共发布 201 个版本,首次发布于 2022/12/29;过去 12 个月发布了 70 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.3.25latest2026/11/056 天前
3.3.25-twap-close-devdev2026/10/2220 天前
3.3.242026/10/2220 天前
3.3.23-instant-twap-close-dev2026/10/2022 天前
3.3.232026/10/1527 天前
3.3.222026/10/1329 天前

其他发布通道:dev-morpho → 3.3.7-morpho-dev-2,dev → 3.3.25-twap-close-dev。

关于 @defisaver/automation-sdk 的常见问题

@defisaver/automation-sdk 是什么?

Fetch strategies data from the blockchain, and parse it into a readable format. Use one of the following classes to fetch data for strategies: EthereumStrategies, OptimismStrategies, ArbitrumStrategies or BaseStrategies. Use one of the following classes t

如何安装 @defisaver/automation-sdk?

在项目目录运行 npm install @defisaver/automation-sdk,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:web3(^1.10.2)、web3-eth-contract(^1.8.1)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@defisaver/automation-sdk 支持 TypeScript 吗?

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

@defisaver/automation-sdk 支持 ESM 还是 CommonJS?

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

@defisaver/automation-sdk 可以商用吗?

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

@defisaver/automation-sdk 的下载量有多少?

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

@defisaver/automation-sdk 还在维护吗?

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