Skip to content

fix(api): serve totalTokenSupply for price trackers - #873

Merged
adamsoffer merged 1 commit into
nextfrom
total-token-supply-next
Nov 17, 2026
Merged

adamsoffer merged 1 commit into
nextfrom
total-token-supply-next

Conversation

@adamsoffer

Copy link
Copy Markdown
Collaborator

What

Adds GET /api/totalTokenSupply to the rebuild at the same path and with the same response as on main: LPT's total supply from the subgraph as a bare JSON number, cached for a day. Other methods get a 405.

Why

Price trackers such as CoinGecko read this endpoint for LPT's total supply, and they derive its market cap from it. #460 removed it from main as unused, which broke the total supply and market cap shown on those trackers. #872 restores it on main. This PR adds it to the rebuild, so it doesn't break again when the rebuild replaces main in production.

Important

Please don't remove this endpoint. Exchanges and price trackers rely on it, even though nothing in the app uses it. The route carries a comment saying so.

Testing

  • GET /api/totalTokenSupply returns 59171401.86044287 (200, application/json), the same as the subgraph's protocol.totalSupply and the main version.
  • POST returns 405.
  • A production build lists the route as dynamic (ƒ), so it's read per request (behind the CDN cache) rather than frozen at build time.

🤖 Generated with Claude Code

Exchanges and price trackers such as CoinGecko read
/api/totalTokenSupply for LPT's total supply, and so its market cap.
The rebuild has no such route, so they'd break when it replaces main.
Serve it as before: the subgraph's total supply as a bare JSON number,
cached for a day, with a note not to remove it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 16, 2026 20:59
@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
explorer-arbitrum-one Ready Ready Preview Nov 16, 2026 9:00pm UTC

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the legacy total-supply endpoint.

No open issues 🎉

What changed in this PR

Adds the legacy total-supply endpoint to the rebuild, preserving compatibility for exchanges and price trackers that use LPT supply to calculate market cap.

Changes:

  • Adds GET /api/totalTokenSupply, returning the subgraph’s total supply as a bare JSON number.
  • Sets one-day shared-cache headers and returns a 502 response when the upstream request fails.
  • Documents the endpoint’s external consumers to prevent accidental removal.
File Description
app/​api/​totalTokenSupply/​route.ts Implements the supply endpoint, caching headers, error handling, and compatibility documentation.

Review effort: Balanced

@adamsoffer
adamsoffer merged commit 6fe4ff8 into next Nov 17, 2026
8 checks passed
@adamsoffer
adamsoffer deleted the total-token-supply-next branch November 17, 2026 00:17

This branch was successfully deployed

1 active deployment
Preview — 40347e65 Deployed Nov 16, 2026 by vercel[bot]
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.

3 participants