Safle Swaps
Step by step description
1. Installation, import & initialisation
npm install @getsafle/safle-swaps-v2
const Swap = require('@getsafle/safle-swaps-v2');
const swap = new Swap({ dex, rpcURL,chain });2. User Flow
const supportedToken = await swap.getSupportedTokens();await swap.getExchangeRates({ toContractAddress, toContractDecimal, fromContractAddress, fromContractDecimal, fromQuantity, slippageTolerance });
await swap.getEstimatedGas({ toContractAddress, toContractDecimal, fromContractAddress, fromContractDecimal, fromQuantity, slippageTolerance })
await swap.getRawTransaction({ walletAddress, toContractAddress, toContractDecimal, fromContractAddress, fromContractDecimal, fromQuantity, toQuantity, slippageTolerance })
const signedTransaction = await vault.signTransaction(rawTx, pin, chain);
Last updated
Was this helpful?