Vault-SDK
SDK for developers who wants to integrate ratio vaults into their app.
You can find a brief tutorial example here => vault-sdk-example
1. Install vault-sdk
yarn add @ratio-finance/vault-sdk2. Get RatioLendingProgram instance and Initialize
import { RatioLendingProgram } from "@ratio-finance/vault-sdk";
const lendingProgram = RatioLendingProgram.getInstance(conn);
await lendingProgram.init();3. Deposit LP
const raydiumUsdtUsdcKey = "As3EGgLtUVpdNpE6WCKauyNRrCCwcQ57trWQ3wyRXDa6";
const depositTx = await lendingProgram.depositLP(
USER_KEYPAIR.publicKey, // UserPublicKey : PublicKey
raydiumUsdtUsdcKey, // CollateralMint: PublicKey
0.1 // DepositAmount: number (must be uiAmount)
);
const depositTxHash = await sendAndConfirmTransaction(
conn,
depositTx,
[USER_KEYPAIR]
);
console.log(`deposit is done successfully. txHash = ${depositTxHash}`);4. Other Transactions
Withdraw (Withdraw deposited collateral)
Harvest (Harvest Yield Farming rewards)
Mint (Borrow USDr against deposited collateral.)
Repay (Repay USDr)
5. Get Yield Farming Reward (Get pending reward from Yield Farming)
6. Get RATIO Apr Reward (If the pool has RATIO emission, user will get RATIO reward)
Last updated