{
  "openapi": "3.1.0",
  "info": {
    "title": "QIEDEX API",
    "version": "0.2.0",
    "description": "Public, read-only data and swap-quote API for QIEDEX (Uniswap V2-style AMM) on QIE Blockchain (chain id 1990). All data is read directly from QIE mainnet. Factory 0x8E23128a5511223bE6c0d64106e2D4508C08398C, Router 0x08cd2e72e156D8563B4351eb4065C262A9f553Ef. Amounts are decimal strings; USD values are numbers. Rate limited per IP (default 120 req/min). Swap endpoints (/quote, /swap) return quotes and UNSIGNED transactions only: the API never signs, holds keys or sends anything. They also draw from a second per-IP bucket (default 60 req/min) because they read live chain state."
  },
  "servers": [
    {
      "url": "https://api.dex.qie.digital"
    },
    {
      "url": "http://localhost:8080"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "summary": "Indexer status",
        "responses": {
          "200": {
            "description": "Indexer head, lag and counts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/summary": {
      "get": {
        "summary": "DEX totals: TVL and 24h/7d/30d volume",
        "responses": {
          "200": {
            "description": "Summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Summary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/pairs": {
      "get": {
        "summary": "All pairs with token metadata, reserves, price, liquidity (USD) and 24h volume",
        "parameters": [
          {
            "name": "include_excluded",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Include pools with tokens on the test/exclusion list"
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "liquidity",
                "volume"
              ]
            },
            "description": ""
          },
          {
            "name": "include_dust",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "false = hide zero-TVL/dust pools"
          }
        ],
        "responses": {
          "200": {
            "description": "Pairs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/pairs/{address}": {
      "get": {
        "summary": "One pair",
        "parameters": [
          {
            "name": "address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$"
            },
            "description": ""
          }
        ],
        "responses": {
          "200": {
            "description": "Pair",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pair"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/tokens": {
      "get": {
        "summary": "All tokens with USD price and liquidity",
        "parameters": [
          {
            "name": "include_excluded",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Include pools with tokens on the test/exclusion list"
          }
        ],
        "responses": {
          "200": {
            "description": "Tokens",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/tokens/{address}": {
      "get": {
        "summary": "One token",
        "parameters": [
          {
            "name": "address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$"
            },
            "description": ""
          }
        ],
        "responses": {
          "200": {
            "description": "Token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Token"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/trades": {
      "get": {
        "summary": "Recent swaps (newest first)",
        "parameters": [
          {
            "name": "pair",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$"
            },
            "description": ""
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 50
            },
            "description": ""
          },
          {
            "name": "before_block",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Pagination cursor"
          },
          {
            "name": "include_excluded",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Include pools with tokens on the test/exclusion list"
          }
        ],
        "responses": {
          "200": {
            "description": "Trades",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/candles": {
      "get": {
        "summary": "OHLCV candles from executed swaps",
        "parameters": [
          {
            "name": "pair",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$"
            },
            "description": ""
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "1m",
                "5m",
                "15m",
                "1h",
                "4h",
                "1d",
                "1w"
              ],
              "default": "1h"
            },
            "description": ""
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "unix seconds"
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": ""
          },
          {
            "name": "quote",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "token1",
                "usd"
              ],
              "default": "token1"
            },
            "description": ""
          },
          {
            "name": "invert",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Price token0 in token1 terms inverted (base=token1)"
          }
        ],
        "responses": {
          "200": {
            "description": "Candles",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/coingecko/pairs": {
      "get": {
        "summary": "CoinGecko DEX: pairs",
        "responses": {
          "200": {
            "description": "ticker_id/base/target/pool_id list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/coingecko/tickers": {
      "get": {
        "summary": "CoinGecko DEX: 24h tickers",
        "responses": {
          "200": {
            "description": "Tickers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/coingecko/orderbook": {
      "get": {
        "summary": "CoinGecko DEX: synthetic order book from AMM reserves (x*y=k, 0.3% fee)",
        "parameters": [
          {
            "name": "ticker_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "BASE_TARGET token addresses, or pool address"
          },
          {
            "name": "depth",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "0 = full; else levels per side = depth/2"
          }
        ],
        "responses": {
          "200": {
            "description": "Order book",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/coingecko/historical_trades": {
      "get": {
        "summary": "CoinGecko DEX: historical trades",
        "parameters": [
          {
            "name": "ticker_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": ""
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "buy",
                "sell"
              ]
            },
            "description": ""
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000
            },
            "description": ""
          },
          {
            "name": "start_time",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "unix s or ms"
          },
          {
            "name": "end_time",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": ""
          }
        ],
        "responses": {
          "200": {
            "description": "Trades",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/cmc/summary": {
      "get": {
        "summary": "CoinMarketCap DEX style summary",
        "responses": {
          "200": {
            "description": "Summary list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/cmc/ticker": {
      "get": {
        "summary": "CoinMarketCap DEX style ticker map",
        "responses": {
          "200": {
            "description": "Ticker map",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/dexscreener/latest-block": {
      "get": {
        "summary": "DEX Screener adapter: latest fully indexed block",
        "responses": {
          "200": {
            "description": "{block:{blockNumber,blockTimestamp}}",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/dexscreener/asset": {
      "get": {
        "summary": "DEX Screener adapter: asset",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$"
            },
            "description": ""
          }
        ],
        "responses": {
          "200": {
            "description": "{asset}",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/dexscreener/pair": {
      "get": {
        "summary": "DEX Screener adapter: pair",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$"
            },
            "description": ""
          }
        ],
        "responses": {
          "200": {
            "description": "{pair}",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/dexscreener/events": {
      "get": {
        "summary": "DEX Screener adapter: swap/join/exit events in an inclusive block range (max 100000 blocks)",
        "parameters": [
          {
            "name": "fromBlock",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": ""
          },
          {
            "name": "toBlock",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": ""
          }
        ],
        "responses": {
          "200": {
            "description": "{events:[...]}",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/quote": {
      "get": {
        "summary": "Swap quote across QIEDEX pools (live reserves, router-checked)",
        "tags": [
          "swap"
        ],
        "parameters": [
          {
            "name": "tokenIn",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Input token: 0x address, or QIE / 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native QIE"
          },
          {
            "name": "tokenOut",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Output token: 0x address, or QIE / 0xEeee\u2026 for native QIE"
          },
          {
            "name": "amountIn",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "Exact input in raw integer units (e.g. 100000000 = 100 QUSDC). Give exactly one of amountIn, amountOut, amountInDecimal, amountOutDecimal."
          },
          {
            "name": "amountOut",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "Exact output in raw integer units"
          },
          {
            "name": "amountInDecimal",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Exact input in human units (e.g. 100.5)"
          },
          {
            "name": "amountOutDecimal",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Exact output in human units"
          },
          {
            "name": "slippageBps",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 5000,
              "default": 50
            },
            "description": "Slippage tolerance in basis points (default 50 = 0.5%, max 5000)"
          },
          {
            "name": "feeOnTransfer",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Use the \u2026SupportingFeeOnTransferTokens router methods (exact input only)"
          },
          {
            "name": "allowUnverifiedHops",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Allow unverified tokens as intermediate hops (default false: hops only through official verified tokens; endpoints can be any token)"
          },
          {
            "name": "recipient",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Accepted and ignored on /quote"
          }
        ],
        "responses": {
          "200": {
            "description": "Quote",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quote"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/swap": {
      "get": {
        "summary": "Quote + unsigned router transaction (+ approval tx). Never signs.",
        "tags": [
          "swap"
        ],
        "parameters": [
          {
            "name": "tokenIn",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Input token: 0x address, or QIE / 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native QIE"
          },
          {
            "name": "tokenOut",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Output token: 0x address, or QIE / 0xEeee\u2026 for native QIE"
          },
          {
            "name": "amountIn",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "Exact input in raw integer units (e.g. 100000000 = 100 QUSDC). Give exactly one of amountIn, amountOut, amountInDecimal, amountOutDecimal."
          },
          {
            "name": "amountOut",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "Exact output in raw integer units"
          },
          {
            "name": "amountInDecimal",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Exact input in human units (e.g. 100.5)"
          },
          {
            "name": "amountOutDecimal",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Exact output in human units"
          },
          {
            "name": "slippageBps",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 5000,
              "default": 50
            },
            "description": "Slippage tolerance in basis points (default 50 = 0.5%, max 5000)"
          },
          {
            "name": "feeOnTransfer",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Use the \u2026SupportingFeeOnTransferTokens router methods (exact input only)"
          },
          {
            "name": "allowUnverifiedHops",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Allow unverified tokens as intermediate hops (default false: hops only through official verified tokens; endpoints can be any token)"
          },
          {
            "name": "recipient",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Address that receives tokenOut"
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Sender: enables allowance/balance checks and simulation"
          },
          {
            "name": "deadline",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Unix seconds, or seconds from now if < 1e9 (default 1200)"
          },
          {
            "name": "simulate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "eth_call the swap from `from` and estimate gas (no state change)"
          },
          {
            "name": "acceptHighImpact",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Required to build a tx above 10% price impact (after explicit user confirmation)"
          },
          {
            "name": "approve",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "exact",
                "max"
              ]
            },
            "description": "exact (default) or max"
          }
        ],
        "responses": {
          "200": {
            "description": "Unsigned transactions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SwapBuild"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/tokens/verified": {
      "get": {
        "summary": "Official verified QIE token list (Uniswap token-list format) plus native QIE",
        "tags": [
          "swap"
        ],
        "responses": {
          "200": {
            "description": "Token list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/tokens/status/{address}": {
      "get": {
        "summary": "Token status (verified / bondfire-launch / unverified)",
        "tags": [
          "swap"
        ],
        "parameters": [
          {
            "name": "address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/swap/tokens": {
      "get": {
        "summary": "Every routable token (has a non-empty, non-test QIEDEX pool) with status, price and liquidity",
        "tags": [
          "swap"
        ],
        "responses": {
          "200": {
            "description": "Tokens",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/swap/sources": {
      "get": {
        "summary": "Enabled liquidity sources, max hops and warning policy",
        "tags": [
          "swap"
        ],
        "responses": {
          "200": {
            "description": "Sources",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "Error": {
        "description": "Error",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "RateLimited": {
        "description": "Too many requests",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            }
          }
        }
      }
    },
    "schemas": {
      "TokenRef": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$"
          },
          "symbol": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "decimals": {
            "type": "integer"
          },
          "priceUsd": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "Pair": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$"
          },
          "token0": {
            "$ref": "#/components/schemas/TokenRef"
          },
          "token1": {
            "$ref": "#/components/schemas/TokenRef"
          },
          "reserve0": {
            "type": "string"
          },
          "reserve1": {
            "type": "string"
          },
          "price": {
            "type": [
              "number",
              "null"
            ],
            "description": "token1 per token0"
          },
          "liquidityUsd": {
            "type": [
              "number",
              "null"
            ]
          },
          "volumeUsd24h": {
            "type": "number"
          },
          "trades24h": {
            "type": "integer"
          },
          "flags": {
            "type": "array",
            "items": {
              "enum": [
                "excluded_test_token",
                "lp_token_pair",
                "zero_tvl",
                "dust",
                "unpriced",
                "price_deviation_gt_25pct",
                "price_unreliable"
              ]
            }
          },
          "countsInTvl": {
            "type": "boolean"
          }
        }
      },
      "Token": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$"
          },
          "symbol": {
            "type": "string"
          },
          "priceUsd": {
            "type": [
              "number",
              "null"
            ]
          },
          "priceSource": {
            "type": [
              "string",
              "null"
            ]
          },
          "liquidityUsd": {
            "type": "number"
          },
          "totalSupply": {
            "type": [
              "string",
              "null"
            ]
          },
          "flags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Summary": {
        "type": "object",
        "properties": {
          "tvlUsd": {
            "type": "number"
          },
          "volumeUsd24h": {
            "type": "number"
          },
          "volumeUsd7d": {
            "type": "number"
          },
          "volumeUsd30d": {
            "type": "number"
          },
          "wqiePriceUsd": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "TokenStatus": {
        "type": "string",
        "enum": [
          "verified",
          "bondfire-launch",
          "unverified"
        ],
        "description": "verified = official QIE token list (only source of \"verified\"); bondfire-launch = marked by the Bondfire status feed; unverified = anything else"
      },
      "SwapToken": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string"
          },
          "symbol": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "decimals": {
            "type": "integer"
          },
          "status": {
            "$ref": "#/components/schemas/TokenStatus"
          },
          "statusSource": {
            "type": "string"
          },
          "isNative": {
            "type": "boolean"
          },
          "priceUsd": {
            "type": [
              "number",
              "null"
            ]
          },
          "firstPoolAt": {
            "type": [
              "integer",
              "null"
            ]
          },
          "launchedAt": {
            "type": [
              "integer",
              "null"
            ]
          },
          "flags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "TxRequest": {
        "type": "object",
        "required": [
          "to",
          "data",
          "value",
          "chainId"
        ],
        "properties": {
          "to": {
            "type": "string"
          },
          "data": {
            "type": "string"
          },
          "value": {
            "type": "string",
            "description": "hex wei"
          },
          "chainId": {
            "type": "integer",
            "const": 1990
          },
          "from": {
            "type": "string"
          },
          "gas": {
            "type": "string",
            "description": "hex gas estimate (only with from + simulate=true); add a margin"
          }
        }
      },
      "QuoteWarning": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "examples": [
              "PRICE_IMPACT_HIGH",
              "PRICE_IMPACT_VERY_HIGH",
              "LIQUIDITY_LOW",
              "LIQUIDITY_VERY_LOW",
              "TOKEN_UNVERIFIED",
              "TOKEN_BONDFIRE_LAUNCH",
              "TOKEN_NEW",
              "TOKEN_TEST_DEPLOYMENT",
              "TOKEN_IS_LP",
              "UNVERIFIED_INTERMEDIATE",
              "MULTI_HOP",
              "SLIPPAGE_HIGH",
              "ROUTER_MISMATCH",
              "ROUTER_CHECK_FAILED",
              "INSUFFICIENT_BALANCE",
              "APPROVE_MAX",
              "FEE_ON_TRANSFER_ESTIMATE",
              "KEEP_GAS_RESERVE",
              "WRAP_RECIPIENT_IS_SENDER"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "info",
              "warning",
              "danger"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "Quote": {
        "type": "object",
        "description": "Amounts are raw integer strings with *Decimal human-readable twins. priceImpactPct excludes the 0.3% LP fee; totalCostPct includes it.",
        "properties": {
          "chainId": {
            "type": "integer"
          },
          "kind": {
            "type": "string",
            "enum": [
              "swap",
              "wrap",
              "unwrap"
            ]
          },
          "tradeType": {
            "type": "string",
            "enum": [
              "exactIn",
              "exactOut"
            ]
          },
          "source": {
            "type": "string"
          },
          "tokenIn": {
            "$ref": "#/components/schemas/SwapToken"
          },
          "tokenOut": {
            "$ref": "#/components/schemas/SwapToken"
          },
          "amountIn": {
            "type": "string"
          },
          "amountInDecimal": {
            "type": "string"
          },
          "amountOut": {
            "type": "string"
          },
          "amountOutDecimal": {
            "type": "string"
          },
          "minAmountOut": {
            "type": "string"
          },
          "minAmountOutDecimal": {
            "type": "string"
          },
          "maxAmountIn": {
            "type": "string"
          },
          "maxAmountInDecimal": {
            "type": "string"
          },
          "slippageBps": {
            "type": "integer"
          },
          "path": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "on-chain path (WQIE stands in for native QIE)"
          },
          "pathSymbols": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "pools": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "priceImpactPct": {
            "type": "number"
          },
          "totalCostPct": {
            "type": "number"
          },
          "fee": {
            "type": "object",
            "properties": {
              "bps": {
                "type": "integer"
              },
              "percentPerHop": {
                "type": "number"
              },
              "hops": {
                "type": "integer"
              },
              "totalPercent": {
                "type": "number"
              }
            }
          },
          "executionPrice": {
            "type": [
              "number",
              "null"
            ]
          },
          "midPrice": {
            "type": [
              "number",
              "null"
            ]
          },
          "amountInUsd": {
            "type": [
              "number",
              "null"
            ]
          },
          "amountOutUsd": {
            "type": [
              "number",
              "null"
            ]
          },
          "sizeGuidance": {
            "type": [
              "object",
              "null"
            ],
            "description": "largest amountIn keeping price impact <= 1/3/10% on this route right now"
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuoteWarning"
            }
          },
          "requiresConfirmation": {
            "type": "boolean",
            "description": "true when any warning is danger"
          },
          "spender": {
            "type": [
              "string",
              "null"
            ],
            "description": "contract to approve for ERC-20 input (the router); null for native input and wrap/unwrap"
          },
          "router": {
            "type": [
              "string",
              "null"
            ]
          },
          "method": {
            "type": "string"
          },
          "routerCheck": {
            "type": [
              "object",
              "null"
            ],
            "description": "router.getAmountsOut/getAmountsIn cross-check"
          },
          "alternatives": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "quotedAt": {
            "type": "integer"
          }
        }
      },
      "SwapBuild": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Quote"
          },
          {
            "type": "object",
            "properties": {
              "recipient": {
                "type": "string"
              },
              "deadline": {
                "type": "integer"
              },
              "tx": {
                "$ref": "#/components/schemas/TxRequest"
              },
              "approval": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "needed": {
                    "type": [
                      "boolean",
                      "null"
                    ],
                    "description": "null when from is not given"
                  },
                  "token": {
                    "type": "string"
                  },
                  "spender": {
                    "type": "string"
                  },
                  "amount": {
                    "type": "string"
                  },
                  "currentAllowance": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "tx": {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/TxRequest"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "balance": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "simulation": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "eth_call from `from` (simulation only)"
              }
            }
          }
        ]
      }
    }
  }
}