NAVI Protocol Developer Docs
  • đŸ–Ĩī¸Build with NAVI Protocol
  • 📖Smart Contract Overview
    • 1ī¸Lending Core
    • 2ī¸Flash Loan
    • 3ī¸Calculator
    • 4ī¸Dynamic Calculator
    • 5ī¸Storage
  • 🕓Decentralized Oracle
    • đŸ’ŊOracle Interface
  • đŸ—ēī¸Contract Configuration
    • 1ī¸âƒŖGet the Latest Package ID
    • 2ī¸âƒŖGet Pools Config and Oracle Price Feeds
    • 3ī¸âƒŖGet Flashloan Config
  • đŸ›Šī¸NAVI SDK
    • 1ī¸Getting Started
    • 2ī¸Retrieve Info & Data
    • 3ī¸Interactions With NAVI
    • 4ī¸PTB Functions
    • 5ī¸Other Ways to Interact with NAVI
    • 6ī¸Demo
  • 📲NAVI UI SDK
    • ⭐Getting Started
    • đŸ…°ī¸Aggregator Components
  • 🎧Contract Integration with NAVI
    • 1ī¸âƒŖRetrieve Pools Info inside Contract
    • 2ī¸âƒŖIntegration with Account Cap
    • 3ī¸âƒŖDemo
  • 🏅NAVI Aggregator
    • 1ī¸âƒŖGetting Started
    • 2ī¸âƒŖAggregator SDK
    • 3ī¸âƒŖAggregator API
    • 🛜Contact Page
  • NAVI Bridge
    • 🚀Quick Start
    • 📄Bridge SDK
  • 📊NAVI Uptime Status Page
  • 📚NAVI API Collection
    • NAVI API
    • afSui, haSui, vSui API
  • ❓FAQ
Powered by GitBook
On this page
  • Supply to NAVI
  • Withdraw from NAVI
  • Borrow from NAVI
  • Repay Debt to NAVI
  • Claim All Available Rewards
  • Create Account Cap
  • Flashloan
  • Liquidation
  1. NAVI SDK

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, 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

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

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

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.

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)

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)

PreviousRetrieve Info & DataNextPTB Functions

Last updated 4 months ago

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

đŸ›Šī¸
3ī¸
code sample