Skip to content

docs: REST API reference and JSON-RPC parity with the node - #313

Merged
majesticwizardcat merged 6 commits into
mainfrom
docs/api-parity
Oct 5, 2026
Merged

majesticwizardcat merged 6 commits into
mainfrom
docs/api-parity

Conversation

@majesticwizardcat

@majesticwizardcat majesticwizardcat commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Brings the API docs in line with the node, treating the node code as the source of truth, and adds a reference for the REST API, which was previously undocumented apart from the bridge routes.

REST reference (new)

doc/api-reference/rest/openapi.yaml and rest/README.md, published as a second GitBook spec, pod-rest, next to pod-docs.

  • Markets: /v1/clob/status, /markets, /markets/stats, /candles/{orderbook}, /orderbook/{orderbook}, /solutions
  • Account: /v1/clob/orders/{account}, /fills/{account}, /positions/{account}, /balances/{account}, /triggers/{account}, /backstop-transfers/{account}, /activity/{account}
  • Explorer: /v1/tx/{hash}, /v1/transactions
  • Bridge: /v1/bridge/config, /withdrawals, /withdrawals/{account}, /withdrawals/by-id/{tx_hash}, with the full claim-proof response and what pending means

Each route documents its parameters, defaults, caps, errors and Cache-Control. The README covers the /v1 prefix on the RPC port, which routes need the indexer, caching, number encodings, and seeding from REST before subscribing.

JSON-RPC reference

The highest-impact fixes:

  • eth_getBalance: plain CLOB cash, not the withdrawable balance.
  • eth_estimateGas: a table lookup, not a fixed 21000.
  • eth_getTransactionCount: honours the pending tag.
  • README block methods: blocks are real.
  • pod_getVoteBatches: the params are now correct; the old example failed.
  • ob_getOrderbook: bids are ascending, and the example is flipped.
  • ob_getCandles: the window is half-open, and limit is capped.
  • Order and triggers: the field encodings are corrected.
  • ob_getPositions: a perp position's realized_pnl is always 0.
  • pod_orders_v2: the status and reject-code lists now match the node.

Also:

  • Added: ob_getSolutions, newHeads and pod_activity.
  • Fixed: the subscription replay and snapshot rules, and the missing schema fields.
  • Removed: pod_getBridgeClaimProof, which no longer exists.

Guides and other pages

  • read-market-data.md: rewritten around REST plus subscriptions.
  • recover-locked-account.md: reads TargetTx as {hash, nonce}.
  • json-rpc-errors.md: adds the missing error codes and the up-front since too old rejection.
  • SDK README: restUrl is the RPC host plus /v1.

Before merging

  • Activity feed (node PR POD-158 Adds pod precompiles documentation #113, now merged). /v1/clob/activity, pod_activity, ADL frames on pod_orders_v2, cash-sweep backstop rows and the extra pod_positions pushes are documented against node main.
  • GitBook. The pod-rest spec has to be accepted in the GitBook organization. The publish workflow now uploads both specs.

Left out on purpose

  • POST /v1/raw-txs: its binary frame format would need describing first.
  • eth_syncing, eth_gasPrice, eth_maxFeePerGas, eth_maxPriorityFeePerGas, eth_getCode, eth_feeHistory, net_version and web3_clientVersion, which return fixed or placeholder answers.
  • Internal node methods: pod_getAccountRepair, pod_pushAccountRepair, pod_getBridgeClaimSignatures, pod_subscribeVotes, and admin and dev methods.
  • ob_* deprecation, left for a later pass.
  • SDK activity and accountValue, which belong with SDK PRs feat(ts-sdk): account activity resource #310 and feat(ts-sdk): account value on the PnL history #311.

Known gap

pod_orders (v1) new and invalid events serialize the engine's order type, not OrderResponse. Their real shape differs from the documented one: end is a string and several fields are absent. This is not fixed here.

Verification

  • Both specs parse.
  • redocly lint: the REST spec has 0 errors. The JSON-RPC spec adds no new errors (44 before and after, all pre-existing).
  • A review pass checked the docs against node code and found four issues, all fixed: price_change_24h is in basis points, the guide's pod_orderbook since now uses the solution-time watermark, pod_activity was missing from the stale-since list, and the README no longer documents unmerged SDK methods.

🤖 Generated with Claude Code

majesticwizardcat and others added 6 commits October 5, 2026 16:06
- New REST reference (doc/api-reference/rest/), published as a second
  GitBook spec (pod-rest): every /v1/clob, explorer and bridge route,
  including /v1/clob/activity from the account activity feed.
- JSON-RPC reference brought in line with the node: method params,
  response fields and encodings, limits, subscription semantics,
  newHeads, pod_activity, ob_getSolutions; pod_getBridgeClaimProof
  removed in favour of the REST by-id route.
- Guides, the JSON-RPC README, the errors page and the SDK README fixed
  where they disagreed with the node.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…tches

- /clob/activity entries use the field names the merged node sends: ts,
  book, mark, pnl, tx, id; the cursor is "{ts}:{ordinal}:{key_hex}".
- withdrawable_cash is max(0, equity - max(initial margin,
  transfer_margin_ratio x notional)), in margin.md and both specs.
- The market-data guide replays the whole forming candle from the bucket
  start (seeding from 1h bars past the replay buffer), and states which
  routes use hex and which decimal strings.
- pod_getVoteBatches takes an optional validator_index, served by any
  node that holds that validator's batches.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Tone down the PR's added text: less emphasis and rationale, each fact
  stated once.
- The publish workflow uploads both specs in one loop; the REST README
  drops the paging table each route already documents.
- From checking against the node: eth_estimateGas cases, the
  pod_sendRawTransaction wait and its code 3 error, getAccountDiagnostics
  current_vote, orders_v2 cancel `st`, settlement_price presence,
  SolutionResponse.funding_index, getVoteBatches result shape, the
  forming candle (since = bucket start - 1us) in the REST reference, the
  orderbook price-key encoding, and the pod_markets snapshot scope.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@majesticwizardcat
majesticwizardcat marked this pull request as ready for review October 5, 2026 14:00
@majesticwizardcat
majesticwizardcat merged commit c2c3302 into main Oct 5, 2026
12 checks passed
@majesticwizardcat
majesticwizardcat deleted the docs/api-parity branch October 5, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants