API_CONTRACTS
API Contracts (Draft)
This document defines framework-agnostic request/response shapes for the BFF. It mirrors Wagyu API fields closely so the BFF can normalize or pass-through safely.
Common Conventions
All responses are JSON.
Errors follow a consistent envelope:
error.code(string)error.message(string, user-safe)error.details(object, optional, not for end users)
GET /health
Response:
status:ok|degradedversion: stringtime: ISO-8601
GET /chains
Response:
chains: arraychainId: numbername: stringnativeToken: stringminSwapUsd: number
POST /quote
Request:
fromChainId: number (0 = Monero)toChainId: number (0 = Monero)fromToken: string (token address orXMR)toToken: string (token address orXMR)fromAmount: string (smallest units)
Response:
fromAmount: stringfromAmountUsd: stringfromSymbol: stringtoAmount: stringtoAmountUsd: stringtoSymbol: stringestimatedTime: number (seconds)minReceived: stringintegratorFee(optional, only when API key used):percent: numberamount: stringamountUsd: string
POST /orders
Request:
fromChainId: numbertoChainId: numberfromToken: stringtoToken: stringfromAmount: stringtoAddress: stringsessionId: string (uuid v4, optional)twapConfig(optional; XMR orders only):disabled: booleanchunkSizeUsd: number (min 250)intervalMs: number (1000-60000)
Response:
orderId: stringdepositAddress: stringdepositChain: stringdepositChainId: numberdepositToken: stringdepositTokenSymbol: stringdepositAmount: stringtoAddress: stringexpectedOutput: stringexpiresAt: ISO-8601status: string
GET /orders/{orderId}
Query:
verify: string (optional destination address for verification)
Response:
orderId: stringstatus: stringdepositAddress: stringdepositChainId: numberdepositTokenSymbol: stringdepositAmount: stringdepositTxHash: string | nulltoAddress: stringexpectedOutput: stringactualOutput: string | nullerrorMessage: string | nullrefundTxHash: string | nullcreatedAt: ISO-8601completedAt: ISO-8601 | nulltwap(optional):enabled: booleanstatus:pending|active|completed|failedchunksCompleted: numberchunksTotal: numberfilledQty: numbertotalQty: numberchunkSizeUsd: numberintervalMs: numberestimatedTimeRemainingMs: number
Order Statuses:
awaiting_depositdeposit_detecteddeposit_confirmedexecuting_swapcompletedrefundingrefundedfailedexpired
GET /orders
Query:
session: string (uuid v4)
Response:
orders: arrayid: stringfrom_chain_id: numberfrom_token_symbol: stringfrom_amount: stringto_chain_id: numberto_token_symbol: stringto_amount_expected: stringto_address: stringstatus: stringcreated_at: ISO-8601completed_at: ISO-8601 | null
POST /support/tickets
Request:
orderId: string | nullsessionId: string | nullwalletAddress: string | nullcategory: stringmessage: string
Response:
ticketId: stringcreatedAt: ISO-8601
Bridge API (BFF Pass-through)
GET /bridge/rates
Response:
rates: arrayexchange: stringrate: numbereta: string
wagyuRate: objectrate: numbereta: string
POST /bridge/deposit
Request:
toAddress: string (Hyperliquid address)
Response:
orderId: stringdepositAddress: stringdestination: stringexpiresAt: ISO-8601
POST /bridge/withdraw
Request:
toAddress: string (Monero address)
Response:
orderId: stringdepositAddress: stringdestination: stringexpiresAt: ISO-8601
GET /bridge/order/{orderId}
Response:
id: stringtype:deposit|withdrawstatus:awaiting_deposit|pending_confirmations|processing|completed|failed|expiredamount: stringconfirmations: numberrequiredConfirmations: numbertx_in: string | nulltx_out: string | nullfailure_reason: string | nullcreated_at: ISO-8601completed_at: ISO-8601 | null
