@aztec/cli 3.0.0-nightly.20251128 → 3.0.0-nightly.20251202
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,7 +5,8 @@ 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 not found
|
|
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
|
|
9
10
|
*/
|
|
10
11
|
export declare function getNetworkConfig(networkName: NetworkNames, cacheDir?: string): Promise<NetworkConfig | undefined>;
|
|
11
12
|
/**
|
|
@@ -14,6 +15,8 @@ export declare function getNetworkConfig(networkName: NetworkNames, cacheDir?: s
|
|
|
14
15
|
* from the remote config, following the same pattern as enrichEnvironmentWithChainConfig().
|
|
15
16
|
*
|
|
16
17
|
* @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
|
|
17
20
|
*/
|
|
18
21
|
export declare function enrichEnvironmentWithNetworkConfig(networkName: NetworkNames): Promise<void>;
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmV0d29ya19jb25maWcuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25maWcvbmV0d29ya19jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssYUFBYSxFQUEwQixLQUFLLFlBQVksRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBYXpHOzs7Ozs7OztHQVFHO0FBQ0gsd0JBQXNCLGdCQUFnQixDQUNwQyxXQUFXLEVBQUUsWUFBWSxFQUN6QixRQUFRLENBQUMsRUFBRSxNQUFNLEdBQ2hCLE9BQU8sQ0FBQyxhQUFhLEdBQUcsU0FBUyxDQUFDLENBOEJwQztBQXVERDs7Ozs7Ozs7R0FRRztBQUNILHdCQUFzQixrQ0FBa0MsQ0FBQyxXQUFXLEVBQUUsWUFBWSxpQkFvQmpGIn0=
|
|
@@ -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
|
|
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"}
|
|
@@ -12,15 +12,32 @@ 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 not found
|
|
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
|
|
16
17
|
*/ export async function getNetworkConfig(networkName, cacheDir) {
|
|
17
18
|
// Try with the primary URL (env var or default)
|
|
18
19
|
const configLocation = process.env.NETWORK_CONFIG_LOCATION || DEFAULT_CONFIG_URL;
|
|
20
|
+
let primaryError;
|
|
21
|
+
let config;
|
|
19
22
|
// First try the primary config location
|
|
20
|
-
|
|
23
|
+
try {
|
|
24
|
+
config = await fetchNetworkConfigFromUrl(configLocation, networkName, cacheDir);
|
|
25
|
+
} catch (error) {
|
|
26
|
+
primaryError = error;
|
|
27
|
+
}
|
|
21
28
|
// If primary fails and we were using the default URL, try the fallback
|
|
22
29
|
if (!config && configLocation === DEFAULT_CONFIG_URL) {
|
|
23
|
-
|
|
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;
|
|
24
41
|
}
|
|
25
42
|
return config;
|
|
26
43
|
}
|
|
@@ -29,7 +46,8 @@ const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
|
|
|
29
46
|
* @param configLocation - The URL or file path to fetch from
|
|
30
47
|
* @param networkName - The network name to fetch config for
|
|
31
48
|
* @param cacheDir - Optional cache directory for storing fetched config
|
|
32
|
-
* @returns Remote configuration for the specified network, or undefined if not found
|
|
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
|
|
33
51
|
*/ async function fetchNetworkConfigFromUrl(configLocation, networkName, cacheDir) {
|
|
34
52
|
let url;
|
|
35
53
|
try {
|
|
@@ -43,28 +61,24 @@ const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
|
|
|
43
61
|
if (!url) {
|
|
44
62
|
return undefined;
|
|
45
63
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} else {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
} catch {
|
|
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 {
|
|
68
82
|
return undefined;
|
|
69
83
|
}
|
|
70
84
|
}
|
|
@@ -74,6 +88,8 @@ const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
|
|
|
74
88
|
* from the remote config, following the same pattern as enrichEnvironmentWithChainConfig().
|
|
75
89
|
*
|
|
76
90
|
* @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
|
|
77
93
|
*/ export async function enrichEnvironmentWithNetworkConfig(networkName) {
|
|
78
94
|
if (networkName === 'local') {
|
|
79
95
|
return; // No remote config for local development
|
|
@@ -81,7 +97,7 @@ const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
|
|
|
81
97
|
const cacheDir = process.env.DATA_DIRECTORY ? join(process.env.DATA_DIRECTORY, 'cache') : undefined;
|
|
82
98
|
const networkConfig = await getNetworkConfig(networkName, cacheDir);
|
|
83
99
|
if (!networkConfig) {
|
|
84
|
-
|
|
100
|
+
return; // Network not found in config, continue without enriching
|
|
85
101
|
}
|
|
86
102
|
enrichVar('BOOTSTRAP_NODES', networkConfig.bootnodes.join(','));
|
|
87
103
|
enrichVar('L1_CHAIN_ID', String(networkConfig.l1ChainId));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251202",
|
|
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": "3.0.0-nightly.
|
|
75
|
-
"@aztec/archiver": "3.0.0-nightly.
|
|
76
|
-
"@aztec/aztec.js": "3.0.0-nightly.
|
|
77
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
78
|
-
"@aztec/entrypoints": "3.0.0-nightly.
|
|
79
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
80
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
81
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
82
|
-
"@aztec/node-keystore": "3.0.0-nightly.
|
|
83
|
-
"@aztec/node-lib": "3.0.0-nightly.
|
|
84
|
-
"@aztec/p2p": "3.0.0-nightly.
|
|
85
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
86
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
87
|
-
"@aztec/test-wallet": "3.0.0-nightly.
|
|
88
|
-
"@aztec/world-state": "3.0.0-nightly.
|
|
74
|
+
"@aztec/accounts": "3.0.0-nightly.20251202",
|
|
75
|
+
"@aztec/archiver": "3.0.0-nightly.20251202",
|
|
76
|
+
"@aztec/aztec.js": "3.0.0-nightly.20251202",
|
|
77
|
+
"@aztec/constants": "3.0.0-nightly.20251202",
|
|
78
|
+
"@aztec/entrypoints": "3.0.0-nightly.20251202",
|
|
79
|
+
"@aztec/ethereum": "3.0.0-nightly.20251202",
|
|
80
|
+
"@aztec/foundation": "3.0.0-nightly.20251202",
|
|
81
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20251202",
|
|
82
|
+
"@aztec/node-keystore": "3.0.0-nightly.20251202",
|
|
83
|
+
"@aztec/node-lib": "3.0.0-nightly.20251202",
|
|
84
|
+
"@aztec/p2p": "3.0.0-nightly.20251202",
|
|
85
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20251202",
|
|
86
|
+
"@aztec/stdlib": "3.0.0-nightly.20251202",
|
|
87
|
+
"@aztec/test-wallet": "3.0.0-nightly.20251202",
|
|
88
|
+
"@aztec/world-state": "3.0.0-nightly.20251202",
|
|
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": "3.0.0-nightly.
|
|
103
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
104
|
-
"@aztec/telemetry-client": "3.0.0-nightly.
|
|
102
|
+
"@aztec/aztec-node": "3.0.0-nightly.20251202",
|
|
103
|
+
"@aztec/kv-store": "3.0.0-nightly.20251202",
|
|
104
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20251202",
|
|
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": "3.0.0-nightly.
|
|
122
|
-
"@aztec/bb-prover": "3.0.0-nightly.
|
|
123
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
124
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
125
|
-
"@aztec/noir-contracts.js": "3.0.0-nightly.
|
|
126
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
127
|
-
"@aztec/noir-test-contracts.js": "3.0.0-nightly.
|
|
128
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
129
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
121
|
+
"@aztec/accounts": "3.0.0-nightly.20251202",
|
|
122
|
+
"@aztec/bb-prover": "3.0.0-nightly.20251202",
|
|
123
|
+
"@aztec/ethereum": "3.0.0-nightly.20251202",
|
|
124
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20251202",
|
|
125
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20251202",
|
|
126
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20251202",
|
|
127
|
+
"@aztec/noir-test-contracts.js": "3.0.0-nightly.20251202",
|
|
128
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20251202",
|
|
129
|
+
"@aztec/stdlib": "3.0.0-nightly.20251202"
|
|
130
130
|
},
|
|
131
131
|
"files": [
|
|
132
132
|
"dest",
|
|
@@ -17,7 +17,8 @@ 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 not found
|
|
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
|
|
21
22
|
*/
|
|
22
23
|
export async function getNetworkConfig(
|
|
23
24
|
networkName: NetworkNames,
|
|
@@ -26,12 +27,29 @@ export async function getNetworkConfig(
|
|
|
26
27
|
// Try with the primary URL (env var or default)
|
|
27
28
|
const configLocation = process.env.NETWORK_CONFIG_LOCATION || DEFAULT_CONFIG_URL;
|
|
28
29
|
|
|
30
|
+
let primaryError: Error | undefined;
|
|
31
|
+
let config: NetworkConfig | undefined;
|
|
32
|
+
|
|
29
33
|
// First try the primary config location
|
|
30
|
-
|
|
34
|
+
try {
|
|
35
|
+
config = await fetchNetworkConfigFromUrl(configLocation, networkName, cacheDir);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
primaryError = error as Error;
|
|
38
|
+
}
|
|
31
39
|
|
|
32
40
|
// If primary fails and we were using the default URL, try the fallback
|
|
33
41
|
if (!config && configLocation === DEFAULT_CONFIG_URL) {
|
|
34
|
-
|
|
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;
|
|
35
53
|
}
|
|
36
54
|
|
|
37
55
|
return config;
|
|
@@ -42,7 +60,8 @@ export async function getNetworkConfig(
|
|
|
42
60
|
* @param configLocation - The URL or file path to fetch from
|
|
43
61
|
* @param networkName - The network name to fetch config for
|
|
44
62
|
* @param cacheDir - Optional cache directory for storing fetched config
|
|
45
|
-
* @returns Remote configuration for the specified network, or undefined if not found
|
|
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
|
|
46
65
|
*/
|
|
47
66
|
async function fetchNetworkConfigFromUrl(
|
|
48
67
|
configLocation: string,
|
|
@@ -64,31 +83,27 @@ async function fetchNetworkConfigFromUrl(
|
|
|
64
83
|
return undefined;
|
|
65
84
|
}
|
|
66
85
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
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
|
+
}
|
|
80
98
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
99
|
+
if (!rawConfig) {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
84
102
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return undefined;
|
|
90
|
-
}
|
|
91
|
-
} catch {
|
|
103
|
+
const networkConfigMap = NetworkConfigMapSchema.parse(rawConfig);
|
|
104
|
+
if (networkName in networkConfigMap) {
|
|
105
|
+
return networkConfigMap[networkName];
|
|
106
|
+
} else {
|
|
92
107
|
return undefined;
|
|
93
108
|
}
|
|
94
109
|
}
|
|
@@ -99,6 +114,8 @@ async function fetchNetworkConfigFromUrl(
|
|
|
99
114
|
* from the remote config, following the same pattern as enrichEnvironmentWithChainConfig().
|
|
100
115
|
*
|
|
101
116
|
* @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
|
|
102
119
|
*/
|
|
103
120
|
export async function enrichEnvironmentWithNetworkConfig(networkName: NetworkNames) {
|
|
104
121
|
if (networkName === 'local') {
|
|
@@ -109,7 +126,7 @@ export async function enrichEnvironmentWithNetworkConfig(networkName: NetworkNam
|
|
|
109
126
|
const networkConfig = await getNetworkConfig(networkName, cacheDir);
|
|
110
127
|
|
|
111
128
|
if (!networkConfig) {
|
|
112
|
-
|
|
129
|
+
return; // Network not found in config, continue without enriching
|
|
113
130
|
}
|
|
114
131
|
|
|
115
132
|
enrichVar('BOOTSTRAP_NODES', networkConfig.bootnodes.join(','));
|