import type { HookContext, NetworkHooks } from "hardhat/types/hooks"; import type { ChainType, NetworkConnection } from "hardhat/types/network"; import { initializeEthers } from "../initialization.js"; export default async (): Promise> => { const handlers: Partial = { async newConnection( context: HookContext, next: ( nextContext: HookContext, ) => Promise>, ) { const connection: NetworkConnection = await next(context); connection.ethers = await initializeEthers( connection.provider, connection.networkName, connection.networkConfig, context.artifacts, ); return connection; }, }; return handlers; };