diff --git a/yarn-project/cli/src/index.ts b/yarn-project/cli/src/index.ts index 5af9df6ab88..1945cd3217b 100644 --- a/yarn-project/cli/src/index.ts +++ b/yarn-project/cli/src/index.ts @@ -165,6 +165,9 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command { 'Optional deployment salt as a hex string for generating the deployment address.', getSaltFromHexString, ) + // `options.wait` is default true. Passing `--no-wait` will set it to false. + // https://github.com/tj/commander.js#other-option-types-negatable-boolean-and-booleanvalue + .option('--no-wait', 'Skip waiting for the contract to be deployed. Print the hash of deployment transaction') .action(async (abiPath, options: any) => { const contractAbi = await getContractAbi(abiPath, log); const constructorAbi = contractAbi.functions.find(({ name }) => name === 'constructor'); @@ -181,9 +184,14 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command { const args = encodeArgs(options.args, constructorAbi!.parameters); debugLogger(`Encoded arguments: ${args.join(', ')}`); const tx = deployer.deploy(...args).send({ contractAddressSalt: options.salt }); - debugLogger(`Deploy tx sent with hash ${await tx.getTxHash()}`); - const deployed = await tx.wait(); - log(`\nContract deployed at ${deployed.contractAddress!.toString()}\n`); + const txHash = await tx.getTxHash(); + debugLogger(`Deploy tx sent with hash ${txHash}`); + if (options.wait) { + const deployed = await tx.wait(); + log(`\nContract deployed at ${deployed.contractAddress!.toString()}\n`); + } else { + log(`\nDeployment transaction hash: ${txHash}\n`); + } }); program @@ -365,7 +373,7 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command { .requiredOption('-ca, --contract-address
', 'Aztec address of the contract.') .requiredOption('-k, --private-key