đąī¸API Interface
Navi Client SDK Initializer
NAVISDKClient(mnemonic: string, networkType: string, wordLength: number, numberOfAccounts: number)
Input:
mnemonic - optional - The mnemonic phrase to use for account generation. If not provided, a new mnemonic will be generated.
networkType - optional - The network type to use. Defaults to "mainnet".
wordLength - optional - The length of the mnemonic phrase to generate. Defaults to 12
numberOfAccounts - optional - The number of accounts to generate. Defaults to 10.
Return: naviSDKClient
Client Get All Accounts
getAllAccounts()
Return: A list of accounts that client has
Client Get Mnemonic
getMnemonic()
Return: Mnemonic of the client
Get Pool Info
getPoolInfo(coinType: CoinInfo)
Input:
coinType - required - Pre-defined coin data type
Sui/vSui/NAVX/USDC/USDT/WETH/CETUS/haSui, you may import these from 'navi-sdk/dist/address'
Return: A Promise that resolves to the pool information.
Get Pool Reserves & Get Pool Reserve Detail
getReserves()
Return: Json - All reserves information
getReserveDetail(coinType: CoinInfo)
Input:
coinType - rquired Specific coin type
Return: Json - Specific reserve information
Get Health Factor
getHealthFactor(address: string)
Input:
address - required - string, this can be any address
Return: Number of health Factor
Get Dynamic Health Factor
getDynamicHealthFactor(address: string, coinType: CoinInfo, estimateSupply: number, estimateBorrow: number, is_increase: boolean = true)
Input:
address - required - any address you want to check
coinType - required - CoinInfo Data Type
estimateSupply - required - The estimated supply value.
estimateBorrow - required - The estimated borrow value.
is_increase - required - A boolean indicating whether to increase the dynamic health factor.
Return: A Promise that resolves to the dynamic health factor.
Get All Navi Portfolios
getAllNaviPortfolios()
Return: A promise that resolves to an array of results for each account.
Get All Balances
getAllBalances()
Return: A record containing the balances of each coin of all accounts.
Accounts
Public Attributes
account.address
account.client
account.keypair
Select Specific Account
const account = client.accounts[0]
const account5 = client.accounts[5]
Get Account Wallet Balance
getWalletBalance(ifPrettyPrint: boolean = true)
Input:
ifPrettyPrint - optional - Console print fancy format of account's balance
Return: A Promise that resolves to an object containing the balance of each coin in the wallet.
Get Account Navi Portfolio Balance
getNAVIPortfolio(ifPrettyPrint: boolean = true)
Input:
ifPrettyPrint - optional - Console print fancy format of account's portfolio
Return: A Promise that resolves to a Map containing the borrow and supply balances for each reserve.
Get Account Health Factor
getHealthFactor()
Input:
address - optional - If leave empty, return use the account address
Return: The health factor as a number.
Get Account Specific Coin
getCoins(coinType: any)
Input:
coinType - optional - You may pass in CoinInfo data Type or any string of coin Address, default is Sui address
Return: A Promise that resolves to the retrieved coin objects.
Get Account All Coins
getAllCoins(ifPrettyPrint: boolean = true)
Input:
ifPrettyPrint - optional - if print out fancy foramt of coins
Return: A Promise that resolves to the data containing all the coins owned by the account.
Create account Cap
createAccountCap()
Result: Will create an accountCap object and transfer it the tx initializer
Send Token to Single or Multiple recipients
sendCoin(coinType: any, recipient: string, amount: number)
sendCoinToMany(coinType: any, recipient: string[], amounts: number[])
Input:
coinType - required - Can pass in either CoinInfo Data Type or string of coin address
recipient - requried - String of recipient address
amount - required - Amount of coin send out
Transfer Objs to single or multiple recipients
transferObjs(object: string, recipient: string)
transferObjsToMany(objects: string[], recipient: string[])
Input:
object - required - ObjectId of the object
recipient - requried - String of recipient address
Interactions with Navi Protocol
Deposit
depositToNavi(coinType: CoinInfo, amount: number)
Input:
coinType - required - Must pass in Pre-defined CoinInfo Type
amount -required - Amount to deposit in
Deposit with Account Cap
depositToNaviWithAccountCap(coinType: CoinInfo, amount: number, accountCapAddress: string)
Input:
coinType - required - Must pass in Pre-defined CoinInfo Type
amount -required - Amount to deposit in
accountCapAddress - requierd - String of address of owned account cap
Withdraw
withdraw(coinType: CoinInfo, amount: number)
Input:
coinType - required - Must pass in Pre-defined CoinInfo Type
amount -required - Amount to withdraw
Withdraw With Account Cap
withdrawWithAccountCap(coinType: CoinInfo, amount: number, accountCapAddress: string
Input:
coinType - required - Must pass in Pre-defined CoinInfo Type
amount -required - Amount to withdraw
accountCapAddress - requierd - String of address of owned account cap
Borrow
borrow(coinType: CoinInfo, borrowAmount: number)
Input:
coinType - required - Must pass in Pre-defined CoinInfo Type
borrowAmount- required - Amount to borrow
Repay
repay(coinType: CoinInfo, repayAmount: number)
Input:
coinType - required - Must pass in Pre-defined CoinInfo Type
repayAmount - required - Amount to repay
Last updated