diff --git a/yarn-project/cli-wallet/src/cmds/index.ts b/yarn-project/cli-wallet/src/cmds/index.ts index 74d8373b6802..749c35b56f1a 100644 --- a/yarn-project/cli-wallet/src/cmds/index.ts +++ b/yarn-project/cli-wallet/src/cmds/index.ts @@ -354,6 +354,9 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL .requiredOption('-a, --address ', 'The Aztec address of the note owner.', address => aliasedAddressParser('accounts', address, db), ) + .addOption( + createSecretKeyOption("The sender's secret key", !db, sk => aliasedSecretKeyParser(sk, db)), + ) .requiredOption('-h, --hash ', 'The tx hash of the tx containing the note.', txHash => aliasedTxHashParser(txHash, db), ) @@ -372,10 +375,10 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL .action(async (noteName, storageFieldName, _options, command) => { const { addNote } = await import('./add_note.js'); const options = command.optsWithGlobals(); - const { contractArtifact: artifactPathPromise, contractAddress, address, rpcUrl, fields, hash } = options; + const { contractArtifact: artifactPathPromise, contractAddress, address, secretKey, rpcUrl, fields, hash } = options; const artifactPath = await artifactPathFromPromiseOrAlias(artifactPathPromise, contractAddress, db); const client = await createCompatibleClient(rpcUrl, debugLogger); - const account = await createOrRetrieveAccount(client, address, db); + const account = await createOrRetrieveAccount(client, address, db, undefined, secretKey); const wallet = await account.getWallet(); await addNote(wallet, address, contractAddress, noteName, storageFieldName, artifactPath, hash, fields, log);