From 6a257db4b60338f9e52d517d974e31063a64377a Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Thu, 7 Aug 2025 11:36:45 -0700 Subject: [PATCH] Allow number type for balance. --- src/lib/block.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/block.ts b/src/lib/block.ts index 45de7a3..797b302 100644 --- a/src/lib/block.ts +++ b/src/lib/block.ts @@ -71,7 +71,7 @@ export class Block { signature?: string work?: string - constructor (account: string | Account, balance?: bigint | string, previous?: string, representative?: string | Account, signature?: string) + constructor (account: string | Account, balance?: bigint | number | string, previous?: string, representative?: string | Account, signature?: string) constructor (account: unknown, balance: unknown, previous: unknown, representative: unknown, signature: unknown) { try { if (typeof account === 'string') { @@ -86,7 +86,7 @@ export class Block { balance ??= account.balance previous ??= account.frontier representative ??= account.representative - if (typeof balance !== 'bigint' && typeof balance !== 'string') { + if (typeof balance !== 'bigint' && typeof balance !== 'number' && typeof balance !== 'string') { throw new TypeError('Account balance is unknown') } if (typeof previous !== 'string') { -- 2.47.3