fix(types): API renamed witness→validator on read paths - #4
Merged
Conversation
The viz-cpp-node witness→validator migration renamed the fields the site
API emits, but the read-path types still declared the old names:
- ChainInfo.current_witness → current_validator (GET /)
- Profile.witness_votes → validator_votes (GET /profile/{user})
- Profile.witnesses_voted_for→ validators_voted_for
Add the new field names as primary and keep the old ones as @deprecated
aliases so consumers on older nodes still type-check. Verified against
live api.viz.cx: GET / returns current_validator, GET /profile returns
validators_voted_for / validator_votes.
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
The viz-cpp-node
witness→validatormigration renamed the fields the site API emits, but this SDK's read-path types still declared the old names:ChainInfo.current_witnesscurrent_validatorGET /Profile.witness_votesvalidator_votesGET /profile/{user}Profile.witnesses_voted_forvalidators_voted_forGET /profile/{user}Why it matters
Consumers (viz.cx frontend) typed against
current_witnessetc. readundefinedat runtime, so the homepage/dashboard 'Current validator' tile and the account 'Validator votes' count rendered empty.Change
Add the new field names as primary; keep the old ones as
@deprecatedaliases so code on older nodes still type-checks. No runtime code in this repo — types only.Verified against live
api.viz.cxGET /→"current_validator":"..."(nocurrent_witness)GET /profile/{user}→validators_voted_for,validator_votestsc --noEmit,tsd,vitest(35), anddriftall pass.