Skip to content

HyperCore spot swap

Quote a swap against Hyperliquid's Core order book and execute it as a gasless order. Core spot often prices better than an on-chain DEX for liquid pairs — this quote shows you the book's top and hands back the exact order to place.

Info

Core spot is quoted on a dedicated endpoint, not mixed into the EVM /quote planner — Core has no token addresses or calldata, so execution is an order, not a transaction. Compare its output to an EVM quote yourself; unified ranking is on the roadmap.

1. Quote the pair

curl "https://vector.example.com/hypercore/spot-quote?chain=10200001&base=HYPE&quote=USDC&amount=2&isBuy=true" \
  -H "api-key: $EDITH_API_KEY"
{
  "code": 0,
  "data": {
    "routeKind": "hypercoreSpot",
    "assetIndex": 10000,
    "pair": "HYPE/USDC",
    "isBuy": true,
    "bestPrice": 24.7,
    "limitPrice": 24.82,
    "amountIn": "2",
    "estimatedAmountOut": "49.4",
    "execution": {
      "endpoint": "POST {photon}/api/hypercore/order",
      "orderRequest": { "chainId": 10200001, "orders": [  ] },
      "note": "Place via Photon with your api-key/JWT; your agent must be approved."
    }
  },
  "message": "success"
}
  • bestPrice is the top of book you'd cross (the ask when buying, the bid when selling).
  • limitPrice is an aggressive IOC limit within your slippage (default 0.5%) so the order crosses and fills.
  • estimatedAmountOut is the output at the top of book — actual fills depend on depth.

2. Execute via Photon

The execution.orderRequest is ready to place through Photon's order endpoint:

curl -X POST https://photon.example.com/api/hypercore/order \
  -H "api-key: $EDITH_API_KEY" -H "Content-Type: application/json" \
  -d '<execution.orderRequest>'

This requires your HyperCore agent to be approved (and the builder fee, if the deployment charges one). The order is signed by your agent and submitted gaslessly; track the returned txId to EXECUTED.

When Core spot wins

  • Liquid majors (HYPE, major stables) — the CLOB's tight spreads beat AMM slippage.
  • Larger sizes — order-book depth often absorbs size an AMM pool can't without heavy price impact.

For thin or long-tail tokens, an EVM DEX route via /quote may still be better — quote both and compare estimatedAmountOut.