@aztec/cli 3.0.0-nightly.20251118 → 3.0.0-nightly.20251120
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.
- package/dest/cmds/validator_keys/add.d.ts.map +1 -1
- package/dest/cmds/validator_keys/add.js +19 -3
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts.map +1 -1
- package/dest/cmds/validator_keys/generate_bls_keypair.js +2 -1
- package/dest/cmds/validator_keys/index.d.ts.map +1 -1
- package/dest/cmds/validator_keys/index.js +4 -3
- package/dest/cmds/validator_keys/new.d.ts +2 -1
- package/dest/cmds/validator_keys/new.d.ts.map +1 -1
- package/dest/cmds/validator_keys/new.js +24 -26
- package/dest/cmds/validator_keys/shared.d.ts +2 -0
- package/dest/cmds/validator_keys/shared.d.ts.map +1 -1
- package/dest/cmds/validator_keys/shared.js +26 -8
- package/dest/cmds/validator_keys/staker.d.ts.map +1 -1
- package/dest/cmds/validator_keys/staker.js +12 -11
- package/dest/cmds/validator_keys/utils.d.ts +25 -0
- package/dest/cmds/validator_keys/utils.d.ts.map +1 -0
- package/dest/cmds/validator_keys/utils.js +52 -0
- package/dest/config/network_config.d.ts +1 -1
- package/dest/config/network_config.d.ts.map +1 -1
- package/dest/config/network_config.js +18 -4
- package/package.json +30 -29
- package/public_include_metric_prefixes.json +1 -0
- package/src/cmds/validator_keys/add.ts +20 -4
- package/src/cmds/validator_keys/generate_bls_keypair.ts +2 -1
- package/src/cmds/validator_keys/index.ts +33 -17
- package/src/cmds/validator_keys/new.ts +35 -34
- package/src/cmds/validator_keys/shared.ts +27 -8
- package/src/cmds/validator_keys/staker.ts +14 -12
- package/src/cmds/validator_keys/utils.ts +80 -0
- package/src/config/network_config.ts +25 -4
|
@@ -8,11 +8,12 @@ import { enrichEthAddressVar, enrichVar } from './enrich_env.js';
|
|
|
8
8
|
|
|
9
9
|
const DEFAULT_CONFIG_URL =
|
|
10
10
|
'https://raw.githubusercontent.com/AztecProtocol/networks/refs/heads/main/network_config.json';
|
|
11
|
+
const FALLBACK_CONFIG_URL = 'https://metadata.aztec.network/network_config.json';
|
|
11
12
|
const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Fetches remote network configuration from GitHub with caching support.
|
|
15
|
-
* Uses the reusable cachedFetch utility.
|
|
16
|
+
* Uses the reusable cachedFetch utility. Falls back to metadata.aztec.network if the default URL fails.
|
|
16
17
|
*
|
|
17
18
|
* @param networkName - The network name to fetch config for
|
|
18
19
|
* @param cacheDir - Optional cache directory for storing fetched config
|
|
@@ -22,13 +23,33 @@ export async function getNetworkConfig(
|
|
|
22
23
|
networkName: NetworkNames,
|
|
23
24
|
cacheDir?: string,
|
|
24
25
|
): Promise<NetworkConfig | undefined> {
|
|
25
|
-
|
|
26
|
+
// Try with the primary URL (env var or default)
|
|
26
27
|
const configLocation = process.env.NETWORK_CONFIG_LOCATION || DEFAULT_CONFIG_URL;
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
// First try the primary config location
|
|
30
|
+
let config = await fetchNetworkConfigFromUrl(configLocation, networkName, cacheDir);
|
|
31
|
+
|
|
32
|
+
// If primary fails and we were using the default URL, try the fallback
|
|
33
|
+
if (!config && configLocation === DEFAULT_CONFIG_URL) {
|
|
34
|
+
config = await fetchNetworkConfigFromUrl(FALLBACK_CONFIG_URL, networkName, cacheDir);
|
|
30
35
|
}
|
|
31
36
|
|
|
37
|
+
return config;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Helper function to fetch network config from a specific URL.
|
|
42
|
+
* @param configLocation - The URL or file path to fetch from
|
|
43
|
+
* @param networkName - The network name to fetch config for
|
|
44
|
+
* @param cacheDir - Optional cache directory for storing fetched config
|
|
45
|
+
* @returns Remote configuration for the specified network, or undefined if not found/error
|
|
46
|
+
*/
|
|
47
|
+
async function fetchNetworkConfigFromUrl(
|
|
48
|
+
configLocation: string,
|
|
49
|
+
networkName: NetworkNames,
|
|
50
|
+
cacheDir?: string,
|
|
51
|
+
): Promise<NetworkConfig | undefined> {
|
|
52
|
+
let url: URL | undefined;
|
|
32
53
|
try {
|
|
33
54
|
if (configLocation.includes('://')) {
|
|
34
55
|
url = new URL(configLocation);
|