From 0b8deb0cce4d5dcf5c8fcacc421eeaa583359458 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Sun, 22 Oct 2023 16:35:50 +0100 Subject: [PATCH 1/2] Added register-account command --- yarn-project/cli/src/index.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/yarn-project/cli/src/index.ts b/yarn-project/cli/src/index.ts index 04ebfed912a..5e829f61aee 100644 --- a/yarn-project/cli/src/index.ts +++ b/yarn-project/cli/src/index.ts @@ -185,6 +185,32 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command { log(`Partial address: ${partialAddress.toString()}`); }); + program + .command('register-account') + .description( + 'Registers an aztec account that can be used for sending transactions. Registers the account on the PXE. Uses a Schnorr single-key account which uses the same key for encryption and authentication (not secure for production usage).', + ) + .summary('Registers an aztec account that can be used for sending transactions.') + .addOption( + createPrivateKeyOption('Private key for note encryption and transaction signing.', true), + ) + .requiredOption( + '-pa, --partial-address ', + 'The partially computed address of the account contract.', + parsePartialAddress, + ) + .addOption(pxeOption) + .action(async ({ rpcUrl, privateKey, partialAddress }) => { + const client = await createCompatibleClient(rpcUrl, debugLogger); + + const { address, publicKey } = await client.registerAccount(privateKey, partialAddress); + + log(`\nRegistered account:\n`); + log(`Address: ${address.toString()}`); + log(`Public key: ${publicKey.toString()}`); + log(`Partial address: ${partialAddress.toString()}`); + }); + program .command('deploy') .description('Deploys a compiled Aztec.nr contract to Aztec.') From 6712e72422668e8b7356912bb253baf7aaccb6c2 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Mon, 23 Oct 2023 16:01:32 +0100 Subject: [PATCH 2/2] Formatting --- yarn-project/cli/src/index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/yarn-project/cli/src/index.ts b/yarn-project/cli/src/index.ts index 5e829f61aee..baed053ad03 100644 --- a/yarn-project/cli/src/index.ts +++ b/yarn-project/cli/src/index.ts @@ -185,15 +185,13 @@ export function getProgram(log: LogFn, debugLogger: DebugLogger): Command { log(`Partial address: ${partialAddress.toString()}`); }); - program + program .command('register-account') .description( 'Registers an aztec account that can be used for sending transactions. Registers the account on the PXE. Uses a Schnorr single-key account which uses the same key for encryption and authentication (not secure for production usage).', ) .summary('Registers an aztec account that can be used for sending transactions.') - .addOption( - createPrivateKeyOption('Private key for note encryption and transaction signing.', true), - ) + .addOption(createPrivateKeyOption('Private key for note encryption and transaction signing.', true)) .requiredOption( '-pa, --partial-address ', 'The partially computed address of the account contract.',