Set Route Options
How to whitelist, blacklist, or prefer certain bridges and exchanges.
The RoutesRequest object takes optional RouteOptions. This allows configuring the route calculation further.
1
interface RouteOptions {
2
order?: Order; // 'RECOMMENDED' | 'FASTEST' | 'CHEAPEST' | 'SAFEST'
3
slippage?: number;
4
infiniteApproval?: boolean;
5
allowSwitchChain?: boolean;
6
bridges?: AllowDenyPrefer;
7
exchanges?: AllowDenyPrefer;
8
}
9
​
10
interface AllowDenyPrefer {
11
allow?: string[];
12
deny?: string[];
13
prefer?: string[];
14
}
Copied!
The inclusion and exclusion of specific bridges and exchanges, as well as which services should be preferred, can be controlled via AllowDenyPrefer objects. By allowing/whitelisting (allow) tools only those tools will be used to find the best routes. Tools specified in deny will be blacklisted. You can find all available key in Supported Chains, Bridges and Exchanges​
E.g. if you only want to use NXTP by Connext as the bridge and don't want to support a specific DEX named someDex your options could look like this:
1
const routeOptions = {
2
bridges: {
3
allow: ['connext']
4
},
5
exchanges: {
6
deny: ['1inch'],
7
},
8
}
Copied!
The allowSwitchChain property is part of an advanced set of functionalities. You can read more about them in the chapter Advanced Features​
Copy link