πŸ–₯️SDK

SDK for swaps, balances, token lists, and prices

Installation

Using npm

npm install @panoraexchange/swap-sdk

Using yarn

yarn add @panoraexchange/swap-sdk

Using pnpm

pnpm add @panoraexchange/swap-sdk

Usage

1. Initialize

import Panora, { PanoraConfig } from "@panoraexchange/swap-sdk"

const config: PanoraConfig = {
  panoraApiKey: "PANORA_API_KEY", // Optional. Default is Panora's public api key
  geomiApiKey: "GEOMI_API_KEY", // Optional. AKA Aptos Build Api Key. Takes higher priority over rpcUrl
  rpcUrl: "CUSTOM_RPC_URL", // Optional
}

const panora = new Panora(config)
  • Public API Key:

    Note: This API key's limits should be sufficient for most use cases. Protocols within the Aptos ecosystem with specific requirements or customization may submit a ticket on Discord.

2. Swap

Fetches a swap quote and executes the transaction on-chain in a single step. Use this when you want to trigger end-to-end transaction without fetching or managing quotes separately. Refer API page for all available query parameters

i. ExactInSwap:

ii. ExactOutSwap:

3. Quote & Execute

a. Quote: Returns quote for a swap transaction. Contains transaction data that can be used to build, sign and submit directly

i. ExactInSwapQuote

ii. ExactOutSwapQuote

b. Execute Quote: Executes a transaction using a pre-fetched swap quote. Unlike swap function, this function does not fetch the quote itself. Use getQuote function to fetch a swap quote.

4. Get Balances

Fetch wallet balances

5. Get Tokenlist

Fetch Panora's Aptos Token List

6. Get Prices

Fetch Token Prices

Attribution

Kindly include proper attribution when using the SDK in projects or presentations. Mention β€œPowered by Panora” wherever applicable.

Last updated