npm install navi-sdk
import {Bridge} from 'navi-sdk';
Bridge.config({ apiKey: 'your api key' });
const supportChains = await Bridge.getSupportChains(); const SuiChain = supportChains[6] const SolanaChain = supportChains[0]
You can query this data in advance and record it in your code for future use.
const navxSearchResult = await Bridge.searchSupportTokens(SuiChain.id, '0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX') const SUI_NAVX = navxSearchResult[0]; const usdcSearchResult = await Bridge.searchSupportTokens(SolanaChain, 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'); const SolanaUSDC = usdcSearchResult[0];
const quote = await Bridge.getQuote(SUI_NAVX, SolanaUSDC, 10, { slippageBps: 50 })
const transaction = await Bridge.swap(quote, fromAddress, toAddress, walletConnect, )
const lastestTransaction = await Bridge.getTransaction(transaction.id) // check transaction state switch(lastestTransaction.status) { case "processing": break; case "completed": break; case "fail": break; }
Last updated 1 day ago