Skip to main content
The Quote Service provides functions for fetching bridge quotes from the LI.FI API, calculating price impact, and managing quote caching.

Exports


Functions

getQuote(params, integrator, autoDeposit?, cache?, timeoutMs?)

Get a single optimal bridge quote.
QuoteParams: Returns: Quote Throws:
  • InvalidQuoteParamsError if parameters are invalid
  • NoRouteFoundError if no route is available
  • QuoteFetchError if API request fails
Example:

getQuotes(params, integrator, autoDeposit?, cache?, timeoutMs?)

Get multiple bridge quotes for comparison.
Returns: QuotesResponse Example:

estimatePriceImpact(fromToken, toToken, fromAmount, toAmount)

Calculate price impact for a swap or bridge.
Returns: PriceImpactResult Severity Thresholds: Example:

invalidateQuoteCache(cache?)

Manually invalidate the quote cache.
Example:

createQuoteCache()

Factory function to create a new cache instance.
Example:

Error Types

QuoteFetchError

Thrown when quote fetching fails.
Example:

InvalidQuoteParamsError

Thrown when quote parameters are invalid.
Example:

NoRouteFoundError

Thrown when no bridge route is available.
Example:

QuoteCache Class

The QuoteCache class manages caching for quote data with a 30-second TTL.

Methods

Example Usage


Types

Quote

Step

Fees

RoutePreference

RouteComparison


Common Patterns

Compare Route Options

Handle High Price Impact

Auto-Refresh Quotes