Upgrade from v1 to v2

This page will give you an overview on the steps necessary to transition from v1 to v2
This guide will focus on upgrading your current setup from the v1 of the Propeller API to v2, it will only help you to get the 200 responses back, but not go into details like optional parameters. For these, please refer to the API Reference v2.
The request in the quote endpoint is the only one that needs to be adjusted. The solve endpoint can be handled the same.

Request

The endpoint changed from being GET to POST.
The individual header inputs of the quote endpoint were reduced to an order object in the body. Instead of submitting all parameters in the header of the request, an Order parameter containing the parameters' described in the documentation should be implemented. Please notice that the sell_amount can only be passed in WEI and not as a float as in v1.

V1 request

curl -X 'GET' \
'https://api.propellerheads.xyz/v1/solver/quote?blockchain=ethereum&sell_token=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&buy_token=0x6B175474E89094C44Da98b954EedeAC495271d0F&sell_amount=100000000' \
-H 'accept: application/json' \
-H 'amms: +all' \
-H 'origin_address: "0x0000000000000000000000000000000000000000'

V2 request

curl -X 'POST' \
'https://api.propellerheads.xyz/v2/solver/quote?blockchain=ethereum' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"orders": [
{
"sell_token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"buy_token": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"sell_amount": "100000000"
}
]
}'

Response

The response of the quote endpoint changed to have the data encapsulated under a separate entry named quotes. bought and bought_integer are not longer part of the response at all, in their place there is now buy_amount.

V1 Response

{
request_id: "quote-3b66116c",
bought: "99.676294448336757728",
bought_integer: 99676294448336757728
gas: 132000
buy_tokens: {
"symbol": "DAI",
"decimals": "18",
"address": "0x6B175474E89094C44Da98b954EedeAC495271d0F"
},
sell_tokens: {
"symbol": "USDC",
"decimals": "6",
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
},
}

V2 Response

{
"request_id": "quote-0868c67b",
"quotes": [
{
"sell_token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"buy_token": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"sell_amount": "100000000",
"buy_amount": "99676294448336757728",
"external_id": "0"
}
],
"gas": 74100,
"buy_tokens": [
{
"symbol": "DAI",
"decimals": "18",
"address": "0x6B175474E89094C44Da98b954EedeAC495271d0F"
}
],
"sell_tokens": [
{
"symbol": "USDC",
"decimals": "6",
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
}
]
}