Lux Docs
Dex

DEX API Reference

Trading API, WebSocket feeds, and market data

Trading API

The Trading API provides unified swap routing across on-chain V4 pools (Lux DEX precompile) and off-chain broker venues.

Base URL: https://dex.lux.network

Endpoints

MethodPathDescription
POST/v1/trade/quoteGet best-price quote across all venues
POST/v1/trade/swapBuild unsigned transaction calldata
POST/v1/trade/orderSubmit order for off-chain routing
GET/v1/trade/swaps/{txHash}Get on-chain swap status
GET/v1/trade/orders/{orderId}Get order status
POST/v1/trade/check-approvalCheck ERC-20 token approval
GET/v1/trade/venuesList available liquidity venues

Get Quote

curl -X POST https://dex.lux.network/v1/trade/quote \
  -H "Content-Type: application/json" \
  -d '{
    "tokenIn": "0xc65ea8882020Af7CDa7854d590C6Fcd34BF364ec",
    "tokenOut": "0x1234567890abcdef1234567890abcdef12345678",
    "amount": "1000000000000000000",
    "type": "EXACT_INPUT",
    "chainId": 96369,
    "swapper": "0x9011E888251AB053B7bD1cdB598Db4f9DEd94714",
    "slippageTolerance": 0.5
  }'

Response includes best quote, all venue quotes sorted by price, routing info, gas estimate, and price impact.

Build Swap Transaction

curl -X POST https://dex.lux.network/v1/trade/swap \
  -H "Content-Type: application/json" \
  -d '{"quote": <quote_from_above>, "swapper": "0x..."}'

Returns unsigned transaction calldata targeting the LXRouter (V4), V2 Router, or V3 SwapRouter depending on the best venue.

Submit Order

curl -X POST https://dex.lux.network/v1/trade/order \
  -H "Content-Type: application/json" \
  -d '{
    "tokenIn": "0x...",
    "tokenOut": "0x...",
    "amount": "1000000000000000000",
    "type": "EXACT_INPUT",
    "side": "BUY",
    "orderType": "MARKET",
    "swapper": "0x...",
    "chainId": 96369
  }'

Venues

The DEX routes across multiple venue types:

VenueTypeDescription
v4_nativeOn-chainLux DEX V4 precompile (LP-9012)
uniswap_v2On-chainAny V2-compatible Router02
uniswap_v3On-chainAny V3-compatible SwapRouter
alpacaOff-chainAlpaca Markets (via Lux Broker)
binanceOff-chainBinance (via Lux Broker)

Chain IDs

NetworkChain ID
Devnet96370
Testnet96368
Mainnet96369

Precompile Addresses

ContractAddress
PoolManager0x0000000000000000000000000000000000009010
LXRouter0x0000000000000000000000000000000000009012

Full OpenAPI spec: api/openapi.yaml


WebSocket

const ws = new WebSocket('wss://dex.lux.network/v1/ws');
ws.send(JSON.stringify({
  op: 'subscribe',
  channel: 'orderbook',
  market: 'LUX-USDC'
}));

Market Data

ChannelDescription
orderbookReal-time order book updates
tradesTrade executions
candlesOHLCV candle data
ticker24h price and volume

On this page