{
  "openapi": "3.1.0",
  "info": {
    "title": "XFlows API",
    "version": "3.0.0",
    "summary": "Wanchain XFlows cross-chain swap & bridge API",
    "description": "XFlows is Wanchain's decentralized cross-chain solution that uses decentralized liquidity pools for native-to-native cross-chain asset transfers.\n\nXFlows supports 6 work modes:\n1. Direct cross-chain via wan-bridge\n2. Direct cross-chain via QUiX\n3. Cross first, then swap on destination chain (e.g. bridge into Wanchain)\n4. Cross to Wanchain, swap on Wanchain, then bridge to destination chain\n5. Swap-only (on Wanchain, or on other chains via Rubic)\n6. Swap first, then bridge out (e.g. from Wanchain swap and bridge to other chains)\n\n**Typical integration flow**\n1. `POST /api/v3/quote` — get a cross-chain quote\n2. `POST /api/v3/buildTx` — build the signed-ready transaction data\n3. `POST /api/v3/status` — track execution status\n\nDemo: https://github.com/wandevs/xflows-api-demo",
    "contact": {
      "name": "Wanchain Tech Support",
      "email": "techsupport@wanchain.org",
      "url": "https://wanchain.org"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://wanchain.org"
    }
  },
  "servers": [
    {
      "url": "https://xflows.wanchain.org",
      "description": "Production"
    }
  ],
  "security": [],
  "tags": [
    {
      "name": "Supported",
      "description": "Discover supported chains, tokens, pairs, bridges and DEXes."
    },
    {
      "name": "Quote",
      "description": "Get the best cross-chain swap quote."
    },
    {
      "name": "Transaction",
      "description": "Build cross-chain swap transactions for wallet signing."
    },
    {
      "name": "Status",
      "description": "Query cross-chain transaction status."
    }
  ],
  "paths": {
    "/api/v3/supported/chains": {
      "get": {
        "tags": [
          "Supported"
        ],
        "summary": "Get supported chains",
        "description": "Returns the list of chains supported by XFlows.",
        "operationId": "getSupportedChains",
        "parameters": [
          {
            "name": "chainId",
            "in": "query",
            "required": false,
            "description": "Chain identifier. If omitted, returns all supported chains. e.g. `1` for Ethereum.",
            "schema": {
              "type": "string"
            },
            "example": "1"
          },
          {
            "name": "id",
            "in": "query",
            "required": false,
            "description": "Optional client-side request id, returned as-is.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "quix",
            "in": "query",
            "required": false,
            "description": "If true, only returns chains supported by QUiX. Default false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of supported chains",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Chain"
                      }
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": [
                    {
                      "chainId": 1,
                      "chainName": "Ethereum",
                      "logo": "https://xflows.wanchain.org/Chain/Ethereum.png",
                      "symbol": "ETH",
                      "chainType": "ETH"
                    },
                    {
                      "chainId": 10,
                      "chainName": "Optimism",
                      "logo": "https://xflows.wanchain.org/Chain/Optimism.png",
                      "symbol": "ETH",
                      "chainType": "OETH"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/api/v3/supported/tokens": {
      "get": {
        "tags": [
          "Supported"
        ],
        "summary": "Get supported tokens",
        "description": "Returns supported tokens for a given chain, or for all chains if `chainId` is omitted.",
        "operationId": "getSupportedTokens",
        "parameters": [
          {
            "name": "chainId",
            "in": "query",
            "required": false,
            "description": "Chain id (e.g. `1` for Ethereum). If omitted, returns tokens grouped by chain.",
            "schema": {
              "type": "string"
            },
            "example": "10"
          },
          {
            "name": "quix",
            "in": "query",
            "required": false,
            "description": "If true, only returns tokens supported by QUiX. Default false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of tokens (flat array when `chainId` is provided, grouped by chain otherwise).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "oneOf": [
                        {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Token"
                          }
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "chainId": {
                                "type": "integer"
                              },
                              "tokens": {
                                "type": "array",
                                "items": {
                                  "$ref": "#/components/schemas/Token"
                                }
                              }
                            }
                          }
                        }
                      ]
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": [
                    {
                      "decimals": "6",
                      "tokenContractAddress": "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",
                      "tokenLogoUrl": "https://xflows.wanchain.org/Token/USDT.png",
                      "tokenName": "Tether USD",
                      "tokenSymbol": "USDT",
                      "asciiTokenAddress": "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/api/v3/supported/pairs": {
      "get": {
        "tags": [
          "Supported"
        ],
        "summary": "Get supported direct-bridge pairs",
        "description": "Returns the list of token pairs that can be directly bridged (without swap) via XFlows.",
        "operationId": "getSupportedPairs",
        "parameters": [
          {
            "name": "fromChainId",
            "in": "query",
            "required": true,
            "description": "Source chain id, e.g. `1` for Ethereum.",
            "schema": {
              "type": "string"
            },
            "example": "56"
          },
          {
            "name": "toChainId",
            "in": "query",
            "required": false,
            "description": "Destination chain id, e.g. `56` for BSC.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of supported direct-bridge pairs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TokenPair"
                      }
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": [
                    {
                      "fromChainId": "56",
                      "toChainId": "1",
                      "fromTokenAddress": "0x55d398326f99059ff775485246999027b3197955",
                      "toTokenAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
                      "fromTokenSymbol": "USDT",
                      "toTokenSymbol": "USDT",
                      "tokenPairId": "189",
                      "symbol": "USDT"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/api/v3/supported/bridges": {
      "get": {
        "tags": [
          "Supported"
        ],
        "summary": "Get supported bridges",
        "description": "Returns the list of bridges supported by XFlows.",
        "operationId": "getSupportedBridges",
        "responses": {
          "200": {
            "description": "List of supported bridges.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/KeyName"
                      }
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": [
                    {
                      "key": "wanbridge",
                      "name": "WanBridge"
                    },
                    {
                      "key": "quix",
                      "name": "QUiX"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/api/v3/supported/dexes": {
      "get": {
        "tags": [
          "Supported"
        ],
        "summary": "Get supported DEXes",
        "description": "Returns the list of DEXes supported by XFlows.",
        "operationId": "getSupportedDexes",
        "responses": {
          "200": {
            "description": "List of supported DEXes.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/KeyName"
                      }
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": [
                    {
                      "key": "wanchain",
                      "name": "Wanchain L1 Swap"
                    },
                    {
                      "key": "rubic",
                      "name": "Rubic"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/api/v3/quote": {
      "post": {
        "tags": [
          "Quote"
        ],
        "summary": "Get cross-chain swap quote",
        "description": "Returns the best route, estimated amount-out and fee breakdown for a cross-chain swap.",
        "operationId": "getQuote",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteRequest"
              },
              "examples": {
                "workMode1": {
                  "summary": "WorkMode 1 — Direct bridge via WanBridge",
                  "value": {
                    "fromChainId": 43114,
                    "toChainId": 56,
                    "fromTokenAddress": "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7",
                    "toTokenAddress": "0x55d398326f99059ff775485246999027b3197955",
                    "fromAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "toAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "fromAmount": "10"
                  }
                },
                "workMode2": {
                  "summary": "WorkMode 2 — Direct bridge via QUiX",
                  "value": {
                    "fromChainId": 10,
                    "toChainId": 56,
                    "fromTokenAddress": "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",
                    "toTokenAddress": "0x55d398326f99059ff775485246999027b3197955",
                    "fromAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "toAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "fromAmount": "10",
                    "bridge": "quix"
                  }
                },
                "workMode3": {
                  "summary": "WorkMode 3 — Cross then swap to Wanchain",
                  "value": {
                    "fromChainId": 43114,
                    "toChainId": 888,
                    "fromTokenAddress": "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7",
                    "toTokenAddress": "0x52A9CEA01c4CBDd669883e41758B8eB8e8E2B34b",
                    "fromAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "toAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "fromAmount": "1000",
                    "slippage": 0.001
                  }
                },
                "workMode4": {
                  "summary": "WorkMode 4 — Cross→Wanchain→Swap→Cross out",
                  "value": {
                    "fromChainId": 43114,
                    "toChainId": 10,
                    "fromTokenAddress": "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7",
                    "toTokenAddress": "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
                    "fromAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "toAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "fromAmount": "1000",
                    "slippage": 0.001
                  }
                },
                "workMode5": {
                  "summary": "WorkMode 5 — Swap only (on Wanchain)",
                  "value": {
                    "fromChainId": 888,
                    "toChainId": 888,
                    "fromTokenAddress": "0x11e77E27Af5539872efEd10abaA0b408cfd9fBBD",
                    "toTokenAddress": "0x52A9CEA01c4CBDd669883e41758B8eB8e8E2B34b",
                    "fromAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "toAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "fromAmount": "1000",
                    "slippage": 0.02
                  }
                },
                "workMode6": {
                  "summary": "WorkMode 6 — Swap on Wanchain then bridge out",
                  "value": {
                    "fromChainId": 888,
                    "toChainId": 10,
                    "fromTokenAddress": "0x11e77E27Af5539872efEd10abaA0b408cfd9fBBD",
                    "toTokenAddress": "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
                    "fromAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "toAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "fromAmount": "1000",
                    "slippage": 0.001
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Quote result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "$ref": "#/components/schemas/QuoteResponse"
                    }
                  }
                },
                "examples": {
                  "workMode1": {
                    "summary": "WorkMode 1 response",
                    "value": {
                      "success": true,
                      "data": {
                        "amountOut": "9.8",
                        "amountOutRaw": "9800000000000000000",
                        "slippage": 0.01,
                        "amountOutMin": "9.8",
                        "amountOutMinRaw": "9800000000000000000",
                        "approvalAddress": "0x88888dd82A91f0406ED42BF750bAF881e64894F6",
                        "priceImpact": 0,
                        "workMode": 1,
                        "bridge": "wanbridge",
                        "nativeFees": [
                          {
                            "nativeFeeAmount": "6500000000000000",
                            "nativeFeeSymbol": "AVAX",
                            "nativeFeeDecimals": 18
                          }
                        ],
                        "tokenFees": [
                          {
                            "tokenFeeAmount": "200000",
                            "tokenFeeSymbol": "USDT",
                            "tokenFeeDecimals": 18,
                            "tokenFeeContract": "0x55d398326f99059ff775485246999027b3197955"
                          }
                        ],
                        "extraData": {
                          "directPair": {
                            "fromChainId": "43114",
                            "toChainId": "56",
                            "fromTokenAddress": "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7",
                            "toTokenAddress": "0x55d398326f99059ff775485246999027b3197955",
                            "fromTokenSymbol": "USDt",
                            "toTokenSymbol": "USDT",
                            "tokenPairId": "235",
                            "symbol": "USDT"
                          },
                          "quotaAndFee": {
                            "symbol": "USDT",
                            "minQuota": "400000",
                            "maxQuota": "61318064549",
                            "networkFee": {
                              "value": "6500000000000000",
                              "isPercent": false
                            },
                            "operationFee": {
                              "value": "0.002",
                              "isPercent": true,
                              "minFeeLimit": "200000",
                              "maxFeeLimit": "100000000"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/api/v3/buildTx": {
      "post": {
        "tags": [
          "Transaction"
        ],
        "summary": "Build a cross-chain swap transaction",
        "description": "Builds the wallet-ready transaction payload for the chosen cross-chain swap route.\n\nThe request body is identical to `/api/v3/quote` (plus optional `partner`). For EVM source chains you must perform any required ERC-20 `approve` separately (use the `approvalAddress` from `/quote`). For USDT-style tokens, remember to `approve(0)` before setting a new allowance.",
        "operationId": "buildTransaction",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BuildTxRequest"
              },
              "examples": {
                "fromEVM": {
                  "summary": "From EVM chain",
                  "value": {
                    "fromChainId": 43114,
                    "toChainId": 888,
                    "fromTokenAddress": "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7",
                    "toTokenAddress": "0x52A9CEA01c4CBDd669883e41758B8eB8e8E2B34b",
                    "fromAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "toAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "fromAmount": "1000",
                    "slippage": 0.001
                  }
                },
                "fromBitcoin": {
                  "summary": "From Bitcoin",
                  "value": {
                    "fromChainId": 2147483648,
                    "toChainId": 888,
                    "fromTokenAddress": "0x0000000000000000000000000000000000000000",
                    "toTokenAddress": "0x50c439b6d602297252505a6799d84ea5928bcfb6",
                    "fromAddress": "bc1qugvdunxxzqvy80hysz9y77nx50240n7ghhz3rd",
                    "toAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "fromAmount": "0.002",
                    "partner": "xflows"
                  }
                },
                "fromCardano": {
                  "summary": "From Cardano",
                  "value": {
                    "fromChainId": 2147485463,
                    "toChainId": 42161,
                    "fromTokenAddress": "0x32356335646535663562323836303733633539336564666437376234386162633761343865356134663364346364396434323866663933352e3535353334343534",
                    "toTokenAddress": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
                    "fromAddress": "addr1q80p2p4a08kmd4fn5p6er8unu25n6302x3wrzajnl46as0nx3yflzt76nqydq2x6603wt96cvtuuj7ealj6j5r7qepmskkhetk",
                    "toAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "fromAmount": "5",
                    "partner": "xflows"
                  }
                },
                "fromSolana": {
                  "summary": "From Solana",
                  "value": {
                    "fromChainId": 501,
                    "toChainId": 888,
                    "fromTokenAddress": "0x45506a465764643541756671535371654d32714e31787a7962617043384734774547476b5a77795444743176",
                    "toTokenAddress": "0x52a9cea01c4cbdd669883e41758b8eb8e8e2b34b",
                    "fromAddress": "2SFMj2XNzFCTzeQE8rEk82MxBq3A4u4J6uQvEnpmcqyh",
                    "toAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "fromAmount": "5",
                    "partner": "xflows"
                  }
                },
                "fromTron": {
                  "summary": "From Tron",
                  "value": {
                    "fromChainId": 195,
                    "toChainId": 1,
                    "fromTokenAddress": "0xa614f803b6fd780986a42c78ec9c7f77e6ded13c",
                    "toTokenAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
                    "fromAddress": "TEKTPLcABzoq8nthP6yV55kE94irztW2dW",
                    "toAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                    "fromAmount": "5",
                    "partner": "xflows"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Built transaction payload, ready for wallet signing.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "$ref": "#/components/schemas/BuildTxResponse"
                    }
                  }
                },
                "examples": {
                  "evm": {
                    "summary": "EVM tx",
                    "value": {
                      "success": true,
                      "data": {
                        "chainId": 43114,
                        "tx": {
                          "value": "13460135000000",
                          "to": "0xAeCbF30602caF42467e7120C04271EDcC843f3c7",
                          "data": "0x4bcb403a..."
                        }
                      }
                    }
                  },
                  "bitcoin": {
                    "summary": "Bitcoin tx (memo)",
                    "value": {
                      "success": true,
                      "data": {
                        "tx": {
                          "to": "bc1p64ekpgpmfzu7qag4eze8h775hwgc5fzzvt2g6w2wv4rdmmgk44dqny9plg",
                          "value": 200000,
                          "memo": "07000f000078666c6f77732fb4d46372ea1748ec3c29bd2c7b536019df5200"
                        }
                      }
                    }
                  },
                  "tron": {
                    "summary": "Tron tx (abi + params)",
                    "value": {
                      "success": true,
                      "data": {
                        "tx": {
                          "to": "41fe464ebd5bb5d95731f90aa7b9e39df920a61c97",
                          "functionSelector": "userLock(bytes32,uint256,uint256,bytes)",
                          "params": [
                            "0x000000000000000000000000000000000000000000000041726965735f303537",
                            "273",
                            "5000000",
                            "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200"
                          ],
                          "value": "0x4a62f80"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/api/v3/status": {
      "post": {
        "tags": [
          "Status"
        ],
        "summary": "Query cross-chain transaction status",
        "description": "Tracks the execution status of a cross-chain transaction. Request body is identical to `/quote` except `slippage` is replaced with `hash` (the source-chain transaction hash).",
        "operationId": "getStatus",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusRequest"
              },
              "example": {
                "fromChainId": 10,
                "toChainId": 42161,
                "fromTokenAddress": "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58",
                "toTokenAddress": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
                "fromAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                "toAddress": "0x2fb4D46372Ea1748ec3c29Bd2C7B536019DF5200",
                "fromAmount": "4.5015",
                "hash": "0x969eb35d16435b8bdd261804c74201454c7d95b348a8033b297278b55fae4590"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current status of the cross-chain transaction.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "$ref": "#/components/schemas/StatusResponse"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "statusCode": 1,
                    "statusMsg": "Success",
                    "receiveAmount": "4.3015",
                    "receiveAmountRaw": "4301500",
                    "workMode": 1,
                    "sourceHash": "0x969eb35d16435b8bdd261804c74201454c7d95b348a8033b297278b55fae4590",
                    "destinationHash": "0xc29d7f9abcff581ccd776a4ea88d4417cbe3ec7485dbcf01dd56c7f3087644e8",
                    "timestamp": 1757045459
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "ErrorResponse": {
        "description": "Error response. XFlows returns HTTP 200 with `success: false` for most business errors; transport/server failures may surface with 4XX/5XX status codes.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            },
            "example": {
              "success": false,
              "error": "Invalid fromTokenAddress"
            }
          }
        }
      }
    },
    "schemas": {
      "ApiError": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "description": "Human-readable error message."
          },
          "code": {
            "type": "string",
            "description": "Optional error code."
          }
        }
      },
      "Chain": {
        "type": "object",
        "properties": {
          "chainId": {
            "type": "integer",
            "description": "Numeric chain id. e.g. `1` for Ethereum."
          },
          "chainName": {
            "type": "string",
            "description": "Human-readable chain name."
          },
          "logo": {
            "type": "string",
            "format": "uri"
          },
          "symbol": {
            "type": "string",
            "description": "Native coin symbol, e.g. `ETH`."
          },
          "decimals": {
            "type": "integer",
            "description": "Native coin decimals."
          },
          "chainType": {
            "type": "string",
            "description": "Chain type tag used by WanBridge."
          }
        }
      },
      "Token": {
        "type": "object",
        "properties": {
          "chainId": {
            "type": "integer",
            "description": "Chain id, present only when returned from the all-chains variant."
          },
          "decimals": {
            "type": "string",
            "example": "18"
          },
          "tokenContractAddress": {
            "type": "string",
            "description": "WanBridge-encoded token contract address — use this as input to other APIs."
          },
          "tokenLogoUrl": {
            "type": "string",
            "format": "uri"
          },
          "tokenName": {
            "type": "string"
          },
          "tokenSymbol": {
            "type": "string"
          },
          "asciiTokenAddress": {
            "type": "string",
            "description": "Friendly display address for non-EVM chains. Do NOT use as API input."
          },
          "wanBridgeOnly": {
            "type": "boolean",
            "description": "true means bridge-only (no swap support)."
          }
        }
      },
      "TokenPair": {
        "type": "object",
        "properties": {
          "fromChainId": {
            "type": "string"
          },
          "toChainId": {
            "type": "string"
          },
          "fromTokenAddress": {
            "type": "string"
          },
          "toTokenAddress": {
            "type": "string"
          },
          "fromTokenSymbol": {
            "type": "string"
          },
          "toTokenSymbol": {
            "type": "string"
          },
          "tokenPairId": {
            "type": "string",
            "description": "WanBridge token pair id."
          },
          "symbol": {
            "type": "string",
            "description": "Ancestor (common) symbol."
          }
        }
      },
      "KeyName": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "key",
          "name"
        ]
      },
      "QuoteRequest": {
        "type": "object",
        "required": [
          "fromChainId",
          "toChainId",
          "fromTokenAddress",
          "toTokenAddress",
          "fromAddress",
          "toAddress",
          "fromAmount"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Optional client-side request id, returned as-is."
          },
          "fromChainId": {
            "type": "integer",
            "description": "Source chain id."
          },
          "toChainId": {
            "type": "integer",
            "description": "Destination chain id."
          },
          "fromTokenAddress": {
            "type": "string",
            "description": "Source token contract address (WanBridge-encoded)."
          },
          "toTokenAddress": {
            "type": "string",
            "description": "Destination token contract address (WanBridge-encoded)."
          },
          "fromAddress": {
            "type": "string",
            "description": "Source-chain wallet address."
          },
          "toAddress": {
            "type": "string",
            "description": "Destination-chain wallet address."
          },
          "fromAmount": {
            "type": "string",
            "description": "Amount of `fromToken` in human units, e.g. \"123.45\"."
          },
          "bridge": {
            "type": "string",
            "description": "Specify a bridge. Default `wanbridge`.",
            "enum": [
              "wanbridge",
              "quix"
            ]
          },
          "dex": {
            "type": "string",
            "description": "Specify a DEX.",
            "enum": [
              "wanchain",
              "rubic"
            ]
          },
          "slippage": {
            "type": "number",
            "description": "Max allowed slippage (0.01 = 1%). Default 0.01.",
            "default": 0.01,
            "example": 0.001
          }
        }
      },
      "BuildTxRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/QuoteRequest"
          },
          {
            "type": "object",
            "properties": {
              "partner": {
                "type": "string",
                "description": "Partner tag for tracking integrations."
              }
            }
          }
        ]
      },
      "StatusRequest": {
        "type": "object",
        "required": [
          "fromChainId",
          "toChainId",
          "fromTokenAddress",
          "toTokenAddress",
          "fromAddress",
          "toAddress",
          "fromAmount",
          "hash"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "fromChainId": {
            "type": "integer"
          },
          "toChainId": {
            "type": "integer"
          },
          "fromTokenAddress": {
            "type": "string"
          },
          "toTokenAddress": {
            "type": "string"
          },
          "fromAddress": {
            "type": "string"
          },
          "toAddress": {
            "type": "string"
          },
          "fromAmount": {
            "type": "string"
          },
          "bridge": {
            "type": "string",
            "enum": [
              "wanbridge",
              "quix"
            ]
          },
          "dex": {
            "type": "string",
            "enum": [
              "wanchain",
              "rubic"
            ]
          },
          "hash": {
            "type": "string",
            "description": "Source-chain transaction hash."
          }
        }
      },
      "NativeFee": {
        "type": "object",
        "properties": {
          "nativeFeeAmount": {
            "type": "string",
            "description": "Fee amount in smallest unit (e.g. wei). 0.001 ETH → \"1000000000000000\"."
          },
          "nativeFeeSymbol": {
            "type": "string",
            "example": "ETH"
          },
          "nativeFeeDecimals": {
            "type": "integer",
            "example": 18
          }
        }
      },
      "TokenFee": {
        "type": "object",
        "properties": {
          "tokenFeeAmount": {
            "type": "string",
            "description": "Fee amount in smallest unit."
          },
          "tokenFeeSymbol": {
            "type": "string",
            "example": "USDT"
          },
          "tokenFeeDecimals": {
            "type": "integer",
            "example": 18
          },
          "tokenFeeContract": {
            "type": "string",
            "description": "Fee token contract address."
          }
        }
      },
      "QuoteResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "amountOut": {
            "type": "string",
            "description": "Estimated amount-out in human units."
          },
          "amountOutRaw": {
            "type": "string",
            "description": "Estimated amount-out in smallest unit (with decimals)."
          },
          "slippage": {
            "type": "number"
          },
          "amountOutMin": {
            "type": "string",
            "description": "Minimum amount-out after slippage, human units."
          },
          "amountOutMinRaw": {
            "type": "string",
            "description": "Minimum amount-out after slippage, smallest unit."
          },
          "priceImpact": {
            "type": "number",
            "description": "Price impact in percent. -1.3 means -1.3%."
          },
          "approvalAddress": {
            "type": "string",
            "description": "ERC-20 spender to approve on the source chain. Empty when no approve needed."
          },
          "workMode": {
            "type": "integer",
            "description": "1: Direct bridge via wan-bridge. 2: Direct bridge via QUiX. 3: Cross then swap on destination. 4: Cross→Wanchain→Swap→Cross out. 5: Swap only. 6: Swap then bridge out.",
            "enum": [
              1,
              2,
              3,
              4,
              5,
              6
            ]
          },
          "bridge": {
            "type": "string",
            "enum": [
              "wanbridge",
              "quix"
            ]
          },
          "dex": {
            "type": "string",
            "enum": [
              "wanchain",
              "rubic"
            ]
          },
          "rubicId": {
            "type": "string",
            "description": "Returned when `dex=rubic`."
          },
          "error": {
            "type": "string",
            "description": "Error message when the request cannot be quoted."
          },
          "nativeFees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NativeFee"
            }
          },
          "tokenFees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TokenFee"
            }
          },
          "extraData": {
            "type": "object",
            "additionalProperties": true,
            "description": "Mode-specific extra info — `directPair`, `quotaAndFee` (workMode 1); `quix` (workMode 2); `dex` (modes 3-6).",
            "properties": {
              "directPair": {
                "$ref": "#/components/schemas/TokenPair"
              },
              "quotaAndFee": {
                "type": "object",
                "properties": {
                  "symbol": {
                    "type": "string"
                  },
                  "minQuota": {
                    "type": "string",
                    "description": "Minimum bridge amount in smallest unit."
                  },
                  "maxQuota": {
                    "type": "string",
                    "description": "Maximum bridge amount in smallest unit."
                  },
                  "networkFee": {
                    "type": "object",
                    "properties": {
                      "value": {
                        "type": "string"
                      },
                      "isPercent": {
                        "type": "boolean"
                      }
                    }
                  },
                  "operationFee": {
                    "type": "object",
                    "properties": {
                      "value": {
                        "type": "string"
                      },
                      "isPercent": {
                        "type": "boolean"
                      },
                      "minFeeLimit": {
                        "type": "string"
                      },
                      "maxFeeLimit": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "quix": {
                "type": "object",
                "additionalProperties": true,
                "description": "QUiX intent details, signature and pre-built transactions."
              },
              "dex": {
                "type": "object",
                "additionalProperties": true,
                "description": "DEX route, swap path, fees and routing details."
              }
            }
          }
        }
      },
      "BuildTxResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "chainId": {
            "type": "integer",
            "description": "Chain id where the transaction should be sent."
          },
          "tx": {
            "type": "object",
            "description": "Wallet-ready transaction payload. Field set varies by source chain.",
            "properties": {
              "value": {
                "description": "Native value to send.",
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "integer"
                  }
                ]
              },
              "to": {
                "type": "string",
                "description": "Recipient address (EVM/Bitcoin)."
              },
              "data": {
                "type": "string",
                "description": "EVM call data."
              },
              "approvalAddress": {
                "type": "string",
                "description": "ERC-20 approve target (Rubic swaps only)."
              },
              "memo": {
                "type": "string",
                "description": "Memo for Bitcoin transactions."
              },
              "serializedTx": {
                "type": "string",
                "description": "Serialized transaction object for Cardano / Solana / SUI."
              },
              "abi": {
                "type": "array",
                "description": "Tron contract ABI fragment.",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "functionSelector": {
                "type": "string",
                "description": "Tron function selector signature."
              },
              "rawParameter": {
                "type": "string",
                "description": "Tron raw-encoded parameters."
              },
              "params": {
                "type": "array",
                "description": "Tron decoded function parameters.",
                "items": {}
              }
            }
          }
        }
      },
      "StatusResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "statusCode": {
            "type": "integer",
            "description": "1: Success. 2: Failed. 3: Processing. 4: Refunded (to source). 5: Refunded (to Wanchain). 6: Trusteeship — manual intervention required, contact techsupport@wanchain.org. 7: Risk transaction (AML risk).",
            "enum": [
              1,
              2,
              3,
              4,
              5,
              6,
              7
            ]
          },
          "statusMsg": {
            "type": "string",
            "enum": [
              "Success",
              "Processing",
              "Failed",
              "Refunded",
              "Trusteeship",
              "Risk transaction"
            ]
          },
          "receiveAmount": {
            "type": "string",
            "description": "Actual amount received in human units. Omitted when toToken is a native coin."
          },
          "receiveAmountRaw": {
            "type": "string",
            "description": "Actual amount received in smallest unit. Omitted when toToken is a native coin."
          },
          "workMode": {
            "type": "integer",
            "enum": [
              1,
              2,
              3,
              4,
              5,
              6
            ]
          },
          "error": {
            "type": "string"
          },
          "sourceHash": {
            "type": "string"
          },
          "destinationHash": {
            "type": "string"
          },
          "swapHash": {
            "type": "string"
          },
          "refundHash": {
            "type": "string",
            "description": "Refund hash when statusCode is 4 or 5."
          },
          "timestamp": {
            "type": "integer",
            "description": "Start time, in seconds."
          },
          "extraData": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    }
  }
}
