Show metrics for all known tokens on homepage. Closes #137#146
Show metrics for all known tokens on homepage. Closes #137#146juliangruber merged 5 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Updates the Explorer homepage stats to show metrics for all tokens returned by the subgraph (instead of hard-coding USDFC and FIL), aligning with issue #137.
Changes:
- Update the stats dashboard GraphQL query to fetch the full
tokenslist. - Simplify
useStatsDashboardto no longer require token address variables. - Render “Total <token> Transacted” and “Total <token> Locked” cards by iterating over returned tokens.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/explorer/src/services/grapql/queries.ts | Changes stats query from per-token lookups to fetching tokens list. |
| apps/explorer/src/hooks/useStatsDashboard.ts | Removes variables-based query and updates hook interface (currently with type mismatches). |
| apps/explorer/src/components/Home/Stats.tsx | Replaces fixed USDFC/FIL cards with dynamic cards generated from tokens. |
Comments suppressed due to low confidence (1)
apps/explorer/src/services/grapql/queries.ts:450
- The
tokensfield is queried without pagination (first/skip) or an explicitfirstlimit. For subgraph/The Graph style APIs this commonly defaults to 100 results, which can prevent the homepage from showing metrics for all known tokens as the PR intends. Consider adding a$firstvariable (with a sufficiently high default) or implementing pagination to fetch all tokens.
query GetStatsDashboard {
tokens {
name
symbol
decimals
totalOneTimePayment
totalSettledAmount
userFunds
lockupCurrent
lockupRate
lockupLastSettledUntilEpoch
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
silent-cipher
left a comment
There was a problem hiding this comment.
Overall looks good to me! I have a couple of concerns -
- Homepage may display unknown tokens, just not known ones. We could address this by either:
- Adding a limit/filter in the graphql query, or
- Restricting results to whitelisted token addresses on home page
- When the query returns no tokens, ui will silently renders zero cards with just the section heading no fallback message. It would be good to handle this explicitly.
This is the whole point of the PR: Display all tokens in use, not just the ones the maintainers know about.
Good catch, but this will be prevented once other network metrics are back, like total FIL burned |
silent-cipher
left a comment
There was a problem hiding this comment.
This is the whole point of the PR: Display all tokens in use, not just the ones the maintainers know about.
That makes sense. My only concern is around scalability. Once we have more tokens (say 5+), this could result in quite a few cards on the homepage alongside the existing metrics.
Not an issue right now since we only have ~3 tokens, but something we might want to keep in mind (e.g. limiting tokens on homepage and moving to table view instead).
Agreed, this will be a good problem to have, and I vote for fixing it then 🥳 |
Closes #137