@aztec/cli 0.0.1-commit.5daedc8 → 0.0.1-commit.9593d84

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.
@@ -5,8 +5,7 @@ import { type NetworkConfig, type NetworkNames } from '@aztec/foundation/config'
5
5
  *
6
6
  * @param networkName - The network name to fetch config for
7
7
  * @param cacheDir - Optional cache directory for storing fetched config
8
- * @returns Remote configuration for the specified network, or undefined if network not found in config
9
- * @throws Error if both primary and fallback URLs fail to fetch
8
+ * @returns Remote configuration for the specified network, or undefined if not found/error
10
9
  */
11
10
  export declare function getNetworkConfig(networkName: NetworkNames, cacheDir?: string): Promise<NetworkConfig | undefined>;
12
11
  /**
@@ -15,8 +14,6 @@ export declare function getNetworkConfig(networkName: NetworkNames, cacheDir?: s
15
14
  * from the remote config, following the same pattern as enrichEnvironmentWithChainConfig().
16
15
  *
17
16
  * @param networkName - The network name to fetch remote config for
18
- * @throws Error if network config fetch fails (network errors, parse errors, etc.)
19
- * Does not throw if the network simply doesn't exist in the config - just returns without enriching
20
17
  */
21
18
  export declare function enrichEnvironmentWithNetworkConfig(networkName: NetworkNames): Promise<void>;
22
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmV0d29ya19jb25maWcuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25maWcvbmV0d29ya19jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssYUFBYSxFQUEwQixLQUFLLFlBQVksRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBYXpHOzs7Ozs7OztHQVFHO0FBQ0gsd0JBQXNCLGdCQUFnQixDQUNwQyxXQUFXLEVBQUUsWUFBWSxFQUN6QixRQUFRLENBQUMsRUFBRSxNQUFNLEdBQ2hCLE9BQU8sQ0FBQyxhQUFhLEdBQUcsU0FBUyxDQUFDLENBOEJwQztBQXVERDs7Ozs7Ozs7R0FRRztBQUNILHdCQUFzQixrQ0FBa0MsQ0FBQyxXQUFXLEVBQUUsWUFBWSxpQkFvQmpGIn0=
19
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmV0d29ya19jb25maWcuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25maWcvbmV0d29ya19jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssYUFBYSxFQUEwQixLQUFLLFlBQVksRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBYXpHOzs7Ozs7O0dBT0c7QUFDSCx3QkFBc0IsZ0JBQWdCLENBQ3BDLFdBQVcsRUFBRSxZQUFZLEVBQ3pCLFFBQVEsQ0FBQyxFQUFFLE1BQU0sR0FDaEIsT0FBTyxDQUFDLGFBQWEsR0FBRyxTQUFTLENBQUMsQ0FhcEM7QUEwREQ7Ozs7OztHQU1HO0FBQ0gsd0JBQXNCLGtDQUFrQyxDQUFDLFdBQVcsRUFBRSxZQUFZLGlCQW9CakYifQ==
@@ -1 +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;AAazG;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,YAAY,EACzB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CA8BpC;AAuDD;;;;;;;;GAQG;AACH,wBAAsB,kCAAkC,CAAC,WAAW,EAAE,YAAY,iBAoBjF"}
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;AAazG;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,YAAY,EACzB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAapC;AA0DD;;;;;;GAMG;AACH,wBAAsB,kCAAkC,CAAC,WAAW,EAAE,YAAY,iBAoBjF"}
@@ -12,32 +12,15 @@ const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
12
12
  *
13
13
  * @param networkName - The network name to fetch config for
14
14
  * @param cacheDir - Optional cache directory for storing fetched config
15
- * @returns Remote configuration for the specified network, or undefined if network not found in config
16
- * @throws Error if both primary and fallback URLs fail to fetch
15
+ * @returns Remote configuration for the specified network, or undefined if not found/error
17
16
  */ export async function getNetworkConfig(networkName, cacheDir) {
18
17
  // Try with the primary URL (env var or default)
19
18
  const configLocation = process.env.NETWORK_CONFIG_LOCATION || DEFAULT_CONFIG_URL;
20
- let primaryError;
21
- let config;
22
19
  // First try the primary config location
23
- try {
24
- config = await fetchNetworkConfigFromUrl(configLocation, networkName, cacheDir);
25
- } catch (error) {
26
- primaryError = error;
27
- }
20
+ let config = await fetchNetworkConfigFromUrl(configLocation, networkName, cacheDir);
28
21
  // If primary fails and we were using the default URL, try the fallback
29
22
  if (!config && configLocation === DEFAULT_CONFIG_URL) {
30
- try {
31
- config = await fetchNetworkConfigFromUrl(FALLBACK_CONFIG_URL, networkName, cacheDir);
32
- } catch {
33
- // Both failed - throw the primary error
34
- if (primaryError) {
35
- throw primaryError;
36
- }
37
- }
38
- } else if (primaryError) {
39
- // Primary failed and no fallback to try
40
- throw primaryError;
23
+ config = await fetchNetworkConfigFromUrl(FALLBACK_CONFIG_URL, networkName, cacheDir);
41
24
  }
42
25
  return config;
43
26
  }
@@ -46,8 +29,7 @@ const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
46
29
  * @param configLocation - The URL or file path to fetch from
47
30
  * @param networkName - The network name to fetch config for
48
31
  * @param cacheDir - Optional cache directory for storing fetched config
49
- * @returns Remote configuration for the specified network, or undefined if network not found in config, or undefined if URL invalid
50
- * @throws Error if fetch/parse fails
32
+ * @returns Remote configuration for the specified network, or undefined if not found/error
51
33
  */ async function fetchNetworkConfigFromUrl(configLocation, networkName, cacheDir) {
52
34
  let url;
53
35
  try {
@@ -61,24 +43,28 @@ const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
61
43
  if (!url) {
62
44
  return undefined;
63
45
  }
64
- let rawConfig;
65
- if (url.protocol === 'http:' || url.protocol === 'https:') {
66
- rawConfig = await cachedFetch(url.href, {
67
- cacheDurationMs: NETWORK_CONFIG_CACHE_DURATION_MS,
68
- cacheFile: cacheDir ? join(cacheDir, networkName, 'network_config.json') : undefined
69
- });
70
- } else if (url.protocol === 'file:') {
71
- rawConfig = JSON.parse(await readFile(url.pathname, 'utf-8'));
72
- } else {
73
- throw new Error('Unsupported Aztec network config protocol: ' + url.href);
74
- }
75
- if (!rawConfig) {
76
- return undefined;
77
- }
78
- const networkConfigMap = NetworkConfigMapSchema.parse(rawConfig);
79
- if (networkName in networkConfigMap) {
80
- return networkConfigMap[networkName];
81
- } else {
46
+ try {
47
+ let rawConfig;
48
+ if (url.protocol === 'http:' || url.protocol === 'https:') {
49
+ rawConfig = await cachedFetch(url.href, {
50
+ cacheDurationMs: NETWORK_CONFIG_CACHE_DURATION_MS,
51
+ cacheFile: cacheDir ? join(cacheDir, networkName, 'network_config.json') : undefined
52
+ });
53
+ } else if (url.protocol === 'file:') {
54
+ rawConfig = JSON.parse(await readFile(url.pathname, 'utf-8'));
55
+ } else {
56
+ throw new Error('Unsupported Aztec network config protocol: ' + url.href);
57
+ }
58
+ if (!rawConfig) {
59
+ return undefined;
60
+ }
61
+ const networkConfigMap = NetworkConfigMapSchema.parse(rawConfig);
62
+ if (networkName in networkConfigMap) {
63
+ return networkConfigMap[networkName];
64
+ } else {
65
+ return undefined;
66
+ }
67
+ } catch {
82
68
  return undefined;
83
69
  }
84
70
  }
@@ -88,8 +74,6 @@ const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
88
74
  * from the remote config, following the same pattern as enrichEnvironmentWithChainConfig().
89
75
  *
90
76
  * @param networkName - The network name to fetch remote config for
91
- * @throws Error if network config fetch fails (network errors, parse errors, etc.)
92
- * Does not throw if the network simply doesn't exist in the config - just returns without enriching
93
77
  */ export async function enrichEnvironmentWithNetworkConfig(networkName) {
94
78
  if (networkName === 'local') {
95
79
  return; // No remote config for local development
@@ -97,7 +81,7 @@ const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
97
81
  const cacheDir = process.env.DATA_DIRECTORY ? join(process.env.DATA_DIRECTORY, 'cache') : undefined;
98
82
  const networkConfig = await getNetworkConfig(networkName, cacheDir);
99
83
  if (!networkConfig) {
100
- return; // Network not found in config, continue without enriching
84
+ throw new Error(`Failed to fetch network config for network: ${networkName}`);
101
85
  }
102
86
  enrichVar('BOOTSTRAP_NODES', networkConfig.bootnodes.join(','));
103
87
  enrichVar('L1_CHAIN_ID', String(networkConfig.l1ChainId));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/cli",
3
- "version": "0.0.1-commit.5daedc8",
3
+ "version": "0.0.1-commit.9593d84",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./contracts": "./dest/cmds/contracts/index.js",
@@ -71,21 +71,21 @@
71
71
  ]
72
72
  },
73
73
  "dependencies": {
74
- "@aztec/accounts": "0.0.1-commit.5daedc8",
75
- "@aztec/archiver": "0.0.1-commit.5daedc8",
76
- "@aztec/aztec.js": "0.0.1-commit.5daedc8",
77
- "@aztec/constants": "0.0.1-commit.5daedc8",
78
- "@aztec/entrypoints": "0.0.1-commit.5daedc8",
79
- "@aztec/ethereum": "0.0.1-commit.5daedc8",
80
- "@aztec/foundation": "0.0.1-commit.5daedc8",
81
- "@aztec/l1-artifacts": "0.0.1-commit.5daedc8",
82
- "@aztec/node-keystore": "0.0.1-commit.5daedc8",
83
- "@aztec/node-lib": "0.0.1-commit.5daedc8",
84
- "@aztec/p2p": "0.0.1-commit.5daedc8",
85
- "@aztec/protocol-contracts": "0.0.1-commit.5daedc8",
86
- "@aztec/stdlib": "0.0.1-commit.5daedc8",
87
- "@aztec/test-wallet": "0.0.1-commit.5daedc8",
88
- "@aztec/world-state": "0.0.1-commit.5daedc8",
74
+ "@aztec/accounts": "0.0.1-commit.9593d84",
75
+ "@aztec/archiver": "0.0.1-commit.9593d84",
76
+ "@aztec/aztec.js": "0.0.1-commit.9593d84",
77
+ "@aztec/constants": "0.0.1-commit.9593d84",
78
+ "@aztec/entrypoints": "0.0.1-commit.9593d84",
79
+ "@aztec/ethereum": "0.0.1-commit.9593d84",
80
+ "@aztec/foundation": "0.0.1-commit.9593d84",
81
+ "@aztec/l1-artifacts": "0.0.1-commit.9593d84",
82
+ "@aztec/node-keystore": "0.0.1-commit.9593d84",
83
+ "@aztec/node-lib": "0.0.1-commit.9593d84",
84
+ "@aztec/p2p": "0.0.1-commit.9593d84",
85
+ "@aztec/protocol-contracts": "0.0.1-commit.9593d84",
86
+ "@aztec/stdlib": "0.0.1-commit.9593d84",
87
+ "@aztec/test-wallet": "0.0.1-commit.9593d84",
88
+ "@aztec/world-state": "0.0.1-commit.9593d84",
89
89
  "@ethersproject/wallet": "^5.8.0",
90
90
  "@iarna/toml": "^2.2.5",
91
91
  "@libp2p/peer-id-factory": "^3.0.4",
@@ -99,9 +99,9 @@
99
99
  "viem": "npm:@aztec/viem@2.38.2"
100
100
  },
101
101
  "devDependencies": {
102
- "@aztec/aztec-node": "0.0.1-commit.5daedc8",
103
- "@aztec/kv-store": "0.0.1-commit.5daedc8",
104
- "@aztec/telemetry-client": "0.0.1-commit.5daedc8",
102
+ "@aztec/aztec-node": "0.0.1-commit.9593d84",
103
+ "@aztec/kv-store": "0.0.1-commit.9593d84",
104
+ "@aztec/telemetry-client": "0.0.1-commit.9593d84",
105
105
  "@jest/globals": "^30.0.0",
106
106
  "@types/jest": "^30.0.0",
107
107
  "@types/lodash.chunk": "^4.2.9",
@@ -118,15 +118,15 @@
118
118
  "typescript": "^5.3.3"
119
119
  },
120
120
  "peerDependencies": {
121
- "@aztec/accounts": "0.0.1-commit.5daedc8",
122
- "@aztec/bb-prover": "0.0.1-commit.5daedc8",
123
- "@aztec/ethereum": "0.0.1-commit.5daedc8",
124
- "@aztec/l1-artifacts": "0.0.1-commit.5daedc8",
125
- "@aztec/noir-contracts.js": "0.0.1-commit.5daedc8",
126
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.5daedc8",
127
- "@aztec/noir-test-contracts.js": "0.0.1-commit.5daedc8",
128
- "@aztec/protocol-contracts": "0.0.1-commit.5daedc8",
129
- "@aztec/stdlib": "0.0.1-commit.5daedc8"
121
+ "@aztec/accounts": "0.0.1-commit.9593d84",
122
+ "@aztec/bb-prover": "0.0.1-commit.9593d84",
123
+ "@aztec/ethereum": "0.0.1-commit.9593d84",
124
+ "@aztec/l1-artifacts": "0.0.1-commit.9593d84",
125
+ "@aztec/noir-contracts.js": "0.0.1-commit.9593d84",
126
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.9593d84",
127
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.9593d84",
128
+ "@aztec/protocol-contracts": "0.0.1-commit.9593d84",
129
+ "@aztec/stdlib": "0.0.1-commit.9593d84"
130
130
  },
131
131
  "files": [
132
132
  "dest",
@@ -17,8 +17,7 @@ const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
17
17
  *
18
18
  * @param networkName - The network name to fetch config for
19
19
  * @param cacheDir - Optional cache directory for storing fetched config
20
- * @returns Remote configuration for the specified network, or undefined if network not found in config
21
- * @throws Error if both primary and fallback URLs fail to fetch
20
+ * @returns Remote configuration for the specified network, or undefined if not found/error
22
21
  */
23
22
  export async function getNetworkConfig(
24
23
  networkName: NetworkNames,
@@ -27,29 +26,12 @@ export async function getNetworkConfig(
27
26
  // Try with the primary URL (env var or default)
28
27
  const configLocation = process.env.NETWORK_CONFIG_LOCATION || DEFAULT_CONFIG_URL;
29
28
 
30
- let primaryError: Error | undefined;
31
- let config: NetworkConfig | undefined;
32
-
33
29
  // First try the primary config location
34
- try {
35
- config = await fetchNetworkConfigFromUrl(configLocation, networkName, cacheDir);
36
- } catch (error) {
37
- primaryError = error as Error;
38
- }
30
+ let config = await fetchNetworkConfigFromUrl(configLocation, networkName, cacheDir);
39
31
 
40
32
  // If primary fails and we were using the default URL, try the fallback
41
33
  if (!config && configLocation === DEFAULT_CONFIG_URL) {
42
- try {
43
- config = await fetchNetworkConfigFromUrl(FALLBACK_CONFIG_URL, networkName, cacheDir);
44
- } catch {
45
- // Both failed - throw the primary error
46
- if (primaryError) {
47
- throw primaryError;
48
- }
49
- }
50
- } else if (primaryError) {
51
- // Primary failed and no fallback to try
52
- throw primaryError;
34
+ config = await fetchNetworkConfigFromUrl(FALLBACK_CONFIG_URL, networkName, cacheDir);
53
35
  }
54
36
 
55
37
  return config;
@@ -60,8 +42,7 @@ export async function getNetworkConfig(
60
42
  * @param configLocation - The URL or file path to fetch from
61
43
  * @param networkName - The network name to fetch config for
62
44
  * @param cacheDir - Optional cache directory for storing fetched config
63
- * @returns Remote configuration for the specified network, or undefined if network not found in config, or undefined if URL invalid
64
- * @throws Error if fetch/parse fails
45
+ * @returns Remote configuration for the specified network, or undefined if not found/error
65
46
  */
66
47
  async function fetchNetworkConfigFromUrl(
67
48
  configLocation: string,
@@ -83,27 +64,31 @@ async function fetchNetworkConfigFromUrl(
83
64
  return undefined;
84
65
  }
85
66
 
86
- let rawConfig: any;
87
-
88
- if (url.protocol === 'http:' || url.protocol === 'https:') {
89
- rawConfig = await cachedFetch(url.href, {
90
- cacheDurationMs: NETWORK_CONFIG_CACHE_DURATION_MS,
91
- cacheFile: cacheDir ? join(cacheDir, networkName, 'network_config.json') : undefined,
92
- });
93
- } else if (url.protocol === 'file:') {
94
- rawConfig = JSON.parse(await readFile(url.pathname, 'utf-8'));
95
- } else {
96
- throw new Error('Unsupported Aztec network config protocol: ' + url.href);
97
- }
67
+ try {
68
+ let rawConfig: any;
69
+
70
+ if (url.protocol === 'http:' || url.protocol === 'https:') {
71
+ rawConfig = await cachedFetch(url.href, {
72
+ cacheDurationMs: NETWORK_CONFIG_CACHE_DURATION_MS,
73
+ cacheFile: cacheDir ? join(cacheDir, networkName, 'network_config.json') : undefined,
74
+ });
75
+ } else if (url.protocol === 'file:') {
76
+ rawConfig = JSON.parse(await readFile(url.pathname, 'utf-8'));
77
+ } else {
78
+ throw new Error('Unsupported Aztec network config protocol: ' + url.href);
79
+ }
98
80
 
99
- if (!rawConfig) {
100
- return undefined;
101
- }
81
+ if (!rawConfig) {
82
+ return undefined;
83
+ }
102
84
 
103
- const networkConfigMap = NetworkConfigMapSchema.parse(rawConfig);
104
- if (networkName in networkConfigMap) {
105
- return networkConfigMap[networkName];
106
- } else {
85
+ const networkConfigMap = NetworkConfigMapSchema.parse(rawConfig);
86
+ if (networkName in networkConfigMap) {
87
+ return networkConfigMap[networkName];
88
+ } else {
89
+ return undefined;
90
+ }
91
+ } catch {
107
92
  return undefined;
108
93
  }
109
94
  }
@@ -114,8 +99,6 @@ async function fetchNetworkConfigFromUrl(
114
99
  * from the remote config, following the same pattern as enrichEnvironmentWithChainConfig().
115
100
  *
116
101
  * @param networkName - The network name to fetch remote config for
117
- * @throws Error if network config fetch fails (network errors, parse errors, etc.)
118
- * Does not throw if the network simply doesn't exist in the config - just returns without enriching
119
102
  */
120
103
  export async function enrichEnvironmentWithNetworkConfig(networkName: NetworkNames) {
121
104
  if (networkName === 'local') {
@@ -126,7 +109,7 @@ export async function enrichEnvironmentWithNetworkConfig(networkName: NetworkNam
126
109
  const networkConfig = await getNetworkConfig(networkName, cacheDir);
127
110
 
128
111
  if (!networkConfig) {
129
- return; // Network not found in config, continue without enriching
112
+ throw new Error(`Failed to fetch network config for network: ${networkName}`);
130
113
  }
131
114
 
132
115
  enrichVar('BOOTSTRAP_NODES', networkConfig.bootnodes.join(','));