Exports
Functions
getQuote(params, integrator, autoDeposit?, cache?, timeoutMs?)
Get a single optimal bridge quote.| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
params | QuoteParams | Yes | - | Quote parameters |
integrator | string | Yes | - | Integrator identifier |
autoDeposit | boolean | No | true | Include auto-deposit step |
cache | QuoteCache | No | - | Optional cache instance |
timeoutMs | number | No | 30000 | Request timeout in ms |
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
fromChainId | number | Yes | - | Source chain ID |
toChainId | number | No | 999 | Destination chain ID (HyperEVM) |
fromToken | string | Yes | - | Source token address |
toToken | string | Yes | - | Destination token address |
fromAmount | string | Yes | - | Amount in smallest unit |
fromAddress | string | Yes | - | User’s wallet address |
toAddress | string | No | fromAddress | Destination address |
slippageTolerance | number | No | 0.5 | Slippage as percentage (0.5 = 0.5%) |
routePreference | RoutePreference | No | 'recommended' | Route priority |
Quote
Throws:
InvalidQuoteParamsErrorif parameters are invalidNoRouteFoundErrorif no route is availableQuoteFetchErrorif API request fails
getQuotes(params, integrator, autoDeposit?, cache?, timeoutMs?)
Get multiple bridge quotes for comparison.QuotesResponse
| Property | Type | Description |
|---|---|---|
quotes | Quote[] | Array of quotes (up to 5) |
recommendedIndex | number | Index of recommended quote |
estimatePriceImpact(fromToken, toToken, fromAmount, toAmount)
Calculate price impact for a swap or bridge.| Parameter | Type | Description |
|---|---|---|
fromToken | Token | Source token with price |
toToken | Token | Destination token with price |
fromAmount | string | Input amount (smallest unit) |
toAmount | string | Output amount (smallest unit) |
PriceImpactResult
| Property | Type | Description |
|---|---|---|
priceImpact | number | Price impact as decimal (0.01 = 1%) |
impactPercentage | string | Formatted percentage string |
severity | 'low' | 'medium' | 'high' | 'very_high' | Severity level |
highImpact | boolean | Whether impact exceeds 1% threshold |
| Severity | Impact |
|---|---|
low | < 0.5% |
medium | 0.5% - 1% |
high | 1% - 3% |
very_high | > 3% |
invalidateQuoteCache(cache?)
Manually invalidate the quote cache.createQuoteCache()
Factory function to create a new cache instance.Error Types
QuoteFetchError
Thrown when quote fetching fails.InvalidQuoteParamsError
Thrown when quote parameters are invalid.NoRouteFoundError
Thrown when no bridge route is available.QuoteCache Class
TheQuoteCache class manages caching for quote data with a 30-second TTL.
