@aquarat/sdk
v0.0.6
Published
## Installation
Downloads
1
Readme
@aquarat/sdk
Installation
npm install @aquarat/sdk
import { IonicSdk } from "@aquarat/sdk";
import { ethers } from "ethers";
const chainId = 56;
const provider = new ethers.providers.JsonRpcProvider("PROVIDER_URL");
const sdk = new Fuse(provider, chainId);
const poolOne = await sdk.fetchPoolData("1");
const assetZero = poolOne.assets[0];
const borrowAPRAssetZero = sdk.ratePerBlockToAPY(
assetZero.borrowRatePerBlock,
20
);
const supplyAPYAssetZero = sdk.ratePerBlockToAPY(
assetZero.supplyRatePerBlock,
20
);
Functions
fetchPoolData
fetchPoolData(poolId: string, signer?: string): Promise<FusePoolData>
Fetch data about an individual pool on ionic protocol based on the pool id. The pool id can be extracted from the pool url https://ionic.money/56/pool/POOL_ID
ratePerBlockToAPY
ratePerBlockToAPY(ratePerBlock: BigNumber, blocksPerMin: number): number
Return the APY for a given current per-block borrow/supply interest rate. This rate can be included in the
FusePoolData['assets'][0].borrowRatePerBlock
and
FusePoolData['assets'][0].supplyRatePerBlock
correspondingly. (i.e. blocksPerMin for BSC: 20
)