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.
export enum EthereumMainnetDexFilter {
Zrx = "0x",
Balancer = "Balancer",
Balancer_V2 = "Balancer_V2",
Bancor = "Bancor",
Bancor_V3 = "BancorV3",
CryptoCom = "CryptoCom",
Curve = "Curve",
Curve_V2 = "Curve_V2",
DODO = "DODO",
DODO_V2 = "DODO_V2",
Kyber = "KyberDMM",
Lido = "Lido",
MakerPsm = "MakerPsm",
Saddle = "Saddle",
Shell = "Shell",
ShibaSwap = "ShibaSwap",
SushiSwap = "SushiSwap",
Synapse = "Synapse",
Synthentix = "Synthetix",
Uniswap = "Uniswap",
Uniswap_V2 = "Uniswap_V2",
Uniswap_V3 = "Uniswap_V3"
}
export enum ArbitrumDexFilter {
Balancer_V2 = "Balancer_V2",
Curve_V2 = "Curve_V2",
GMX = "GMX",
Saddle = "Saddle",
SushiSwap = "SushiSwap",
Synapse = "Synapse",
Uniswap_V3 = "Uniswap_V3"
}
export enum AvalancheDexFilter {
Aave_V2 = "Aave_V2",
Curve = "Curve",
Curve_V2 = "Curve_V2",
GMX = "GMX",
Kyber = "KyberDMM",
Pangolin = "Pangolin",
Platypus = "Platypus",
SushiSwap = "SushiSwap",
Synapse = "Synapse",
TraderJoe = "TraderJoe",
W00Fi = "WOOFi"
}
export enum BinanceDexFilter {
ACryptoS = "ACryptoS",
ApeSwap = "ApeSwap",
BakerySwap = "BakerySwap",
Belt = "Belt",
BiSwap = "BiSwap",
DODO = "DODO",
DODO_V2 = "DODO_V2",
Ellipsis = "Ellipsis",
FirebirdOneSwap = "FirebirdOneSwap",
KnightSwap = "KnightSwap",
Kyber = "KyberDMM",
MDex = "MDex",
Mooniswap = "Mooniswap",
Nerve = "Nerve",
PancakeSwap = "PancakeSwap",
PancakeSwap_V2 = "PancakeSwap_V2",
SushiSwap = "SushiSwap",
Synapse = "Synapse",
WaultSwap = "WaultSwap",
WOOFi = "WOOFi"
}
export enum GoerliDexFilter {
Zrx = "0x",
SushiSwap = "SushiSwap",
Uniswap = "Uniswap",
Uniswap_V2 = "Uniswap_V2",
Uniswap_V3 = "Uniswap_V3"
}
export enum FantomDexFilter {
Beethovenx = "Beethovenx",
Curve = "Curve",
Curve_V2 = "Curve_V2",
MorpheusSwap = "MorpheusSwap",
SpiritSwap = "SpiritSwap",
SpookySwap = "SpookySwap",
SushiSwap = "SushiSwap",
Synapse = "Synapse",
WOOFi = "WOOFi",
Yoshi = "Yoshi"
}
export enum OptimismDexFilter {
Curve = "Curve",
Curve_V2 = "Curve_V2",
Saddle = "Saddle",
Synapse = "Synapse",
Synthetix = "Synthetix",
Uniswap_V3 = "Uniswap_V3",
Velodrome = "Velodrome"
}
export enum PolygonDexFilter {
Aave_V2 = "Aave_V2",
ApeSwap = "ApeSwap",
Balancer_V2 = "Balancer_V2",
Curve = "Curve",
Curve_V2 = "Curve_V2",
Dfyn = "Dfyn",
DODO = "DODO",
DODO_V2 = "DODO_V2",
FirebirdOneSwap = "FirebirdOneSwap",
IronSwap = "IronSwap",
Kyber = "KyberDMM",
MeshSwap = "MeshSwap",
QuickSwap = "QuickSwap",
SushiSwap = "SushiSwap",
Synapse = "Synapse",
Uniswap_V3 = "Uniswap_V3",
WaultSwap = "WaultSwap",
WOOFi = "WOOFi"
}
Simply import the network you are targeting and use the filters available.