text-swap-widget-knv-1
TypeScript icon, indicating that this package has built-in type declarations

1.0.15 • Public • Published

@panoraexchange/swap-sdk

SDK to perform the most optimal swap

Installtion

Using npm

npm i @panoraexchange/swap-sdk

Using yarn

yarn add @panoraexchange/swap-sdk

Using pnpm

pnpm add @panoraexchange/swap-sdk

For complete example of SDK usage please refer to the docs

https://docs.panora.exchange/developer/swap-aggregator-api-and-sdk/aggregator-sdk

Usage

Swap Functions

1. Swap transaction Function to get maximum toToken amount

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.

2. Swap transaction fucntion to get desire amount of outToken

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.

Get Quote Functions

1. Get the Quote for maximum possible toToken

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.

2. Get the Quote for desire amount of toToken with minimum fromToken amount

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.

Readme

Keywords

none

Package Sidebar

Install

npm i text-swap-widget-knv-1

Weekly Downloads

7

Version

1.0.15

License

none

Unpacked Size

36.6 kB

Total Files

12

Last publish

Collaborators

  • imkunal132002z