diff --git a/packages/cli/src/cmds/node/handler.ts b/packages/cli/src/cmds/node/handler.ts index f9b25468..c6c6430b 100644 --- a/packages/cli/src/cmds/node/handler.ts +++ b/packages/cli/src/cmds/node/handler.ts @@ -27,7 +27,7 @@ export async function nodeHandler(args: IGlobalArgs): Promise { let config: Config; try { const configOptions = readFile(params.configFile) as ConfigOptions; - config = new Config({ + config = await Config.init({ networks: configOptions.networks, testingMode: params.testingMode, unsafeMode: params.unsafeMode, @@ -35,7 +35,7 @@ export async function nodeHandler(args: IGlobalArgs): Promise { }); } catch (err) { logger.info("Config file not found. Proceeding with env vars..."); - config = new Config({ + config = await Config.init({ networks: {}, testingMode: false, unsafeMode: false, diff --git a/packages/cli/src/cmds/standalone/handler.ts b/packages/cli/src/cmds/standalone/handler.ts index 990de77c..b9840a98 100644 --- a/packages/cli/src/cmds/standalone/handler.ts +++ b/packages/cli/src/cmds/standalone/handler.ts @@ -34,7 +34,7 @@ export async function bundlerHandler( let config: Config; try { const configOptions = readFile(configFile) as ConfigOptions; - config = new Config({ + config = await Config.init({ networks: configOptions.networks, testingMode, unsafeMode, @@ -42,7 +42,7 @@ export async function bundlerHandler( }); } catch (err) { logger.debug("Config file not found. Proceeding with env vars..."); - config = new Config({ + config = await Config.init({ networks: {}, testingMode, unsafeMode, diff --git a/packages/executor/src/config.ts b/packages/executor/src/config.ts index 594f9a1b..8884a534 100644 --- a/packages/executor/src/config.ts +++ b/packages/executor/src/config.ts @@ -25,6 +25,12 @@ export class Config { this.networks = this.parseNetworkConfigs(); } + static async init(configOptions: ConfigOptions): Promise { + const config = new Config(configOptions); + await config.fetchChainIds(); + return config; + } + getNetworkProvider(network: string): providers.JsonRpcProvider | null { const conf = this.networks[network]; const endpoint = conf?.rpcEndpoint;