Getting Started
NAVI Lending SDK Quick Start
NAVI Lending SDK is a lending SDK designed specifically for the Sui blockchain, providing complete lending functionality including account management, pool operations, flash loans, liquidation, and reward systems.
Core Concepts
Lending Protocol Basics
The NAVI lending protocol allows users to:
- Deposit: Deposit assets into pools to earn interest
- Borrow: Use deposits as collateral to borrow other assets
- Repay: Repay loans and pay interest
- Withdraw: Withdraw deposits from pools
Health Factor
Health factor is an important metric for measuring the safety of a user's lending account:
- Health Factor > 1: Account is safe and can continue borrowing
- Health Factor ≤ 1: Account is at risk of liquidation
Flash Loan
Flash loans allow users to borrow assets without collateral, but must be repaid within the same transaction.
Installation
npm install @naviprotocol/lending
Code Style and Conventions
Interface Optional Parameters
The last options
parameter of the interface is usually an optional object used to customize interface behavior. Common optional parameters include but are not limited to:
client
: Sui network client instance (such asSuiClient
), used for customizing network requests, suitable for scenarios that require custom RPC nodes or multi-network environments.env
: Specify environment (such as'prod'
、'dev'
), affecting data sources and on-chain contract addresses, ensuring data isolation and compatibility in different deployment environments.cacheTime
: Custom cache time in milliseconds. By setting cache time, you can reduce duplicate requests and improve performance. For example,cacheTime: 60000
means cache for 60 seconds.disableCache
: Whether to disable cacheaccountCap
: In ptb-related operations, use account cap
Usage Recommendations:
- If you don't pass
options
, the SDK will automatically use default configuration, suitable for most regular scenarios. - When you need to customize network, environment, or cache strategy, it's recommended to pass corresponding parameters for more flexible control.
Interface Naming
- Interfaces with PTB suffix indicate that the current interface is used for constructing transactions.
Support
- Issues: GitHub Issues