From: Chris Duncan Date: Fri, 7 Aug 2026 19:55:20 +0000 (-0700) Subject: Fix account_info fields replaced in v22. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=189dc78b59626af6a767c415e38fb523d3d6ddd3;p=libnemo.git Fix account_info fields replaced in v22. --- diff --git a/src/lib/rpc/account_info.ts b/src/lib/rpc/account_info.ts index 6931cd1..bff8461 100644 --- a/src/lib/rpc/account_info.ts +++ b/src/lib/rpc/account_info.ts @@ -15,8 +15,8 @@ export type AccountInfoResponse = { account_version: string balance: string block_count: string - confirmation_height: string - confirmation_height_frontier: string + confirmation_height?: string + confirmation_height_frontier?: string confirmed_balance: string confirmed_frontier: string confirmed_height: string @@ -38,8 +38,6 @@ export function account_info (body: unknown): AccountInfoResponse { if ('account_version' in body && typeof body.account_version === 'string' && 'balance' in body && typeof body.balance === 'string' && 'block_count' in body && typeof body.block_count === 'string' - && 'confirmation_height' in body && typeof body.confirmation_height === 'string' - && 'confirmation_height_frontier' in body && typeof body.confirmation_height_frontier === 'string' && 'confirmed_balance' in body && typeof body.confirmed_balance === 'string' && 'confirmed_frontier' in body && typeof body.confirmed_frontier === 'string' && 'confirmed_height' in body && typeof body.confirmed_height === 'string' @@ -57,8 +55,6 @@ export function account_info (body: unknown): AccountInfoResponse { account_version: body.account_version, balance: body.balance, block_count: body.block_count, - confirmation_height: body.confirmation_height, - confirmation_height_frontier: body.confirmation_height_frontier, confirmed_balance: body.confirmed_balance, confirmed_frontier: body.confirmed_frontier, confirmed_height: body.confirmed_height, @@ -72,6 +68,12 @@ export function account_info (body: unknown): AccountInfoResponse { representative_block: body.representative_block, weight: body.weight, } + if ('confirmation_height' in body && typeof body.confirmation_height === 'string') { + response.confirmation_height = body.confirmation_height + } + if ('confirmation_height_frontier' in body && typeof body.confirmation_height_frontier === 'string') { + response.confirmation_height_frontier = body.confirmation_height_frontier + } if ('confirmed_pending' in body && typeof body.confirmed_pending === 'string') { response.confirmed_pending = body.confirmed_pending }