From 4f620fec04156236187d5d410773e4b8afc08d99 Mon Sep 17 00:00:00 2001 From: Wodann Date: Thu, 19 Sep 2024 19:59:41 +0000 Subject: [PATCH] feat: switch to generic chain type --- .../internal/hardhat-network/provider/provider.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts index 3dda0ab27f..0acef856cc 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/provider.ts @@ -84,16 +84,17 @@ let _globalEdrContext: EdrContext | undefined; // Lazy initialize the global EDR context. export async function getGlobalEdrContext(): Promise { - const { EdrContext, L1_CHAIN_TYPE, l1ProviderFactory } = requireNapiRsModule( - "@nomicfoundation/edr" - ) as typeof import("@nomicfoundation/edr"); + const { EdrContext, GENERIC_CHAIN_TYPE, genericChainProviderFactory } = + requireNapiRsModule( + "@nomicfoundation/edr" + ) as typeof import("@nomicfoundation/edr"); if (_globalEdrContext === undefined) { // Only one is allowed to exist _globalEdrContext = new EdrContext(); await _globalEdrContext.registerProviderFactory( - L1_CHAIN_TYPE, - l1ProviderFactory() + GENERIC_CHAIN_TYPE, + genericChainProviderFactory() ); } @@ -196,7 +197,7 @@ export class EdrProviderWrapper loggerConfig: LoggerConfig, tracingConfig?: TracingConfig ): Promise { - const { L1_CHAIN_TYPE } = requireNapiRsModule( + const { GENERIC_CHAIN_TYPE } = requireNapiRsModule( "@nomicfoundation/edr" ) as typeof import("@nomicfoundation/edr"); @@ -232,7 +233,7 @@ export class EdrProviderWrapper const context = await getGlobalEdrContext(); const provider = await context.createProvider( - L1_CHAIN_TYPE, + GENERIC_CHAIN_TYPE, { allowBlocksWithSameTimestamp: config.allowBlocksWithSameTimestamp ?? false,