v1
latestOpenAPI 3.1.02026-07-13172871.5 KBAssemble Odos quote into transaction
Provide valid call data for a given quoted path. This is called after calling the sor/quote endpoint and receiving back a quote and pathID.
A quote only lasts for 60 seconds. If it is not assembled in that time, it will not be available to assemble, and the path will need to be quoted again.
Use the information provided by this endpoint directly. Do not try to modify the call data. You will make a mistake and you will end up losing money. We will not provide support for users modifying the call data provided by our API. The data the API provides is directly able to be executed on chain.
Request Body
| Parameter | Description | Required |
|---|---|---|
| userAddr | Address of the user who requested the quote | Yes |
| pathId | ID of the Path returned from the sor/quote/{version} endpoint | Yes |
| simulate | Simulate the transaction to make sure it can actually be executed. This increases the response time to receive transaction data. Defaults to False. | No |
| receiver | Optionally, specify a different receiver address for the transaction output, default receiver is userAddr | No |
Response Body
| Parameter | Description |
|---|---|
| deprecated | If the endpoint or any part of the request is deprecated, this field will be populated with a message. This field is omitted if there is nothing to notify on. |
| blockNumber | Block number the quote was generated for |
| gasEstimate | A very naive gas estimate |
| gasEstimateValue | USD Value of the gasEstimate |
| inputTokens | List of input token addresses and amounts |
| outputTokens | List of output token addresses and amounts |
| netOutValue | USD value of the sum of the output tokens after gas |
| outValues | A list of the output values of the given output tokens. In the same order as the outputTokens list |
| transaction | Transaction data needed for execution |
| simulation | Simulation results |
Transaction
This structure can be signed by a wallet and be executed against the Odos router.
In the smart contract that makes the swap, the data field of the transaction given in the response can be used in a low level call from another contract:
(bool success, bytes memory result) = router.call{value: $ethInput}(data)
Where $ethInput is 0 unless the native coin of the network is an input, in which case the value should be set to the corresponding path input amount. Approvals for ERC20 inputs should be made to the router address prior to the call. The address of the router can be found in the to field of the response, as well as from the /info/router/{version}/{chain_id} endpoint.
| Parameter | Description |
|---|---|
| chainId | The chain ID for the path to execute one |
| gas | Suggested gas limit. Either 2X the naive gas estimate or 10% more than the simulated gas estimate |
| gasPrice | Gas price used to calculate the path |
| value | Input amount of gas token. 0 if the gas token is not one of the inputs |
| to | Odos router address to be used for the transaction |
| from | Source of the executed transaction |
| data | Call data for the Odos router. This is the payload used by our executor contracts to execute the necessary DEX swaps. |
| nonce | The standard ETH nonce |
Simulation
This the result of the simulation
| Parameter | Description |
|---|---|
| isSuccess | If the transaction reverted or not |
| amountsOut | Amounts out when the path was simulated |
| simGasUsed | Gas used by the simulation |
| gasEstimate | Estimate from a eth_estimateGas RPC call for the path |
| simulationError | If a simulation error occurs, it will show up here. |
Request body
Example request
{
"pathId": "95bb963d193cd229a0b4087f34382ea2",
"simulate": false,
"userAddr": "0x47E2D28169738039755586743E2dfCF3bd643f86"
}Response
Successful Response