Repository navigation
fix(api): serve totalTokenSupply for price trackers - #873
Merged
Merged
Conversation
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>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
🟢 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
ECWireless
approved these changes
Nov 16, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
GET /api/totalTokenSupplyto the rebuild at the same path and with the same response as onmain: 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
mainas unused, which broke the total supply and market cap shown on those trackers. #872 restores it onmain. This PR adds it to the rebuild, so it doesn't break again when the rebuild replacesmainin 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/totalTokenSupplyreturns59171401.86044287(200,application/json), the same as the subgraph'sprotocol.totalSupplyand themainversion.POSTreturns 405.ƒ), so it's read per request (behind the CDN cache) rather than frozen at build time.🤖 Generated with Claude Code