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