Quote object
This page is also Markdown, for agents: /dex-aggregator/reference/quote.md, and /llms.txt lists every page.
A quote is one DEX’s route for your swap, with everything needed to execute it.
| Field | Type | Description |
|---|---|---|
dex_id |
string | The DEX that found this route |
estimated_amount |
amount | Expected result. {"amount_out": "..."} if you sent amount_in, {"amount_in": "..."} if you sent amount_out |
worst_case_amount |
amount | Result at the slippage limit: the minimum output, or the maximum input. Same shape as estimated_amount. Equal to estimated_amount for Wrap quotes, which have no slippage |
discount |
amount, optional | What a fee discount saves on this route: {"amount_out": "..."} of extra output if you sent amount_in, {"amount_in": "..."} off the input if you sent amount_out. Already included in estimated_amount and worst_case_amount. Missing if the route has no fee discount |
execution_instructions |
array | Transactions to sign, in order. See Executing a route |
token_output |
token ID | Where the output tokens end up. If it differs from your token_out, a second step is needed |
estimated_gas_usage |
string | Expected gas fee in yoctoNEAR, to show to the user |
estimated_max_gas_cost |
string | Gas fee that is attached. A part of it will be refunded |
storage_deposits |
string | yoctoNEAR attached to storage deposits. Usually only non-zero the first time the trader uses a token or DEX |
fee_amount |
string | What the route’s fee transactions pay out of the wallet balance of the input token (wNEAR for NEAR), in its smallest unit. "0" without fee transactions. Pass it to /route/outcome |
signing |
object, optional | The nonce and block hash to sign the transactions with. Only with trader_account_id and signing_public_key in the request, once the key is on chain |
needs_unwrap |
boolean | Deprecated, always false. Use token_output instead |
All token amounts and NEAR amounts are strings, to avoid losing precision in JSON. Parse them as big integers.
Amount
Section titled “Amount”{ "amount_in": "1000000000000000000000000" }{ "amount_out": "4880007" }Exactly one key, with the raw amount in the token’s smallest unit.
Execution instruction
Section titled “Execution instruction”{ "NearTransaction": { "receiver_id": "wrap.near", "actions": [ { "FunctionCall": { "method_name": "near_deposit", "args": "e30=", "gas": 5000000000000, "deposit": "1000000000000000000000000" } } ], "is_fee_transaction": false }}| Field | Type | Description |
|---|---|---|
receiver_id |
account ID | Contract to send the transaction to |
actions[].FunctionCall.method_name |
string | Method to call |
actions[].FunctionCall.args |
string | Base64-encoded JSON arguments |
actions[].FunctionCall.gas |
number | Gas to attach |
actions[].FunctionCall.deposit |
string | yoctoNEAR to attach |
is_fee_transaction |
boolean | Pays referral fees after the swap. Fee transactions are always the last ones. Send them only if /route/outcome of the transactions before them says charge_fee. See fee transactions |
NearTransaction is the only instruction kind, and FunctionCall the only action kind, for now. Treat anything else as an error.
Signing
Section titled “Signing”{ "nonce": 220599934000001, "block_hash": "5LBYTk45a9txMX73nHumpddPaP4og374UJr14fBRCaqC" }| Field | Type | Description |
|---|---|---|
nonce |
number | The nonce of signing_public_key as of the latest block when the routes were found. The first transaction takes nonce + 1 |
block_hash |
string | A recent final block’s hash |
A live quote is only sent again when routes change, so a transaction the key sent since can make nonce stale, which is an edge case you might have to handle. A web dApp doesn’t need to care, since wallet is the one signing, and if you’re integrating DEX Aggregator into a wallet, you probably track nonces anyway, so that shouldn’t be an issue, you can just ignore this and sign with whatever nonce / block hash you have.