v1

latestOpenAPI 3.0.02026-07-22243670.8 KB
Swap

Preview a swap

Reads preview(inputToken, amount) on the Superstate swap contract and returns the quote: the input amount to pay, the fee charged on it and the output amount to receive.

get/v1/swap/preview

Query parameters

contract_addressstring required
Example:0x742d35cc6634c0532925a3b844bc9e7595f0beb1

The swap contract address

chainstring required
Example:ethereum_sepolia

The EVM chain to read from, e.g. ethereum_mainnet, ethereum_sepolia, base_mainnet or base_sepolia

input_tokenstring required
Example:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48

The input token contract address

amountstring required
Example:1000000

Amount of the input token to swap, as a uint256 decimal string in the input token's smallest unit

Response

Successful response.

feestring required

Fee charged on the swap, as a uint256 decimal string in the input token's smallest unit

object'swap_preview' required

String representing the object's type. Objects of the same type share the same value.

pay_input_amountstring required

Amount of the input token to pay, as a uint256 decimal string in the input token's smallest unit

receive_output_amountstring required

Amount of the output token to receive, as a uint256 decimal string in the output token's smallest unit

Example response

{
  "fee": "1000",
  "pay_input_amount": "1000000",
  "receive_output_amount": "999000"
}