The parameters needed to call the quote endpoint are the following:
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.
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:
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.
Where the splits represent the percentage of sell amount that goes into each pool.
Fee and Fee Receiver
The fee and fee_receiver parameters let you specify the fee percentage (as a value between 0 and 1, where 1 signifies a fee of 100%) and receiver wallet of the fee respectively. By setting the fee parameter of the swap, additional gas will be necessary in order to perform the fee transfer. This will be reflected in a higher gas value in the response of both the /quote and /solve endpoints.
Fee taking is only available on Ethereum Mainnet. To use the fee taking feature, please use the latest Router contract ethereum address: 0x6F67D2b294eAFCD10c420Af9cCdE99ddE7aBE41a. See here all the addresses.
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.
(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.
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
fee
(optional float) Percentage of the swap to be taken as a fee to be sent to the fee receiver, specified as a value between 0 and 1 where 1 would signify a fee of 100%. Default 0 (see Fee and Fee Receiver for more)
fee_receiver
(optional string) Address of the wallet which will receive the fee
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)
fee
(optional float) Percentage of the swap to be taken as a fee to be sent to the fee receiver, specified as a value between 0 and 1 where 1 would signify a fee of 100%. Default 0 (see Fee and Fee Receiver for more)
fee_receiver
(optional string) Address of the wallet which will receive the fee
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.
blockchain
(string) The blockchain on which to obtain the tokens
limit
(int) The number of results per page
page
(int) Which page number containing results to view
address
(string) The address of the token.
symbol
(string) The symbol of the token.
name
(string) The name of the token
decimals
(int) The number of decimal places used in the token contract
icon_url
(string) A link to an image representation of the token
volume_24_hr
(int) The total volume of this token traded on-chain in the last 24 hours
blockchain
(string) The blockchain of the token for which we would like the price of.
token_address
(string) The address of the token that we would like the price of
blockchain
(string) The blockchain of the native token for which we would like the USD price of.