> 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/bsc/aggregator/editor/quotes-and-routing.md).

# Quotes and Routing

Display quotes, select providers and carry routing choices into preparation.

Use `getQuote()` to display and refresh prices and routes. It requests routes from the Aggregator and returns no executable transaction. v0.3.0 no longer exports the local `RouteDiscovery` estimator; use `getQuote()` for supported route discovery.

### Quote parameters

| Input                                 | Purpose                                                                                                      |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `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.

Use the `getQuote()` snippet from [Quickstart](https://docs.peach.ag/documentation/bsc/aggregator/quickstart). For a read-only page, construct `PeachClient` with a JSON-RPC provider; quoting does not require connecting a wallet.

### Quote response

| Field                                     | Display usage                                                                                                          |
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `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`.

### Available providers

`getAvailableProviders()` returns provider names from the selected Aggregator. Keep these strings as supplied by the service. Omitting the filter lets the service select its enabled providers. An empty list is also omitted by the current serializer.

Provider availability does not guarantee liquidity for a pair or amount. Refresh the provider list when an integration reports no routes. Do not use a closed SDK enum as the list of currently supported providers.

### From quote to execution

Assign each edit a new revision. Show a result only if its revision matches the current order, and disable confirmation while the current preview is pending or failed. v0.3.0 does not expose a per-call `AbortSignal`; ignoring stale responses is application logic.

At confirmation, reuse the original order inputs using this mapping:

<table><thead><tr><th width="218.76953125">getQuote() input</th><th>Preparation input</th></tr></thead><tbody><tr><td><code>from</code>, <code>target</code></td><td><code>from</code>, <code>target</code></td></tr><tr><td><code>amountIn</code></td><td><code>amount</code></td></tr><tr><td><code>options.providers</code></td><td><code>providers</code></td></tr><tr><td><code>options.depth</code></td><td><code>depth</code></td></tr><tr><td><code>options.splitCount</code></td><td><code>splitCount</code></td></tr><tr><td><code>options.customFee</code></td><td><code>customFeeReceiver</code> and <code>customFeeBps</code>, as described in <a href="https://docs.peach.ag/documentation/bsc/aggregator/editor/fees-slippage-and-settlement">Fees</a></td></tr></tbody></table>

Keep the original native sentinel when reusing token inputs; `quote.srcToken` and `quote.dstToken` are normalized addresses. `slippageBps`, `deadlineSecs`, payer, executor and recipient are preparation settings, not quote options.

Preparation searches again. Review the fresh terms and follow [Transaction Safety](https://docs.peach.ag/documentation/bsc/aggregator/editor/validation-approvals-and-expiry) when inputs change.


---

# 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/bsc/aggregator/editor/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.
