Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Guide: Get a Swap Quote

Use getQuote from sushi/evm to get an EVM swap quote without building transaction calldata.

import { ChainId } from "sushi";
import { getQuote } from "sushi/evm";
 
const quote = await getQuote({
  chainId: ChainId.ETHEREUM,
  tokenIn: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
  tokenOut: "0x6B3595068778DD592e39A122f4f5a5cF09C90fE2",
  amount: 1_000_000_000_000_000_000n,
  maxSlippage: 0.005,
});
 
if (quote.status === "Success") {
  console.log(quote.assumedAmountOut);
}

Request fields

FieldRequiredDescription
chainIdYesSupported EVM swap API chain ID.
tokenInYesInput token address.
tokenOutYesOutput token address.
amountYesRaw input amount in token base units.
maxSlippageYesMaximum slippage as a decimal number.
maxPriceImpactNoMaximum accepted price impact.
feeNoIntegration fee amount.
feeReceiverNoAddress receiving the fee.
feeByNoWhether fee is taken from input or output.
referrerNoCustom referrer string.
visualizeNoInclude route visualization data.
baseUrlNoOverride API base URL.

amount is not a human decimal. Use raw units such as wei for ETH.

Response statuses

StatusMeaning
SuccessA complete route was found.
PartialA route exists but may not fully satisfy the request.
NoWayNo route was found.

Success and Partial responses include tokens, prices, price impact, amountIn, and assumedAmountOut. NoWay responses only indicate that no suitable route was found.