From 3d99fe99c5c326b56ac288b66a78888911c2f79b Mon Sep 17 00:00:00 2001 From: Vladimir Babin Date: Thu, 13 Aug 2026 16:57:00 +0300 Subject: [PATCH] =?UTF-8?q?fix(api):=20node=20renamed=20witness=E2=86=92va?= =?UTF-8?q?lidator=20on=20read=20shapes?= 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 node returns from the read RPCs, but the SDK types still declared the old names: - DynamicGlobalProperties.current_witness → current_validator (database_api.get_dynamic_global_properties) - Block.witness → validator - Block.witness_signature → validator_signature (database_api.get_block / get_block_header) Add the new names as primary and keep the old ones as @deprecated aliases; widen getBlockHeader's Pick to include validator. The write path (op-schema, tx builder) already used the new names — this fixes only the lagging read shapes. Verified against live node.viz.cx: get_block_header returns { previous, timestamp, validator, ... } and dgp returns current_validator. tsc --noEmit clean; 232 unit tests pass. --- src/api.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/api.ts b/src/api.ts index 010c3b9..4edf743 100644 --- a/src/api.ts +++ b/src/api.ts @@ -5,7 +5,11 @@ export interface DynamicGlobalProperties { head_block_number: number; head_block_id: string; time: string; - current_witness: string; + current_validator: string; + /** @deprecated Renamed to {@link DynamicGlobalProperties.current_validator} + * in the viz-cpp-node witness→validator migration. The node now emits + * `current_validator`; this alias is kept only for older nodes. */ + current_witness?: string; total_pow?: number; total_vesting_fund?: string; total_vesting_shares?: string; @@ -29,10 +33,15 @@ export interface Account { export interface Block { previous: string; timestamp: string; - witness: string; + validator: string; + /** @deprecated Renamed to {@link Block.validator} in the witness→validator + * migration. The node now emits `validator`; kept only for older nodes. */ + witness?: string; transaction_merkle_root: string; extensions: unknown[]; - witness_signature: string; + validator_signature: string; + /** @deprecated Renamed to {@link Block.validator_signature}. */ + witness_signature?: string; transactions: unknown[]; block_id: string; signing_key: string; @@ -55,7 +64,7 @@ export interface ReadApi { getAccounts(names: ReadonlyArray): Promise; lookupAccountNames(names: ReadonlyArray): Promise<(Account | null)[]>; getBlock(blockNum: number): Promise; - getBlockHeader(blockNum: number): Promise | null>; + getBlockHeader(blockNum: number): Promise | null>; getAccountHistory(name: AccountName | string, from: number, limit: number): Promise>; getOpsInBlock(blockNum: number, onlyVirtual: boolean): Promise; getKeyReferences(keys: string[]): Promise;