> For the complete documentation index, see [llms.txt](https://docs.peach.ag/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.peach.ag/documentation/arc/aggregator/core-features/quotes-and-routing.md).

# 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](https://docs.peach.ag/documentation/arc/aggregator/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

| Field                               | Purpose                                                           |
| ----------------------------------- | ----------------------------------------------------------------- |
| `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

| Field                          | How to use it                                                               |
| ------------------------------ | --------------------------------------------------------------------------- |
| `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](https://docs.peach.ag/documentation/arc/aggregator/core-features/slippage), [Fees](https://docs.peach.ag/documentation/arc/aggregator/core-features/custom-fee-and-slippage) and [Transaction Safety](https://docs.peach.ag/documentation/arc/aggregator/core-features/validation-approvals-and-expiry).

### 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

| Current state                                           | Expected integration behavior                                                                   |
| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| 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](https://docs.peach.ag/documentation/arc/launchpad/core-features/graduation) and the [V4 integration guide](https://docs.peach.ag/documentation/arc/launchpad/core-features/uniswap-v4-hooks/trading-integration).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.peach.ag/documentation/arc/aggregator/core-features/quotes-and-routing.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
