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.
Route Order Options
The different order
options are defined as follows:
RECOMMENDED: This sorting option balances cost and complexity, prioritizing affordable and less complex routes. It first sorts routes based on their cost and then focuses on the top 5% of the routes. These top routes are ranked by considering both their cheapness and ease of use.
FASTEST: This sorting option prioritizes routes with the shortest estimated execution time. Users who value speed and want their transactions to be completed as quickly as possible should choose the fastest routes.
CHEAPEST: This option focuses on minimizing the cost of the transaction, whether in token amount or USD amount (USD amount minus gas cost). Users looking for the most economical option should choose the cheapest routes.
SAFEST: Sorting with this option emphasizes the safety and reliability of the routes. Routes are ranked based on the safety level of the tools (bridges) used in their steps. Users who prioritize security and want to minimize risks associated with their transactions should choose the safest routes. If two routes have the same safety level, they are further ranked based on their speed.
Monetization
As an integrator, you can monetize your LI.FI Widget integration and collect fees. See our monetization guide for more information.
Enable/Disable of Assets/DEXs/Bridges
The inclusion and exclusion of specific bridges, exchanges, and services which 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 List: Chains, Bridges, DEXs, Solvers or by fetching the list of supported tools.
E.g., if you only want to use Connext as the bridge and don't want to support the 1inch exchange your options could look like this:
The allowSwitchChain
property is part of an advanced set of functionalities. You can read more about them in the chapter Advanced Features
Last updated