Minimum received & Maximum sold
How to calculate minimun received?
Example
const res = await sdk.RouterV2.getBestRouter(USDT, USDC, 100000000, true, 5, '', undefined, true, false)
const slippageTolerance = 0.01
const minReceived = res.result.outputAmount * (1 - slippageTolerance)
console.log('minReceived: ', minReceived )How to calculate maximum sold?
Example
const res = await sdk.RouterV2.getBestRouter(USDT, USDC, 100000000, true, 5, '', undefined, true, false)
const slippageTolerance = 0.01
const maxSold = res.result.inputAmount * (1 + slippageTolerance)
console.log('maxSold: ', maxSold )Last updated