Skip to content

Commit

Permalink
feat: switch to generic chain type
Browse files Browse the repository at this point in the history
  • Loading branch information
Wodann committed Sep 19, 2024
1 parent a2e715e commit c58dcd7
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,16 @@ let _globalEdrContext: EdrContext | undefined;

// Lazy initialize the global EDR context.
export async function getGlobalEdrContext(): Promise<EdrContext> {
const { EdrContext, L1_CHAIN_TYPE, l1ProviderFactory } = requireNapiRsModule(
"@nomicfoundation/edr"
) as typeof import("@nomicfoundation/edr");
const { EdrContext, GENERIC_CHAIN_TYPE, l1ProviderFactory } =
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,
GENERIC_CHAIN_TYPE,
l1ProviderFactory()
);
}
Expand Down Expand Up @@ -196,7 +197,7 @@ export class EdrProviderWrapper
loggerConfig: LoggerConfig,
tracingConfig?: TracingConfig
): Promise<EdrProviderWrapper> {
const { L1_CHAIN_TYPE } = requireNapiRsModule(
const { GENERIC_CHAIN_TYPE } = requireNapiRsModule(
"@nomicfoundation/edr"
) as typeof import("@nomicfoundation/edr");

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit c58dcd7

Please sign in to comment.