DeFi Saver Positions SDK
Supported protocols:
Setup
Supported Node version is v10.
- run
npm install
(first time)
- run
npm run build
build
command will generate contracts and build ejs and esm folders
How to use
All available imports
This is a Compound V3 example, and every other protocol is similar
import { compoundV3 } from '@defisaver/positions-sdk';
const {
getCompoundV3MarketsData,
getCompoundV3AccountData,
} = compoundV3;
const provider = 'Your RPC provider';
const user = '0x123...';
const { assetsData } = await getCompoundV3MarketsData(
provider,
1,
selectedMarket,
provider,
);
const userData = await getCompoundV3AccountData(
provider,
1,
userAddress,
'',
{
selectedMarket,
assetsData,
}
);
More examples found here
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.js test name is MyTest