Quotes and Routing
Read prepared quotes and paths, choose providers and retain legacy quote compatibility.
The swap methods return quoted amounts with the prepared trade. Use this page to display those amounts, inspect paths and choose routing providers.
Prepared quotes and routing
Set providers, depth and splitCount at the top level of the swap request; depth and split defaults are 3 and 20. See Quickstart for preparation and Fees for custom-fee settings.
prepared.amountIn
Input amount; compare with the requested order
prepared.expectAmountOut
Expected net recipient output after fees
prepared.amountOut
Gross output before custom fees
prepared.tx.amountOutMin
Validated signed minimum received
prepared.raw.paths
Display-only paths; service strings and string amounts
Each path has provider, adapter, token_in, token_out, direction, fee_rate, amount_in and amount_out. pool and extra_data are optional. A server-whitelisted api.apiKey reveals pool addresses on Allowance; an absent or invalid key does not prevent transaction construction. Do not reconstruct transaction data from display paths.
Use output-token decimals with formatUnits() and preserve integers as bigint or decimal strings. Reuse the confirmed result at submission; another swap preparation requests a new route and requires new confirmation.
Available providers
getAvailableProviders() returns names from the selected service. Pass these strings unchanged. Omitting providers, or passing an empty list, lets the service select enabled providers. Availability does not guarantee liquidity for a particular pair or amount.
Refresh behavior
Ignore responses for superseded orders and disable confirmation while the current request is pending or failed. Follow Transaction Safety for refreshing and reconfirming plans.
Legacy quote reference
Planned deprecation:
find_routes, used bygetQuote()andApiClient.findRoutes(), remains available for compatibility and is planned for future deprecation. No removal date is announced. New integrations should useswapAllowance(),swapPermit2()andswapPermit2Build(). Follow Migration Guide.
The following reference preserves the old display-only contract. It is not a prerequisite for the recommended swap flow. getQuote() returns no transaction. The local RouteDiscovery estimator is no longer exported.
Quote parameters
from, target
ERC20 addresses or NATIVE_TOKEN_ADDRESS
amountIn
Positive exact input amount as bigint in input-token base units; validate the user's amount before calling
options.providers
Optional list of provider strings
options.depth, options.splitCount
Route search controls; SDK defaults are 3 and 20
options.customFee
Optional display fee using feeAccount and feeBps
options.includeResponseHeaders
Defaults to false; when true, adds available response headers to quote.responseHeaders
The service and SDK support exact-input quotes and swaps only. Amounts always use input-token decimals. The SDK sends by_amount_in=true internally and exposes no direction setting. Legacy JavaScript calls that pass byAmountIn: false are rejected before an HTTP request is sent.
A legacy read-only quote does not require a connected wallet. Its amount field is amountIn; swap preparation uses amount.
Quote response
srcToken, dstToken
Returned token addresses; these output fields retain their names and use WBNB for native BNB requests
srcNative, dstNative
Set to true for a native input or output request
amountIn
Input estimate
amountOut
Expected user output after the configured display custom fee
route.totalAmountOut
Gross output before that fee
route.routes[0].steps
The API's route-path steps, including any branching paths, represented in one SDK route container
priceImpact
Route-derived value; not a guaranteed slippage bound
gasEstimate
Display estimate; final wallet/RPC estimation can differ
customFee
Optional receiver, basis points and projected total fee
routerAddress, executionRouterAddress
Optional contract addresses advertised by the route response; use a validated prepared plan for approval and execution
Use formatUnits(value, decimals) for amounts. Avoid converting large integer amounts through JavaScript number.
For old-to-new input and result mappings, see Migration Guide.
Last updated
Was this helpful?