Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added register-account command to cli #2980

Merged
merged 3 commits into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions yarn-project/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,30 @@ 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 <partialAddress>',
'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.')
Expand Down