Overview
The Route endpoint finds the optimal trading path through Fibrous Finance’s liquidity pools to maximize output and minimize slippage. This endpoint is available across all supported networks.Supported Networks
- Base
- HyperEVM
- Scroll
- Monad
- Starknet
Request Parameters
The amount of input tokens in wei format (for EVM chains) or the smallest unit for the token.Example:
"1000000000000000000" for 1 token with 18 decimalsThe contract address of the input token.
- Base/HyperEVM/Scroll/Monad
- Starknet
Use
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE or 0x0000000000000000000000000000000000000000 for native tokensThe contract address of the output token.
Maximum acceptable slippage in percentage (0.1 to 100).Example:
0.5 for 0.5% slippage toleranceThe destination address to receive the output tokens. If not provided, defaults to the sender address.
Array of protocol IDs to exclude from routing.
If true, only direct swaps will be considered (no multi-hop routes).
Response
Indicates if the route was successfully found
Type of swap route (0 = standard)
Information about the input token
Information about the output token (same structure as inputToken)
The amount of input tokens in wei format
The expected amount of output tokens in wei format
Time taken to calculate the route (in seconds)
Estimated gas units for the transaction
Estimated gas cost in USD
Array of route segments showing how the swap is split
Indicates if this is an initial route calculation
Example Request
Example Response
Best Practices
-
Fresh Routes
- Always fetch a new route before executing a swap
- Routes can become stale due to market movements
- Typical validity: 30-60 seconds depending on market volatility
-
Slippage Settings
- Stable pairs: 0.1% - 0.5%
- Volatile pairs: 1% - 3%
- Low liquidity tokens: 3% - 5%
-
Gas Optimization
- Use
direct: truefor major token pairs - Consider gas costs vs. price improvement for small amounts
- Exclude high-gas protocols when optimizing for speed
- Use
-
Error Handling
- Implement retry logic with exponential backoff
- Check for insufficient liquidity errors
- Validate token addresses before calling
Network-Specific Notes
Base Network
Base Network
- Native token: ETH
- Common tokens: USDC, USDbC, WETH, DAI
- Average block time: ~2 seconds
HyperEVM
HyperEVM
- Native token: HYPE
- Common tokens: USDC, WHYPE
- Average block time: ~2 seconds
Scroll
Scroll
- Native token: ETH
- Common tokens: USDC, WETH
- Average block time: ~3 seconds
Starknet
Starknet
- Native token: ETH
- Common tokens: USDC, STRK
- Uses Cairo VM (different address format)
- See Starknet-specific documentation
Related Endpoints
- Execute - Execute the swap using the route
- Calldata - Get transaction calldata
- Health Check - Check API status