Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.generalmarket.io/llms.txt

Use this file to discover all available pages before exploring further.

Infrastructure Endpoints

The plumbing. Contract addresses, health checks, testnet faucet, market history, and the catch-all proxy. Not glamorous. Essential.
  +------------------------------------------------------------------+
  |                     Infrastructure Routes                         |
  +------------------------------------------------------------------+
  |                                                                    |
  |   /api/deployment ------> reads JSON from server filesystem        |
  |                                                                    |
  |   /api/explorer/health -> Data Node /explorer/health/{endpoint}    |
  |                           (injects EXPLORER_TOKEN server-side)     |
  |                                                                    |
  |   /api/market/history --> Data Node /market/prices/{source}/{id}   |
  |                                                                    |
  |   /api/faucet ----------> L3 RPC (mint USDC)                       |
  |                    +----> Settlement RPC (drip gas)                 |
  |                                                                    |
  |   /api/dn/{...path} ---> Data Node /{path} (catch-all, SSE ok)    |
  |                                                                    |
  +------------------------------------------------------------------+

Get Deployment Config

Where the contracts live. The frontend reads this at runtime to know which addresses to call.
GET /api/deployment?file={filename}
file
string
required
Deployment file name. Must be one of:
  • active-deployment.json
  • morpho-e2e.json
  • local-e2e.json
  • local-frontend.json
curl "https://generalmarket.io/api/deployment?file=active-deployment.json"
  Resolution path:

  1. Try   ../deployments/{file}     (local dev: monorepo root)
  2. Fall  public/deployment.json    (Vercel prod, active-deployment.json only)
  3. 404   if both fail
StatusMeaning
200File found, JSON returned
400Invalid or missing file parameter
404Deployment file not found on server

Get Explorer Health

Consensus metrics, peer counts, order throughput. The pulse of the system. Token-authenticated, but the proxy handles that for you.
GET /api/explorer/health?endpoint={endpoint}&range={range}
endpoint
string
One of history or latest. Default: history.
range
string
Time range for history. One of: 1h, 6h, 24h, 7d, 30d. Default: 24h.
# Latest health snapshot
curl "https://generalmarket.io/api/explorer/health?endpoint=latest"

# Health history over 7 days
curl "https://generalmarket.io/api/explorer/health?endpoint=history&range=7d"
Whitelisted response fields (all other fields are stripped server-side):
  poll_batch_ts              Timestamp of the health poll
  quorum_met                 Whether BLS quorum was achieved
  worst_status               Worst status across all oracles
  consensus_rounds_total     Total consensus rounds attempted
  consensus_success_total    Rounds that reached quorum
  consensus_failed_total     Rounds that failed quorum
  signatures_collected       BLS signatures in latest round
  avg_consensus_time_ms      Average consensus latency
  avg_cycle_duration_ms      Average full cycle time
  orders_processed_last_60s  Recent order throughput
  pending_order_count        Orders waiting for processing
  total_peers                Number of oracle peers
  p2p_messages_received      P2P messages received
  p2p_messages_sent          P2P messages sent
  total_peers_healthy        Peers reporting healthy
  total_peers_unhealthy      Peers reporting unhealthy
StatusMeaning
200Health data returned
400Invalid endpoint or range parameter
502Data-node upstream unavailable
503EXPLORER_TOKEN not configured on server

Get Market Price History

Historical prices for a specific source and asset. The raw material for charts and analysis.
GET /api/market/history?source={source}&asset={assetId}&from={ts}&to={ts}
source
string
required
Data source identifier (e.g., earthquake, crypto, weather).
asset
string
required
Asset identifier within the source (e.g., USGS/us7000abc1, BTC).
from
string
Start timestamp (Unix seconds). Optional.
to
string
End timestamp (Unix seconds). Optional.
curl "https://generalmarket.io/api/market/history?source=crypto&asset=BTC&from=1708000000&to=1708600000"
StatusMeaning
200Price history returned
400Missing source or asset parameter
502Data-node upstream unavailable
Responses are cached at the CDN for 60 seconds with a 5-minute stale-while-revalidate window.

Testnet Faucet

Free money. Testnet only. Mints USDC on L3 and optionally drips gas on Settlement.
POST /api/faucet
address
string
required
Recipient wallet address (checksummed hex, 0x...).
amount
string
USDC amount to mint. Default: 100. Maximum: 10000.
gas
boolean
When true, also sends 0.5 S (Sonic testnet native token) for settlement gas. Default: false.
curl -X POST "https://generalmarket.io/api/faucet" \
  -H "Content-Type: application/json" \
  -d '{"address": "0xYourAddress", "amount": "1000", "gas": true}'
  Faucet flow:

  1. Validate address format (0x + 40 hex chars)
  2. Clamp amount to [0, 10000]
  3. Call L3_WUSDC.mint(address, amount * 1e18) on L3 chain
  4. Wait for L3 tx receipt
  5. If gas=true:
     a. Check deployer balance on Settlement chain
     b. If sufficient, send 0.5 S to address
     c. Wait for Settlement tx receipt
  6. Return tx hashes
StatusMeaning
200Mint successful (check individual usdc and gas fields)
400Invalid address format or amount
500Transaction failed
L3 USDC uses 18 decimals (not 6). The faucet handles this conversion internally. The amount parameter is in human-readable USDC (e.g., "1000" = 1000 USDC).

Data Node Proxy (Catch-All)

Everything that does not have its own route goes through here. Transparent pass-through to the data node, with SSE streaming support.
GET /api/dn/{...path}
Everything after /api/dn/ is forwarded to the data node, with all query parameters intact.
  Browser request                     Upstream request
  ---------------------------------   -----------------------------------
  /api/dn/sim/run-stream?top_n=10    DATA_NODE:8200/sim/run-stream?top_n=10
  /api/dn/sim/categories              DATA_NODE:8200/sim/categories
  /api/dn/portfolio?address=0x...    DATA_NODE:8200/portfolio?address=0x...
  /api/dn/snapshot?itp_id=0x...      DATA_NODE:8200/snapshot?itp_id=0x...
SSE streaming support:
  Regular JSON response:
    Browser --GET--> /api/dn/sim/categories
    Proxy   --GET--> DATA_NODE:8200/sim/categories
    Proxy   <--200-- { "categories": [...] }
    Browser <--200-- { "categories": [...] }

  SSE streaming response (backtest progress):
    Browser --GET--> /api/dn/sim/run-stream?...
    Proxy   --GET--> DATA_NODE:8200/sim/run-stream?...
    Proxy   <--200-- Content-Type: text/event-stream
    Browser <--200-- data: {"type":"progress","pct":10}
                     data: {"type":"progress","pct":50}
                     data: {"type":"progress","pct":100}
                     data: {"type":"result","stats":{...}}
Behaviors:
  • 5-minute timeout for long-running simulations
  • SSE pass-through with X-Accel-Buffering: no to bypass nginx buffering
  • No caching at the proxy layer
  • 502 on failure when the data node is unreachable
StatusMeaning
200Upstream response forwarded successfully
502Data-node unreachable or timed out
OtherUpstream HTTP status forwarded as-is