From e4430ae27cdb049c195ed3979dbfcf251706482c Mon Sep 17 00:00:00 2001 From: Andrew Miller Date: Fri, 29 May 2026 17:08:41 -0400 Subject: [PATCH] Fix Block model to match server: nest header with camelCase keys The block endpoint returns block id / prev / timestamp nested under a "header" object with camelCase keys (blockId, dcId, prevId, prevProof, timestamp) and a proof of just {proof}. The previous flat snake_case Block fields never matched the response and always deserialized empty. Add a BlockHeader interface, nest it in Block, and make proof.scheme optional. Verified live against a dev chain. --- src/types.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/types.ts b/src/types.ts index 53eeb92..8b87857 100644 --- a/src/types.ts +++ b/src/types.ts @@ -122,17 +122,22 @@ export interface SmartContract { // Block Types export interface BlockProof { - scheme: string; proof: string; + scheme?: string; // absent on trust-scheme chains; present on PoW nonce?: number; } +export interface BlockHeader { + blockId: string; + dcId: string; + prevId: string; + prevProof: string; + timestamp: string; +} + export interface Block { version: string; - block_id: string; - timestamp: string; - prev_id: string; - prev_proof: string; + header: BlockHeader; transactions: string[]; proof: BlockProof; }