@aztec/cli 3.0.0-nightly.20250924 → 3.0.0-nightly.20250926

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +0 -10
  2. package/dest/cmds/aztec_node/get_block.d.ts +2 -2
  3. package/dest/cmds/aztec_node/get_block.d.ts.map +1 -1
  4. package/dest/cmds/aztec_node/get_block.js +3 -4
  5. package/dest/cmds/aztec_node/index.d.ts.map +1 -1
  6. package/dest/cmds/aztec_node/index.js +3 -3
  7. package/dest/cmds/devnet/bootstrap_network.d.ts +1 -1
  8. package/dest/cmds/devnet/bootstrap_network.d.ts.map +1 -1
  9. package/dest/cmds/devnet/bootstrap_network.js +3 -4
  10. package/dest/cmds/devnet/index.d.ts.map +1 -1
  11. package/dest/cmds/devnet/index.js +3 -3
  12. package/dest/cmds/infrastructure/index.d.ts.map +1 -1
  13. package/dest/cmds/infrastructure/index.js +3 -3
  14. package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
  15. package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
  16. package/dest/cmds/infrastructure/setup_l2_contract.js +3 -15
  17. package/dest/cmds/l1/index.d.ts.map +1 -1
  18. package/dest/cmds/l1/index.js +3 -3
  19. package/dest/config/chain_l2_config.d.ts.map +1 -1
  20. package/dest/config/chain_l2_config.js +13 -10
  21. package/dest/utils/commands.d.ts +0 -2
  22. package/dest/utils/commands.d.ts.map +1 -1
  23. package/dest/utils/commands.js +1 -3
  24. package/dest/utils/inspect.d.ts +3 -10
  25. package/dest/utils/inspect.d.ts.map +1 -1
  26. package/dest/utils/inspect.js +10 -92
  27. package/dest/utils/setup_contracts.d.ts +0 -3
  28. package/dest/utils/setup_contracts.d.ts.map +1 -1
  29. package/dest/utils/setup_contracts.js +0 -11
  30. package/package.json +24 -25
  31. package/src/cmds/aztec_node/get_block.ts +4 -11
  32. package/src/cmds/aztec_node/index.ts +1 -3
  33. package/src/cmds/devnet/bootstrap_network.ts +1 -4
  34. package/src/cmds/devnet/index.ts +1 -3
  35. package/src/cmds/infrastructure/index.ts +2 -11
  36. package/src/cmds/infrastructure/setup_l2_contract.ts +3 -25
  37. package/src/cmds/l1/index.ts +2 -3
  38. package/src/config/chain_l2_config.ts +12 -8
  39. package/src/utils/commands.ts +1 -10
  40. package/src/utils/inspect.ts +9 -109
  41. package/src/utils/setup_contracts.ts +1 -12
  42. package/dest/cmds/pxe/add_contract.d.ts +0 -5
  43. package/dest/cmds/pxe/add_contract.d.ts.map +0 -1
  44. package/dest/cmds/pxe/add_contract.js +0 -29
  45. package/dest/cmds/pxe/get_account.d.ts +0 -4
  46. package/dest/cmds/pxe/get_account.d.ts.map +0 -1
  47. package/dest/cmds/pxe/get_account.js +0 -10
  48. package/dest/cmds/pxe/get_accounts.d.ts +0 -3
  49. package/dest/cmds/pxe/get_accounts.d.ts.map +0 -1
  50. package/dest/cmds/pxe/get_accounts.js +0 -25
  51. package/dest/cmds/pxe/get_contract_data.d.ts +0 -4
  52. package/dest/cmds/pxe/get_contract_data.d.ts.map +0 -1
  53. package/dest/cmds/pxe/get_contract_data.js +0 -31
  54. package/dest/cmds/pxe/get_pxe_info.d.ts +0 -3
  55. package/dest/cmds/pxe/get_pxe_info.d.ts.map +0 -1
  56. package/dest/cmds/pxe/get_pxe_info.js +0 -11
  57. package/dest/cmds/pxe/index.d.ts +0 -4
  58. package/dest/cmds/pxe/index.d.ts.map +0 -1
  59. package/dest/cmds/pxe/index.js +0 -25
  60. package/src/cmds/pxe/add_contract.ts +0 -41
  61. package/src/cmds/pxe/get_account.ts +0 -16
  62. package/src/cmds/pxe/get_accounts.ts +0 -35
  63. package/src/cmds/pxe/get_contract_data.ts +0 -51
  64. package/src/cmds/pxe/get_pxe_info.ts +0 -13
  65. package/src/cmds/pxe/index.ts +0 -88
@@ -1,25 +0,0 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import { logJson, parseAztecAddress, parseEthereumAddress, parseFieldFromHexString, parsePublicKey, pxeOption } from '../../utils/commands.js';
3
- export function injectCommands(program, log, debugLogger) {
4
- program.command('add-contract').description('Adds an existing contract to the PXE. This is useful if you have deployed a contract outside of the PXE and want to use it with the PXE.').requiredOption('-c, --contract-artifact <fileLocation>', "A compiled Aztec.nr contract's ABI in JSON format or name of a contract ABI exported by @aztec/noir-contracts.js").requiredOption('-ca, --contract-address <address>', 'Aztec address of the contract.', parseAztecAddress).requiredOption('--init-hash <init hash>', 'Initialization hash', parseFieldFromHexString).option('--salt <salt>', 'Optional deployment salt', parseFieldFromHexString).option('-p, --public-key <public key>', 'Optional public key for this contract', parsePublicKey).option('--portal-address <address>', 'Optional address to a portal contract on L1', parseEthereumAddress).option('--deployer-address <address>', 'Optional address of the contract deployer', parseAztecAddress).addOption(pxeOption).action(async (options)=>{
5
- const { addContract } = await import('./add_contract.js');
6
- await addContract(options.rpcUrl, options.contractArtifact, options.contractAddress, options.initHash, options.salt ?? Fr.ZERO, options.publicKey, options.deployerAddress, debugLogger, log);
7
- });
8
- program.command('get-contract-data').description('Gets information about the Aztec contract deployed at the specified address.').argument('<contractAddress>', 'Aztec address of the contract.', parseAztecAddress).addOption(pxeOption).option('-b, --include-bytecode <boolean>', "Include the contract's public function bytecode, if any.", false).action(async (contractAddress, options)=>{
9
- const { getContractData } = await import('./get_contract_data.js');
10
- await getContractData(options.rpcUrl, contractAddress, options.includeBytecode, debugLogger, log);
11
- });
12
- program.command('get-accounts').description('Gets all the Aztec accounts stored in the PXE.').addOption(pxeOption).option('--json', 'Emit output as json').action(async (options)=>{
13
- const { getAccounts } = await import('./get_accounts.js');
14
- await getAccounts(options.rpcUrl, options.json, debugLogger, log, logJson(log));
15
- });
16
- program.command('get-account').description('Gets an account given its Aztec address.').argument('<address>', 'The Aztec address to get account for', parseAztecAddress).addOption(pxeOption).action(async (address, options)=>{
17
- const { getAccount } = await import('./get_account.js');
18
- await getAccount(address, options.rpcUrl, debugLogger, log);
19
- });
20
- program.command('get-pxe-info').description('Gets the information of a PXE at a URL.').addOption(pxeOption).action(async (options)=>{
21
- const { getPXEInfo } = await import('./get_pxe_info.js');
22
- await getPXEInfo(options.rpcUrl, debugLogger, log);
23
- });
24
- return program;
25
- }
@@ -1,41 +0,0 @@
1
- import { AztecAddress, type ContractInstanceWithAddress, type Fr, getContractClassFromArtifact } from '@aztec/aztec.js';
2
- import { createCompatibleClient } from '@aztec/aztec.js';
3
- import type { LogFn, Logger } from '@aztec/foundation/log';
4
- import { computeContractAddressFromInstance } from '@aztec/stdlib/contract';
5
- import { PublicKeys } from '@aztec/stdlib/keys';
6
-
7
- import { getContractArtifact } from '../../utils/aztec.js';
8
-
9
- export async function addContract(
10
- rpcUrl: string,
11
- contractArtifactPath: string,
12
- address: AztecAddress,
13
- initializationHash: Fr,
14
- salt: Fr,
15
- publicKeys: PublicKeys,
16
- deployer: AztecAddress | undefined,
17
- debugLogger: Logger,
18
- log: LogFn,
19
- ) {
20
- const artifact = await getContractArtifact(contractArtifactPath, log);
21
- const contractClass = await getContractClassFromArtifact(artifact);
22
- const instance: ContractInstanceWithAddress = {
23
- version: 1,
24
- salt,
25
- initializationHash,
26
- currentContractClassId: contractClass.id,
27
- originalContractClassId: contractClass.id,
28
- publicKeys: publicKeys ?? PublicKeys.default(),
29
- address,
30
- deployer: deployer ?? AztecAddress.ZERO,
31
- };
32
- const computed = await computeContractAddressFromInstance(instance);
33
- if (!computed.equals(address)) {
34
- throw new Error(`Contract address ${address.toString()} does not match computed address ${computed.toString()}`);
35
- }
36
-
37
- const client = await createCompatibleClient(rpcUrl, debugLogger);
38
-
39
- await client.registerContract({ artifact, instance });
40
- log(`\nContract added to PXE at ${address.toString()} with class ${instance.currentContractClassId.toString()}\n`);
41
- }
@@ -1,16 +0,0 @@
1
- import type { AztecAddress } from '@aztec/aztec.js';
2
- import { createCompatibleClient } from '@aztec/aztec.js';
3
- import type { LogFn, Logger } from '@aztec/foundation/log';
4
-
5
- export async function getAccount(aztecAddress: AztecAddress, rpcUrl: string, debugLogger: Logger, log: LogFn) {
6
- const client = await createCompatibleClient(rpcUrl, debugLogger);
7
- const account = (await client.getRegisteredAccounts()).find(completeAddress =>
8
- completeAddress.address.equals(aztecAddress),
9
- );
10
-
11
- if (!account) {
12
- log(`Unknown account ${aztecAddress.toString()}`);
13
- } else {
14
- log(account.toReadableString());
15
- }
16
- }
@@ -1,35 +0,0 @@
1
- import { createCompatibleClient } from '@aztec/aztec.js';
2
- import type { LogFn, Logger } from '@aztec/foundation/log';
3
-
4
- export async function getAccounts(
5
- rpcUrl: string,
6
- json: boolean,
7
- debugLogger: Logger,
8
- log: LogFn,
9
- logJson: (output: any) => void,
10
- ) {
11
- const client = await createCompatibleClient(rpcUrl, debugLogger);
12
- const accounts = await client.getRegisteredAccounts();
13
- if (!accounts.length) {
14
- if (json) {
15
- logJson([]);
16
- } else {
17
- log('No accounts found.');
18
- }
19
- return;
20
- }
21
- if (json) {
22
- logJson(
23
- accounts.map(a => ({
24
- address: a.address.toString(),
25
- publicKeys: a.publicKeys.toString(),
26
- partialAddress: a.partialAddress.toString(),
27
- })),
28
- );
29
- } else {
30
- log(`Accounts found: \n`);
31
- for (const account of accounts) {
32
- log(account.toReadableString());
33
- }
34
- }
35
- }
@@ -1,51 +0,0 @@
1
- import type { AztecAddress } from '@aztec/aztec.js';
2
- import { createCompatibleClient } from '@aztec/aztec.js';
3
- import type { LogFn, Logger } from '@aztec/foundation/log';
4
-
5
- export async function getContractData(
6
- rpcUrl: string,
7
- contractAddress: AztecAddress,
8
- includeBytecode: boolean,
9
- debugLogger: Logger,
10
- log: LogFn,
11
- ) {
12
- const client = await createCompatibleClient(rpcUrl, debugLogger);
13
- const {
14
- contractInstance: instance,
15
- isContractInitialized: isInitialized,
16
- isContractPublished: isPubliclyDeployed,
17
- } = await client.getContractMetadata(contractAddress);
18
- const contractClass =
19
- includeBytecode &&
20
- instance &&
21
- (await client.getContractClassMetadata(instance?.currentContractClassId)).contractClass;
22
-
23
- const isPrivatelyDeployed = !!instance;
24
- const initStr = isInitialized ? 'initialized' : 'not initialized';
25
- const addrStr = contractAddress.toString();
26
-
27
- if (isPubliclyDeployed && isPrivatelyDeployed) {
28
- log(`Contract is ${initStr} and publicly deployed at ${addrStr}`);
29
- } else if (isPrivatelyDeployed) {
30
- log(`Contract is ${initStr} and registered in the local pxe at ${addrStr} but not publicly deployed`);
31
- } else if (isPubliclyDeployed) {
32
- log(`Contract is ${initStr} and publicly deployed at ${addrStr} but not registered in the local pxe`);
33
- } else if (isInitialized) {
34
- log(`Contract is initialized but not publicly deployed nor registered in the local pxe at ${addrStr}`);
35
- } else {
36
- log(`No contract found at ${addrStr}`);
37
- }
38
-
39
- if (instance) {
40
- log(``);
41
- Object.entries(instance).forEach(([key, value]) => {
42
- const capitalized = key.charAt(0).toUpperCase() + key.slice(1);
43
- log(`${capitalized}: ${value.toString()}`);
44
- });
45
-
46
- if (contractClass) {
47
- log(`\nBytecode: ${contractClass.packedBytecode.toString('base64')}`);
48
- }
49
- log('');
50
- }
51
- }
@@ -1,13 +0,0 @@
1
- import { createCompatibleClient } from '@aztec/aztec.js';
2
- import type { LogFn, Logger } from '@aztec/foundation/log';
3
-
4
- export async function getPXEInfo(rpcUrl: string, debugLogger: Logger, log: LogFn) {
5
- const client = await createCompatibleClient(rpcUrl, debugLogger);
6
- const info = await client.getPXEInfo();
7
- log(`PXE Version: ${info.pxeVersion}`);
8
- log(`Protocol Contract Addresses:`);
9
- log(` Class Registry: ${info.protocolContractAddresses.classRegistry.toString()}`);
10
- log(` Fee Juice: ${info.protocolContractAddresses.feeJuice.toString()}`);
11
- log(` Instance Deployer: ${info.protocolContractAddresses.instanceRegistry.toString()}`);
12
- log(` Multi Call Entrypoint: ${info.protocolContractAddresses.multiCallEntrypoint.toString()}`);
13
- }
@@ -1,88 +0,0 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import type { LogFn, Logger } from '@aztec/foundation/log';
3
-
4
- import type { Command } from 'commander';
5
-
6
- import {
7
- logJson,
8
- parseAztecAddress,
9
- parseEthereumAddress,
10
- parseFieldFromHexString,
11
- parsePublicKey,
12
- pxeOption,
13
- } from '../../utils/commands.js';
14
-
15
- export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
16
- program
17
- .command('add-contract')
18
- .description(
19
- 'Adds an existing contract to the PXE. This is useful if you have deployed a contract outside of the PXE and want to use it with the PXE.',
20
- )
21
- .requiredOption(
22
- '-c, --contract-artifact <fileLocation>',
23
- "A compiled Aztec.nr contract's ABI in JSON format or name of a contract ABI exported by @aztec/noir-contracts.js",
24
- )
25
- .requiredOption('-ca, --contract-address <address>', 'Aztec address of the contract.', parseAztecAddress)
26
- .requiredOption('--init-hash <init hash>', 'Initialization hash', parseFieldFromHexString)
27
- .option('--salt <salt>', 'Optional deployment salt', parseFieldFromHexString)
28
- .option('-p, --public-key <public key>', 'Optional public key for this contract', parsePublicKey)
29
- .option('--portal-address <address>', 'Optional address to a portal contract on L1', parseEthereumAddress)
30
- .option('--deployer-address <address>', 'Optional address of the contract deployer', parseAztecAddress)
31
- .addOption(pxeOption)
32
- .action(async options => {
33
- const { addContract } = await import('./add_contract.js');
34
- await addContract(
35
- options.rpcUrl,
36
- options.contractArtifact,
37
- options.contractAddress,
38
- options.initHash,
39
- options.salt ?? Fr.ZERO,
40
- options.publicKey,
41
- options.deployerAddress,
42
- debugLogger,
43
- log,
44
- );
45
- });
46
-
47
- program
48
- .command('get-contract-data')
49
- .description('Gets information about the Aztec contract deployed at the specified address.')
50
- .argument('<contractAddress>', 'Aztec address of the contract.', parseAztecAddress)
51
- .addOption(pxeOption)
52
- .option('-b, --include-bytecode <boolean>', "Include the contract's public function bytecode, if any.", false)
53
- .action(async (contractAddress, options) => {
54
- const { getContractData } = await import('./get_contract_data.js');
55
- await getContractData(options.rpcUrl, contractAddress, options.includeBytecode, debugLogger, log);
56
- });
57
-
58
- program
59
- .command('get-accounts')
60
- .description('Gets all the Aztec accounts stored in the PXE.')
61
- .addOption(pxeOption)
62
- .option('--json', 'Emit output as json')
63
- .action(async (options: any) => {
64
- const { getAccounts } = await import('./get_accounts.js');
65
- await getAccounts(options.rpcUrl, options.json, debugLogger, log, logJson(log));
66
- });
67
-
68
- program
69
- .command('get-account')
70
- .description('Gets an account given its Aztec address.')
71
- .argument('<address>', 'The Aztec address to get account for', parseAztecAddress)
72
- .addOption(pxeOption)
73
- .action(async (address, options) => {
74
- const { getAccount } = await import('./get_account.js');
75
- await getAccount(address, options.rpcUrl, debugLogger, log);
76
- });
77
-
78
- program
79
- .command('get-pxe-info')
80
- .description('Gets the information of a PXE at a URL.')
81
- .addOption(pxeOption)
82
- .action(async options => {
83
- const { getPXEInfo } = await import('./get_pxe_info.js');
84
- await getPXEInfo(options.rpcUrl, debugLogger, log);
85
- });
86
-
87
- return program;
88
- }