Token Swapping (Same/Cross-Chain)

circle-info

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

is_token_swappable

Example Request
Example Response
{
  "tokenIn": "WETH",
  "tokenOut": "USDC",
  "chainIn": 8453, // should accept both chain name and chain id
  "chainOut": 8453 // should accept both chain name and chain id
}
## IF TRADABLE
{
  "tokenIn": {
    "symbol": "WETH",
    "address": "0x4200000000000000000000000000000000000006",
    "chainId": 8453,
    "chainName": "Base"
  },
  "tokenOut": {
    "symbol": "USDC",
    "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "chainId": 8453,
    "chainName": "Base"
  }
  "isSwappable": true,
  "isCrossChain": false,
  "checkedAt": "2025-01-14T11:05:44Z"
}


## IF NOT TRADABLE
{
  "tokenIn": {
    "symbol": "XYZ",
    "address": "0x5100000000000000000000000000000000000006",
    "chainId": 8453,
    "chainName": "Base"
  },
  "tokenOut": {
    "symbol": "USDC",
    "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "chainId": 8453,
    "chainName": "Base"
  }
  "isSwappable": false,
  "isCrossChain": false,
  "reasonCode": "PAIR_NOT_SUPPORTED",
  "checkedAt": "2025-01-14T11:05:44Z"
}

get_swap_quote

Example Request
Example Response
{
  "tokenIn": "WETH", // should accept both token symbol and token address
  "tokenOut": "USDC", // should accept both token symbol and token address
  "amountIn": 0.75,
  "slippageTolerance": "0.50%",
  "chainIn": 8453, // should accept both chain name and chain id
  "chainOut": 42161 // should accept both chain name and chain id
}
{
  "tokenIn": {
    "symbol": "WETH",
    "address": "0x4200000000000000000000000000000000000006",
    "chainId": 8453,
    "chainName": "Base",
    "amount": 0.75,
    "usdValue": 2535.10
  },
  "tokenOut": {
    "symbol": "USDC",
    "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "chainId": 42161,
    "chainName": "Arbitrumn One",
    "expectedAmount": 2535.20,
    "minimumReceivedAmount": 2533.90,
    "minimumReceivedUsdValue": 2533.80
  }
  "priceImpact": "0.28%",
  "quoteExpiresAt": "2025-01-14T11:05:44Z"
}

get_swap_history

Example Request
Example Response
{
  "chainIn": 42161, // leave empty to show all chains, should accept both chain name and chain id
  "chainOut": 8453 // leave empty to show all chains, should accept both chain name and chain id
}
{
  "swaps": [
    {
      "swapId": "swap_662190",
      "tokenIn": {
        "symbol": "WETH",
        "address": "0x4200000000000000000000000000000000000006",
        "chainId": 8453,
        "chainName": "Base",
        "amount": 0.50,
        "usdValue": 1695.70
      },
      "tokenOut": {
        "symbol": "USDC",
        "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "chainId": 42161,
        "chainName": "Arbitrum One",
        "amount": 1695.80,
        "usdValue": 1695.70
      },
      "usdFeePaid": 0.75,
      "txHash": "0xabc789...",
      "status": "success",
      "executedAt": "2025-01-14T11:05:44Z"
    },
    {
      "swapId": "swap_661875",
      "tokenIn": {
        "symbol": "USDC",
        "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "chainId": 8453,
        "chainName": "Base",
        "amount": 1000.00,
        "usdValue": 999.90 
      },
      "tokenOut": {
        "symbol": "WETH",
        "address": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
        "chainId": 42161,
        "chainName": "Arbitrum One",
        "amount": 0.2934,
        "usdValue": 999.90 
      },
      "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"
  ],
  "tokenIn": {
    "symbol": "USDC",
    "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "chainId": 8453,
    "chainName": "Base",
    "amount": 1000.00,
    "usdValue": 999.90
  },
  "tokenOut": {
    "symbol": "WETH",
    "address": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
    "chainId": 42161,
    "chainName": "Arbitrum One",
    "amount": 0.2934,
    "usdValue": 999.90
  },
  "txHash": "0xabc123...",
  "updatedAt": "2025-01-15T10:15:42Z"
}

Last updated