SDK to perform the most optimal swap
npm i @panoraexchange/swap-sdk
yarn add @panoraexchange/swap-sdk
pnpm add @panoraexchange/swap-sdk
https://docs.panora.exchange/developer/swap-aggregator-api-and-sdk/aggregator-sdk
ExactInSwap = async (SwapParamas, private_key);
SwapParams is an object with the below field
SwapParamas | Required | Description |
---|---|---|
chainId | No | ID for the chain. Note: Since Panora is only on Aptos, chainId=1. |
fromTokenAddress | Yes | Address of the token being swapped. |
fromTokenAmount | Yes | Amount of the token being swapped. |
toTokenAddress | Yes | Address of the token being swapped to. |
toWalletAddress | Yes | Address of the wallet in which the transaction will happen |
slippagePercentage | No | Percentage of the slippage to be considered. |
ExactOutSwap = async (SwapParamas, private_key)
SwapParams is an object with the below field
SwapParamas | Required | Description |
---|---|---|
chainId | No | ID for the chain. Note: Since Panora is only on Aptos, chainId=1. |
fromTokenAddress | Yes | Address of the token being swapped. |
toTokenAmount | Yes | Amount of token user desire to get after the swap. |
toTokenAddress | Yes | Address of the token being swapped to. |
toWalletAddress | Yes | Address of the wallet in which the transaction will happen. |
slippagePercentage | No | Percentage of the slippage to be considered. |
ExactInSwapQuote = async (GetQuotesParamas)
GetQuoteParamas is an object with the below fields
GetQuotesParamas | Required | Description |
---|---|---|
chainId | No | ID for the chain. Note: Since Panora is only on Aptos, chainId=1. |
fromTokenAddress | Yes | Address of the token being swapped. |
fromTokenAmount | Yes | Amount of the token being swapped. |
toTokenAddress | Yes | Address of the token being swapped to. |
slippagePercentage | No | Percentage of the slippage to be considered. |
ExactOutSwapQuote = async (GetQuotesParamas)
GetQuoteParamas is an object with the below fields
GetQuotesParamas | Required | Description |
---|---|---|
chainId | No | ID for the chain. Note: Since Panora is only on Aptos, chainId=1. |
fromTokenAddress | Yes | Address of the token being swapped. |
toTokenAmount | Yes | Amount of token user desire to get after the swap. |
toTokenAddress | Yes | Address of the token being swapped to. |
slippagePercentage | No | Percentage of the slippage to be considered. |