Skip to content

Commit

Permalink
feat: Added register-account command to cli (#2980)
Browse files Browse the repository at this point in the history
This PR adds the PXE's register-account command to the cli.

# Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if
the PR is ready to merge.
- [ ] If the pull request requires a cryptography review (e.g.
cryptographic algorithm implementations) I have added the 'crypto' tag.
- [ ] I have reviewed my diff in github, line by line and removed
unexpected formatting changes, testing logs, or commented-out code.
- [ ] Every change is related to the PR description.
- [ ] I have
[linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
this pull request to relevant issues (if any exist).
  • Loading branch information
PhilWindle authored Oct 24, 2023
1 parent 3085676 commit 0977a90
Showing 1 changed file with 24 additions and 0 deletions.
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

0 comments on commit 0977a90

Please sign in to comment.