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.
interface RouteOptions {
order?: Order; // 'RECOMMENDED' | 'FASTEST' | 'CHEAPEST' | 'SAFEST'
slippage?: number; // expressed as decimal proportion: 0.03 represents 3%
infiniteApproval?: boolean;
allowSwitchChain?: boolean;
integrator?: string; // string telling us who you are
referrer?: string; // string telling us who referred you to us
fee?: number; // expressed as decimal proportion: 0.03 represents 3%
bridges?: AllowDenyPrefer;
exchanges?: AllowDenyPrefer;
}
​
interface AllowDenyPrefer {
allow?: string[];
deny?: string[];
prefer?: string[];
}
Find out more about integrator fees here.
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 keys in Supported Chains, Bridges, and Exchanges or by fetching the list of supported tools.
E.g. if you only want to use NXTP by Connext as the bridge and don't want to support the exchange 1inch your options could look like this:
const routeOptions = {
bridges: {
allow: ['connext']
},
exchanges: {
deny: ['1inch'],
},
}
The allowSwitchChain property is part of an advanced set of functionalities. You can read more about them in the chapter Advanced Features​
Copy link