refactor: migrate validator endpoints from v1 to v2#600
Merged
Conversation
The indexer marked /api/v1/validators, /api/v1/validators/{id}, and
/api/v1/validators/blocks/missed as deprecated; switch all three to
their v2 replacements. The slots endpoint now takes a 7-day Unix-seconds
window instead of a timeframe enum, and reliability is derived from
missedSlotRatio (already 0..1) so 0/0 windows render as 0% rather
than NaN%.
Along the way, fixes a long-standing bug where the validator details
schema parsed a field literally named `nftYieldsNextCycle` — that field
has never existed in the API (both v1 and v2 expose
`nftYieldsIfDelegatedNextCycle`), so the value was always `{}` and
every NFT tier rendered as 0%. The summary now merges current
`nftYields` with `nftYieldsIfDelegatedNextCycle` (next-cycle takes
precedence) and the UI omits tiers absent from both, matching the
Stargate display pattern.
Drops dead exports (`ValidatorSortBy`, `SortDirection`, the
`validatorId` query param, `ValidatorDetails.online`) that the v2
contract no longer supports and that had no callers.
Also drops `export` from six selector-decoder / sourcify-cache types
that knip flagged as unused — none of them are imported anywhere,
they were only blocking the pre-commit hook.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Block explorer – Preview
Preview environment destroyed after PR was closed |
PR Docker Image PublishedRun locallydocker run --rm -p 3000:3000 ghcr.io/vechain/block-explorer:pr.600.427c280 |
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.
Summary
/api/v1/validators→/api/v2/validators/api/v1/validators/{id}→/api/v2/validators/{id}/api/v1/validators/blocks/missed?timeframe=WEEK→/api/v2/validators/{id}/slots(now takes a 7-day Unix-seconds window; reliability derived frommissedSlotRatio)nftYieldsNextCycle, but that field has never existed in the API (v1 and v2 both exposenftYieldsIfDelegatedNextCycle). Every NFT tier therefore rendered as 0% in production. The summary now merges currentnftYieldswithnftYieldsIfDelegatedNextCycle(next-cycle takes precedence) and the UI omits tiers absent from both, matching the Stargate display pattern.0/0slot windows (e.g. a queued validator with no scheduled slots over the last 7 days).ValidatorSortBy,SortDirection,validatorIdquery param,ValidatorDetails.online) that v2 no longer supports and no caller used.exportfrom six unused selector-decoder / sourcify-cache types that knip flagged (pre-existing failures onmain, unblocking pre-commit).Test plan
HomeStatsGroup/address/0xfe28fa171d78fb02bc3227bec8073b4d94ab6c4d): Stake breakdown, staking pie chart, Validator APY + next-cycle APY, cycle info populateEndorsedValidatorsSectionlists endorsed validators with correct stake amounts🤖 Generated with Claude Code