Skip to content

Latest commit

 

History

History
186 lines (136 loc) · 3.5 KB

split-swap-request.md

File metadata and controls

186 lines (136 loc) · 3.5 KB

Split Swap Request

Request a split order request in order to split your swap order into chunks on different DEXs.

Obtaining

dexter.newSplitSwapRequest()
    ...

SwapRequest API

withSwapInToken(Token): SplitSwapRequest Set which Token in the pool you are swapping in.
Using
dexter.newSplitSwapRequest()
    .withSwapInToken('lovelace')
    ...

withSwapOutToken(Token): SplitSwapRequest Set which Token in the pool you are swapping out.
Using
dexter.newSplitSwapRequest()
    .withSwapOutToken('lovelace')
    ...

withSwapInAmountMappings(SwapInAmountMapping[]): SplitSwapRequest Set how much you are swapping in for each DEX.
Using
dexter.newSplitSwapRequest()
    .withSwapInAmountMappings([
        {
            swapInAmount: 2_000000n,
            liquidityPool: new LiquidityPool(Minswap.identifier, ...)
        },
        {
            swapInAmount: 5_000000n,
            liquidityPool: new LiquidityPool(WingRiders.identifier, ...)
        },
    ])
    ...

withSwapOutAmountMappings(SwapOutAmountMapping[]): SplitSwapRequest Set how much you are swapping out for each DEX.
Using
dexter.newSplitSwapRequest()
    .withSwapOutAmountMappings([
        {
            swapInAmount: 2_000000n,
            liquidityPool: new LiquidityPool(Minswap.identifier, ...)
        },
        {
            swapInAmount: 5_000000n,
            liquidityPool: new LiquidityPool(WingRiders.identifier, ...)
        },
    ])

flip(): SplitSwapRequest Flip your swap in and swap out token.
Using
dexter.newSplitSwapRequest()
    .flip()
    ...

withSlippagePercent(number): SplitSwapRequest Set how much slippage you will tolerate. (Default: 1.0%)
Using
dexter.newSplitSwapRequest()
    .withSlippagePercent(0.5)
    ...

getEstimatedReceive(): bigint Get the total estimated receive for your swap.

Will return a sum of the estimated receive for each DEX mapping.

Using
dexter.newSplitSwapRequest()
    .getEstimatedReceive()

getMinimumReceive(): bigint Get the total minimum receive for your swap.

Will return a sum of the minimum receive for each DEX mapping.

Using
dexter.newSplitSwapRequest()
    .getMinimumReceive()

getAvgPriceImpactPercent(): number Get the average price impact percentage for your swap.

Will return the average price impact for each swap on each DEX.

Using
dexter.newSplitSwapRequest()
    .getAvgPriceImpactPercent()

getSwapFees(): SwapFee[] Get the DEX specific fees for your swap.

Will return all swap fees associated with each DEX in the swap.

Using
dexter.newSplitSwapRequest()
    .getSwapFees()

submit(): DexTransaction Finally submit your split swap on-chain.
Using
dexter.newSplitSwapRequest()
    ...
    .submit()