From 627b71ac843dfa5496e0dbfa849130a8dd5df152 Mon Sep 17 00:00:00 2001 From: Vladimir Babin Date: Thu, 13 Aug 2026 16:56:48 +0300 Subject: [PATCH] =?UTF-8?q?fix(types):=20API=20renamed=20witness=E2=86=92v?= =?UTF-8?q?alidator=20on=20read=20paths?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/types.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/types.ts b/src/types.ts index 5d3fd98..ab591fd 100644 --- a/src/types.ts +++ b/src/types.ts @@ -23,6 +23,10 @@ export interface ChainInfo { head_block_number?: number; head_block_id?: string; time?: string; + current_validator?: string; + /** @deprecated Renamed to {@link ChainInfo.current_validator} in the + * viz-cpp-node witness→validator migration. The API now emits + * `current_validator`; this alias is kept only for older nodes. */ current_witness?: string; current_supply?: string; total_vesting_fund?: string; @@ -66,7 +70,13 @@ export interface Profile { last_vote_time?: string; created?: string; proxy?: string; + validator_votes?: string[]; + validators_voted_for?: number; + /** @deprecated Renamed to {@link Profile.validator_votes} in the + * witness→validator migration. Kept for older nodes/snapshots. */ witness_votes?: string[]; + /** @deprecated Renamed to {@link Profile.validators_voted_for} in the + * witness→validator migration. Kept for older nodes/snapshots. */ witnesses_voted_for?: number; json_metadata: { profile?: { avatar?: string; name?: string; about?: string; [k: string]: unknown } } & Record< string,