Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

navi-aggregator-sdk-dev

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

navi-aggregator-sdk-dev

NAVI Aggregator for Sui Defi Ecosystem

  • 1.0.7
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-40%
Maintainers
0
Weekly downloads
 
Created
Source

navi-aggregator-sdk

NAVI Aggregator for Sui Defi Ecosystem

This TypeScript SDK simplifies integration with decentralized exchanges (DEXs) on the Sui blockchain, allowing developers to execute token swaps in Move-based PTB applications or directly leverage the SDK for optimized token swaps across multiple sources for the best prices.

For full details, please see the Documentation.

Supported DEX

  • Cetus
  • Turbos
  • DeepBook v3
  • Aftermath
  • Kriya v2/v3

Installation

npm i navi-aggregator-sdk

Usage

  • Get Quote

Pass in the fromCoin, toCoin, and amountIn. The output will be the quote for the swap.

import { getRoute } from 'navi-aggregator-sdk';

const quote = await getRoute(fromCoin: string, toCoin: string, amountIn: number | string | bigint);
console.log(`Amount In: ${quote.amount_in}, Amount Out: ${quote.amount_out}`);
console.log(`Routes: ${quote.routes}`);
  • Coin-In-Coin-Out PTB function

Pass in a coinObject as the coin parameter. The output will be the final coin object after the swap.

import { swapPTB } from 'navi-aggregator-sdk';

const coinB = await swapPTB(
    address: string,
    txb: Transaction,
    fromCoin: string,
    toCoin: string,
    coin: TransactionResult,
    amountIn: number | string | bigint,
    minAmountOut: number,
    swapOptions: SwapOptions = { referer: 'https://www.navi.ag/', dexList: [], byAmountIn: true, depth: 3 }
)
  • Swap function

The swap function is a wrapper for the getRoute and swapPTB functions. Set isDryRun from swapOptions to true to get a dry run result and balance changes. It will submit the transaction and return the result if a keypair is provided.

import { swap } from 'navi-aggregator-sdk';

const result = await swap(
    address: string,
    client: SuiClient,
    fromCoin: string,
    toCoin: string,
    amountIn: number | string | bigint,
    minAmountOut: number,
    swapOptions: SwapOptions = { referer: 'https://www.navi.ag/', dexList: [], byAmountIn: true, depth: 3, isDryRun: true, keypair: undefined }
);

Demo

See the demo for examples of how to use the SDK with NAVI-SDK.

License

This project is licensed under the MIT License - see the LICENSE file for details.

FAQs

Package last updated on 14 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc