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

Reference: sushi/evm API

The EVM API module wraps Sushiโ€™s hosted price, quote, and swap APIs.

Exports

ExportPurpose
getPricesFetch all known prices for a chain.
getPriceFetch one token price.
getQuoteFetch a route quote.
getSwapFetch swap transaction data.
QuoteRequest, QuoteResponseQuote request/response types.
SwapRequest, SwapResponseSwap request/response types.
RouteStatusSuccess, NoWay, Partial.
TransferValueFee transfer value mode.
RouterLiquiditySourceRoute source selection.

Price

import { getPrice, getPrices } from 'sushi/evm'
 
const price = await getPrice(1, '0x6B3595068778DD592e39A122f4f5a5cF09C90fE2')
const prices = await getPrices(1)

Quote request

FieldRequiredDescription
chainIdYesSupported swap API chain ID.
tokenInYesInput token address.
tokenOutYesOutput token address.
amountYesRaw input amount.
maxSlippageYesMaximum slippage.
maxPriceImpact, fee, feeReceiver, feeBy, referrer, visualize, baseUrlNoOptional routing, fee, metadata, and API options.

Swap request

FieldRequiredDescription
chainIdYesSupported swap API chain ID.
tokenInYesInput token address.
tokenOutYesOutput token address.
amountYesRaw input amount.
senderYesTransaction sender.
maxSlippageYesMaximum slippage.
maxPriceImpact, source, fee, feeReceiver, feeBy, referrer, recipient, simulate, validate, apiKey, baseUrlNoRouting, fee, execution, simulation, key, and API options.

The SDK builds the URL, calls fetch, and parses the response. Pass standard RequestInit options as the second argument.

await getSwap(params, { signal: abortController.signal })

Success and Partial responses transform token indexes into token objects.