@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,17 +1,10 @@
1
- import { createAztecNodeClient, createCompatibleClient } from '@aztec/aztec.js';
2
- import type { LogFn, Logger } from '@aztec/foundation/log';
1
+ import { createAztecNodeClient } from '@aztec/aztec.js';
2
+ import type { LogFn } from '@aztec/foundation/log';
3
3
 
4
4
  import { inspectBlock } from '../../utils/inspect.js';
5
5
 
6
- export async function getBlock(
7
- pxeUrl: string,
8
- nodeUrl: string,
9
- maybeBlockNumber: number | undefined,
10
- debugLogger: Logger,
11
- log: LogFn,
12
- ) {
13
- const client = await createCompatibleClient(pxeUrl, debugLogger);
6
+ export async function getBlock(nodeUrl: string, maybeBlockNumber: number | undefined, log: LogFn) {
14
7
  const aztecNode = createAztecNodeClient(nodeUrl);
15
8
  const blockNumber = maybeBlockNumber ?? (await aztecNode.getBlockNumber());
16
- await inspectBlock(client, aztecNode, blockNumber, log, { showTxs: true });
9
+ await inspectBlock(aztecNode, blockNumber, log, { showTxs: true });
17
10
  }
@@ -11,7 +11,6 @@ import {
11
11
  parseOptionalInteger,
12
12
  parseOptionalLogId,
13
13
  parseOptionalTxHash,
14
- pxeOption,
15
14
  } from '../../utils/commands.js';
16
15
 
17
16
  export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
@@ -19,11 +18,10 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
19
18
  .command('get-block')
20
19
  .description('Gets info for a given block or latest.')
21
20
  .argument('[blockNumber]', 'Block height', parseOptionalInteger)
22
- .addOption(pxeOption)
23
21
  .addOption(nodeOption)
24
22
  .action(async (blockNumber, options) => {
25
23
  const { getBlock } = await import('./get_block.js');
26
- await getBlock(options.rpcUrl, options.nodeUrl, blockNumber, debugLogger, log);
24
+ await getBlock(options.nodeUrl, blockNumber, log);
27
25
  });
28
26
 
29
27
  program
@@ -10,7 +10,6 @@ import {
10
10
  type WaitOpts,
11
11
  type Wallet,
12
12
  createAztecNodeClient,
13
- createCompatibleClient,
14
13
  retryUntil,
15
14
  waitForProven,
16
15
  } from '@aztec/aztec.js';
@@ -44,7 +43,6 @@ const provenWaitOpts: WaitForProvenOpts = {
44
43
  };
45
44
 
46
45
  export async function bootstrapNetwork(
47
- pxeUrl: string,
48
46
  nodeUrl: string,
49
47
  l1Urls: string[],
50
48
  l1ChainId: string,
@@ -55,9 +53,8 @@ export async function bootstrapNetwork(
55
53
  log: LogFn,
56
54
  debugLog: Logger,
57
55
  ) {
58
- const pxe = await createCompatibleClient(pxeUrl, debugLog);
59
56
  const node = createAztecNodeClient(nodeUrl);
60
- const wallet = new TestWallet(pxe, node);
57
+ const wallet = await TestWallet.create(node);
61
58
 
62
59
  // We assume here that the initial test accounts were prefunded with deploy-l1-contracts, and deployed with setup-l2-contracts
63
60
  // so all we need to do is register them to our pxe.
@@ -2,13 +2,12 @@ import type { LogFn, Logger } from '@aztec/foundation/log';
2
2
 
3
3
  import type { Command } from 'commander';
4
4
 
5
- import { ETHEREUM_HOSTS, l1ChainIdOption, nodeOption, parseEthereumAddress, pxeOption } from '../../utils/commands.js';
5
+ import { ETHEREUM_HOSTS, l1ChainIdOption, nodeOption, parseEthereumAddress } from '../../utils/commands.js';
6
6
 
7
7
  export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
8
8
  program
9
9
  .command('bootstrap-network')
10
10
  .description('Bootstrap a new network')
11
- .addOption(pxeOption)
12
11
  .addOption(nodeOption)
13
12
  .addOption(l1ChainIdOption)
14
13
  .requiredOption<string[]>(
@@ -33,7 +32,6 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
33
32
  .action(async options => {
34
33
  const { bootstrapNetwork } = await import('./bootstrap_network.js');
35
34
  await bootstrapNetwork(
36
- options[pxeOption.attributeName()],
37
35
  options[nodeOption.attributeName()],
38
36
  options.l1RpcUrls,
39
37
  options[l1ChainIdOption.attributeName()],
@@ -2,27 +2,18 @@ import type { LogFn } from '@aztec/foundation/log';
2
2
 
3
3
  import type { Command } from 'commander';
4
4
 
5
- import { ETHEREUM_HOSTS, l1ChainIdOption, nodeOption, parseOptionalInteger, pxeOption } from '../../utils/commands.js';
5
+ import { ETHEREUM_HOSTS, l1ChainIdOption, nodeOption, parseOptionalInteger } from '../../utils/commands.js';
6
6
 
7
7
  export function injectCommands(program: Command, log: LogFn) {
8
8
  program
9
9
  .command('setup-protocol-contracts')
10
10
  .description('Bootstrap the blockchain by initializing all the protocol contracts')
11
- .addOption(pxeOption)
12
11
  .addOption(nodeOption)
13
12
  .option('--testAccounts', 'Deploy funded test accounts.')
14
- .option('--sponsoredFPC', 'Deploy a sponsored FPC.')
15
13
  .option('--json', 'Output the contract addresses in JSON format')
16
14
  .action(async options => {
17
15
  const { setupL2Contracts } = await import('./setup_l2_contract.js');
18
- await setupL2Contracts(
19
- options.rpcUrl,
20
- options.nodeUrl,
21
- options.testAccounts,
22
- options.sponsoredFPC,
23
- options.json,
24
- log,
25
- );
16
+ await setupL2Contracts(options.nodeUrl, options.testAccounts, options.json, log);
26
17
  });
27
18
 
28
19
  program
@@ -1,36 +1,19 @@
1
1
  import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2
- import {
3
- AccountManager,
4
- type AztecAddress,
5
- type WaitOpts,
6
- createAztecNodeClient,
7
- createPXEClient,
8
- makeFetch,
9
- } from '@aztec/aztec.js';
2
+ import { AccountManager, type AztecAddress, type WaitOpts, createAztecNodeClient } from '@aztec/aztec.js';
10
3
  import { jsonStringify } from '@aztec/foundation/json-rpc';
11
4
  import type { LogFn } from '@aztec/foundation/log';
12
5
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
13
6
  import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet';
14
7
 
15
- import { setupSponsoredFPC } from '../../utils/setup_contracts.js';
16
-
17
- export async function setupL2Contracts(
18
- pxeUrl: string,
19
- nodeUrl: string,
20
- testAccounts: boolean,
21
- sponsoredFPC: boolean,
22
- json: boolean,
23
- log: LogFn,
24
- ) {
8
+ export async function setupL2Contracts(nodeUrl: string, testAccounts: boolean, json: boolean, log: LogFn) {
25
9
  const waitOpts: WaitOpts = {
26
10
  timeout: 180,
27
11
  interval: 1,
28
12
  };
29
13
  log('setupL2Contracts: Wait options' + jsonStringify(waitOpts));
30
14
  log('setupL2Contracts: Creating PXE client...');
31
- const pxe = createPXEClient(pxeUrl, {}, makeFetch([1, 1, 1, 1, 1], false));
32
15
  const node = createAztecNodeClient(nodeUrl);
33
- const wallet = new TestWallet(pxe, node);
16
+ const wallet = await TestWallet.create(node);
34
17
 
35
18
  let deployedAccountManagers: AccountManager[] = [];
36
19
  if (testAccounts) {
@@ -39,11 +22,6 @@ export async function setupL2Contracts(
39
22
  deployedAccountManagers = await deployFundedSchnorrAccounts(wallet, initialAccountsData, waitOpts);
40
23
  }
41
24
 
42
- if (sponsoredFPC) {
43
- log('setupL2Contracts: Setting up sponsored FPC...');
44
- await setupSponsoredFPC(pxe, log);
45
- }
46
-
47
25
  if (json) {
48
26
  const toPrint: Record<string, AztecAddress> = { ...ProtocolContractAddress };
49
27
  deployedAccountManagers.forEach((a, i) => {
@@ -13,7 +13,6 @@ import {
13
13
  parseAztecAddress,
14
14
  parseBigint,
15
15
  parseEthereumAddress,
16
- pxeOption,
17
16
  } from '../../utils/commands.js';
18
17
 
19
18
  export { addL1Validator } from './update_l1_validators.js';
@@ -518,10 +517,10 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
518
517
  .command('advance-epoch')
519
518
  .description('Use L1 cheat codes to warp time until the next epoch.')
520
519
  .addOption(l1RpcUrlsOption)
521
- .addOption(pxeOption)
520
+ .addOption(nodeOption)
522
521
  .action(async options => {
523
522
  const { advanceEpoch } = await import('./advance_epoch.js');
524
- await advanceEpoch(options.l1RpcUrls, options.rpcUrl, log);
523
+ await advanceEpoch(options.l1RpcUrls, options.nodeUrl, log);
525
524
  });
526
525
 
527
526
  program
@@ -9,6 +9,8 @@ import path, { dirname, join } from 'path';
9
9
 
10
10
  import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with { type: 'json' };
11
11
 
12
+ const SNAPSHOT_URL = 'https://pub-f4a8c34d4bb7441ebf8f48d904512180.r2.dev/snapshots';
13
+
12
14
  export type L2ChainConfig = L1ContractsConfig &
13
15
  Omit<SlasherConfig, 'slashValidatorsNever' | 'slashValidatorsAlways'> & {
14
16
  l1ChainId: number;
@@ -63,11 +65,12 @@ const DefaultSlashConfig = {
63
65
  slashProposeInvalidAttestationsPenalty: DefaultL1ContractsConfig.slashAmountLarge,
64
66
  slashAttestDescendantOfInvalidPenalty: DefaultL1ContractsConfig.slashAmountLarge,
65
67
  slashUnknownPenalty: DefaultL1ContractsConfig.slashAmountSmall,
66
- slashBroadcastedInvalidBlockPenalty: DefaultL1ContractsConfig.slashAmountMedium,
68
+ slashBroadcastedInvalidBlockPenalty: 0n, // DefaultL1ContractsConfig.slashAmountSmall // Disabled until further testing
67
69
  slashMaxPayloadSize: 50,
68
70
  slashGracePeriodL2Slots: 32 * 2, // Two epochs from genesis
69
71
  slashOffenseExpirationRounds: 8,
70
72
  sentinelEnabled: true,
73
+ slashExecuteRoundsLookBack: 4,
71
74
  } satisfies Partial<L2ChainConfig>;
72
75
 
73
76
  export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
@@ -76,13 +79,13 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
76
79
  sponsoredFPC: false,
77
80
  p2pEnabled: true,
78
81
  p2pBootstrapNodes: [],
79
- registryAddress: '0xa2ed20f46dc58e5af6035ec61d463ac85a6d52d3',
80
- slashFactoryAddress: '0x2c03d596f4b5f0c1d0d2dbf92a5964dfc658763c',
81
- feeAssetHandlerAddress: '0x48be40187f2932bd14cd4d111fba26646da96c36',
82
+ registryAddress: '0x5f85fa0f40bc4b5ccd53c9f34258aa55d25cdde8',
83
+ slashFactoryAddress: '0x257db2ca1471b7f76f414d2997404bfbe916c8c9',
84
+ feeAssetHandlerAddress: '0x67d645b0a3e053605ea861d7e8909be6669812c4',
82
85
  seqMinTxsPerBlock: 0,
83
86
  seqMaxTxsPerBlock: 0,
84
87
  realProofs: true,
85
- snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/staging-ignition/',
88
+ snapshotsUrl: `${SNAPSHOT_URL}/staging-ignition/`,
86
89
  autoUpdate: 'config-and-version',
87
90
  autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-ignition.json',
88
91
  maxTxPoolSize: 100_000_000, // 100MB
@@ -142,12 +145,13 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
142
145
  slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n,
143
146
  slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n,
144
147
  slashUnknownPenalty: 2_000n * 10n ** 18n,
145
- slashBroadcastedInvalidBlockPenalty: 10_000n * 10n ** 18n,
148
+ slashBroadcastedInvalidBlockPenalty: 0n, // 10_000n * 10n ** 18n, Disabled for now until further testing
146
149
  slashMaxPayloadSize: 50,
147
150
  slashGracePeriodL2Slots: 32 * 4, // One round from genesis
148
151
  slashOffenseExpirationRounds: 8,
149
152
  sentinelEnabled: true,
150
153
  slashingDisableDuration: 5 * 24 * 60 * 60,
154
+ slashExecuteRoundsLookBack: 4,
151
155
  };
152
156
 
153
157
  export const stagingPublicL2ChainConfig: L2ChainConfig = {
@@ -162,7 +166,7 @@ export const stagingPublicL2ChainConfig: L2ChainConfig = {
162
166
  seqMinTxsPerBlock: 0,
163
167
  seqMaxTxsPerBlock: 20,
164
168
  realProofs: true,
165
- snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/staging-public/',
169
+ snapshotsUrl: `${SNAPSHOT_URL}/staging-public/`,
166
170
  autoUpdate: 'config-and-version',
167
171
  autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/staging-public.json',
168
172
  publicIncludeMetrics,
@@ -215,7 +219,7 @@ export const testnetL2ChainConfig: L2ChainConfig = {
215
219
  seqMinTxsPerBlock: 0,
216
220
  seqMaxTxsPerBlock: 20,
217
221
  realProofs: true,
218
- snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/testnet/',
222
+ snapshotsUrl: `${SNAPSHOT_URL}/testnet/`,
219
223
  autoUpdate: 'config-and-version',
220
224
  autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/testnet.json',
221
225
  maxTxPoolSize: 100_000_000, // 100MB
@@ -29,19 +29,10 @@ export function addOptions(program: Command, options: Option[]) {
29
29
  return program;
30
30
  }
31
31
 
32
- export const makePxeOption = (mandatory: boolean) =>
33
- new Option('-u, --rpc-url <string>', 'URL of the PXE')
34
- .env('PXE_URL')
35
- .default(`http://${LOCALHOST}:8080`)
36
- .conflicts('remote-pxe')
37
- .makeOptionMandatory(mandatory);
38
-
39
- export const pxeOption = makePxeOption(true);
40
-
41
32
  export const makeNodeOption = (mandatory: boolean) =>
42
33
  new Option('-n, --node-url <string>', 'URL of the Aztec node')
43
34
  .env('AZTEC_NODE_URL')
44
- .default(`http://${LOCALHOST}:8079`)
35
+ .default(`http://${LOCALHOST}:8080`)
45
36
  .makeOptionMandatory(mandatory);
46
37
 
47
38
  export const nodeOption = makeNodeOption(true);
@@ -1,13 +1,8 @@
1
- import type { AztecAddress, ContractArtifact, Fr } from '@aztec/aztec.js';
2
1
  import type { LogFn } from '@aztec/foundation/log';
3
- import { ProtocolContractAddress } from '@aztec/protocol-contracts';
4
- import { siloNullifier } from '@aztec/stdlib/hash';
5
- import type { AztecNode, PXE } from '@aztec/stdlib/interfaces/client';
6
- import type { ExtendedNote } from '@aztec/stdlib/note';
2
+ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
7
3
  import type { TxHash } from '@aztec/stdlib/tx';
8
4
 
9
5
  export async function inspectBlock(
10
- pxe: PXE,
11
6
  aztecNode: AztecNode,
12
7
  blockNumber: number,
13
8
  log: LogFn,
@@ -31,9 +26,8 @@ export async function inspectBlock(
31
26
  log(` Timestamp: ${new Date(Number(block.header.globalVariables.timestamp) * 500)}`);
32
27
  if (opts.showTxs) {
33
28
  log(``);
34
- const artifactMap = await getKnownArtifacts(pxe);
35
29
  for (const txHash of block.body.txEffects.map(tx => tx.txHash)) {
36
- await inspectTx(pxe, aztecNode, txHash, log, { includeBlockInfo: false, artifactMap });
30
+ await inspectTx(aztecNode, txHash, log, { includeBlockInfo: false });
37
31
  }
38
32
  } else {
39
33
  log(` Transactions: ${block.body.txEffects.length}`);
@@ -41,11 +35,10 @@ export async function inspectBlock(
41
35
  }
42
36
 
43
37
  export async function inspectTx(
44
- pxe: PXE,
45
38
  aztecNode: AztecNode,
46
39
  txHash: TxHash,
47
40
  log: LogFn,
48
- opts: { includeBlockInfo?: boolean; artifactMap?: ArtifactMap } = {},
41
+ opts: { includeBlockInfo?: boolean } = {},
49
42
  ) {
50
43
  const [receipt, effectsInBlock] = await Promise.all([aztecNode.getTxReceipt(txHash), aztecNode.getTxEffect(txHash)]);
51
44
  // Base tx data
@@ -60,7 +53,6 @@ export async function inspectTx(
60
53
  }
61
54
 
62
55
  const effects = effectsInBlock.data;
63
- const artifactMap = opts?.artifactMap ?? (await getKnownArtifacts(pxe));
64
56
 
65
57
  if (opts.includeBlockInfo) {
66
58
  log(` Block: ${receipt.blockNumber} (${receipt.blockHash?.toString()})`);
@@ -97,38 +89,12 @@ export async function inspectTx(
97
89
  }
98
90
  }
99
91
 
100
- // Nullifiers
101
- const nullifierCount = effects.nullifiers.length;
102
- const { deployNullifiers, initNullifiers, classNullifiers } = await getKnownNullifiers(pxe, artifactMap);
103
- if (nullifierCount > 0) {
104
- log(' Nullifiers:');
105
- for (const nullifier of effects.nullifiers) {
106
- const deployed = deployNullifiers[nullifier.toString()];
107
- const note = deployed
108
- ? (await pxe.getNotes({ siloedNullifier: nullifier, contractAddress: deployed }))[0]
109
- : undefined;
110
- const initialized = initNullifiers[nullifier.toString()];
111
- const registered = classNullifiers[nullifier.toString()];
112
- if (nullifier.toBuffer().equals(txHash.toBuffer())) {
113
- log(` Transaction hash nullifier ${nullifier.toShortString()}`);
114
- } else if (note) {
115
- inspectNote(note, artifactMap, log, `Nullifier ${nullifier.toShortString()} for note`);
116
- } else if (deployed) {
117
- log(
118
- ` Contract ${toFriendlyAddress(deployed, artifactMap)} deployed via nullifier ${nullifier.toShortString()}`,
119
- );
120
- } else if (initialized) {
121
- log(
122
- ` Contract ${toFriendlyAddress(
123
- initialized,
124
- artifactMap,
125
- )} initialized via nullifier ${nullifier.toShortString()}`,
126
- );
127
- } else if (registered) {
128
- log(` Class ${registered} registered via nullifier ${nullifier.toShortString()}`);
129
- } else {
130
- log(` Unknown nullifier ${nullifier.toString()}`);
131
- }
92
+ // Created nullifiers
93
+ const nullifiers = effects.nullifiers;
94
+ if (nullifiers.length > 0) {
95
+ log(' Created nullifiers:');
96
+ for (const nullifier of nullifiers) {
97
+ log(` Nullifier: ${nullifier.toShortString()}`);
132
98
  }
133
99
  }
134
100
 
@@ -140,69 +106,3 @@ export async function inspectTx(
140
106
  }
141
107
  }
142
108
  }
143
-
144
- function inspectNote(note: ExtendedNote, artifactMap: ArtifactMap, log: LogFn, text = 'Note') {
145
- const artifact = artifactMap[note.contractAddress.toString()];
146
- const contract = artifact?.name ?? note.contractAddress.toString();
147
- log(` ${text} at ${contract}`);
148
- log(` Recipient: ${toFriendlyAddress(note.recipient, artifactMap)}`);
149
- for (const field of note.note.items) {
150
- log(` ${field.toString()}`);
151
- }
152
- }
153
-
154
- function toFriendlyAddress(address: AztecAddress, artifactMap: ArtifactMap) {
155
- const artifact = artifactMap[address.toString()];
156
- if (!artifact) {
157
- return address.toString();
158
- }
159
-
160
- return `${artifact.name}<${address.toString()}>`;
161
- }
162
-
163
- async function getKnownNullifiers(pxe: PXE, artifactMap: ArtifactMap) {
164
- const knownContracts = await pxe.getContracts();
165
- const deployerAddress = ProtocolContractAddress.ContractInstanceRegistry;
166
- const classRegistryAddress = ProtocolContractAddress.ContractClassRegistry;
167
- const initNullifiers: Record<string, AztecAddress> = {};
168
- const deployNullifiers: Record<string, AztecAddress> = {};
169
- const classNullifiers: Record<string, string> = {};
170
- for (const contract of knownContracts) {
171
- initNullifiers[(await siloNullifier(contract, contract.toField())).toString()] = contract;
172
- deployNullifiers[(await siloNullifier(deployerAddress, contract.toField())).toString()] = contract;
173
- }
174
- for (const artifact of Object.values(artifactMap)) {
175
- classNullifiers[(await siloNullifier(classRegistryAddress, artifact.classId)).toString()] =
176
- `${artifact.name}Class<${artifact.classId}>`;
177
- }
178
- return { initNullifiers, deployNullifiers, classNullifiers };
179
- }
180
-
181
- type ArtifactMap = Record<string, ContractArtifactWithClassId>;
182
- type ContractArtifactWithClassId = ContractArtifact & { classId: Fr };
183
- async function getKnownArtifacts(pxe: PXE): Promise<ArtifactMap> {
184
- const knownContractAddresses = await pxe.getContracts();
185
- const knownContracts = (
186
- await Promise.all(knownContractAddresses.map(contractAddress => pxe.getContractMetadata(contractAddress)))
187
- ).map(contractMetadata => contractMetadata.contractInstance);
188
- const classIds = [...new Set(knownContracts.map(contract => contract?.currentContractClassId))];
189
- const knownArtifacts = (
190
- await Promise.all(classIds.map(classId => (classId ? pxe.getContractClassMetadata(classId) : undefined)))
191
- ).map(contractClassMetadata =>
192
- contractClassMetadata
193
- ? { ...contractClassMetadata.artifact, classId: contractClassMetadata.contractClass?.id }
194
- : undefined,
195
- );
196
- const map: Record<string, ContractArtifactWithClassId> = {};
197
- for (const instance of knownContracts) {
198
- if (instance) {
199
- const artifact = knownArtifacts.find(a =>
200
- a?.classId?.equals(instance.currentContractClassId),
201
- ) as ContractArtifactWithClassId;
202
- if (artifact) {
203
- map[instance.address.toString()] = artifact;
204
- }
205
- }
206
- }
207
- return map;
208
- }
@@ -1,6 +1,5 @@
1
- import { Fr, type PXE, getContractInstanceFromInstantiationParams } from '@aztec/aztec.js';
1
+ import { Fr, getContractInstanceFromInstantiationParams } from '@aztec/aztec.js';
2
2
  import { SPONSORED_FPC_SALT } from '@aztec/constants';
3
- import type { LogFn } from '@aztec/foundation/log';
4
3
 
5
4
  async function getSponsoredFPCContract() {
6
5
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -16,13 +15,3 @@ export async function getSponsoredFPCAddress() {
16
15
  });
17
16
  return sponsoredFPCInstance.address;
18
17
  }
19
-
20
- export async function setupSponsoredFPC(pxe: PXE, log: LogFn) {
21
- const SponsoredFPCContract = await getSponsoredFPCContract();
22
- const sponsoredFPCInstance = await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
23
- salt: new Fr(SPONSORED_FPC_SALT),
24
- });
25
- await pxe.registerContract({ instance: sponsoredFPCInstance, artifact: SponsoredFPCContract.artifact });
26
-
27
- log(`SponsoredFPC: ${sponsoredFPCInstance.address}`);
28
- }
@@ -1,5 +0,0 @@
1
- import { AztecAddress, type Fr } from '@aztec/aztec.js';
2
- import type { LogFn, Logger } from '@aztec/foundation/log';
3
- import { PublicKeys } from '@aztec/stdlib/keys';
4
- export declare function addContract(rpcUrl: string, contractArtifactPath: string, address: AztecAddress, initializationHash: Fr, salt: Fr, publicKeys: PublicKeys, deployer: AztecAddress | undefined, debugLogger: Logger, log: LogFn): Promise<void>;
5
- //# sourceMappingURL=add_contract.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add_contract.d.ts","sourceRoot":"","sources":["../../../src/cmds/pxe/add_contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoC,KAAK,EAAE,EAAgC,MAAM,iBAAiB,CAAC;AAExH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIhD,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,YAAY,EACrB,kBAAkB,EAAE,EAAE,EACtB,IAAI,EAAE,EAAE,EACR,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,YAAY,GAAG,SAAS,EAClC,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,iBAuBX"}
@@ -1,29 +0,0 @@
1
- import { AztecAddress, getContractClassFromArtifact } from '@aztec/aztec.js';
2
- import { createCompatibleClient } from '@aztec/aztec.js';
3
- import { computeContractAddressFromInstance } from '@aztec/stdlib/contract';
4
- import { PublicKeys } from '@aztec/stdlib/keys';
5
- import { getContractArtifact } from '../../utils/aztec.js';
6
- export async function addContract(rpcUrl, contractArtifactPath, address, initializationHash, salt, publicKeys, deployer, debugLogger, log) {
7
- const artifact = await getContractArtifact(contractArtifactPath, log);
8
- const contractClass = await getContractClassFromArtifact(artifact);
9
- const instance = {
10
- version: 1,
11
- salt,
12
- initializationHash,
13
- currentContractClassId: contractClass.id,
14
- originalContractClassId: contractClass.id,
15
- publicKeys: publicKeys ?? PublicKeys.default(),
16
- address,
17
- deployer: deployer ?? AztecAddress.ZERO
18
- };
19
- const computed = await computeContractAddressFromInstance(instance);
20
- if (!computed.equals(address)) {
21
- throw new Error(`Contract address ${address.toString()} does not match computed address ${computed.toString()}`);
22
- }
23
- const client = await createCompatibleClient(rpcUrl, debugLogger);
24
- await client.registerContract({
25
- artifact,
26
- instance
27
- });
28
- log(`\nContract added to PXE at ${address.toString()} with class ${instance.currentContractClassId.toString()}\n`);
29
- }
@@ -1,4 +0,0 @@
1
- import type { AztecAddress } from '@aztec/aztec.js';
2
- import type { LogFn, Logger } from '@aztec/foundation/log';
3
- export declare function getAccount(aztecAddress: AztecAddress, rpcUrl: string, debugLogger: Logger, log: LogFn): Promise<void>;
4
- //# sourceMappingURL=get_account.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get_account.d.ts","sourceRoot":"","sources":["../../../src/cmds/pxe/get_account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,wBAAsB,UAAU,CAAC,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,iBAW3G"}
@@ -1,10 +0,0 @@
1
- import { createCompatibleClient } from '@aztec/aztec.js';
2
- export async function getAccount(aztecAddress, rpcUrl, debugLogger, log) {
3
- const client = await createCompatibleClient(rpcUrl, debugLogger);
4
- const account = (await client.getRegisteredAccounts()).find((completeAddress)=>completeAddress.address.equals(aztecAddress));
5
- if (!account) {
6
- log(`Unknown account ${aztecAddress.toString()}`);
7
- } else {
8
- log(account.toReadableString());
9
- }
10
- }
@@ -1,3 +0,0 @@
1
- import type { LogFn, Logger } from '@aztec/foundation/log';
2
- export declare function getAccounts(rpcUrl: string, json: boolean, debugLogger: Logger, log: LogFn, logJson: (output: any) => void): Promise<void>;
3
- //# sourceMappingURL=get_accounts.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get_accounts.d.ts","sourceRoot":"","sources":["../../../src/cmds/pxe/get_accounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,EACV,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,iBA0B/B"}
@@ -1,25 +0,0 @@
1
- import { createCompatibleClient } from '@aztec/aztec.js';
2
- export async function getAccounts(rpcUrl, json, debugLogger, log, logJson) {
3
- const client = await createCompatibleClient(rpcUrl, debugLogger);
4
- const accounts = await client.getRegisteredAccounts();
5
- if (!accounts.length) {
6
- if (json) {
7
- logJson([]);
8
- } else {
9
- log('No accounts found.');
10
- }
11
- return;
12
- }
13
- if (json) {
14
- logJson(accounts.map((a)=>({
15
- address: a.address.toString(),
16
- publicKeys: a.publicKeys.toString(),
17
- partialAddress: a.partialAddress.toString()
18
- })));
19
- } else {
20
- log(`Accounts found: \n`);
21
- for (const account of accounts){
22
- log(account.toReadableString());
23
- }
24
- }
25
- }
@@ -1,4 +0,0 @@
1
- import type { AztecAddress } from '@aztec/aztec.js';
2
- import type { LogFn, Logger } from '@aztec/foundation/log';
3
- export declare function getContractData(rpcUrl: string, contractAddress: AztecAddress, includeBytecode: boolean, debugLogger: Logger, log: LogFn): Promise<void>;
4
- //# sourceMappingURL=get_contract_data.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get_contract_data.d.ts","sourceRoot":"","sources":["../../../src/cmds/pxe/get_contract_data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,YAAY,EAC7B,eAAe,EAAE,OAAO,EACxB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,iBAyCX"}
@@ -1,31 +0,0 @@
1
- import { createCompatibleClient } from '@aztec/aztec.js';
2
- export async function getContractData(rpcUrl, contractAddress, includeBytecode, debugLogger, log) {
3
- const client = await createCompatibleClient(rpcUrl, debugLogger);
4
- const { contractInstance: instance, isContractInitialized: isInitialized, isContractPublished: isPubliclyDeployed } = await client.getContractMetadata(contractAddress);
5
- const contractClass = includeBytecode && instance && (await client.getContractClassMetadata(instance?.currentContractClassId)).contractClass;
6
- const isPrivatelyDeployed = !!instance;
7
- const initStr = isInitialized ? 'initialized' : 'not initialized';
8
- const addrStr = contractAddress.toString();
9
- if (isPubliclyDeployed && isPrivatelyDeployed) {
10
- log(`Contract is ${initStr} and publicly deployed at ${addrStr}`);
11
- } else if (isPrivatelyDeployed) {
12
- log(`Contract is ${initStr} and registered in the local pxe at ${addrStr} but not publicly deployed`);
13
- } else if (isPubliclyDeployed) {
14
- log(`Contract is ${initStr} and publicly deployed at ${addrStr} but not registered in the local pxe`);
15
- } else if (isInitialized) {
16
- log(`Contract is initialized but not publicly deployed nor registered in the local pxe at ${addrStr}`);
17
- } else {
18
- log(`No contract found at ${addrStr}`);
19
- }
20
- if (instance) {
21
- log(``);
22
- Object.entries(instance).forEach(([key, value])=>{
23
- const capitalized = key.charAt(0).toUpperCase() + key.slice(1);
24
- log(`${capitalized}: ${value.toString()}`);
25
- });
26
- if (contractClass) {
27
- log(`\nBytecode: ${contractClass.packedBytecode.toString('base64')}`);
28
- }
29
- log('');
30
- }
31
- }
@@ -1,3 +0,0 @@
1
- import type { LogFn, Logger } from '@aztec/foundation/log';
2
- export declare function getPXEInfo(rpcUrl: string, debugLogger: Logger, log: LogFn): Promise<void>;
3
- //# sourceMappingURL=get_pxe_info.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get_pxe_info.d.ts","sourceRoot":"","sources":["../../../src/cmds/pxe/get_pxe_info.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,iBAS/E"}
@@ -1,11 +0,0 @@
1
- import { createCompatibleClient } from '@aztec/aztec.js';
2
- export async function getPXEInfo(rpcUrl, debugLogger, log) {
3
- const client = await createCompatibleClient(rpcUrl, debugLogger);
4
- const info = await client.getPXEInfo();
5
- log(`PXE Version: ${info.pxeVersion}`);
6
- log(`Protocol Contract Addresses:`);
7
- log(` Class Registry: ${info.protocolContractAddresses.classRegistry.toString()}`);
8
- log(` Fee Juice: ${info.protocolContractAddresses.feeJuice.toString()}`);
9
- log(` Instance Deployer: ${info.protocolContractAddresses.instanceRegistry.toString()}`);
10
- log(` Multi Call Entrypoint: ${info.protocolContractAddresses.multiCallEntrypoint.toString()}`);
11
- }
@@ -1,4 +0,0 @@
1
- import type { LogFn, Logger } from '@aztec/foundation/log';
2
- import type { Command } from 'commander';
3
- export declare function injectCommands(program: Command, log: LogFn, debugLogger: Logger): Command;
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/pxe/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWzC,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAyE/E"}