File tree 8 files changed +55
-48
lines changed
internal/builtin-plugins/network-manager
hardhat-network-helpers/src
8 files changed +55
-48
lines changed Original file line number Diff line number Diff line change 1
1
import { HardhatPlugin } from "@ignored/hardhat-vnext/types/plugins" ;
2
- import { ChainType } from "@ignored/hardhat-vnext/types/config" ;
3
2
import { HookContext } from "@ignored/hardhat-vnext/types/hooks" ;
4
3
5
- import type { NetworkConnection } from "@ignored/hardhat-vnext/types/network" ;
4
+ import type {
5
+ ChainType ,
6
+ NetworkConnection ,
7
+ } from "@ignored/hardhat-vnext/types/network" ;
6
8
7
9
import "@ignored/hardhat-vnext/types/network" ;
8
10
Original file line number Diff line number Diff line change 1
- import type { ChainType } from "@ignored/hardhat-vnext/types/config" ;
2
1
import type {
3
2
HookContext ,
4
3
NetworkHooks ,
5
4
} from "@ignored/hardhat-vnext/types/hooks" ;
6
- import type { NetworkConnection } from "@ignored/hardhat-vnext/types/network" ;
5
+ import type {
6
+ ChainType ,
7
+ NetworkConnection ,
8
+ } from "@ignored/hardhat-vnext/types/network" ;
7
9
8
10
import { NetworkHelpers } from "../network-helpers/network-helpers.js" ;
9
11
Original file line number Diff line number Diff line change 1
1
import "@ignored/hardhat-vnext/types/network" ;
2
2
3
3
import type { NetworkHelpers } from "./internal/network-helpers/network-helpers.js" ;
4
- import type { ChainType } from "@ignored/hardhat-vnext/types/config" ;
5
4
6
5
declare module "@ignored/hardhat-vnext/types/network" {
7
6
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- the ChainTypeT must be declared in the interface but in this scenario it's not used
Original file line number Diff line number Diff line change 1
- import type { ChainType , NetworkConfig } from "../../../types/config.js" ;
2
- import type { NetworkConnection } from "../../../types/network.js" ;
1
+ import type { NetworkConfig } from "../../../types/config.js" ;
2
+ import type { ChainType , NetworkConnection } from "../../../types/network.js" ;
3
3
import type { EthereumProvider } from "../../../types/providers.js" ;
4
4
5
5
export type CloseConnectionFunction < ChainTypeT extends ChainType | string > = (
Original file line number Diff line number Diff line change
1
+ import type { NetworkConfig } from "../../../types/config.js" ;
2
+ import type { HookManager } from "../../../types/hooks.js" ;
1
3
import type {
2
4
ChainType ,
3
5
DefaultChainType ,
4
- NetworkConfig ,
5
- } from "../../../types/config.js" ;
6
- import type { HookManager } from "../../../types/hooks.js" ;
7
- import type { NetworkConnection } from "../../../types/network.js" ;
6
+ NetworkConnection ,
7
+ } from "../../../types/network.js" ;
8
8
import type { EthereumProvider } from "../../../types/providers.js" ;
9
9
10
10
import { HardhatError } from "@ignored/hardhat-vnext-errors" ;
Original file line number Diff line number Diff line change
1
+ import type { ChainType , DefaultChainType } from "../../../../types/network.js" ;
2
+
1
3
import "../../../../types/config.js" ;
2
4
declare module "../../../../types/config.js" {
3
- /**
4
- * Represents the possible chain types for the network. The options are:
5
- * - `"unknown"`: Represents the most generic type of network.
6
- * - `"l1"`: Represents Layer 1 networks like Ethereum.
7
- * - `"optimism"`: Represents Layer 2 networks like Optimism.
8
- */
9
- export type ChainType = "unknown" | "l1" | "optimism" ;
10
-
11
- /**
12
- * Determines the default chain type to use when no chain type is specified.
13
- * The default chain type is `"unknown"` by default. You can customize the
14
- * default chain type by adding a `defaultChainType` property to the
15
- * `ChainTypeConfig` interface with a valid `ChainType` value.
16
- * For example:
17
- * ```ts
18
- * declare module "@ignored/hardhat-vnext/types/config" {
19
- * export interface ChainTypeConfig {
20
- * defaultChainType: "l1";
21
- * }
22
- * }
23
- * ```
24
- */
25
- export type DefaultChainType = ChainTypeConfig extends {
26
- defaultChainType : infer T ;
27
- }
28
- ? T extends ChainType
29
- ? T
30
- : "unknown"
31
- : "unknown" ;
32
-
33
- /* eslint-disable-next-line @typescript-eslint/no-empty-interface -- Empty
34
- interface to allow the user to change the default chain type. */
35
- export interface ChainTypeConfig { }
36
-
37
5
export interface HardhatUserConfig {
38
6
defaultChainType ?: DefaultChainType ;
39
7
defaultNetwork ?: string ;
Original file line number Diff line number Diff line change 1
- import type { ChainType } from "../../../../types/config.js" ;
2
- import type { NetworkConnection } from "../../../../types/network.js" ;
1
+ import type {
2
+ ChainType ,
3
+ NetworkConnection ,
4
+ } from "../../../../types/network.js" ;
3
5
import type {
4
6
JsonRpcRequest ,
5
7
JsonRpcResponse ,
Original file line number Diff line number Diff line change 1
- import type { ChainType , DefaultChainType , NetworkConfig } from "./config.js" ;
1
+ import type { NetworkConfig } from "./config.js" ;
2
2
import type { EthereumProvider } from "./providers.js" ;
3
3
4
+ /**
5
+ * Represents the possible chain types for the network. The options are:
6
+ * - `"unknown"`: Represents the most generic type of network.
7
+ * - `"l1"`: Represents Layer 1 networks like Ethereum.
8
+ * - `"optimism"`: Represents Layer 2 networks like Optimism.
9
+ */
10
+ export type ChainType = "unknown" | "l1" | "optimism" ;
11
+
12
+ /**
13
+ * Determines the default chain type to use when no chain type is specified.
14
+ * The default chain type is `"unknown"` by default. You can customize the
15
+ * default chain type by adding a `defaultChainType` property to the
16
+ * `ChainTypeConfig` interface with a valid `ChainType` value.
17
+ * For example:
18
+ * ```ts
19
+ * declare module "@ignored/hardhat-vnext/types/config" {
20
+ * export interface ChainTypeConfig {
21
+ * defaultChainType: "l1";
22
+ * }
23
+ * }
24
+ * ```
25
+ */
26
+ export type DefaultChainType = ChainTypeConfig extends {
27
+ defaultChainType : infer T ;
28
+ }
29
+ ? T extends ChainType
30
+ ? T
31
+ : "unknown"
32
+ : "unknown" ;
33
+
34
+ /* eslint-disable-next-line @typescript-eslint/no-empty-interface -- Empty
35
+ interface to allow the user to change the default chain type. */
36
+ export interface ChainTypeConfig { }
37
+
4
38
export interface NetworkManager {
5
39
connect < ChainTypeT extends ChainType = DefaultChainType > (
6
40
networkName ?: string ,
You can’t perform that action at this time.
0 commit comments