Quote object
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 |
has_slippage |
boolean | false if the result is guaranteed (staking, wrapping), true for AMM swaps |
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 |
deadline |
string | null | ISO 8601 time after which the quote is invalid. Currently always null |
estimated_gas_usage |
string | Expected gas fee in yoctoNEAR, to show to the user |
estimated_max_gas_cost |
string | Gas fee in yoctoNEAR if all attached gas is burnt |
storage_deposits |
string | yoctoNEAR attached to storage deposits. Usually only non-zero the first time the trader uses a token or DEX |
max_storage_deposits |
string | Deprecated, always equal to storage_deposits |
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" } } ] }}| 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 |
NearTransaction is the only instruction kind, and FunctionCall the only action kind, for now. Treat anything else as an error.