All calculations for your swap parameters are DEX specific. For example, the estimated receive might be different on one DEX vs another given the same values due to DEXs using different formulas for their calculations.
dexter.newSwapRequest()
...
forLiquidityPool(LiquidityPool): SwapRequest
Set which Liquidity Pool to swap from.
dexter.newSwapRequest()
.forLiquidityPool(new LiquidityPool(...))
...
withSwapInToken(Token): SwapRequest
Set which Token in the pool you are swapping in.
dexter.newSwapRequest()
.withSwapInToken('lovelace')
...
withSwapOutToken(Token): SwapRequest
Set which Token in the pool you are swapping out.
dexter.newSwapRequest()
.withSwapOutToken('lovelace')
...
withSwapInAmount(bigint): SwapRequest
Set how much you are swapping in.
dexter.newSwapRequest()
.withSwapInAmount(10_000000n)
...
withSwapOutAmount(bigint): SwapRequest
Set how much you are swapping out.
dexter.newSwapRequest()
.withSwapOutAmount(10_000000n)
...
withMinimumReceive(bigint): SwapRequest
Set the minimum you want to receive.
dexter.newSwapRequest()
.withMinimumReceive(10_000000n)
...
withSlippagePercent(number): SwapRequest
Set how much slippage you will tolerate. (Default: 1.0%)
dexter.newSwapRequest()
.withSlippagePercent(0.5)
...
flip(): SwapRequest
Flip your swap in and swap out token.
Flipping will only affect the swap in & swap out token if the swap in token was set beforehand.
dexter.newSwapRequest()
.flip()
...
getEstimatedReceive(LiquidityPool?): bigint
Get the estimated receive for your swap.
Supplying a liquidity pool will run against the provided pool. This is useful when getting the estimated receive for pools with the same tokens, but on different DEXs.
dexter.newSwapRequest()
.getEstimatedReceive()
getMinimumReceive(LiquidityPool?): bigint
Get the minimum receive for your swap.
Supplying a liquidity pool will run against the provided pool. This is useful when getting the minimum receive for pools with the same tokens, but on different DEXs.
dexter.newSwapRequest()
.getMinimumReceive()
getPriceImpactPercent(): number
Get the price impact percentage for your swap.
Supplying a liquidity pool will run against the provided pool. This is useful when getting the minimum receive for pools with the same tokens, but on different DEXs.
dexter.newSwapRequest()
.getPriceImpactPercent()
getSwapFees(): SwapFee[]
Get the DEX specific fees for your swap.
dexter.newSwapRequest()
.getSwapFees()