V4 to V5 Migration
ParaSwap Migration Document for changes from v4 to v5
Here are the important changes from ParaSwap API v4 to v5:
- Renamed Parameters:(Note: only the parameter name has changed, the content remains the same).
X-Partner
(in Headers) →partner
(in query): partner/referrer string.from
→srcToken
(Source Token Address).to
→destToken
(Destination Token Address).fromDecimals
→srcDecimals
(Source Token Decimals).toDecimals
→destDecimals
(Destination Token Decimals)
- Change in Response Body:
- The response body of the /prices endpoint has changed to be uniform for all routing methods:
simpleSwap
,multiPath
, andmegaPath
prices responses. Please infer to this example to understand the response body structure.{"priceRoute": {"blockNumber": 13036269,"network": 1,"src": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","srcDecimals": 18,"srcAmount": "10000000000000000","dest": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","destDecimals": 6,"destAmount": "32704734","bestRoute": [{"percent": 100,"swaps": [{"src": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","srcDecimals": 18,"dest": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","destDecimals": 6,"swapExchanges": [{"exchange": "UniswapV2","srcAmount": "10000000000000000","destAmount": "32704734","percent": 100,"data": {"router": "0x0000000000000000000000000000000000000000","path": ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"],"factory": "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f","initCode": "0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f","feeFactor": 10000,"pools": [{"address": "0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc","fee": 30,"direction": false}],"gasUSD": "9.835332"}}]}]}],"gasCostUSD": "13.700002","gasCost": "111435","side": "SELL","tokenTransferProxy": "0x0000000000000000000000000000000000000000","contractAddress": "0x0000000000000000000000000000000000000000","contractMethod": "swapOnUniswap","partnerFee": 0,"srcUSD": "32.7332000000","destUSD": "32.5799000303","partner": "paraswap","maxImpactReached": false,"hmac": "cf2ac4b20f83b6656eb9dd28e26414658430e1d5"}}
- Other Important changes:
- The
spender
parameter in the response body has been changed to thetokenTransferProxy
parameter. - Everywhere
from
andto
token-parameters are renamed tosrcToken
&destToken
.
- Added Parameters:
slippage
: Could be used instead of destAmount in SELL orders and srcAmount in BUY orders. It will automatically take the quote amount to be the optimal price minus slippage.partnerAddress
: Partner Address.partnerFeeBps
: Used together with Partner Address.Note: Instead ofX-partners
header orreferrer
parameter, usepartner
(if referrer string is available) orpartnerAddress
if partner address is available.
- Removed Parameters:
useReduxToken
: REDUX token has been discontinued in v5.X-Partner
(in Headers).
- Renamed Parameters:
fromDecimals
→srcDecimals
(Source Token Decimals).toDecimals
→destDecimals
(Destination Token Decimals)
- Other Changes:
network
has become a required parameter in/transactions
endpoint.
Last modified 2yr ago