Skip to content

Frontend: Create a 'Keeper Statistics' page#745

Open
wheval wants to merge 1 commit into
SoroLabs:mainfrom
wheval:feat/issue-695-keeper-statistics-page
Open

Frontend: Create a 'Keeper Statistics' page#745
wheval wants to merge 1 commit into
SoroLabs:mainfrom
wheval:feat/issue-695-keeper-statistics-page

Conversation

@wheval

@wheval wheval commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • New route /keepers (frontend/app/keepers/page.tsx): a public leaderboard table of top Keepers by tasks executed and bounties earned, backed by useKeeperStats (frontend/app/hooks/useKeeperStats.ts).
  • Indexer: added a keeperStats(limit: Int): [KeeperStat!]! GraphQL query, aggregating KeeperPaid events at the SQL layer (json_extract + GROUP BY on the existing events table) rather than pulling raw events into the frontend and summing them client-side - the issue asks to "fetch aggregate statistics from the indexer," and no aggregate endpoint existed yet, so building it was necessary to do that literally rather than working around it.
  • bountiesEarnedXlm divides the raw stroop amount by 1e7, matching the convention the existing /keeper-metrics page already uses for avgFeePaidXlm.

Found while wiring this up: the indexer's GraphQL layer (apollo-server-express, express, cors, jsonwebtoken - all required by the existing api.js/resolvers.js) was never declared in indexer/package.json. npm install && node index.js has never actually been able to start the API server. Added the missing dependencies so the new keeperStats query (and the GraphQL API generally) is actually runnable - verified end-to-end below.

Closes #695

Test plan

  • Verified the new resolver end-to-end: started a real Apollo server against a seeded sqlite db and confirmed keeperStats returns correctly aggregated, correctly-ordered results (2 keepers, correct tasksExecuted counts and bountiesEarnedXlm sums).
  • cd frontend && npx jest app/keepers/page.test.tsx - 4 tests pass (renders leaderboard ranked by tasks executed, empty state, error state, loading state).

Note: the indexer's own test script (npm test -> node --test) currently fails to even run its existing Jest-style test file (describe/expect aren't valid under node --test) and has one unrelated pre-existing failing test in staleTasks.test.js - both predate this change and are out of scope here, so I verified the new resolver manually instead of adding a test that would hit the same broken harness.

- New route /keepers (frontend/app/keepers/page.tsx): public leaderboard
  table of top Keepers by tasks executed and bounties earned, backed by
  useKeeperStats (frontend/app/hooks/useKeeperStats.ts).
- Indexer: added a keeperStats(limit: Int) GraphQL query, aggregating
  KeeperPaid events at the SQL layer (json_extract + GROUP BY on the
  existing events table) rather than pulling raw events into the
  frontend and summing them there - the requirement was 'fetch aggregate
  statistics from the indexer,' and no aggregate endpoint existed yet.
  Verified end-to-end against a live Apollo server + seeded sqlite db.

While wiring this up, found the indexer's GraphQL layer
(apollo-server-express, express, cors, jsonwebtoken - all required by
existing code in api.js/resolvers.js) was never declared in
package.json, so npm install + running the API has never actually
worked. Added the missing dependencies so the new query (and the
existing GraphQL API generally) is runnable.

Closes SoroLabs#695

## Test plan
- Verified the new GraphQL resolver end-to-end: started a real Apollo
  server against a seeded sqlite db and confirmed keeperStats returns
  correctly aggregated, correctly-ordered results.
- frontend: npx jest app/keepers/page.test.tsx - 4 tests pass (renders
  leaderboard, empty state, error state, loading state).
@drips-wave

drips-wave Bot commented Jul 5, 2026

Copy link
Copy Markdown

@wheval Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Frontend: Create a 'Keeper Statistics' page

1 participant