From 4032c837bd9ea7d57c1bc57ac8349ed73acc9fa8 Mon Sep 17 00:00:00 2001 From: Brice Date: Fri, 29 Nov 2024 17:13:52 +0800 Subject: [PATCH] fix: honor --contract-name and --start-block --- packages/cli/src/commands/add.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/commands/add.ts b/packages/cli/src/commands/add.ts index 86420c12..2a9266ed 100644 --- a/packages/cli/src/commands/add.ts +++ b/packages/cli/src/commands/add.ts @@ -136,8 +136,9 @@ export default class AddCommand extends Command { try { if (isLocalHost) throw Error; // Triggers user prompting without waiting for Etherscan lookup to fail - - startBlock ||= Number(await loadStartBlockForContract(network, address)).toString(); + if (startBlock === undefined) { + startBlock = Number(await loadStartBlockForContract(network, address)).toString(); + } } catch (error) { // we cannot ask user to do prompt in test environment if (process.env.NODE_ENV !== 'test') { @@ -161,7 +162,7 @@ export default class AddCommand extends Command { try { if (isLocalHost) throw Error; // Triggers user prompting without waiting for Etherscan lookup to fail - contractName = await loadContractNameForAddress(network, address); + contractName ||= await loadContractNameForAddress(network, address); } catch (error) { // not asking user to do prompt in test environment if (process.env.NODE_ENV !== 'test') {