Fix Block model to match server: nest header with camelCase keys
All checks were successful
Build and Test / build (20.x) (push) Successful in 2m14s
Build and Test / build (18.x) (push) Successful in 2m21s
Build and Test / build (16.x) (push) Successful in 2m24s

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.
This commit is contained in:
2026-05-29 17:08:41 -04:00
parent 2071db93e5
commit e4430ae27c

View File

@@ -122,17 +122,22 @@ export interface SmartContract {
// Block Types // Block Types
export interface BlockProof { export interface BlockProof {
scheme: string;
proof: string; proof: string;
scheme?: string; // absent on trust-scheme chains; present on PoW
nonce?: number; nonce?: number;
} }
export interface BlockHeader {
blockId: string;
dcId: string;
prevId: string;
prevProof: string;
timestamp: string;
}
export interface Block { export interface Block {
version: string; version: string;
block_id: string; header: BlockHeader;
timestamp: string;
prev_id: string;
prev_proof: string;
transactions: string[]; transactions: string[];
proof: BlockProof; proof: BlockProof;
} }