REST API

Overview

The /v1/quote endpoint provides token swap and bridge quotes with detailed transaction information for EVM-compatible chains. It returns both pricing information and the complete transaction data needed to execute the swap.

Endpoint

POST https://wheelx.fi/v1/quote

Request

Request Body Schema

interface QuoteRequest {
  from_chain: number;          // Source chain ID (e.g., 1 for Ethereum)
  to_chain: number;            // Destination chain ID
  from_token: string;          // Source token address
  to_token: string;            // Destination token address
  from_address: string;        // User's wallet address (source)
  to_address: string;          // Recipient address (destination)
  amount: number;              // Amount to swap (in smallest units)
  slippage?: number;           // Optional slippage tolerance (default: auto)
}

Example Request

{
  "from_chain": 1,
  "to_chain": 1,
  "from_token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "to_token": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
  "from_address": "0x742d35Cc6634C0532925a3b8Dc9F6A7c5D3a7C6a",
  "to_address": "0x742d35Cc6634C0532925a3b8Dc9F6A7c5D3a7C6a",
  "amount": 1000000,
  "slippage": 50,
}

Response

Response Schema

interface QuoteResponse {
  request_id: string;          // Unique identifier for this quote
  amount_out: string;          // Expected output amount
  fee: string;                 // Total fee amount
  tx: Tx;                     // Transaction data for execution
  approve?: ApproveAction;     // Optional approval transaction data
  slippage: number;           // Applied slippage percentage
  min_receive: string;        // Minimum amount to receive after slippage
  estimated_time: number;     // Estimated completion time in seconds
  recipient: string;          // Recipient address
  router_type: RouterType;    // Type of operation (swap/bridge/wrap/unwrap)
  price_impact: PriceImpactFormatted; // Detailed fee breakdown
  router: string;             // Router identifier
  created_at: string;         // Quote creation timestamp
  points: string;             // Points earned for this transaction
}

interface Tx {
  to: string;                 // Contract address to interact with
  value: number;              // ETH value to send (for native token swaps)
  data: string;               // Transaction calldata
  chainId?: number;           // Chain ID
  gas?: number;               // Estimated gas limit
  maxFeePerGas?: number;      // Max fee per gas (EIP-1559)
  maxPriorityFeePerGas?: number; // Max priority fee per gas (EIP-1559)
}

interface ApproveAction {
  token: string;              // Token address to approve
  spender: string;            // Spender contract address
  amount: number;             // Amount to approve
}

interface PriceImpactFormatted {
  bridge_fee: string;         // Bridge fee amount
  swap_fee: string;           // Swap fee amount
  dst_gas_fee: string;        // Destination gas fee
}

type RouterType = "swap" | "bridge" | "wrap" | "unwrap";

Example Response

{
  "request_id": "quote_123456789",
  "amount_out": "999500",
  "fee": "500",
  "tx": {
    "to": "0x1234567890123456789012345678901234567890",
    "value": 0,
    "data": "0x1234567890abcdef...",
    "chainId": 1,
    "gas": 210000,
    "maxFeePerGas": 30000000000,
    "maxPriorityFeePerGas": 2000000000
  },
  "approve": {
    "token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "spender": "0x1234567890123456789012345678901234567890",
    "amount": 1000000
  },
  "slippage": 50,
  "min_receive": "999000",
  "estimated_time": 10,
  "recipient": "0x742d35Cc6634C0532925a3b8Dc9F6A7c5D3a7C6a",
  "router_type": "swap",
  "price_impact": {
    "bridge_fee": "0",
    "swap_fee": "500",
    "dst_gas_fee": "0"
  },
  "router": "wheelx",
  "created_at": "2024-01-01T12:00:00Z",
  "points": "10"
}

Last updated