Skip to content

fix(types): API renamed witness→validator on read paths - #4

Merged
chiliec merged 1 commit into
mainfrom
fix/witness-to-validator-read-types
Aug 13, 2026
Merged

fix(types): API renamed witness→validator on read paths#4
chiliec merged 1 commit into
mainfrom
fix/witness-to-validator-read-types

Conversation

@chiliec

@chiliec chiliec commented Aug 13, 2026

Copy link
Copy Markdown
Member

What

The viz-cpp-node witness→validator migration renamed the fields the site API emits, but this SDK's read-path types still declared the old names:

Old (declared) New (API actually emits) Endpoint
ChainInfo.current_witness current_validator GET /
Profile.witness_votes validator_votes GET /profile/{user}
Profile.witnesses_voted_for validators_voted_for GET /profile/{user}

Why it matters

Consumers (viz.cx frontend) typed against current_witness etc. read undefined at 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 @deprecated aliases so code on older nodes still type-checks. No runtime code in this repo — types only.

Verified against live api.viz.cx

  • GET /"current_validator":"..." (no current_witness)
  • GET /profile/{user}validators_voted_for, validator_votes

tsc --noEmit, tsd, vitest (35), and drift all pass.

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.
@chiliec
chiliec merged commit 75a805e into main Aug 13, 2026
4 checks passed
@chiliec
chiliec deleted the fix/witness-to-validator-read-types branch August 13, 2026 14:25
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.

1 participant