1 |
|
2 |
|
3 | import { EventEmitter } from "events";
|
4 | import { DeepPartial, DeepReadonly, Omit } from "ts-essentials";
|
5 | import * as types from "./internal/core/params/argumentTypes";
|
6 | interface CommonNetworkConfig {
|
7 | chainId?: number;
|
8 | from?: string;
|
9 | gas?: "auto" | number;
|
10 | gasPrice?: "auto" | number;
|
11 | gasMultiplier?: number;
|
12 | }
|
13 | interface BuidlerNetworkAccount {
|
14 | privateKey: string;
|
15 | balance: string;
|
16 | }
|
17 | export interface BuidlerNetworkConfig extends CommonNetworkConfig {
|
18 | accounts?: BuidlerNetworkAccount[];
|
19 | blockGasLimit?: number;
|
20 | hardfork?: string;
|
21 | throwOnTransactionFailures?: boolean;
|
22 | throwOnCallFailures?: boolean;
|
23 | loggingEnabled?: boolean;
|
24 | }
|
25 | export interface HDAccountsConfig {
|
26 | mnemonic: string;
|
27 | initialIndex?: number;
|
28 | count?: number;
|
29 | path?: string;
|
30 | }
|
31 | export interface OtherAccountsConfig {
|
32 | type: string;
|
33 | }
|
34 | export declare type NetworkConfigAccounts = "remote" | string[] | HDAccountsConfig | OtherAccountsConfig;
|
35 | export interface HttpNetworkConfig extends CommonNetworkConfig {
|
36 | url?: string;
|
37 | timeout?: number;
|
38 | accounts?: NetworkConfigAccounts;
|
39 | }
|
40 | export declare type NetworkConfig = BuidlerNetworkConfig | HttpNetworkConfig;
|
41 | export interface Networks {
|
42 | [networkName: string]: NetworkConfig;
|
43 | }
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 | export interface ProjectPaths {
|
54 | root: string;
|
55 | configFile: string;
|
56 | cache: string;
|
57 | artifacts: string;
|
58 | sources: string;
|
59 | tests: string;
|
60 | }
|
61 | declare type EVMVersion = string;
|
62 | export interface SolcConfig {
|
63 | version: string;
|
64 | optimizer: SolcOptimizerConfig;
|
65 | evmVersion?: EVMVersion;
|
66 | }
|
67 | export interface SolcOptimizerConfig {
|
68 | enabled: boolean;
|
69 | runs: number;
|
70 | }
|
71 | export interface AnalyticsConfig {
|
72 | enabled: boolean;
|
73 | }
|
74 | export interface BuidlerConfig {
|
75 | defaultNetwork?: string;
|
76 | networks?: Networks;
|
77 | paths?: Omit<Partial<ProjectPaths>, "configFile">;
|
78 | solc?: DeepPartial<SolcConfig>;
|
79 | mocha?: Mocha.MochaOptions;
|
80 | analytics?: Partial<AnalyticsConfig>;
|
81 | }
|
82 | export interface ResolvedBuidlerConfig extends BuidlerConfig {
|
83 | defaultNetwork: string;
|
84 | paths: ProjectPaths;
|
85 | networks: Networks;
|
86 | solc: SolcConfig;
|
87 | analytics: AnalyticsConfig;
|
88 | }
|
89 | export interface SolcInput {
|
90 | settings: {
|
91 | metadata: {
|
92 | useLiteralContent: boolean;
|
93 | };
|
94 | optimizer: SolcOptimizerConfig;
|
95 | outputSelection: {
|
96 | "*": {
|
97 | "": string[];
|
98 | "*": string[];
|
99 | };
|
100 | };
|
101 | evmVersion?: string;
|
102 | };
|
103 | sources: {
|
104 | [p: string]: {
|
105 | content: string;
|
106 | };
|
107 | };
|
108 | language: string;
|
109 | }
|
110 |
|
111 |
|
112 |
|
113 |
|
114 | export declare type EnvironmentExtender = (env: BuidlerRuntimeEnvironment) => void;
|
115 | export declare type ConfigExtender = (config: ResolvedBuidlerConfig, userConfig: DeepReadonly<BuidlerConfig>) => void;
|
116 | export interface TasksMap {
|
117 | [name: string]: TaskDefinition;
|
118 | }
|
119 | export interface ConfigurableTaskDefinition {
|
120 | setDescription(description: string): this;
|
121 | setAction(action: ActionType<TaskArguments>): this;
|
122 | addParam<T>(name: string, description?: string, defaultValue?: T, type?: types.ArgumentType<T>, isOptional?: boolean): this;
|
123 | addOptionalParam<T>(name: string, description?: string, defaultValue?: T, type?: types.ArgumentType<T>): this;
|
124 | addPositionalParam<T>(name: string, description?: string, defaultValue?: T, type?: types.ArgumentType<T>, isOptional?: boolean): this;
|
125 | addOptionalPositionalParam<T>(name: string, description?: string, defaultValue?: T, type?: types.ArgumentType<T>): this;
|
126 | addVariadicPositionalParam<T>(name: string, description?: string, defaultValue?: T[], type?: types.ArgumentType<T>, isOptional?: boolean): this;
|
127 | addOptionalVariadicPositionalParam<T>(name: string, description?: string, defaultValue?: T[], type?: types.ArgumentType<T>): this;
|
128 | addFlag(name: string, description?: string): this;
|
129 | }
|
130 | export interface ParamDefinition<T> {
|
131 | name: string;
|
132 | defaultValue?: T;
|
133 | type: types.ArgumentType<T>;
|
134 | description?: string;
|
135 | isOptional: boolean;
|
136 | isFlag: boolean;
|
137 | isVariadic: boolean;
|
138 | }
|
139 | export interface OptionalParamDefinition<T> extends ParamDefinition<T> {
|
140 | defaultValue: T;
|
141 | isOptional: true;
|
142 | }
|
143 | export interface ParamDefinitionsMap {
|
144 | [paramName: string]: ParamDefinition<any>;
|
145 | }
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 | export interface BuidlerArguments {
|
156 | network?: string;
|
157 | showStackTraces: boolean;
|
158 | version: boolean;
|
159 | help: boolean;
|
160 | emoji: boolean;
|
161 | config?: string;
|
162 | verbose: boolean;
|
163 | maxMemory?: number;
|
164 | }
|
165 | export declare type BuidlerParamDefinitions = {
|
166 | [param in keyof Required<BuidlerArguments>]: OptionalParamDefinition<BuidlerArguments[param]>;
|
167 | };
|
168 | export interface TaskDefinition extends ConfigurableTaskDefinition {
|
169 | readonly name: string;
|
170 | readonly description?: string;
|
171 | readonly action: ActionType<TaskArguments>;
|
172 | readonly isInternal: boolean;
|
173 | readonly paramDefinitions: ParamDefinitionsMap;
|
174 | readonly positionalParamDefinitions: Array<ParamDefinition<any>>;
|
175 | }
|
176 | export declare type TaskArguments = any;
|
177 | export declare type RunTaskFunction = (name: string, taskArguments?: TaskArguments) => Promise<any>;
|
178 | export interface RunSuperFunction<ArgT extends TaskArguments> {
|
179 | (taskArguments?: ArgT): Promise<any>;
|
180 | isDefined: boolean;
|
181 | }
|
182 | export declare type ActionType<ArgsT extends TaskArguments> = (taskArgs: ArgsT, env: BuidlerRuntimeEnvironment, runSuper: RunSuperFunction<ArgsT>) => Promise<any>;
|
183 | export interface EthereumProvider extends EventEmitter {
|
184 | send(method: string, params?: any[]): Promise<any>;
|
185 | }
|
186 | export declare type IEthereumProvider = EthereumProvider;
|
187 | export interface Network {
|
188 | name: string;
|
189 | config: NetworkConfig;
|
190 | provider: EthereumProvider;
|
191 | }
|
192 | export interface BuidlerRuntimeEnvironment {
|
193 | readonly config: ResolvedBuidlerConfig;
|
194 | readonly buidlerArguments: BuidlerArguments;
|
195 | readonly tasks: TasksMap;
|
196 | readonly run: RunTaskFunction;
|
197 | readonly network: Network;
|
198 | readonly ethereum: EthereumProvider;
|
199 | }
|
200 | export interface Artifact {
|
201 | contractName: string;
|
202 | abi: any;
|
203 | bytecode: string;
|
204 | deployedBytecode: string;
|
205 | linkReferences: LinkReferences;
|
206 | deployedLinkReferences: LinkReferences;
|
207 | }
|
208 | export interface LinkReferences {
|
209 | [libraryFileName: string]: {
|
210 | [libraryName: string]: Array<{
|
211 | length: number;
|
212 | start: number;
|
213 | }>;
|
214 | };
|
215 | }
|
216 | export {};
|
217 |
|
\ | No newline at end of file |