1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.createProviderProxy = void 0;
|
4 | const constants_1 = require("hardhat/internal/constants");
|
5 | const ethers_provider_wrapper_1 = require("./ethers-provider-wrapper");
|
6 | const updatable_target_proxy_1 = require("./updatable-target-proxy");
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | function createProviderProxy(hardhatProvider) {
|
15 | const initialProvider = new ethers_provider_wrapper_1.EthersProviderWrapper(hardhatProvider);
|
16 | const { proxy: providerProxy, setTarget } = (0, updatable_target_proxy_1.createUpdatableTargetProxy)(initialProvider);
|
17 | hardhatProvider.on(constants_1.HARDHAT_NETWORK_RESET_EVENT, () => {
|
18 | setTarget(new ethers_provider_wrapper_1.EthersProviderWrapper(hardhatProvider));
|
19 | });
|
20 | hardhatProvider.on(constants_1.HARDHAT_NETWORK_REVERT_SNAPSHOT_EVENT, () => {
|
21 | setTarget(new ethers_provider_wrapper_1.EthersProviderWrapper(hardhatProvider));
|
22 | });
|
23 | return providerProxy;
|
24 | }
|
25 | exports.createProviderProxy = createProviderProxy;
|
26 |
|
\ | No newline at end of file |