GET /v1/shortcuts/quote
If the EoA doesn't hold enough funds or allowance to execute the transaction, the route endpoint won't be able to calculate the best route.
The quote endpoint is a fast way to get the amount of tokenOut that will be received, without the need of holding the funds or allowance.
Request
Query Param | Description | Example |
---|---|---|
fromAddress | Ethereum address of the wallet to send the transaction from (It could be an EoA, or a Smart Wallet) | tokenIn=0x6b175474e8909... |
tokenIn | Ethereum address of the token to swap or enter into a position from | tokenIn=0x6b175474e8909... |
amountIn | Amount of tokenIn to swap in wei | amountIn=100000000000 |
tokenOut | Ethereum address of the token to swap or enter into a position to | tokenOut=0x182b723a587... |
priceImpact | Flag that indicates whether to calculate and return the price impact of the transaction | priceImpact=true |
chainId | (Optional) The chainId of the network. Default value is 1 for Mainnet | chainId=1 |
fee | (Optional) Fee in basis points. Must be in range 0-100. If specified, this percentage of amountIn value will be sent to feeReceiver | fee=100 (1%) |
feeReceiver | (Optional) Ethereum address that will receive the collected fee amount if fee was provided. | feeReceiver=0x220866B1A22... |
Response
It returns an object with the following parameters:
Field | Description |
---|---|
amountOut | Estimated amount out received |
route | The route of the transaction |
gas | An estimation on how much gas will be spent |
feeAmount | An Array containting all the collected fee amounts for each amountIn input (Only if fee was provided). |
Examples
Quote ETH to stETH
Get a quote for spending 1 ETH for stEth
Request:
https://api.enso.finance/api/v1/shortcuts/quote?chainId=1&fromAddress=0xd8da6bf26964af9d7eed9e03e53415d37aa96045&tokenIn=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&tokenOut=0xae7ab96520de3a18e5e111b5eaab095312d7fe84&amountIn=1000000000000000000
Response:
(Response route may differ)
{
"amountOut": "1001537694734262349",
"gas": {
"_hex": "0x04cb07",
"_isBigNumber": true
},
"route": [
{
"action": "router",
"protocol": "enso",
"tokenIn": ["0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
"tokenOut": ["0xae7ab96520de3a18e5e111b5eaab095312d7fe84"],
"positionInId": ["1:0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"],
"positionOutId": [
"1:0xae7ab96520de3a18e5e111b5eaab095312d7fe84:0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
]
}
]
}