LogoNAVI Protocol SDKS

Flash Loan

Zero Fee Month Is Live

Navi Flash Loan enables developers to borrow assets without collateral, as long as the borrowed amount plus fees is repaid within the same transaction. It is designed for advanced on-chain use cases such as arbitrage, liquidation protection, and debt restructuring while abstracting protocol-level complexity through a JavaScript/TypeScript SDK.

Flash Loan At A Glance

Before integrating, here are the key facts you should know:

  • Atomic execution: Borrow and repay must occur in the same transaction
  • No collateral required
  • Fees apply: Repayment must include the flash loan fee
  • Pool-dependent: Not all assets or pools support flash loans
  • Amount-limited: Each asset has a maximum borrowable amount

Supported Assets And Fees

Use the live table below to check currently supported flashloan tokens and their fees. You can switch campaign configs on the fly.

Live Flashloan Fees

TokenCoin TypeFee
Loading supported assets...

When To Use Flash Loans

Flash loans are best suited for:

  • Arbitrage trading: Exploit price differences across DEXs in a single transaction
  • Debt restructuring: Rebalance positions to reduce borrowing costs
  • Liquidation protection: Temporarily replenish collateral to avoid liquidation
  • Liquidity management: Access short-term liquidity for complex operations

Quick Start: End-To-End Flow

A typical flash loan flow looks like this:

  1. Discover available flash loan assets and fees
  2. Borrow assets using flashloanPTB
  3. Execute your custom logic (for example arbitrage)
  4. Repay the loan using repayFlashLoanPTB
  5. Submit the transaction

Step 1: Discover Available Flash Loan Assets And Fees

Use this API to check which assets support flash loans, along with their limits and fees.

getAllFlashLoanAssets

Returns all available flash loan assets. Results are cached to reduce repeated API calls. See documentation for details.

import { getAllFlashLoanAssets } from '@naviprotocol/lending'

const flashLoanAssets = await getAllFlashLoanAssets({
  env: 'prod',
  cacheTime: 30000
})

Key fields to check before borrowing:

  • max: Maximum borrowable amount
  • flashloanFee: Fee rate applied to the borrowed amount
  • coinType: Asset identifier used in subsequent calls

Step 2: Get A Specific Flash Loan Asset

getFlashLoanAsset

Retrieve flash loan details using a coin type, asset ID, or pool object. See documentation for details.

import { getFlashLoanAsset, getPool } from '@naviprotocol/lending'

const assetByCoinType = await getFlashLoanAsset('0x2::sui::SUI')
const assetById = await getFlashLoanAsset(0)

const pool = await getPool('0x2::sui::SUI')
const assetByObject = await getFlashLoanAsset(pool)

Step 3: Borrow Assets In A Transaction

flashloanPTB

Creates a flash loan within a Programmable Transaction Block (PTB). See documentation for details.

import { flashloanPTB } from '@naviprotocol/lending'
import { Transaction } from '@mysten/sui/transactions'

const tx = new Transaction()

const [balance, receipt] = await flashloanPTB(
  tx,
  '0x2::sui::SUI',
  1_000_000_000,
  { env: 'prod' }
)

Returns:

  • balance: Borrowed asset balance
  • receipt: Flash loan receipt (required for repayment)

Step 4: Repay The Flash Loan

repayFlashLoanPTB

Repays the flash loan using the receipt and repayment balance. See documentation for details.

import { repayFlashLoanPTB } from '@naviprotocol/lending'

await repayFlashLoanPTB(
  tx,
  '0x2::sui::SUI',
  receipt,
  balance,
  { env: 'prod' }
)

The repayment balance must include borrowed amount + flash loan fee.

Complete Example: Flash Loan Arbitrage

import { flashloanPTB, repayFlashLoanPTB } from '@naviprotocol/lending'
import { Transaction } from '@mysten/sui/transactions'

async function executeFlashLoanArbitrage() {
  const tx = new Transaction()

  const [borrowedBalance, receipt] = await flashloanPTB(
    tx,
    '0x2::sui::SUI',
    1_000_000_000,
    { env: 'prod' }
  )

  // Execute arbitrage logic here

  await repayFlashLoanPTB(
    tx,
    '0x2::sui::SUI',
    receipt,
    borrowedBalance,
    { env: 'prod' }
  )

  // Submit transaction
}

Comparison: Navi Vs DeepBook Vs Cetus

FeatureNavi Flash Loan SDKDeepBook Flash LoanCetus Flash Loan
Abstraction levelHigh (SDK + PTB helpers)MediumLow (Move-level)
LanguageJS / TSTSMove
Asset discoveryBuilt-in APIsManualManual
Transaction safetyAbstractedSemi-manualManual
Best forFast integration, non-Move devsOrderbook strategiesProtocol-native control

Troubleshooting And Common Errors

Transaction Reverted

Cause: Borrow and repay are not executed in the same transaction.

Solution: Ensure both steps are added to the same PTB.

Insufficient Repayment

Cause: Fee is not included in repayment.

Solution: Repay borrowed amount plus flashloanFee.

Unsupported Asset Or Pool

Cause: The pool does not support flash loans.

Solution: Verify availability using getAllFlashLoanAssets.

Borrow Amount Exceeds Limit

Cause: Amount is greater than max.

Solution: Check limits before borrowing.

Missing Or Invalid Receipt

Cause: Receipt is not passed correctly.

Solution: Always use the receipt returned from flashloanPTB.

Debugging Tips

  • Start with small borrow amounts
  • Log intermediate balances during development
  • Test in non-production environments first
  • Avoid conditional logic that may skip repayment

Why Use Navi Flash Loan SDK

  • JavaScript/TypeScript SDK abstraction
  • Safer PTB-based transaction construction
  • Built-in asset discovery and limit checking

Navi Flash Loan is designed to help developers focus on strategy and outcomes, not protocol boilerplate.