From: Chris Duncan Date: Mon, 8 Sep 2025 04:37:52 +0000 (-0700) Subject: Fix invalid iteration of single account object. X-Git-Tag: v0.10.5~24^2~7 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=d0f4c4e5bba4903d8b7934fe4d8345970e6c4b67;p=libnemo.git Fix invalid iteration of single account object. --- diff --git a/src/lib/wallet/accounts.ts b/src/lib/wallet/accounts.ts index d5331e2..1939c40 100644 --- a/src/lib/wallet/accounts.ts +++ b/src/lib/wallet/accounts.ts @@ -7,7 +7,9 @@ import { Vault } from '../vault' export async function _accounts (type: WalletType, accounts: Map, vault: Vault, index: number): Promise export async function _accounts (type: WalletType, accounts: Map, vault: Vault, from: number, to: number): Promise> -export async function _accounts (type: WalletType, accounts: Map, vault: Vault, from: unknown, to: unknown = from): Promise> { +export async function _accounts (type: WalletType, accounts: Map, vault: Vault, from: unknown, to?: unknown): Promise> { + const isSingle = to === undefined + to ??= from if (typeof from !== 'number' || typeof to !== 'number') { throw new TypeError('Invalid account range', { cause: `${from}-${to}` }) } @@ -54,7 +56,7 @@ export async function _accounts (type: WalletType, accounts: Map