From 41aa09da35fdb2c5092da4b90f3afd559b39549c Mon Sep 17 00:00:00 2001 From: Ermal Kaleci Date: Thu, 26 Oct 2023 18:50:48 +0200 Subject: [PATCH] fix boolean --- packages/chopsticks/src/context.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/chopsticks/src/context.ts b/packages/chopsticks/src/context.ts index 9e109541..fde15c31 100644 --- a/packages/chopsticks/src/context.ts +++ b/packages/chopsticks/src/context.ts @@ -54,10 +54,10 @@ export const setupContext = async (argv: Config, overrideParent = false) => { let blockData: BlockEntry | null = null if (typeof argv.resume === 'string' && argv.resume.startsWith('0x')) { blockData = await chain.db.queryBlock(argv.resume as HexString) - } else if (Number.isInteger(+argv.resume)) { - blockData = await chain.db.queryBlockByNumber(argv.resume as number) - } else if (argv.resume === 'true') { + } else if (typeof argv.resume === 'boolean' || argv.resume === 'true') { blockData = await chain.db.queryHighestBlock() + } else if (Number.isInteger(+argv.resume)) { + blockData = await chain.db.queryBlockByNumber(+argv.resume) } else { throw new Error(`Resume failed. Invalid resume option ${argv.resume}`) }