Swap
This page illustrate how to integrate PiperX swap functionality to your Dapps and website.
Integrating Swap to website
Steps to Integration
import { routingExactInput } from '@piperx/sdk/src/routing'
import { swap, routerTokenApproval } from '@piperx/sdk/src/core'
import { WIP_ADDRESS } from '@piperx/sdk/src/constant'Prepare Input
token1_address: address, // if it is $IP native token, use WIP_ADDRESS
token2_address: address, // if it is $IP native token, use WIP_ADDRESS
amount1: bigint, // amount of token 1 you want to give
amount2Min: bigint, // minimal number of token 2 you want to receive
expire_time: bigint// expiration timestamp for a swap
signer: ethers.Signer. //Finding the best swap path
Approve tokens
Conduct swap
Last updated