Skip to content

Show metrics for all known tokens on homepage. Closes #137#146

Merged
juliangruber merged 5 commits intomainfrom
add/home-metrics-for-all-tokens
Apr 30, 2026
Merged

Show metrics for all known tokens on homepage. Closes #137#146
juliangruber merged 5 commits intomainfrom
add/home-metrics-for-all-tokens

Conversation

@juliangruber
Copy link
Copy Markdown
Member

Closes #137

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

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

Project Deployment Actions Updated (UTC)
filecoin-pay-explorer Ready Ready Preview, Comment Apr 24, 2026 1:37pm

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 tokens list.
  • Simplify useStatsDashboard to 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 tokens field is queried without pagination (first/skip) or an explicit first limit. 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 $first variable (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.

Comment thread apps/explorer/src/hooks/useStatsDashboard.ts
Comment thread apps/explorer/src/hooks/useStatsDashboard.ts Outdated
juliangruber and others added 2 commits April 24, 2026 14:01
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread apps/explorer/src/services/grapql/queries.ts
Comment thread apps/explorer/src/services/grapql/queries.ts Outdated
Comment thread apps/explorer/src/components/Home/Stats.tsx
@BigLep BigLep moved this from 📌 Triage to 🔎 Awaiting review in FOC Apr 24, 2026
Copy link
Copy Markdown
Collaborator

@silent-cipher silent-cipher left a comment

Choose a reason for hiding this comment

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

Overall looks good to me! I have a couple of concerns -

  1. 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
  2. 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.

@rjan90 rjan90 added this to the M4.2: mainnet GA milestone Apr 29, 2026
@juliangruber
Copy link
Copy Markdown
Member Author

Homepage may display unknown tokens, just not known ones.

This is the whole point of the PR: Display all tokens in use, not just the ones the maintainers know about.

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.

Good catch, but this will be prevented once other network metrics are back, like total FIL burned

Copy link
Copy Markdown
Collaborator

@silent-cipher silent-cipher left a comment

Choose a reason for hiding this comment

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

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).

@github-project-automation github-project-automation Bot moved this from 🔎 Awaiting review to ✔️ Approved by reviewer in FOC Apr 30, 2026
@juliangruber
Copy link
Copy Markdown
Member Author

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.

Agreed, this will be a good problem to have, and I vote for fixing it then 🥳

@juliangruber juliangruber merged commit 943bb1b into main Apr 30, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from ✔️ Approved by reviewer to 🎉 Done in FOC Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

Add metrics "<token> settled"

6 participants