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
Copy import { Sui , USDT , WETH , vSui , haSui , CETUS , NAVX , WBTC , AUSD , wUSDC , nUSDC , ETH , USDY , NS , LorenzoBTC , DEEP , FDUSD , BLUE , BUCK , suiUSDT } from 'navi-sdk'
// 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
Copy import { Sui , USDT , WETH , vSui , haSui , CETUS , NAVX , WBTC , AUSD , wUSDC , nUSDC , ETH , USDY , NS , LorenzoBTC , DEEP , FDUSD , BLUE , BUCK , suiUSDT } from 'navi-sdk'
// 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
Copy import { Sui , USDT , WETH , vSui , haSui , CETUS , NAVX , WBTC , AUSD , wUSDC , nUSDC , ETH , USDY , NS , LorenzoBTC , DEEP , FDUSD , BLUE , BUCK , suiUSDT } from 'navi-sdk'
// Borrow tokens from NAVI
account .borrow (coinType = NAVX , amount)
Repay Debt to NAVI
Copy import { Sui , USDT , WETH , vSui , haSui , CETUS , NAVX , WBTC , AUSD , wUSDC , nUSDC , ETH , USDY , NS , LorenzoBTC , DEEP , FDUSD , BLUE , BUCK , suiUSDT } from 'navi-sdk'
// 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.
Copy account .claimAllRewards ()
Create Account Cap
Use this function to create an account cap, which is a prerequisite for certain operations within the NAVI protocol.
Copy account .createAccountCap ()
Flashloan
Copy const [ balance , receipt ] = flashloan (txb: Transaction , _pool: PoolConfig , amount: number)
This function initiates a flashloan from a specified pool with a given amount.
Copy 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.
Copy const result = account .liquidate (payCoinType: CoinInfo , liquidationAddress: string , collateralCoinType: CoinInfo , liquidationAmount: number = 0 )