Integrate Fibrous SDK
Best Route
Returns Best Route via Fibrous Finance
The getBestRoute
function finds the optimal trading route for a token swap through Fibrous Finance’s liquidity pools.
Function Signature
Parameters
Parameter | Type | Description |
---|---|---|
amount | BigNumber | Amount to swap, formatted according to token decimals |
tokenInAddress | string | Token address to swap from |
tokenOutAddress | string | Token address to swap to |
chainName | string | Chain name where the transaction will take place |
options | RouteOverrides | Optional parameters for route customization |
RouteOverrides Type
- excludeProtocols: This is where you list the IDs of the AMMs you don’t want to include. For example, if there are certain AMMs you prefer not to use due to high fees or other reasons, you simply put their unique IDs in this list.
- Use supportPairs to get a list of supported AMMs and their IDs.