Both endpoints use the Order object, which is defined as follows:
Field
Description
sell_token
(string) ERC20 token address of the token you want to sell.
buy_token
(string) ERC20 token address of the token you want to buy.
sell_amount
(string) The amount of sell_token (in sell_token base units) you want to send. Assumes the amount is given in WEI.
origin_address
(string) Wallet address with the funds.
receiver
(optional string) Receiver of the funds. Only pass if different from the origin_address
buy_amount
(optional string) The minimum amount of buy_token (in buy_token base units) you want to receive. If the solver can't find a solution with a better buy amount than this, it will fail immediately. Default is 0, meaning that your order will be solved at the current market price.
The parameters needed to call the quote endpoint are the following:
Body Parameter
Description
blockchain
(string) The blockchain on which to obtain quotes for orders.
orders
(list[Order]) A list of Order objects
amms
(optional list[string]) Protocols to include in the solution. By default, this is "+all", which includes all protocols (see AMMs for details).
venue
(optional string) Switch between propeller (classic swap) or helix (intent based swap). Default is propeller
The Orderfor the quote endpoint has an optional origin_address and receiver. If at least the origin_address is passed, the quote might be better than without it because the Solver will be able to tap into market makers (through Hashflow, for example).
Where request_id is the unique ID used to identify the quote. The quotes are displayed in a list in the same order as the request. For each quote, the sell_token, buy_token, sell_amount and buy_amount are returned. gas is a rough gas estimation of what it would take to execute all quotes on chain and target_address is our router address on the target chain. Information on the sell_tokens and buy_tokens is also returned.
The parameters needed to call the solve endpoint are the following:
Body Parameter
Description
blockchain
(string) The blockchain on which to solve the orders.
orders
A list of orders to be solved.
amms
(optional list[string]) Protocols to include in the solution. By default, this is "+all", which includes all protocols (see AMMs for details).
slippage
(optional float) Represents the percentage of acceptable difference between the expected price of an order and the price when the order actually executes. The default value is 0.0005.
return_routes
(optional bool) If the user wants to have information on the solutions' routes in the response or not. Default false (see Routes for more)
Where there is one solution per order that was in the request, the solution is defined by the same parameters as the order (to match order and solution) and the following parameters:
Field
Description
executed_buy_amount
(string) Optimised amount of buy_token that the solver found.
buy_amount
(string) Minimum amount that you will receive for your order, taking slippage into consideration
gas
(string) Estimated gas used in the txs
call_data
(string) Call data used to execute the txs found by the solver. This data is meant to be sent to our Solver Contracts.
target_address
(string) Contract address to send the txs to. This address should match our Solver Contracts.
Information on the sell_tokens and buy_tokens is returned. If return_routes is True, the routes used in each solution will also be returned (see Routes for more information).
Details on parameters:
AMMs
Both Quote and Solve endpoints support the amms input parameter. amms lets you specify a list of protocols to include in the solution. By default, it is ["+all"], which includes all protocols.
If you want to include only a particular protocol, for example uniswap_v2, you would set amms=["+uniswap_v2"]. If you want to exclude only a particular protocol, you would set amms=["+all", "-uniswap_v2"].
If an AMM that is not supported is passed, the API will return a 400 error.
"Unsupported AMM found. Supported AMM's are {"uniswap_v2", ...}."
Return Routes
The return_routes parameter in the Solve endpoint lets you specify if you want to receive the routes included in the swap in a structured format (for example, to display the route to users). By default, it is set to False). If set True, the routes used in each solution will be returned in the response. The routes are aggregated per in_token.
The response from the native_usd_price endpoint looks like:
{"price":3285.82039213321}
Where the price field represents our price for the native token of the given blockchain in USD.
Error messages
The PropellerSolver API follows standard HTTP status codes to indicate success or failure. In case of an error, additional information is provided in the response body to help identify and resolve the issue.
Status: 204 No solution found: Our solvers were not able to find a solution for a given order
Example:
We regret to inform you that we're currently unable to find quote for the provided currency pair.
Status: 404 Not found
Example:
Unsupported AMM found. Supported AMM's are ... - PropellerSolver does not yet support AMM.