Skip to main content

Indexer

warning

Indexer APIs are continuously evolving and may break.

The Indexer is responsible for synchronizing on-chain Solana state with our fast off-chain database. It provides a lightweight Hono.js REST API for querying historical and aggregated data.

API Reference

The Indexer API is available at: https://indexer.api.test.winnr.trade/api/v1

Markets

  • GET /markets
    • List all markets with optional status filtering.
    • Query Params: status (active, halted, resolution_pending, resolved), limit (default 50).
  • GET /markets/:id
    • Get detailed information for a specific market by ID.
  • GET /markets/:id/chart
    • Get historical price/probability data points for charting.
    • Query Params: startTime, endTime, limit.
  • GET /markets/:id/trades
    • Get the most recent trade history for a specific market.

Trades & Activity

  • GET /trades
    • Get trade activity for a specific user address across all markets.
    • Query Params: userAddress (Required), page, limit.

Portfolio & Positions

  • GET /positions
    • Get active share balances, costs, and current market value for a specific user.
    • Query Params: user_address (Required), page, limit.

Private Order Flow

Stealth Order Memos

When a private order is placed, the execution layer emits a StealthOrderMemo event which the indexer persists. Owners can scan for their own orders by querying with locally-computed detection tags:

GET /api/v1/stealth-order-memos?detection_tags=<tag1>,<tag2>,...
  • Query: One or more detection tags (comma-separated, hex strings).
  • Response: A map of detection_tag → memo | null. A null value means no order exists for that tag — useful for efficient gap scanning without extra round trips.

Each memo record contains:

FieldDescription
commitmentUTXO note commitment (Poseidon(owner, amount, salt, nonce))
stealth_addressThe stealth Ed25519 pubkey used as the order owner
detection_tagHMAC-SHA256(view_key, market_id || nonce) — scoped per market
timestampBlock timestamp of the order
tx_hashOn-chain transaction hash

The owner recomputes detection tags locally using their view_key and queries in batches — they learn which orders are theirs without revealing their identity to the indexer.

Notes (Shielded Pool)

Deposits, withdrawals, and account registrations are indexed as UTXO notes. These are used by clients to reconstruct the local Merkle tree for proof generation:

GET /api/v1/notes?kind=<kind>&from_index=<leaf_index>&limit=<n>
GET /api/v1/notes/leaves # full Merkle leaf set (commitment + leaf_index)
GET /api/v1/notes/commitment/:commitment # look up a single note by commitment
  • kind: register_account, deposit, or withdraw.
  • from_index: Filters notes with leaf_index >= from_index, ordered ascending — allows efficient incremental sync.
  • /notes/leaves: Returns only commitment and leaf_index fields (up to 5000 per page), optimised for tree reconstruction.