Skip to content

Commit

Permalink
fix: honor --contract-name and --start-block
Browse files Browse the repository at this point in the history
  • Loading branch information
briceyan committed Nov 29, 2024
1 parent 023bac6 commit 4032c83
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/cli/src/commands/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand All @@ -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') {
Expand Down

0 comments on commit 4032c83

Please sign in to comment.