@@ -27,15 +27,10 @@ import type {
27
27
} from "@ignored/edr-optimism" ;
28
28
29
29
import {
30
- EdrContext ,
31
30
createModelsAndDecodeBytecodes ,
32
31
initializeVmTraceDecoder ,
33
32
SolidityTracer ,
34
33
VmTracer ,
35
- GENERIC_CHAIN_TYPE ,
36
- OPTIMISM_CHAIN_TYPE ,
37
- genericChainProviderFactory ,
38
- optimismProviderFactory ,
39
34
} from "@ignored/edr-optimism" ;
40
35
import { toSeconds } from "@ignored/hardhat-vnext-utils/date" ;
41
36
import { deepEqual } from "@ignored/hardhat-vnext-utils/lang" ;
@@ -50,6 +45,7 @@ import { DEFAULT_HD_ACCOUNTS_CONFIG_PARAMS } from "../accounts/constants.js";
50
45
import { BaseProvider } from "../base-provider.js" ;
51
46
import { getJsonRpcRequest , isFailedJsonRpcResponse } from "../json-rpc.js" ;
52
47
48
+ import { getGlobalEdrContext } from "./edr-context.js" ;
53
49
import {
54
50
InvalidArgumentsError ,
55
51
InvalidInputError ,
@@ -121,25 +117,6 @@ export const EDR_NETWORK_DEFAULT_PRIVATE_KEYS: string[] = [
121
117
"0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e" ,
122
118
] ;
123
119
124
- // Lazy initialize the global EDR context.
125
- let _globalEdrContext : EdrContext | undefined ;
126
- export async function getGlobalEdrContext ( ) : Promise < EdrContext > {
127
- if ( _globalEdrContext === undefined ) {
128
- // Only one is allowed to exist
129
- _globalEdrContext = new EdrContext ( ) ;
130
- await _globalEdrContext . registerProviderFactory (
131
- GENERIC_CHAIN_TYPE ,
132
- genericChainProviderFactory ( ) ,
133
- ) ;
134
- await _globalEdrContext . registerProviderFactory (
135
- OPTIMISM_CHAIN_TYPE ,
136
- optimismProviderFactory ( ) ,
137
- ) ;
138
- }
139
-
140
- return _globalEdrContext ;
141
- }
142
-
143
120
interface EdrProviderConfig {
144
121
networkConfig : EdrNetworkConfig ;
145
122
loggerConfig ?: LoggerConfig ;
0 commit comments