Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
The NaviSDK Client provides a set of tools for interacting with sui blockchain networks, specifically designed for handling transactions, accounts, and smart contracts in a streamlined and efficient manner. This documentation covers the setup, account man
The NaviSDK Client provides a set of tools for interacting with sui blockchain networks, specifically designed for handling transactions, accounts, and smart contracts in a streamlined and efficient manner. This documentation covers the setup, account management, and transaction handling within the NaviSDK ecosystem.
Before you can use the NaviSDK Client, you need to set up your project environment.
npm i navi-sdk
To create a default account, you will need a mnemonic phrase or we will generate a new one for you. We will never save user's mnemonic phrase
const mnemonic = ''; // Use an existing mnemonic or leave empty to generate a new one
const client = new naviSDKClient({mnemonic, networkType: "mainnet", wordLength: 12}); //WordLength supports 12 or 24 words
client.createNewAccount();
console.log(`index 1:`, client.getMnemonic(accountIndexNumber)); //You may print it out to check the mnemonic
client.deleteAccount(index = 0);
client.createNewAccount({mnemonic: 'potato potato potato potato potato potato potato potato potato potato potato potato'});
// Double check the index 2 account
console.log(`index 2:`, client.getMnemonic(2));
client.getAllAccounts()
client.getAllMnemonic()
//Return Sample
index:0, address: 0xa814b8c01b111f5e440e5d4785925a033961915c2f44d22ca71619ac73534ee7
index:1, address: 0xd8be370139dd297924e31f6a507ba3a1d5f52f98f04f144bb75100d179698f84
index:2, address: 0xca29dbf32047fba966fa5aca7e378ba11171b3817f53ad324489a138288cc02d
client.createAccountCap(index = 0) //Index 0 Account will create an Account Cap
client.getPublicKey(index = 0)
client.getMnemonic(index = 0)
We have prepare a token type for Sui/NAVX/vSui/USDT/USDC/WETH/CETUS/haSui
import {Sui, NAVX, vSui, USDT, USDC, WETH, CETUS, haSui} from 'navi-sdk/dist/address';
client.getAllObjs(index = 0) //Return all Objects that account has
//Get all objs for this type of token
client.getTokenObjs(index = 0, coinType = "0x2::sui::SUI")
//Or you may import token address from address
client.getTokenObjs(index = 0, coinType = Sui)
client.sendToken(index = 0, coinType = NAVX, your_recipient_address, amount)
client.sendTokenToMany(index = 0, coinType = NAVX, [addr1, addr2, .. addrN], [amount1, amount2, .. amountN])
client.transferObj(index = 0, obj = "0xerror", your_recipient_address)
client.transferObjToMany(index = 0, [obj1, obj2, ...], [addr1, addr2, ...])
You may Simply input 'NAVX' as a string or NAVX as a type imported from address.ts.
Current These Pools are supported: Sui | NAVX | vSui | USDC | USDT | WETH | CETUS | haSui
client.deposit(index = 0, coinType = "Sui"||Sui, amount)
client.depositWithAccountCap(index = 0, coinType = "NAVX"||NAVX, amount, accountCap_Address_that_you_own)
client.withdraw(index = 0, coinType = "NAVX", amount)
client.withdrawWithAccountCap(index = 0, coinType = NAVX, amount, accountCap_Address_that_you_own)
client.borrow(index = 0, coinType = "NAVX", amount)
client.repay(index = 0, coinType = NAVX, amount)
import { naviSDKClient } from 'navi-sdk'
import { TransactionBlock } from "@mysten/sui.js/transactions";
import {depositToken, borrowToken, flashloan,repayFlashLoan, SignAndSubmitTXB, mergeTokens} from 'navi-sdk/dist/libs/PTB'
import { Pool, PoolConfig } from "navi-sdk/dist/types";
import { pool } from 'navi-sdk/dist/address'
const mnemonic = "";
const client = new naviSDKClient({mnemonic: mnemonic, networkType: "mainnet", wordLength: 12});
// Initialize the TransactionBlock
let txb = new TransactionBlock();
let sender = client.getPublicKey(0);
console.log(sender)
txb.setSender(sender);
const poolName = 'USDC'; // Supported: Sui/NAVX/vSui/USDC/USDT/WETH/CETUS/HAsui
const amount_to_borrow = 1*1e6; //Borrow 1 USDC
const USDC_Pool: PoolConfig = pool[poolName as keyof Pool];
const [balance, receipt] = flashloan(txb, USDC_Pool, amount_to_borrow); // Flashloan 1 usdc
//Transfer the flashloan money to the account
const this_coin = txb.moveCall({
target: '0x2::coin::from_balance',
arguments: [balance],
typeArguments: [USDC_Pool.type],
});
//Get the repayment object
const repayBalance = txb.moveCall({
target: '0x2::coin::into_balance',
arguments: [txb.object('{your_repay_coin_object_id}')],
typeArguments: [USDC_Pool.type],
});
const [e_balance] = repayFlashLoan(txb, USDC_Pool, receipt, repayBalance); // Repay with USDC
//Extra token after repay
const e_coin = txb.moveCall({
target: '0x2::coin::from_balance',
arguments: [e_balance],
typeArguments: [USDC_Pool.type],
});
//Transfer the borrowed money and left_money after repay to teh account
txb.transferObjects([e_coin, this_coin], client.getPublicKey(0));
const result = SignAndSubmitTXB(txb, client.client(0), client.keypair(0));
console.log("result: ", result);
FAQs
The NAVI SDK Client provides tools for interacting with the Sui blockchain networks, designed for handling transactions, accounts, and smart contracts efficiently. This documentation covers the setup, account management, and transaction handling within th
The npm package navi-sdk receives a total of 817 weekly downloads. As such, navi-sdk popularity was classified as not popular.
We found that navi-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.