Developers
Indexer API
The indexer reads Moxie’s accounts and transactions from Solana and serves them as JSON. The website uses it for everything it shows; you can use it for bots, dashboards and analytics.
Basics#
The indexer runs at http://localhost:8787 by default (pnpm indexer:start in the monorepo; set SOLANA_RPC_URL and MOXIE_MARKET_ACCOUNT). All endpoints are GET, unauthenticated, and return JSON.
Markets#
| Endpoint | Returns |
|---|---|
/v1/markets | Every listed market with prices, lifecycle status and 24h stats. |
/v1/markets/:address | One market. |
/v1/markets/:address/chart?range=1h|1d|1w|all | Bucketed mark and index lines, trade candles and fills, ready for charting. |
/v1/markets/:address/trades | Fills in this market, newest first. |
/v1/markets/:address/prices | Raw price observations. |
/v1/markets/:address/funding | Funding events. |
GET /v1/markets/:address
{
"address": "DTixFhdpGh9vNpU4JFxp4cq5onoTwtNbm3BpJuMRL2qm",
"provider": "panta",
"providerMarketId": "C86nbpSX4ntRWvN4HMrdnhzHjHTtLooNtnw6k7hnmx1F",
"title": "Saka 7+ points, GW6",
"rules": "Resolves YES if …",
"assetIndex": 2,
"marketId": "3",
"status": 1, // 1 active, 2 restricted, 3 reduce-only, 4 locked, 5 resolved
"markE6": "491906", // protected mark (the displayed price)
"indexE6": "491899", // source index
"localBidE6": "484903",
"localAskE6": "498909",
"basisTwapE6": "7",
"closeTime": "1791639000", // unix seconds
"oracleUpdatedAt": "1791582638",
"stats": {
"change24hCents": -0.49,
"volume24hUsd": 0,
"openInterestContracts": 1.996805,
"openInterestUsd": 0.98
}
}GET /v1/markets/:address/chart?range=1h
{
"range": "1h",
"bucketSeconds": 60,
"mark": [{ "time": 1791582000, "value": 49.19 }, …],
"index": [{ "time": 1791582000, "value": 49.19 }, …],
"fills": [{ "time": 1791407564, "price": 50.78, "size": 1.99, "side": "long", "portfolio": "Em17…", "signature": "2rAQ…" }],
"candles": [{ "time": 1791406980, "open": 50.78, "high": 50.78, "low": 50.78, "close": 50.78, "volume": 1.99 }]
}GET /v1/markets/:address/trades
[
{
"signature": "2rAQHYKa…",
"slot": 508586517,
"blockTime": 1791407564,
"kind": "trade",
"marketId": "3",
"portfolio": "Em17bXzKw2QNScV1HRSKEBLY3FnieXXkgcxzSJpEjAtj",
"data": { "sizeQ": "1996805", "feeBps": "30", "limitPriceE6": "527804", "executionPriceE6": "507804", "executedSizeQ": "1996805" }
}
]Portfolios#
| Endpoint | Returns |
|---|---|
/v1/portfolios/:address | Collateral, PnL, ids needed to build transactions, health and positions. |
/v1/portfolios/:address/positions | Open positions only. |
/v1/portfolios/:address/transactions | Trades, deposits and other events for this portfolio. |
/v1/owners/:ownerHex/portfolio | Look up a wallet’s portfolio. ownerHex is the wallet’s 32-byte public key as lowercase hex. |
GET /v1/portfolios/:address
{
"address": "Em17bXzKw2QNScV1HRSKEBLY3FnieXXkgcxzSJpEjAtj",
"owner": "b2da9311…41fcace", // wallet public key, hex
"capital": "99997000", // 99.997 USDC
"pnl": "0",
"portfolioId": "4",
"positionEpoch": "1",
"sequence": "1",
"health": { "valid": true, "equity": "…", "initialRequirement": "…", "maintenanceRequirement": "…", "liquidationDeficit": "0", "worstCaseLoss": "…" },
"positions": [
{ "assetIndex": 2, "marketId": "3", "side": "long", "sizeQ": "1996805", "entryPriceE6": "507804", "stale": false }
]
}Finding a wallet’s portfolio
lookup.ts
import { PublicKey } from "@solana/web3.js";
const ownerHex = Buffer.from(new PublicKey(wallet).toBytes()).toString("hex");
const res = await fetch(`http://localhost:8787/v1/owners/${ownerHex}/portfolio`);
const portfolio = res.status === 404 ? null : await res.json();Source markets#
| Endpoint | Returns |
|---|---|
/v1/providers/panta/markets?status=&category=&query=&limit=50 | Events available on the source prediction market. |
/v1/providers/panta/markets/:id | One source event. |
/v1/providers/panta/status | Source catalog connection status. |
Status#
| Endpoint | Returns |
|---|---|
/health | Latest indexed slot and the last slots seen from the oracle and the keeper. |
/v1/status/oracle | Oracle reporter’s last slot vs. the indexed slot. |
/v1/status/keeper | Keeper’s last slot vs. the indexed slot. |
/v1/events | Every indexed event (trades, funding, deposits…), newest first. |