feat(indexer): add holder and supply-history aggregates (Closes #945) - #1060
Open
aishagbadamosi wants to merge 3 commits into
Open
aishagbadamosi wants to merge 3 commits into
aishagbadamosi wants to merge 3 commits into
Conversation
|
@aishagbadamosi 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! 🚀 |
p3ris0n
requested changes
Sep 28, 2026
p3ris0n
left a comment
Contributor
There was a problem hiding this comment.
Review
The read API matches #945, but it cannot run against a migrated database.
What is in place:
GET /api/v1/holdersreturns balances folded from mint, transfer, and burn deltas, drops zero balances, and uses the existing limit/cursor pagination.GET /api/v1/supply-historyappends a timestamped point per mint or burn, from the event'snew_supplyor the previous point plus the delta. It does not call RPC.aggregates.test.tscovers a mint then a transfer. CI on this branch is green.
What is missing:
schema.prismaaddsHolderandSupplyPoint, and there is no Prisma migration.prisma migrate deploywill not create those tables, so both routes fail on a fresh or existing database.- Please add a committed migration for the new models (and keep it compatible with #1056's init migration if that lands first).
Holding merge until that migration is in the branch.
The Holder and SupplyPoint models added for BCPathway#945 were only declared in schema.prisma, so "prisma migrate deploy" never created the tables and both /api/v1/holders and /api/v1/supply-history failed against a fresh or existing database. Commits 20260928193226_add_holder_and_supply_point, generated with "prisma migrate diff" against the pre-change schema so the DDL matches Prisma's canonical output. The migration is additive only and creates none of the base models, so it applies in either order relative to the BCPathway#1056 init migration. Every CREATE is guarded with IF NOT EXISTS so an init generated from a schema snapshot that already includes these two models cannot fail the deploy; this is the only deviation from Prisma's raw output and it is commented in the file. Also fixes a duplicate "test" key in package.json. JSON keeps the last entry, so CI was running a script that excluded ledger.test.ts, aggregates.test.ts, and healthz.test.ts, including the aggregates coverage cited for BCPathway#945. Adds migrations.test.ts to guard the schema/migration invariant, a prisma:deploy script, and the migration flow in the README.
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 does this PR do?
Adds
GET /api/v1/holdersandGET /api/v1/supply-historyto the indexer,deriving current holder balances and supply history from the already-indexed
mint, transfer, and burn events.
closes #945
Type of change
Checklist
pre-commit run --all-fileslocally and it passedBreaking changes?
Related issues
Closes #945