3.1.1 • Published 8 months ago

@defisaver/automation-sdk v3.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

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

3.1.1

8 months ago

3.0.9-dev

8 months ago

3.0.9

9 months ago

3.0.8

9 months ago

3.0.8-dev3

9 months ago

3.0.8-dev

9 months ago

3.0.8-dev2

9 months ago

3.0.2-dev2

9 months ago

3.0.7

12 months ago

3.0.6

1 year ago

3.0.5

1 year ago

3.0.4

1 year ago

3.0.3

1 year ago

3.0.2

1 year ago

3.0.2-dev

1 year ago

3.0.1

1 year ago

3.0.0

1 year ago

2.1.6

1 year ago

2.1.5

1 year ago

2.1.4

1 year ago

2.1.3

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.6

2 years ago

2.0.9

2 years ago

2.0.8

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.2.27

2 years ago

1.2.28

2 years ago

2.1.0

2 years ago

1.2.29

2 years ago

1.2.30

2 years ago

1.2.31

2 years ago

1.2.32

2 years ago

1.2.33

2 years ago

1.2.26

2 years ago

1.2.18

2 years ago

1.2.19

2 years ago

1.2.20

2 years ago

1.2.23

2 years ago

1.2.24

2 years ago

1.2.21

2 years ago

1.2.22

2 years ago

1.2.25

2 years ago

1.2.16

2 years ago

1.2.17

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.9

2 years ago

1.2.12

2 years ago

1.2.13

2 years ago

1.2.10

2 years ago

1.2.11

2 years ago

1.2.14

2 years ago

1.2.15

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.2

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.12

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago