GET /v1/shortcuts/quote

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 ParamDescriptionExample
fromAddressEthereum address of the wallet to send the transaction from (It could be an EoA, or a Smart Wallet)tokenIn=0x6b175474e8909...
tokenInEthereum address of the token to swap or enter into a position fromtokenIn=0x6b175474e8909...
amountInAmount of tokenIn to swap in weiamountIn=100000000000
tokenOutEthereum address of the token to swap or enter into a position totokenOut=0x182b723a587...
priceImpactFlag that indicates whether to calculate and return the price impact of the transactionpriceImpact=true
chainId(Optional) The chainId of the network. Default value is 1 for MainnetchainId=1
fee(Optional) Fee in basis points. Must be in range 0-100. If specified, this percentage of amountIn value will be sent to feeReceiverfee=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:

FieldDescription
amountOutEstimated amount out received
routeThe route of the transaction
gasAn estimation on how much gas will be spent
feeAmountAn 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"
			]
		}
	]
}