1 | import { Artifacts } from "./artifacts";
|
2 | import { HardhatConfig, HardhatUserConfig, NetworkConfig } from "./config";
|
3 | import { EIP1193Provider, EthereumProvider } from "./provider";
|
4 |
|
5 |
|
6 |
|
7 | export interface ArgumentType<T> {
|
8 | |
9 |
|
10 |
|
11 | name: string;
|
12 | |
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | validate(argName: string, argumentValue: any): void;
|
21 | }
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | export interface CLIArgumentType<T> extends ArgumentType<T> {
|
29 | |
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | parse(argName: string, strValue: string): T;
|
37 | }
|
38 | export interface ConfigurableTaskDefinition {
|
39 | setDescription(description: string): this;
|
40 | setAction(action: ActionType<TaskArguments>): this;
|
41 | addParam<T>(name: string, description?: string, defaultValue?: T, type?: ArgumentType<T>, isOptional?: boolean): this;
|
42 | addOptionalParam<T>(name: string, description?: string, defaultValue?: T, type?: ArgumentType<T>): this;
|
43 | addPositionalParam<T>(name: string, description?: string, defaultValue?: T, type?: ArgumentType<T>, isOptional?: boolean): this;
|
44 | addOptionalPositionalParam<T>(name: string, description?: string, defaultValue?: T, type?: ArgumentType<T>): this;
|
45 | addVariadicPositionalParam<T>(name: string, description?: string, defaultValue?: T[], type?: ArgumentType<T>, isOptional?: boolean): this;
|
46 | addOptionalVariadicPositionalParam<T>(name: string, description?: string, defaultValue?: T[], type?: ArgumentType<T>): this;
|
47 | addFlag(name: string, description?: string): this;
|
48 | }
|
49 | declare function addTask<TaskArgumentsT extends TaskArguments>(name: string, description?: string, action?: ActionType<TaskArgumentsT>): ConfigurableTaskDefinition;
|
50 | declare function addTask<TaskArgumentsT extends TaskArguments>(name: string, action: ActionType<TaskArgumentsT>): ConfigurableTaskDefinition;
|
51 | type AddConfigurableTaskFunction = typeof addTask;
|
52 | export interface ConfigurableScopeDefinition {
|
53 | setDescription(description: string): this;
|
54 | task: AddConfigurableTaskFunction;
|
55 | subtask: AddConfigurableTaskFunction;
|
56 | }
|
57 | export interface ParamDefinition<T> {
|
58 | name: string;
|
59 | defaultValue?: T;
|
60 | type: ArgumentType<T>;
|
61 | description?: string;
|
62 | isOptional: boolean;
|
63 | isFlag: boolean;
|
64 | isVariadic: boolean;
|
65 | }
|
66 | export interface OptionalParamDefinition<T> extends ParamDefinition<T> {
|
67 | defaultValue: T;
|
68 | isOptional: true;
|
69 | }
|
70 | export interface CLIOptionalParamDefinition<T> extends OptionalParamDefinition<T> {
|
71 | type: CLIArgumentType<T>;
|
72 | }
|
73 | export interface ParamDefinitionsMap {
|
74 | [paramName: string]: ParamDefinition<any>;
|
75 | }
|
76 | export interface TaskDefinition extends ConfigurableTaskDefinition {
|
77 | readonly scope?: string;
|
78 | readonly name: string;
|
79 | readonly description?: string;
|
80 | readonly action: ActionType<TaskArguments>;
|
81 | readonly isSubtask: boolean;
|
82 | readonly paramDefinitions: ParamDefinitionsMap;
|
83 | readonly positionalParamDefinitions: Array<ParamDefinition<any>>;
|
84 | }
|
85 | export interface ScopeDefinition extends ConfigurableScopeDefinition {
|
86 | readonly name: string;
|
87 | readonly description?: string;
|
88 | readonly tasks: TasksMap;
|
89 | }
|
90 | export type TaskIdentifier = string | {
|
91 | scope?: string;
|
92 | task: string;
|
93 | };
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 | export type TaskArguments = any;
|
109 | export interface SubtaskArguments {
|
110 | [subtaskName: string]: TaskArguments;
|
111 | }
|
112 | export interface RunSuperFunction<TaskArgumentsT extends TaskArguments> {
|
113 | (taskArguments?: TaskArgumentsT, subtaskArguments?: SubtaskArguments): Promise<any>;
|
114 | isDefined: boolean;
|
115 | }
|
116 | export type ActionType<TaskArgumentsT extends TaskArguments> = (taskArgs: TaskArgumentsT, env: HardhatRuntimeEnvironment, runSuper: RunSuperFunction<TaskArgumentsT>) => Promise<any>;
|
117 | export interface HardhatArguments {
|
118 | network?: string;
|
119 | showStackTraces: boolean;
|
120 | version: boolean;
|
121 | help: boolean;
|
122 | emoji: boolean;
|
123 | config?: string;
|
124 | verbose: boolean;
|
125 | maxMemory?: number;
|
126 | tsconfig?: string;
|
127 | flamegraph?: boolean;
|
128 | typecheck?: boolean;
|
129 | }
|
130 | export type HardhatParamDefinitions = {
|
131 | [param in keyof Required<HardhatArguments>]: CLIOptionalParamDefinition<HardhatArguments[param]>;
|
132 | };
|
133 | export interface TasksMap {
|
134 | [name: string]: TaskDefinition;
|
135 | }
|
136 | export interface ScopesMap {
|
137 | [scopeName: string]: ScopeDefinition;
|
138 | }
|
139 | export type RunTaskFunction = (taskIdentifier: TaskIdentifier, taskArguments?: TaskArguments, subtaskArguments?: SubtaskArguments) => Promise<any>;
|
140 | export interface HardhatRuntimeEnvironment {
|
141 | readonly config: HardhatConfig;
|
142 | readonly userConfig: HardhatUserConfig;
|
143 | readonly hardhatArguments: HardhatArguments;
|
144 | readonly tasks: TasksMap;
|
145 | readonly scopes: ScopesMap;
|
146 | readonly run: RunTaskFunction;
|
147 | readonly network: Network;
|
148 | readonly artifacts: Artifacts;
|
149 | readonly version: string;
|
150 | }
|
151 | export interface Network {
|
152 | name: string;
|
153 | config: NetworkConfig;
|
154 | provider: EthereumProvider;
|
155 | }
|
156 |
|
157 |
|
158 |
|
159 |
|
160 | export type EnvironmentExtender = (env: HardhatRuntimeEnvironment) => void;
|
161 |
|
162 |
|
163 |
|
164 |
|
165 | export type ProviderExtender = (provider: EIP1193Provider, config: HardhatConfig, network: string) => EIP1193Provider | Promise<EIP1193Provider>;
|
166 | export {};
|
167 |
|
\ | No newline at end of file |