DEX Filters

Sometimes you may want to limit the liquidity sources for your trades. This is where DEX Filters come in. Filters are applied as a customization to a trade. Every trade can have custom settings including a max gas price, max number of rounds, expiration time, and filters. Here is an example that includes filters:

...
const limit = new LimitSwap({
    amountIn:  units.inBNETH(".1"),
    tokenIn: ...,
    tokenOut: ...,
    slippage: new Slippage(.5, false),
    price: new Price({
        inAmount: units.inBNETH(".65"),
        inToken: ...,
        outAmount: units.inBNETH("1"),
        outToken: ...
    }),
    customizations: {
        dexFilters: {
            include: [GoerliDexFilter.SushiSwap]
        }
    }
});

In this example, the limit order will only use liquidity from Sushiswap on the Goerli network. Each network has a list of DEXs they support and are available as part of the SDK.

Simply import the network you are targeting and use the filters available.

Last updated

Was this helpful?