1.0.15 • Published 1 year ago

text-swap-widget-knv-1 v1.0.15

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

@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

SwapParamasRequiredDescription
chainIdNoID for the chain. Note: Since Panora is only on Aptos, chainId=1.
fromTokenAddressYesAddress of the token being swapped.
fromTokenAmountYesAmount of the token being swapped.
toTokenAddressYesAddress of the token being swapped to.
toWalletAddressYesAddress of the wallet in which the transaction will happen
slippagePercentageNoPercentage 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

SwapParamasRequiredDescription
chainIdNoID for the chain. Note: Since Panora is only on Aptos, chainId=1.
fromTokenAddressYesAddress of the token being swapped.
toTokenAmountYesAmount of token user desire to get after the swap.
toTokenAddressYesAddress of the token being swapped to.
toWalletAddressYesAddress of the wallet in which the transaction will happen.
slippagePercentageNoPercentage 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

GetQuotesParamasRequiredDescription
chainIdNoID for the chain. Note: Since Panora is only on Aptos, chainId=1.
fromTokenAddressYesAddress of the token being swapped.
fromTokenAmountYesAmount of the token being swapped.
toTokenAddressYesAddress of the token being swapped to.
slippagePercentageNoPercentage 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

GetQuotesParamasRequiredDescription
chainIdNoID for the chain. Note: Since Panora is only on Aptos, chainId=1.
fromTokenAddressYesAddress of the token being swapped.
toTokenAmountYesAmount of token user desire to get after the swap.
toTokenAddressYesAddress of the token being swapped to.
slippagePercentageNoPercentage of the slippage to be considered.
1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago