You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently 1inch etc must be using some complex logic to calculate swap estimated outputs for their frontend/api for SPv2 pools, now that we have an easy swapQuote endpoint we should reach out and make this easier for them
Returns estimated swap output for swapping InputToken * InputUnits -> OutputToken via SpartanProtocol V2 AMM. inputUnits type is WEI (not units). So if you want to swap 1.00 BNB/unit you would enter 1000000000000000000.
The return amount is also in WEI as a string, so interfaces will need to convert from WEI -> units for users.
When swapping to/from BNB you can enter either the WBNB address (0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c) or the BNB address (0x0000000000000000000000000000000000000000) the API will convert both to the corresponding correct WBNB pool.
Request
GET https://api.spartanprotocol.org/api/v1/swapQuote?inputAddr=0x55d398326f99059fF775485246999027B3197955&outputAddr=0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56&inputUnits=100000000000000000000
Response
"100019501036169151511"
The text was updated successfully, but these errors were encountered:
Currently 1inch etc must be using some complex logic to calculate swap estimated outputs for their frontend/api for SPv2 pools, now that we have an easy swapQuote endpoint we should reach out and make this easier for them
Endpoint details below 👇
/v1/swapQuote?inputAddr=0x...&outputAddr=0x...&inputUnits=100000000000000000000
Returns estimated swap output for swapping InputToken * InputUnits -> OutputToken via SpartanProtocol V2 AMM.
inputUnits
type is WEI (not units). So if you want to swap 1.00 BNB/unit you would enter 1000000000000000000.The return amount is also in WEI as a string, so interfaces will need to convert from WEI -> units for users.
When swapping to/from BNB you can enter either the WBNB address (0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c) or the BNB address (0x0000000000000000000000000000000000000000) the API will convert both to the corresponding correct WBNB pool.
Request
GET https://api.spartanprotocol.org/api/v1/swapQuote?inputAddr=0x55d398326f99059fF775485246999027B3197955&outputAddr=0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56&inputUnits=100000000000000000000
Response
"100019501036169151511"
The text was updated successfully, but these errors were encountered: