A market route: /:chain/market and /:chain/market/near-intents #32

Closed
opened 2026-10-03 18:57:21 +00:00 by grenade · 0 comments
Owner

Why

#27, #30 and #31 index QTC's settled swaps on NEAR Intents, but the only UI is the Market panel on /:chain/network. It shows the price per counter token, or the "no market yet" evidence. Nothing in the frontend calls /intents/swaps, so:

  • there is nowhere to see an individual trade (tx, taker, referral, counter, side, kind)
  • there is no feed of swaps as they settle, although each one is already pushed on /v1/ws

NEAR Intents is unlikely to stay the only venue, so the page belongs under a market index rather than being a one-off.

What

  • URL grammar (lib/routes.ts): /:chain/market is the index and /:chain/market/:market is one venue. The first market is near-intents.
    • Singular, like every other kind on the site (/node/, /block/, /account/). markets is accepted and rewritten to the canonical form, so a link typed either way works.
    • market is added to isStandings, href and parse together. That is where the node section's two missed places were caught (CLAUDE.md, "Is this the standings?").
  • API:
    • GET /v1/chains/{chain}/markets lists the venues a chain is tracked on, so the index is not hard-coded. It is empty for a chain with no [chains.intents].
    • /intents/swaps gains before=<near_height>:<trade_index>, which pages newest first. A history page reads from the top; the existing after stays for clients that read forward.
  • /:chain/market/near-intents:
    1. The Market panel's figures and listing evidence as the header. The network page keeps its panel and links here.
    2. Live: swaps as they settle, newest first, fed by ServerMessage::IntentsSwap, in the block ticker's idiom (no auto-scroll, a fixed number of lines).
    3. History: paged through /intents/swaps?before=, with user trades and unattributed solver-to-solver trades labelled apart. Each row links to the transaction on a NEAR explorer.
    4. What is read, and the blind spot, in words, as the panel does now.
  • Empty is a state, not an error. For QTC today the page shows the evidence that nothing has been bridged. Proven against a busy token (wNEAR) in development, as the indexer was.

Not this

  • A price chart. That needs a time-bucketed series route first (OHLC was left out of #27's phase 1), and it has to be read against the dataviz skill and the site's single-hue rule. It is a separate issue once there is data worth drawing.
## Why #27, #30 and #31 index QTC's settled swaps on NEAR Intents, but the only UI is the Market panel on `/:chain/network`. It shows the price per counter token, or the "no market yet" evidence. Nothing in the frontend calls `/intents/swaps`, so: - there is nowhere to see an individual trade (tx, taker, referral, counter, side, `kind`) - there is no feed of swaps as they settle, although each one is already pushed on `/v1/ws` NEAR Intents is unlikely to stay the only venue, so the page belongs under a market index rather than being a one-off. ## What - **URL grammar** (`lib/routes.ts`): `/:chain/market` is the index and `/:chain/market/:market` is one venue. The first market is `near-intents`. - Singular, like every other kind on the site (`/node/`, `/block/`, `/account/`). `markets` is accepted and rewritten to the canonical form, so a link typed either way works. - `market` is added to `isStandings`, `href` and `parse` together. That is where the node section's two missed places were caught (CLAUDE.md, "Is this the standings?"). - **API:** - `GET /v1/chains/{chain}/markets` lists the venues a chain is tracked on, so the index is not hard-coded. It is empty for a chain with no `[chains.intents]`. - `/intents/swaps` gains `before=<near_height>:<trade_index>`, which pages newest first. A history page reads from the top; the existing `after` stays for clients that read forward. - **`/:chain/market/near-intents`:** 1. The Market panel's figures and listing evidence as the header. The network page keeps its panel and links here. 2. **Live**: swaps as they settle, newest first, fed by `ServerMessage::IntentsSwap`, in the block ticker's idiom (no auto-scroll, a fixed number of lines). 3. **History**: paged through `/intents/swaps?before=`, with user trades and `unattributed` solver-to-solver trades labelled apart. Each row links to the transaction on a NEAR explorer. 4. What is read, and the blind spot, in words, as the panel does now. - **Empty is a state, not an error.** For QTC today the page shows the evidence that nothing has been bridged. Proven against a busy token (wNEAR) in development, as the indexer was. ## Not this - **A price chart.** That needs a time-bucketed series route first (OHLC was left out of #27's phase 1), and it has to be read against the `dataviz` skill and the site's single-hue rule. It is a separate issue once there is data worth drawing.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: blackbeard/observer#32