3ī¸Interactions With NAVI

The NAVI SDK enables full access to all core functionalities, allowing seamless integration without the need for a user interface. With the SDK, all operations can be performed programmatically, giving you complete control over your interactions with the NAVI protocol.

Currently, the SDK supports 10 coins for interaction with NAVI, with more to come in the future:

  • Sui, NAVX, vSui, USDT, USDC, WETH, CETUS, haSui, WBTC, AUSD

Supply to NAVI

import { Sui, NAVX, vSui, USDT, USDC, WETH, CETUS, haSui, WBTC, AUSD } from 'navi-sdk/dist/address';

// Deposit tokens to NAVI
account.depositToNavi(Sui, amount)

// Deposit with account cap restrictions
account.depositToNaviWithAccountCap(NAVX, amount, accountCap_Address_that_account_own)

Withdraw from NAVI

import { Sui, NAVX, vSui, USDT, USDC, WETH, CETUS, haSui, WBTC, AUSD } from 'navi-sdk/dist/address';

// Withdraw tokens from NAVI
account.withdraw(coinType = NAVX, amount)

// Withdraw with account cap restrictions
account.withdrawWithAccountCap(coinType = NAVX, amount, accountCap_Address_that_account_own)

Borrow from NAVI

import { Sui, NAVX, vSui, USDT, USDC, WETH, CETUS, haSui, WBTC, AUSD } from 'navi-sdk/dist/address';

// Borrow tokens from NAVI
account.borrow(coinType = NAVX, amount)

Repay Debt to NAVI

import { Sui, NAVX, vSui, USDT, USDC, WETH, CETUS, haSui, WBTC, AUSD } from 'navi-sdk/dist/address';

// Repay debt to NAVI
account.repay(coinType = NAVX, amount)

Claim All Available Rewards

This command allows you to claim all available rewards in a single call.

account.claimAllRewards()

Create Account Cap

Use this function to create an account cap, which is a prerequisite for certain operations within the NAVI protocol.

account.createAccountCap()

Flashloan

const [balance, receipt] = flashloan(txb: Transaction, _pool: PoolConfig, amount: number)

This function initiates a flashloan from a specified pool with a given amount.

const [e_balance] = repayFlashLoan(txb: Transaction, _pool: PoolConfig, receipt: any, repayCoin: any)

This code sample demostrated how to repay the flashloan using the provided receipt and repayment coin.

https://suiscan.xyz/mainnet/tx/fCFERvsTk7t6G4SJyuuwXU3HbVqYbQ1RKzTDaeRwM4A


Liquidation

To streamline the liquidation process, the NAVI SDK offers a dedicated function to efficiently handle bad debt liquidation.

const result = account.liquidate(payCoinType: CoinInfo, liquidationAddress: string, collateralCoinType: CoinInfo, liquidationAmount: number = 0)

Last updated