Token Swapping (Same/Cross-Chain)

Swap agents are execution-heavy and must prioritise validity and route safety.

is_token_swappable

Example Request
Example Response
{
  "tokenIn": "ETH",
  "tokenOut": "USDC",
  "chainIn": 8453, // optional for same-chain swap
  "chainOut": 8453 // optional for same-chain swap
}
## IF TRADABLE
{
  "tokenIn": "ETH",
  "tokenOut": "USDC",
  "chainIn": 8453,
  "chainOut": 8453,
  "isSwappable": true,
  "checkedAt": "2025-01-14T11:05:44Z"
}


## IF NOT TRADABLE
{
  "tokenIn": "XYZ",
  "tokenOut": "USDC",
  "chainIn": 8453,
  "chainOut": 8453,
  "isSwappable": false,
  "reasonCode": "PAIR_NOT_SUPPORTED",
  "checkedAt": "2025-01-14T11:05:44Z"
}

get_swap_quote

Example Request
Example Response
{
  "tokenIn": "ETH",
  "tokenOut": "USDC",
  "amountIn": 0.75,
  "slippageTolerance": "0.50%",
  "chainIn": 8453,
  "chainOut": 42161
}
{
  "tokenIn": "ETH",
  "tokenOut": "USDC",
  "chainIn": 8453,
  "chainOut": 42161,
  "amountIn": 0.75,
  "expectedAmountOut": 2535.20,
  "priceImpact": "0.28%",
  "quoteExpiresAt": "2025-01-14T11:05:44Z"
}

get_swap_history

Example Request
Example Response
{
  "chainIn": 8453,
  "chainOut": 42161
}
{
  "swaps": [
    {
      "swapId": "swap_662190",
      "tokenIn": "ETH",
      "tokenOut": "USDC",
      "chainIn": 8453,
      "chainOut": 42161,
      "amountIn": 0.50,
      "amountOut": 1695.80,
      "usdFeePaid": 0.75,
      "txHash": "0xabc789...",
      "status": "success",
      "executedAt": "2025-01-14T11:05:44Z"
    },
    {
      "swapId": "swap_661875",
      "tokenIn": "USDC",
      "tokenOut": "ETH",
      "chainIn": 8453,
      "chainOut": 42161,
      "amountIn": 1000.00,
      "amountOut": 0.2934,
      "usdFeePaid": 0.75,
      "txHash": "0xdef456...",
      "status": "success",
      "executedAt": "2025-01-14T11:05:44Z"
    }
  ]
}

get_swap_status

Example Request
Example Response
{
  "orderId": "order_882901"
}
{
  "orderId": "order_882901",
  "status": "bridge_initiated",
  "progress": {
    "currentStep": 3,
    "completedSteps": 2,
    "totalSteps": 4
  },
  "completedSteps": [
    "source_chain_transfer",
    "bridge_initiated"
  ],
  "pendingSteps": [
    "destination_chain_confirmation",
    "funds_delivered"
  ],
  "chainIn": 8453,
  "chainOut": 42161,
  "tokenIn": "USDC",
  "tokenOut": "ETH",
  "amountIn": 1000.00,
  "amountOut": 0.2934,
  "txHash": "0xabc123...",
  "updatedAt": "2025-01-15T10:15:42Z"
}

Last updated