Overview
The three Daejin prediction-market APIs, and where each one lives.
Daejin exposes two HTTP surfaces. They share one credential model — an API key from this portal, or the app's own session — described in Authentication.
| Surface | What it is for | Base URL (this environment) |
|---|---|---|
| CLOB Market Maker API | The matching engine: live books, depth, trades, placing and cancelling signed limit orders, and the real-time WebSocket feed. | https://app-staging.daejin.xyz/clob/v1 |
| Settlement Bridge API | Market orders against the AMM, quotes, and Solana transaction builders. Every POST here makes the bridge spend gas. | https://app-staging.daejin.xyz/clob-engine |
Staging mirrors production at app-staging.tokenplay.ai — with one trap: on staging
/clob is the engine and /clob-engine is the bridge, while on production
/clob-engine is the engine and /clob-bridge is the bridge. Read the base URL from
your environment; never hardcode a path.
Amounts are decimal strings when they may exceed JavaScript's safe integer range. Prices are integer ticks: 1000 = $1.00.
Start here
- Sign in on the API keys page with the wallet that will own your keys and create one with the scopes you need.
- Read Authentication for headers, rate limits and the migration timeline.
GET /marketson the engine tells you what is live and the exactmarketlabel every other call takes.- Orders are signed by your own wallet — EIP-712 on EVM, ed25519 over a canonical string on Solana. The API never holds a key of yours; see the operation pages under API Reference for the exact payloads.
- Subscribe to the WebSocket feed instead of polling.
Which surface for what
The matching engine holds resting limit orders. The settlement bridge handles market orders, chain preparation and Solana transaction builders.
| Need | Use | Important detail |
|---|---|---|
| Read the book, place/cancel limit orders | Engine | API and UI use the same book when the market label is the same. |
| Market orders and funding helpers | Bridge | Market orders fill against the AMM and never rest in the engine book. |
| EVM integration | examples/market-maker/mm-client.mjs in prediction-backend | Orders use EIP-712. Market label is evm:<chainId>:<clobMarketId>. |
| Solana integration | examples/market-maker/solana-mm-client.mjs | Orders use base58 ed25519 over a canonical string. Market label is the plain numeric CLOB market id. |
| Deposit, withdraw, claim, LP actions | Wallet-signed chain transaction | Solana uses the bridge's /tx/* builders. EVM calls ClobExchange directly or via mm-client.mjs. |
First-time test order: GET /markets, inspect /book, generate a fresh signature, then
POST /orders. A copied old signature will be rejected.
Market maker API list
| Method | Endpoint | Use | Auth / Signature |
|---|---|---|---|
| GET | /markets | List live CLOB books known to this engine. | None |
| GET | /markets/{market} | Summary: best bid/ask levels, open orders, session volume. | None |
| GET | /markets/{market}/ticker | Current top-of-book price/spread/session stats. | None |
| GET | /markets/{market}/book | Aggregated order book depth. | None |
| GET | /markets/{market}/orders | All current resting limit orders. | None; the ?user= filter needs read and is owner-only |
| GET | /markets/{market}/trades | Recent matched fills observed by this engine. | None |
| GET | /users/{user}/orders?market={market} | One wallet's current resting orders. | read, owner-only |
| GET | /users/{user}/orders/closed?market={market} | One wallet's cancelled, expired, or rejected orders. | read, owner-only |
| GET | /orders/{orderId} | Status for one order id. | read |
| POST | /orders | Place a limit/market-maker order. | write, plus the order signature — EVM: EIP-712; Solana: ed25519 over the canonical string |
| DELETE | /orders/{orderId} | Cancel a resting order. | write, plus a wallet-signed cancel message |
Every endpoint above is on the engine. The API key identifies the caller; the wallet
signature is what authorises a trade, and the API never creates one for you. Market
orders are not here: they fill against the AMM through the settlement bridge, see
Market Order. Money movement is chain-specific:
Solana uses the bridge's /tx/* transaction builders,
while EVM users send ClobExchange contract transactions from their own wallet/RPC or
with mm-client.mjs.
Close, settlement and resolve endpoints are operator-only and are not issued to market makers.
Suggested test flow
| Step | Action | Expected result |
|---|---|---|
| 1 | GET /markets. | You have the correct engine market label. Do not use the app/Mongo market id in /orders. |
| 2 | GET …/book, …/orders, …/ticker. | You see current book depth, resting orders, and current top-of-book stats. |
| 3 | Fund the wallet on chain, then place a signed limit order. | The order is accepted only if the signature matches the exact payload. |
| 4 | GET /orders/{orderId}. | You see the exact order status: open, partial, filled, cancelled, or expired. |
| 5 | Cancel from the UI, or use signed DELETE /orders/{orderId}. | The order disappears from book/orders. No explorer tx is expected for an engine cancel. |
| 6 | Check /users/{user}/orders/closed. | Cancelled, expired, or rejected orders are visible separately from the live book. |
| 7 | Withdraw idle balance from the exchange. | The wallet receives tokens and this withdrawal appears on the explorer. |
| 8 | Use a second wallet to cross the book with a taker order. | Book size changes and app trade history records the fill. If settlement fails, the engine rolls the fill back. |
The same flow on Solana, as paste-able commands with the arithmetic to check against, is the Solana walkthrough.