🖥️SDK_GASLESS
SDK for swaps, balances, token lists, and prices
Installation
Using npm
npm install @panoraexchange/swap-sdkUsing yarn
yarn add @panoraexchange/swap-sdkUsing pnpm
pnpm add @panoraexchange/swap-sdkUsage
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. Gasless Transactions
Trigger swap transactions with fee-payer enabled, allowing another account to cover the network gas fees by sponsoring the transaction.
Fetch swap quote
Retrieve fee payer account
Sign the raw transaction as fee payer
Execute gasless swap transaction
Gasless Transactions Code Sample
5. Get Balances
Fetch wallet balances
6. Get Tokenlist
Fetch Panora's Aptos Token List
7. 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