Quotes and Routing
Get the quote and transaction together, and configure service-side routing.
How routing works
A provider is a liquidity source enabled by the API. A pool is an individual trading venue within a source. A path describes a leg of the selected route; a route may split the input across paths or connect pools through intermediate tokens.
Start with the default routing settings and all available providers. Restrict providers only when the application needs that restriction: excluding sources can remove usable routes. More depth or splits does not guarantee a better executable result. Compare the returned amounts for the actual order and consider gas separately.
Quote and transaction in one request
Call arc.swap() with the order and execution settings. It returns PreparedDirectSwap with quote amounts and a validated transaction, without approving tokens, signing or broadcasting. See Quickstart for the complete example.
Use token base units: 100000n represents 0.1 token with 6 decimals. arc.getTokenInfo(token, owner?) reads metadata and an optional balance; arc.getBalance(token, user) returns bigint. Native-sentinel balance reads do not enable native Arc swaps.
Request options
from, target
Input and output ERC-20 addresses
amount
Positive exact-input bigint in input-token base units
executor
Wallet that submits the swap
payer, recipient
Default to executor; Direct payer must equal executor
depth, splitCount
Maximum route depth and split count; defaults 3 and 20
providers
Optional provider filter; omitted/empty allows server selection
slippageBps, deadlineSecs
Tolerance and requested validity; defaults 50 bps and 120 seconds
customFeeBps, customFeeReceiver
Output-side custom fee
signal
Optional AbortSignal for the HTTP request
All routing and execution settings are top-level fields. arc.getAvailableProviders(signal?) discovers enabled sources; preserve returned identifiers. A provider's availability does not guarantee liquidity for a specific pair or amount. Depth and split count are search controls, not promises about the exact route.
Read and display the result
amountIn
Input amount; compare with the order and display using input-token decimals
amountOut
Gross route output before aggregator custom fee
expectAmountOut
Expected net recipient output
tx.amountOutMin
Signed minimum received; display directly without deducting slippage again
quoteId, planHash
Identifiers for this quote and signed plan
approvalSpender
Validated Direct approval target
execution.plan.deadline
Signed expiry in Unix seconds
execution
Decoded signed plan, route and settlement data
tx.to, tx.data, tx.value
Transaction data to submit unchanged
Use formatUnits for output display and bigint for arithmetic. Keep network gas separate from token output. Do not deduct custom fees again from expectAmountOut or the signed minimum. Route execution data is part of the returned signed transaction; do not construct or splice in alternate paths.
Confirm the returned result
Show expected net output, the signed minimum, recipient and fee terms. After acceptance, approve if needed and submit the same prepared result. A separate executor uses prepareDelegatedSwap → payer signature → buildDelegatedSwap; preparation returns the quote and build reuses its plan.
Cancel superseded requests and ignore late responses. Bind the result to the current tokens, amount, accounts, network, recipient, routing, fees and slippage. If those inputs change or the plan expires, obtain and confirm a new result. Never silently replace a confirmed result with a worse one or raise tolerance automatically.
See Slippage, Fees and Transaction Safety.
Amount direction
Arc Aggregator currently supports fixed-input swaps only. amount is the amount of the input token to spend, expressed in its base units. The quote estimates the output; slippage sets the minimum output accepted during execution.
Graduation and missing liquidity
Curve trading is open
Allow LAUNCHPAD routes
Curve ready/closed, or funds swept but pool not created
Explain the transition and refresh state; do not keep submitting the old curve route
Pool created but not yet indexed
Keep checking route availability; the on-chain status alone does not establish API availability
Pool active and indexed
Allow UNISWAPV4 routes
getAvailableProviders() discovers enabled sources, not token-specific liquidity. If a graduated token returns 5010, inspect filters first, then the official pool, liquidity and indexer progress. See Graduation and the V4 integration guide.
Last updated
Was this helpful?