@aztec/cli 0.0.0-test.1 → 0.0.1-fake-ceab37513c

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 (146) hide show
  1. package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -1
  2. package/dest/cmds/contracts/inspect_contract.js +9 -5
  3. package/dest/cmds/infrastructure/index.d.ts.map +1 -1
  4. package/dest/cmds/infrastructure/index.js +3 -3
  5. package/dest/cmds/infrastructure/sequencers.d.ts +2 -1
  6. package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
  7. package/dest/cmds/infrastructure/sequencers.js +27 -15
  8. package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
  9. package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
  10. package/dest/cmds/infrastructure/setup_l2_contract.js +14 -12
  11. package/dest/cmds/l1/advance_epoch.d.ts.map +1 -1
  12. package/dest/cmds/l1/advance_epoch.js +3 -2
  13. package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
  14. package/dest/cmds/l1/assume_proven_through.js +3 -3
  15. package/dest/cmds/l1/bridge_erc20.d.ts +1 -1
  16. package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
  17. package/dest/cmds/l1/bridge_erc20.js +4 -4
  18. package/dest/cmds/l1/deploy_l1_contracts.d.ts +2 -2
  19. package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -1
  20. package/dest/cmds/l1/deploy_l1_contracts.js +22 -5
  21. package/dest/cmds/l1/deploy_new_rollup.d.ts +2 -1
  22. package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
  23. package/dest/cmds/l1/deploy_new_rollup.js +16 -7
  24. package/dest/cmds/l1/governance_utils.d.ts.map +1 -1
  25. package/dest/cmds/l1/governance_utils.js +17 -17
  26. package/dest/cmds/l1/index.d.ts +1 -0
  27. package/dest/cmds/l1/index.d.ts.map +1 -1
  28. package/dest/cmds/l1/index.js +29 -39
  29. package/dest/cmds/l1/trigger_seed_snapshot.d.ts +6 -0
  30. package/dest/cmds/l1/trigger_seed_snapshot.d.ts.map +1 -0
  31. package/dest/cmds/l1/trigger_seed_snapshot.js +19 -0
  32. package/dest/cmds/l1/update_l1_validators.d.ts +17 -2
  33. package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
  34. package/dest/cmds/l1/update_l1_validators.js +156 -101
  35. package/dest/cmds/misc/generate_bootnode_enr.d.ts +1 -1
  36. package/dest/cmds/misc/generate_bootnode_enr.d.ts.map +1 -1
  37. package/dest/cmds/misc/generate_bootnode_enr.js +2 -2
  38. package/dest/cmds/misc/generate_secret_and_hash.d.ts +1 -1
  39. package/dest/cmds/misc/generate_secret_and_hash.d.ts.map +1 -1
  40. package/dest/cmds/misc/generate_secret_and_hash.js +2 -2
  41. package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts +3 -0
  42. package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts.map +1 -0
  43. package/dest/cmds/misc/get_canonical_sponsored_fpc_address.js +4 -0
  44. package/dest/cmds/misc/index.d.ts.map +1 -1
  45. package/dest/cmds/misc/index.js +7 -3
  46. package/dest/cmds/misc/update/github.d.ts +0 -1
  47. package/dest/cmds/misc/update/github.d.ts.map +1 -1
  48. package/dest/cmds/misc/update/github.js +0 -1
  49. package/dest/cmds/misc/update.d.ts.map +1 -1
  50. package/dest/cmds/misc/update.js +2 -3
  51. package/dest/cmds/pxe/get_contract_data.js +1 -1
  52. package/dest/cmds/pxe/get_node_info.d.ts.map +1 -1
  53. package/dest/cmds/pxe/get_node_info.js +11 -7
  54. package/dest/cmds/pxe/get_pxe_info.js +2 -2
  55. package/dest/config/cached_fetch.d.ts +18 -0
  56. package/dest/config/cached_fetch.d.ts.map +1 -0
  57. package/dest/config/cached_fetch.js +54 -0
  58. package/dest/config/chain_l2_config.d.ts +38 -0
  59. package/dest/config/chain_l2_config.d.ts.map +1 -0
  60. package/dest/config/chain_l2_config.js +376 -0
  61. package/dest/config/enrich_env.d.ts +4 -0
  62. package/dest/config/enrich_env.d.ts.map +1 -0
  63. package/dest/config/enrich_env.js +12 -0
  64. package/dest/config/get_l1_config.d.ts +8 -0
  65. package/dest/config/get_l1_config.d.ts.map +1 -0
  66. package/dest/config/get_l1_config.js +22 -0
  67. package/dest/config/index.d.ts +5 -0
  68. package/dest/config/index.d.ts.map +1 -0
  69. package/dest/config/index.js +4 -0
  70. package/dest/config/network_config.d.ts +19 -0
  71. package/dest/config/network_config.d.ts.map +1 -0
  72. package/dest/config/network_config.js +79 -0
  73. package/dest/utils/aztec.d.ts +12 -11
  74. package/dest/utils/aztec.d.ts.map +1 -1
  75. package/dest/utils/aztec.js +52 -22
  76. package/dest/utils/commands.d.ts +1 -1
  77. package/dest/utils/commands.d.ts.map +1 -1
  78. package/dest/utils/commands.js +5 -5
  79. package/dest/utils/encoding.js +1 -1
  80. package/dest/utils/github.d.ts +0 -1
  81. package/dest/utils/github.d.ts.map +1 -1
  82. package/dest/utils/github.js +0 -1
  83. package/dest/utils/index.d.ts +1 -0
  84. package/dest/utils/index.d.ts.map +1 -1
  85. package/dest/utils/index.js +1 -0
  86. package/dest/utils/inspect.d.ts.map +1 -1
  87. package/dest/utils/inspect.js +18 -26
  88. package/dest/utils/setup_contracts.d.ts +5 -0
  89. package/dest/utils/setup_contracts.d.ts.map +1 -0
  90. package/dest/utils/setup_contracts.js +36 -0
  91. package/package.json +38 -32
  92. package/src/cmds/contracts/inspect_contract.ts +16 -6
  93. package/src/cmds/infrastructure/index.ts +10 -2
  94. package/src/cmds/infrastructure/sequencers.ts +32 -15
  95. package/src/cmds/infrastructure/setup_l2_contract.ts +16 -11
  96. package/src/cmds/l1/advance_epoch.ts +3 -2
  97. package/src/cmds/l1/assume_proven_through.ts +3 -3
  98. package/src/cmds/l1/bridge_erc20.ts +4 -3
  99. package/src/cmds/l1/deploy_l1_contracts.ts +30 -6
  100. package/src/cmds/l1/deploy_new_rollup.ts +22 -8
  101. package/src/cmds/l1/governance_utils.ts +18 -17
  102. package/src/cmds/l1/index.ts +69 -96
  103. package/src/cmds/l1/trigger_seed_snapshot.ts +31 -0
  104. package/src/cmds/l1/update_l1_validators.ts +191 -92
  105. package/src/cmds/misc/generate_bootnode_enr.ts +3 -2
  106. package/src/cmds/misc/generate_secret_and_hash.ts +2 -2
  107. package/src/cmds/misc/get_canonical_sponsored_fpc_address.ts +7 -0
  108. package/src/cmds/misc/index.ts +13 -4
  109. package/src/cmds/misc/update/github.ts +0 -1
  110. package/src/cmds/misc/update.ts +1 -7
  111. package/src/cmds/pxe/get_contract_data.ts +1 -1
  112. package/src/cmds/pxe/get_node_info.ts +10 -7
  113. package/src/cmds/pxe/get_pxe_info.ts +2 -2
  114. package/src/config/cached_fetch.ts +67 -0
  115. package/src/config/chain_l2_config.ts +493 -0
  116. package/src/config/enrich_env.ts +15 -0
  117. package/src/config/get_l1_config.ts +28 -0
  118. package/src/config/index.ts +4 -0
  119. package/src/config/network_config.ts +102 -0
  120. package/src/utils/aztec.ts +76 -27
  121. package/src/utils/commands.ts +5 -5
  122. package/src/utils/encoding.ts +1 -1
  123. package/src/utils/github.ts +0 -1
  124. package/src/utils/index.ts +1 -0
  125. package/src/utils/inspect.ts +18 -25
  126. package/src/utils/setup_contracts.ts +58 -0
  127. package/dest/cmds/devnet/bootstrap_network.d.ts +0 -3
  128. package/dest/cmds/devnet/bootstrap_network.d.ts.map +0 -1
  129. package/dest/cmds/devnet/bootstrap_network.js +0 -196
  130. package/dest/cmds/devnet/faucet.d.ts +0 -4
  131. package/dest/cmds/devnet/faucet.d.ts.map +0 -1
  132. package/dest/cmds/devnet/faucet.js +0 -26
  133. package/dest/cmds/devnet/index.d.ts +0 -4
  134. package/dest/cmds/devnet/index.d.ts.map +0 -1
  135. package/dest/cmds/devnet/index.js +0 -14
  136. package/dest/cmds/l1/deploy_l1_verifier.d.ts +0 -5
  137. package/dest/cmds/l1/deploy_l1_verifier.d.ts.map +0 -1
  138. package/dest/cmds/l1/deploy_l1_verifier.js +0 -54
  139. package/dest/cmds/misc/setup_contracts.d.ts +0 -7
  140. package/dest/cmds/misc/setup_contracts.d.ts.map +0 -1
  141. package/dest/cmds/misc/setup_contracts.js +0 -27
  142. package/src/cmds/devnet/bootstrap_network.ts +0 -318
  143. package/src/cmds/devnet/faucet.ts +0 -33
  144. package/src/cmds/devnet/index.ts +0 -60
  145. package/src/cmds/l1/deploy_l1_verifier.ts +0 -105
  146. package/src/cmds/misc/setup_contracts.ts +0 -40
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enrich_env.d.ts","sourceRoot":"","sources":["../../src/config/enrich_env.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAEvD,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,QAMlE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAGhE"}
@@ -0,0 +1,12 @@
1
+ import { EthAddress } from '@aztec/aztec.js';
2
+ export function enrichVar(envVar, value) {
3
+ // Don't override
4
+ if (process.env[envVar] || value === undefined) {
5
+ return;
6
+ }
7
+ process.env[envVar] = value;
8
+ }
9
+ export function enrichEthAddressVar(envVar, value) {
10
+ // EthAddress doesn't like being given empty strings
11
+ enrichVar(envVar, value || EthAddress.ZERO.toString());
12
+ }
@@ -0,0 +1,8 @@
1
+ import { type L1ContractAddresses, getL1ContractsConfig } from '@aztec/ethereum';
2
+ import { EthAddress } from '@aztec/foundation/eth-address';
3
+ export declare function getL1Config(registryAddress: EthAddress, l1RpcUrls: string[], l1ChainId: number, rollupVersion?: number | 'canonical'): Promise<{
4
+ addresses: L1ContractAddresses;
5
+ config: Awaited<ReturnType<typeof getL1ContractsConfig>>;
6
+ }>;
7
+ export declare function getL1RollupAddressFromEnv(l1RpcUrls: string[], l1ChainId: number): Promise<EthAddress>;
8
+ //# sourceMappingURL=get_l1_config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get_l1_config.d.ts","sourceRoot":"","sources":["../../src/config/get_l1_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAoB,oBAAoB,EAAmB,MAAM,iBAAiB,CAAC;AACpH,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,wBAAsB,WAAW,CAC/B,eAAe,EAAE,UAAU,EAC3B,SAAS,EAAE,MAAM,EAAE,EACnB,SAAS,EAAE,MAAM,EACjB,aAAa,GAAE,MAAM,GAAG,WAAyB,GAChD,OAAO,CAAC;IAAE,SAAS,EAAE,mBAAmB,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAA;CAAE,CAAC,CAUvG;AAED,wBAAsB,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,uBAOrF"}
@@ -0,0 +1,22 @@
1
+ import { RegistryContract, getL1ContractsConfig, getPublicClient } from '@aztec/ethereum';
2
+ import { EthAddress } from '@aztec/foundation/eth-address';
3
+ export async function getL1Config(registryAddress, l1RpcUrls, l1ChainId, rollupVersion = 'canonical') {
4
+ const publicClient = getPublicClient({
5
+ l1RpcUrls,
6
+ l1ChainId
7
+ });
8
+ const addresses = await RegistryContract.collectAddresses(publicClient, registryAddress, rollupVersion);
9
+ const config = await getL1ContractsConfig(publicClient, addresses);
10
+ return {
11
+ addresses,
12
+ config
13
+ };
14
+ }
15
+ export async function getL1RollupAddressFromEnv(l1RpcUrls, l1ChainId) {
16
+ const registryAddress = process.env.REGISTRY_CONTRACT_ADDRESS;
17
+ if (!registryAddress || !EthAddress.isAddress(registryAddress)) {
18
+ throw new Error(`Failed to extract registry address`);
19
+ }
20
+ const { addresses } = await getL1Config(EthAddress.fromString(registryAddress), l1RpcUrls, l1ChainId);
21
+ return addresses.rollupAddress;
22
+ }
@@ -0,0 +1,5 @@
1
+ export * from './cached_fetch.js';
2
+ export * from './chain_l2_config.js';
3
+ export * from './get_l1_config.js';
4
+ export * from './network_config.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './cached_fetch.js';
2
+ export * from './chain_l2_config.js';
3
+ export * from './get_l1_config.js';
4
+ export * from './network_config.js';
@@ -0,0 +1,19 @@
1
+ import { type NetworkConfig, type NetworkNames } from '@aztec/foundation/config';
2
+ /**
3
+ * Fetches remote network configuration from GitHub with caching support.
4
+ * Uses the reusable cachedFetch utility.
5
+ *
6
+ * @param networkName - The network name to fetch config for
7
+ * @param cacheDir - Optional cache directory for storing fetched config
8
+ * @returns Remote configuration for the specified network, or undefined if not found/error
9
+ */
10
+ export declare function getNetworkConfig(networkName: NetworkNames, cacheDir?: string): Promise<NetworkConfig | undefined>;
11
+ /**
12
+ * Enriches environment variables with remote network configuration.
13
+ * This function is called before node config initialization to set env vars
14
+ * from the remote config, following the same pattern as enrichEnvironmentWithChainConfig().
15
+ *
16
+ * @param networkName - The network name to fetch remote config for
17
+ */
18
+ export declare function enrichEnvironmentWithNetworkConfig(networkName: NetworkNames): Promise<void>;
19
+ //# sourceMappingURL=network_config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network_config.d.ts","sourceRoot":"","sources":["../../src/config/network_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAA0B,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAYzG;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,YAAY,EACzB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAiDpC;AAED;;;;;;GAMG;AACH,wBAAsB,kCAAkC,CAAC,WAAW,EAAE,YAAY,iBAoBjF"}
@@ -0,0 +1,79 @@
1
+ import { NetworkConfigMapSchema } from '@aztec/foundation/config';
2
+ import { readFile } from 'fs/promises';
3
+ import { join } from 'path';
4
+ import { cachedFetch } from './cached_fetch.js';
5
+ import { enrichEthAddressVar, enrichVar } from './enrich_env.js';
6
+ const DEFAULT_CONFIG_URL = 'https://raw.githubusercontent.com/AztecProtocol/networks/refs/heads/main/network_config.json';
7
+ const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
8
+ /**
9
+ * Fetches remote network configuration from GitHub with caching support.
10
+ * Uses the reusable cachedFetch utility.
11
+ *
12
+ * @param networkName - The network name to fetch config for
13
+ * @param cacheDir - Optional cache directory for storing fetched config
14
+ * @returns Remote configuration for the specified network, or undefined if not found/error
15
+ */ export async function getNetworkConfig(networkName, cacheDir) {
16
+ let url;
17
+ const configLocation = process.env.NETWORK_CONFIG_LOCATION || DEFAULT_CONFIG_URL;
18
+ if (!configLocation) {
19
+ return undefined;
20
+ }
21
+ try {
22
+ if (configLocation.includes('://')) {
23
+ url = new URL(configLocation);
24
+ } else {
25
+ url = new URL(`file://${configLocation}`);
26
+ }
27
+ } catch {
28
+ /* no-op */ }
29
+ if (!url) {
30
+ return undefined;
31
+ }
32
+ try {
33
+ let rawConfig;
34
+ if (url.protocol === 'http:' || url.protocol === 'https:') {
35
+ rawConfig = await cachedFetch(url.href, {
36
+ cacheDurationMs: NETWORK_CONFIG_CACHE_DURATION_MS,
37
+ cacheFile: cacheDir ? join(cacheDir, networkName, 'network_config.json') : undefined
38
+ });
39
+ } else if (url.protocol === 'file:') {
40
+ rawConfig = JSON.parse(await readFile(url.pathname, 'utf-8'));
41
+ } else {
42
+ throw new Error('Unsupported Aztec network config protocol: ' + url.href);
43
+ }
44
+ if (!rawConfig) {
45
+ return undefined;
46
+ }
47
+ const networkConfigMap = NetworkConfigMapSchema.parse(rawConfig);
48
+ if (networkName in networkConfigMap) {
49
+ return networkConfigMap[networkName];
50
+ } else {
51
+ return undefined;
52
+ }
53
+ } catch {
54
+ return undefined;
55
+ }
56
+ }
57
+ /**
58
+ * Enriches environment variables with remote network configuration.
59
+ * This function is called before node config initialization to set env vars
60
+ * from the remote config, following the same pattern as enrichEnvironmentWithChainConfig().
61
+ *
62
+ * @param networkName - The network name to fetch remote config for
63
+ */ export async function enrichEnvironmentWithNetworkConfig(networkName) {
64
+ if (networkName === 'local') {
65
+ return; // No remote config for local development
66
+ }
67
+ const cacheDir = process.env.DATA_DIRECTORY ? join(process.env.DATA_DIRECTORY, 'cache') : undefined;
68
+ const networkConfig = await getNetworkConfig(networkName, cacheDir);
69
+ if (!networkConfig) {
70
+ return;
71
+ }
72
+ enrichVar('BOOTSTRAP_NODES', networkConfig.bootnodes.join(','));
73
+ enrichVar('L1_CHAIN_ID', String(networkConfig.l1ChainId));
74
+ enrichVar('SYNC_SNAPSHOTS_URLS', networkConfig.snapshots.join(','));
75
+ enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', networkConfig.registryAddress.toString());
76
+ if (networkConfig.feeAssetHandlerAddress) {
77
+ enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', networkConfig.feeAssetHandlerAddress.toString());
78
+ }
79
+ }
@@ -1,7 +1,7 @@
1
- import type { EthAddress, PXE } from '@aztec/aztec.js';
2
- import { type ContractArtifact, type FunctionArtifact } from '@aztec/aztec.js/abi';
3
- import type { DeployL1ContractsReturnType, L1ContractsConfig, RollupContract } from '@aztec/ethereum';
4
- import type { Fr } from '@aztec/foundation/fields';
1
+ import { EthAddress, type PXE } from '@aztec/aztec.js';
2
+ import { type ContractArtifact, type FunctionAbi } from '@aztec/aztec.js/abi';
3
+ import { type DeployL1ContractsReturnType, type L1ContractsConfig, type Operator, RollupContract } from '@aztec/ethereum';
4
+ import { Fr } from '@aztec/foundation/fields';
5
5
  import type { LogFn, Logger } from '@aztec/foundation/log';
6
6
  import type { NoirPackageConfig } from '@aztec/foundation/noir';
7
7
  /**
@@ -10,7 +10,7 @@ import type { NoirPackageConfig } from '@aztec/foundation/noir';
10
10
  * @param fnName - Function name to be found.
11
11
  * @returns The function's ABI.
12
12
  */
13
- export declare function getFunctionArtifact(artifact: ContractArtifact, fnName: string): FunctionArtifact;
13
+ export declare function getFunctionAbi(artifact: ContractArtifact, fnName: string): FunctionAbi;
14
14
  /**
15
15
  * Function to execute the 'deployRollupContracts' command.
16
16
  * @param rpcUrls - The RPC URL of the ethereum node.
@@ -18,10 +18,10 @@ export declare function getFunctionArtifact(artifact: ContractArtifact, fnName:
18
18
  * @param privateKey - The private key to be used in contract deployment.
19
19
  * @param mnemonic - The mnemonic to be used in contract deployment.
20
20
  */
21
- export declare function deployAztecContracts(rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators: EthAddress[], genesisArchiveRoot: Fr, genesisBlockHash: Fr, acceleratedTestDeployments: boolean, config: L1ContractsConfig, debugLogger: Logger): Promise<DeployL1ContractsReturnType>;
22
- export declare function deployNewRollupContracts(registryAddress: EthAddress, rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators: EthAddress[], genesisArchiveRoot: Fr, genesisBlockHash: Fr, config: L1ContractsConfig, logger: Logger): Promise<{
23
- payloadAddress: EthAddress;
21
+ export declare function deployAztecContracts(rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators: Operator[], genesisArchiveRoot: Fr, feeJuicePortalInitialBalance: bigint, acceleratedTestDeployments: boolean, config: L1ContractsConfig, existingToken: EthAddress | undefined, realVerifier: boolean, createVerificationJson: string | false, debugLogger: Logger): Promise<DeployL1ContractsReturnType>;
22
+ export declare function deployNewRollupContracts(registryAddress: EthAddress, rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators: Operator[], genesisArchiveRoot: Fr, feeJuicePortalInitialBalance: bigint, config: L1ContractsConfig, realVerifier: boolean, createVerificationJson: string | false, logger: Logger): Promise<{
24
23
  rollup: RollupContract;
24
+ slashFactoryAddress: EthAddress;
25
25
  }>;
26
26
  /**
27
27
  * Gets all contracts available in \@aztec/noir-contracts.js.
@@ -54,10 +54,11 @@ export declare function prepTx(contractFile: string, functionName: string, _func
54
54
  */
55
55
  export declare const stripLeadingHex: (hex: string) => string;
56
56
  /**
57
- * Pretty prints Nargo.toml contents to a string
58
- * @param config - Nargo.toml contents
59
- * @returns The Nargo.toml contents as a string
57
+ * Adds a leading 0x to a hex string. If a leading 0x is already present the string is returned unchanged.
58
+ * @param hex - A hex string
59
+ * @returns A new string with leading 0x added
60
60
  */
61
+ export declare const addLeadingHex: (hex: string) => `0x${string}`;
61
62
  export declare function prettyPrintNargoToml(config: NoirPackageConfig): string;
62
63
  /**
63
64
  * Checks that Private eXecution Environment (PXE) version matches the expected one by this CLI. Throws if not.
@@ -1 +1 @@
1
- {"version":3,"file":"aztec.d.ts","sourceRoot":"","sources":["../../src/utils/aztec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAwB,MAAM,qBAAqB,CAAC;AACzG,OAAO,KAAK,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtG,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAUhE;;;;;GAKG;AACH,wB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AoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAUtE;AAKD;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,iBAyB9E"}
@@ -1,6 +1,8 @@
1
- import { loadContractArtifact } from '@aztec/aztec.js/abi';
2
- import { ProtocolContractAddress, protocolContractTreeRoot } from '@aztec/protocol-contracts';
3
- import { FunctionType } from '@aztec/stdlib/abi';
1
+ import { EthAddress } from '@aztec/aztec.js';
2
+ import { FunctionType, getAllFunctionAbis, loadContractArtifact } from '@aztec/aztec.js/abi';
3
+ import { SecretValue } from '@aztec/foundation/config';
4
+ import { Fr } from '@aztec/foundation/fields';
5
+ import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
4
6
  import TOML from '@iarna/toml';
5
7
  import { readFile } from 'fs/promises';
6
8
  import { gtr, ltr, satisfies, valid } from 'semver';
@@ -10,8 +12,8 @@ import { encodeArgs } from './encoding.js';
10
12
  * @param artifact - Contract's build artifact in JSON format.
11
13
  * @param fnName - Function name to be found.
12
14
  * @returns The function's ABI.
13
- */ export function getFunctionArtifact(artifact, fnName) {
14
- const fn = artifact.functions.find(({ name })=>name === fnName);
15
+ */ export function getFunctionAbi(artifact, fnName) {
16
+ const fn = getAllFunctionAbis(artifact).find(({ name })=>name === fnName);
15
17
  if (!fn) {
16
18
  throw Error(`Function ${fnName} not found in contract ABI.`);
17
19
  }
@@ -23,48 +25,66 @@ import { encodeArgs } from './encoding.js';
23
25
  * @param chainId - The chain ID of the L1 host.
24
26
  * @param privateKey - The private key to be used in contract deployment.
25
27
  * @param mnemonic - The mnemonic to be used in contract deployment.
26
- */ export async function deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, genesisBlockHash, acceleratedTestDeployments, config, debugLogger) {
28
+ */ export async function deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, feeJuicePortalInitialBalance, acceleratedTestDeployments, config, existingToken, realVerifier, createVerificationJson, debugLogger) {
27
29
  const { createEthereumChain, deployL1Contracts } = await import('@aztec/ethereum');
28
30
  const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
29
31
  const account = !privateKey ? mnemonicToAccount(mnemonic, {
30
32
  addressIndex: mnemonicIndex
31
- }) : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}`);
33
+ }) : privateKeyToAccount(addLeadingHex(privateKey));
32
34
  const chain = createEthereumChain(rpcUrls, chainId);
33
35
  const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
34
- return await deployL1Contracts(chain.rpcUrls, account, chain.chainInfo, debugLogger, {
35
- l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
36
+ const result = await deployL1Contracts(chain.rpcUrls, account, chain.chainInfo, debugLogger, {
36
37
  vkTreeRoot: getVKTreeRoot(),
37
38
  protocolContractTreeRoot,
38
39
  genesisArchiveRoot,
39
- genesisBlockHash,
40
40
  salt,
41
41
  initialValidators,
42
42
  acceleratedTestDeployments,
43
+ feeJuicePortalInitialBalance,
44
+ realVerifier,
45
+ existingTokenAddress: existingToken,
43
46
  ...config
44
- }, config);
47
+ }, config, createVerificationJson);
48
+ return result;
45
49
  }
46
- export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, genesisBlockHash, config, logger) {
47
- const { createEthereumChain, deployRollupAndPeriphery, createL1Clients } = await import('@aztec/ethereum');
50
+ export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, feeJuicePortalInitialBalance, config, realVerifier, createVerificationJson, logger) {
51
+ const { createEthereumChain, deployRollupForUpgrade, createExtendedL1Client } = await import('@aztec/ethereum');
48
52
  const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
49
53
  const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
50
54
  const account = !privateKey ? mnemonicToAccount(mnemonic, {
51
55
  addressIndex: mnemonicIndex
52
- }) : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}`);
56
+ }) : privateKeyToAccount(addLeadingHex(privateKey));
53
57
  const chain = createEthereumChain(rpcUrls, chainId);
54
- const clients = createL1Clients(rpcUrls, account, chain.chainInfo, mnemonicIndex);
55
- const { payloadAddress, rollup } = await deployRollupAndPeriphery(clients, {
58
+ const client = createExtendedL1Client(rpcUrls, account, chain.chainInfo, undefined, mnemonicIndex);
59
+ if (!initialValidators || initialValidators.length === 0) {
60
+ // initialize the new rollup with Amin's validator address.
61
+ const aminAddressString = '0x3b218d0F26d15B36C715cB06c949210a0d630637';
62
+ const amin = EthAddress.fromString(aminAddressString);
63
+ initialValidators = [
64
+ {
65
+ attester: amin,
66
+ withdrawer: amin,
67
+ // No secrets here. The actual keys are not currently used.
68
+ bn254SecretKey: new SecretValue(Fr.fromHexString(aminAddressString).toBigInt())
69
+ }
70
+ ];
71
+ logger.info('Initializing new rollup with old attesters', {
72
+ initialValidators
73
+ });
74
+ }
75
+ const { rollup, slashFactoryAddress } = await deployRollupForUpgrade(client, {
56
76
  salt,
57
77
  vkTreeRoot: getVKTreeRoot(),
58
78
  protocolContractTreeRoot,
59
- l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
60
79
  genesisArchiveRoot,
61
- genesisBlockHash,
62
80
  initialValidators,
81
+ feeJuicePortalInitialBalance,
82
+ realVerifier,
63
83
  ...config
64
- }, registryAddress, logger, config);
84
+ }, registryAddress, logger, config, createVerificationJson);
65
85
  return {
66
- payloadAddress,
67
- rollup
86
+ rollup,
87
+ slashFactoryAddress
68
88
  };
69
89
  }
70
90
  /**
@@ -116,7 +136,7 @@ export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId
116
136
  * @returns Formatted contract address, function arguments and caller's aztec address.
117
137
  */ export async function prepTx(contractFile, functionName, _functionArgs, log) {
118
138
  const contractArtifact = await getContractArtifact(contractFile, log);
119
- const functionArtifact = getFunctionArtifact(contractArtifact, functionName);
139
+ const functionArtifact = getFunctionAbi(contractArtifact, functionName);
120
140
  const functionArgs = encodeArgs(_functionArgs, functionArtifact.parameters);
121
141
  const isPrivate = functionArtifact.functionType === FunctionType.PRIVATE;
122
142
  return {
@@ -136,6 +156,16 @@ export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId
136
156
  return hex;
137
157
  };
138
158
  /**
159
+ * Adds a leading 0x to a hex string. If a leading 0x is already present the string is returned unchanged.
160
+ * @param hex - A hex string
161
+ * @returns A new string with leading 0x added
162
+ */ export const addLeadingHex = (hex)=>{
163
+ if (hex.length > 2 && hex.startsWith('0x')) {
164
+ return hex;
165
+ }
166
+ return `0x${hex}`;
167
+ };
168
+ /*
139
169
  * Pretty prints Nargo.toml contents to a string
140
170
  * @param config - Nargo.toml contents
141
171
  * @returns The Nargo.toml contents as a string
@@ -14,7 +14,7 @@ import { type Command, Option } from 'commander';
14
14
  */
15
15
  export declare const getLocalhost: () => Promise<string>;
16
16
  export declare const LOCALHOST: string;
17
- export declare const ETHEREUM_HOSTS: string, PRIVATE_KEY: string | undefined, API_KEY: string | undefined, CLI_VERSION: string | undefined;
17
+ export declare const ETHEREUM_HOSTS: string, PRIVATE_KEY: string | undefined, MNEMONIC: string | undefined, API_KEY: string | undefined, CLI_VERSION: string | undefined;
18
18
  export declare function addOptions(program: Command, options: Option[]): Command;
19
19
  export declare const makePxeOption: (mandatory: boolean) => Option;
20
20
  export declare const pxeOption: Option;
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/utils/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,E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U,GAAG,SAAS,CASxE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,EAAE,CAMvD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,EAAE,CAMpD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,EAAE,CAyB5C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAElD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAcjE"}
@@ -13,7 +13,7 @@ import { rename, writeFile } from 'fs/promises';
13
13
  * localhost as being host.docker.internal.
14
14
  */ export const getLocalhost = ()=>lookup('host.docker.internal').then(()=>'host.docker.internal').catch(()=>'localhost');
15
15
  export const LOCALHOST = await getLocalhost();
16
- export const { ETHEREUM_HOSTS = `http://${LOCALHOST}:8545`, PRIVATE_KEY, API_KEY, CLI_VERSION } = process.env;
16
+ export const { ETHEREUM_HOSTS = `http://${LOCALHOST}:8545`, PRIVATE_KEY, MNEMONIC, API_KEY, CLI_VERSION } = process.env;
17
17
  export function addOptions(program, options) {
18
18
  options.forEach((option)=>program.addOption(option));
19
19
  return program;
@@ -221,7 +221,7 @@ export function parseBigint(bigint) {
221
221
  }
222
222
  try {
223
223
  return PublicKeys.fromString(publicKey);
224
- } catch (err) {
224
+ } catch {
225
225
  throw new InvalidArgumentError(`Invalid public key: ${publicKey}`);
226
226
  }
227
227
  }
@@ -233,7 +233,7 @@ export function parseBigint(bigint) {
233
233
  */ export function parsePartialAddress(address) {
234
234
  try {
235
235
  return Fr.fromHexString(address);
236
- } catch (err) {
236
+ } catch {
237
237
  throw new InvalidArgumentError(`Invalid partial address: ${address}`);
238
238
  }
239
239
  }
@@ -245,7 +245,7 @@ export function parseBigint(bigint) {
245
245
  */ export function parseSecretKey(secretKey) {
246
246
  try {
247
247
  return Fr.fromHexString(secretKey);
248
- } catch (err) {
248
+ } catch {
249
249
  throw new InvalidArgumentError(`Invalid encryption secret key: ${secretKey}`);
250
250
  }
251
251
  }
@@ -275,7 +275,7 @@ export function parseBigint(bigint) {
275
275
  return new Fr(BigInt(field.replace(/n$/, '')));
276
276
  }
277
277
  return new Fr(BigInt(field));
278
- } catch (err) {
278
+ } catch {
279
279
  throw new InvalidArgumentError(`Invalid field: ${field}`);
280
280
  }
281
281
  }
@@ -29,7 +29,7 @@ import { Fr } from '@aztec/foundation/fields';
29
29
  let res;
30
30
  try {
31
31
  res = BigInt(arg);
32
- } catch (err) {
32
+ } catch {
33
33
  throw new Error(`Invalid value passed for ${name}. Could not parse ${arg} as a${kind === 'integer' ? 'n' : ''} ${kind}.`);
34
34
  }
35
35
  return res;
@@ -1,4 +1,3 @@
1
1
  export declare const GITHUB_OWNER = "AztecProtocol";
2
2
  export declare const GITHUB_REPO = "aztec-packages";
3
- export declare const GITHUB_TAG_PREFIX = "aztec-packages";
4
3
  //# sourceMappingURL=github.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/utils/github.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,kBAAkB,CAAC;AAC5C,eAAO,MAAM,WAAW,mBAAmB,CAAC;AAC5C,eAAO,MAAM,iBAAiB,mBAAmB,CAAC"}
1
+ {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/utils/github.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,kBAAkB,CAAC;AAC5C,eAAO,MAAM,WAAW,mBAAmB,CAAC"}
@@ -1,3 +1,2 @@
1
1
  export const GITHUB_OWNER = 'AztecProtocol';
2
2
  export const GITHUB_REPO = 'aztec-packages';
3
- export const GITHUB_TAG_PREFIX = 'aztec-packages';
@@ -2,4 +2,5 @@ export * from './commands.js';
2
2
  export * from './aztec.js';
3
3
  export * from './encoding.js';
4
4
  export * from './github.js';
5
+ export * from './setup_contracts.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC"}
@@ -2,3 +2,4 @@ export * from './commands.js';
2
2
  export * from './aztec.js';
3
3
  export * from './encoding.js';
4
4
  export * from './github.js';
5
+ export * from './setup_contracts.js';
@@ -1 +1 @@
1
- {"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/utils/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,gBAAgB,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,wBAAsB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,iBA0B7G;AAED,wBAAsB,SAAS,CAC7B,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,KAAK,EACV,IAAI,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,WAAW,CAAA;CAAO,iBAmGrE;AAyCD,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;AAC/D,KAAK,2BAA2B,GAAG,gBAAgB,GAAG;IAAE,OAAO,EAAE,EAAE,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/utils/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,gBAAgB,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,wBAAsB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,iBA0B7G;AAED,wBAAsB,SAAS,CAC7B,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,KAAK,EACV,IAAI,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,WAAW,CAAA;CAAO,iBA8FrE;AAuCD,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;AAC/D,KAAK,2BAA2B,GAAG,gBAAgB,GAAG;IAAE,OAAO,EAAE,EAAE,CAAA;CAAE,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
2
2
  import { siloNullifier } from '@aztec/stdlib/hash';
3
- import { NoteStatus } from '@aztec/stdlib/note';
4
3
  export async function inspectBlock(pxe, blockNumber, log, opts = {}) {
5
4
  const block = await pxe.getBlock(blockNumber);
6
5
  if (!block) {
@@ -11,10 +10,10 @@ export async function inspectBlock(pxe, blockNumber, log, opts = {}) {
11
10
  log(`Block ${blockNumber} (${blockHash.toString()})`);
12
11
  log(` Total fees: ${block.header.totalFees.toBigInt()}`);
13
12
  log(` Total mana used: ${block.header.totalManaUsed.toBigInt()}`);
14
- log(` Fee per gas unit: DA=${block.header.globalVariables.gasFees.feePerDaGas.toBigInt()} L2=${block.header.globalVariables.gasFees.feePerL2Gas.toBigInt()}`);
13
+ log(` Fee per gas unit: DA=${block.header.globalVariables.gasFees.feePerDaGas} L2=${block.header.globalVariables.gasFees.feePerL2Gas}`);
15
14
  log(` Coinbase: ${block.header.globalVariables.coinbase}`);
16
15
  log(` Fee recipient: ${block.header.globalVariables.feeRecipient}`);
17
- log(` Timestamp: ${new Date(block.header.globalVariables.timestamp.toNumber() * 500)}`);
16
+ log(` Timestamp: ${new Date(Number(block.header.globalVariables.timestamp) * 500)}`);
18
17
  if (opts.showTxs) {
19
18
  log(``);
20
19
  const artifactMap = await getKnownArtifacts(pxe);
@@ -29,13 +28,9 @@ export async function inspectBlock(pxe, blockNumber, log, opts = {}) {
29
28
  }
30
29
  }
31
30
  export async function inspectTx(pxe, txHash, log, opts = {}) {
32
- const [receipt, effectsInBlock, getNotes] = await Promise.all([
31
+ const [receipt, effectsInBlock] = await Promise.all([
33
32
  pxe.getTxReceipt(txHash),
34
- pxe.getTxEffect(txHash),
35
- pxe.getNotes({
36
- txHash,
37
- status: NoteStatus.ACTIVE_OR_NULLIFIED
38
- })
33
+ pxe.getTxEffect(txHash)
39
34
  ]);
40
35
  // Base tx data
41
36
  log(`Tx ${txHash.toString()}`);
@@ -74,12 +69,9 @@ export async function inspectTx(pxe, txHash, log, opts = {}) {
74
69
  const notes = effects.noteHashes;
75
70
  if (notes.length > 0) {
76
71
  log(' Created notes:');
77
- log(` Total: ${notes.length}. Found: ${getNotes.length}.`);
78
- if (getNotes.length) {
79
- log(' Found notes:');
80
- for (const note of getNotes){
81
- inspectNote(note, artifactMap, log);
82
- }
72
+ log(` Total: ${notes.length}`);
73
+ for (const note of notes){
74
+ log(` Note hash: ${note.toShortString()}`);
83
75
  }
84
76
  }
85
77
  // Nullifiers
@@ -88,10 +80,11 @@ export async function inspectTx(pxe, txHash, log, opts = {}) {
88
80
  if (nullifierCount > 0) {
89
81
  log(' Nullifiers:');
90
82
  for (const nullifier of effects.nullifiers){
91
- const [note] = await pxe.getNotes({
92
- siloedNullifier: nullifier
93
- });
94
83
  const deployed = deployNullifiers[nullifier.toString()];
84
+ const note = deployed ? (await pxe.getNotes({
85
+ siloedNullifier: nullifier,
86
+ contractAddress: deployed
87
+ }))[0] : undefined;
95
88
  const initialized = initNullifiers[nullifier.toString()];
96
89
  const registered = classNullifiers[nullifier.toString()];
97
90
  if (nullifier.toBuffer().equals(txHash.toBuffer())) {
@@ -120,9 +113,8 @@ export async function inspectTx(pxe, txHash, log, opts = {}) {
120
113
  function inspectNote(note, artifactMap, log, text = 'Note') {
121
114
  const artifact = artifactMap[note.contractAddress.toString()];
122
115
  const contract = artifact?.name ?? note.contractAddress.toString();
123
- const type = artifact?.notes[note.noteTypeId.toString()]?.typ ?? note.noteTypeId.toField().toShortString();
124
- log(` ${text} type ${type} at ${contract}`);
125
- log(` Owner: ${toFriendlyAddress(note.owner, artifactMap)}`);
116
+ log(` ${text} at ${contract}`);
117
+ log(` Recipient: ${toFriendlyAddress(note.recipient, artifactMap)}`);
126
118
  for (const field of note.note.items){
127
119
  log(` ${field.toString()}`);
128
120
  }
@@ -136,17 +128,17 @@ function toFriendlyAddress(address, artifactMap) {
136
128
  }
137
129
  async function getKnownNullifiers(pxe, artifactMap) {
138
130
  const knownContracts = await pxe.getContracts();
139
- const deployerAddress = ProtocolContractAddress.ContractInstanceDeployer;
140
- const registererAddress = ProtocolContractAddress.ContractClassRegisterer;
131
+ const deployerAddress = ProtocolContractAddress.ContractInstanceRegistry;
132
+ const classRegistryAddress = ProtocolContractAddress.ContractClassRegistry;
141
133
  const initNullifiers = {};
142
134
  const deployNullifiers = {};
143
135
  const classNullifiers = {};
144
136
  for (const contract of knownContracts){
145
- initNullifiers[siloNullifier(contract, contract.toField()).toString()] = contract;
146
- deployNullifiers[siloNullifier(deployerAddress, contract.toField()).toString()] = contract;
137
+ initNullifiers[(await siloNullifier(contract, contract.toField())).toString()] = contract;
138
+ deployNullifiers[(await siloNullifier(deployerAddress, contract.toField())).toString()] = contract;
147
139
  }
148
140
  for (const artifact of Object.values(artifactMap)){
149
- classNullifiers[siloNullifier(registererAddress, artifact.classId).toString()] = `${artifact.name}Class<${artifact.classId}>`;
141
+ classNullifiers[(await siloNullifier(classRegistryAddress, artifact.classId)).toString()] = `${artifact.name}Class<${artifact.classId}>`;
150
142
  }
151
143
  return {
152
144
  initNullifiers,
@@ -0,0 +1,5 @@
1
+ import { AztecAddress, type PXE, type WaitForProvenOpts } from '@aztec/aztec.js';
2
+ import type { LogFn } from '@aztec/foundation/log';
3
+ export declare function getSponsoredFPCAddress(): Promise<AztecAddress>;
4
+ export declare function setupSponsoredFPC(pxe: PXE, log: LogFn, waitOpts?: import("@aztec/aztec.js").WaitOpts, waitForProvenOptions?: WaitForProvenOpts): Promise<void>;
5
+ //# sourceMappingURL=setup_contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup_contracts.d.ts","sourceRoot":"","sources":["../../src/utils/setup_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGZ,KAAK,GAAG,EAGR,KAAK,iBAAiB,EAGvB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AASnD,wBAAsB,sBAAsB,0BAM3C;AAED,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,KAAK,EACV,QAAQ,qCAAkB,EAC1B,oBAAoB,CAAC,EAAE,iBAAiB,iBAuBzC"}