preSwap
To initiate a swap, start with a preliminary swap assessment to understand the potential outcome. Afterward, you can set the amount limit based on the swap result and the slippage tolerance.
Preswap by simulation transaction
Signature
computeSwapResultV2(options: ComputeSwapResultOptionsV2): Promise<Transaction>
Params
interface ComputeSwapResultOptionsV2 {
pools: Array<{
// Pool object ID
pool: string;
// swap from coinA to coinB
a2b: boolean;
amountSpecified: string | number
}>;
// Operator's wallet address
address: string;
amountSpecifiedIsInput: boolean;
tickStep?: number;
}pools: Multiple pools can be passed for prediction, which is particularly useful when there are multiple fee pools with the same token.address: Transaction sendera2b: Swap Direction: A value oftrueindicates a swap from CoinA to CoinBamountSpecifiedIsInput:truemeans fixed the amount of input,falsemeans fixed the amount of outputtickStep: Represented this pre swap can move up to how many tickSpacing
Examples
Response
Last updated