burrow-lending-sdk
v1.0.0
Published
npm Package - burrow-lending-sdk
Readme
burrow-lending-sdk
JavaScript/TypeScript SDK for interacting with the Burrow lending protocol on NEAR.
Installation
npm install burrow-lending-sdk
API
getAssets(): Promise<BurrowAsset[]>
Returns all supported assets in the Burrow protocol.
getAccount(accountId: string): Promise<BurrowAccount>
Returns lending account details for the given NEAR account ID.
supply(tokenId: string, amount: string, opts: FunctionCallOptions): Promise<FinalExecutionOutcome>
Supply tokens as collateral.
borrow(tokenId: string, amount: string, opts: FunctionCallOptions): Promise<FinalExecutionOutcome>
Borrow tokens against supplied collateral.
repay(tokenId: string, amount: string, opts: FunctionCallOptions): Promise<FinalExecutionOutcome>
Repay a previously borrowed amount.
Usage
import { getAssets, getAccount, supply, borrow, repay } from 'burrow-lending-sdk';
// Fetch all assets const assets = await getAssets();
// Fetch account info const account = await getAccount('alice.near');
// Supply tokens await supply('usdc.token.near', '1000000', { account });
// Borrow tokens await borrow('wrap.near', '500000000000000000000000', { account });
// Repay borrowed tokens await repay('wrap.near', '500000000000000000000000', { account });
Types
interface FunctionCallOptions { account: nearApiJs.Account; }
License
MIT
