///
///
import { EventEmitter } from "events";
import { DeepPartial, DeepReadonly, Omit } from "ts-essentials";
import * as types from "./internal/core/params/argumentTypes";
interface CommonNetworkConfig {
chainId?: number;
from?: string;
gas?: "auto" | number;
gasPrice?: "auto" | number;
gasMultiplier?: number;
}
interface BuidlerNetworkAccount {
privateKey: string;
balance: string;
}
export interface BuidlerNetworkConfig extends CommonNetworkConfig {
accounts?: BuidlerNetworkAccount[];
blockGasLimit?: number;
hardfork?: string;
throwOnTransactionFailures?: boolean;
throwOnCallFailures?: boolean;
loggingEnabled?: boolean;
}
export interface HDAccountsConfig {
mnemonic: string;
initialIndex?: number;
count?: number;
path?: string;
}
export interface OtherAccountsConfig {
type: string;
}
export declare type NetworkConfigAccounts = "remote" | string[] | HDAccountsConfig | OtherAccountsConfig;
export interface HttpNetworkConfig extends CommonNetworkConfig {
url?: string;
timeout?: number;
accounts?: NetworkConfigAccounts;
}
export declare type NetworkConfig = BuidlerNetworkConfig | HttpNetworkConfig;
export interface Networks {
[networkName: string]: NetworkConfig;
}
/**
* The project paths:
* * root: the project's root.
* * configFile: the buidler's config filepath.
* * cache: project's cache directory.
* * artifacts: artifact's directory.
* * sources: project's sources directory.
* * tests: project's tests directory.
*/
export interface ProjectPaths {
root: string;
configFile: string;
cache: string;
artifacts: string;
sources: string;
tests: string;
}
declare type EVMVersion = string;
export interface SolcConfig {
version: string;
optimizer: SolcOptimizerConfig;
evmVersion?: EVMVersion;
}
export interface SolcOptimizerConfig {
enabled: boolean;
runs: number;
}
export interface AnalyticsConfig {
enabled: boolean;
}
export interface BuidlerConfig {
defaultNetwork?: string;
networks?: Networks;
paths?: Omit, "configFile">;
solc?: DeepPartial;
mocha?: Mocha.MochaOptions;
analytics?: Partial;
}
export interface ResolvedBuidlerConfig extends BuidlerConfig {
defaultNetwork: string;
paths: ProjectPaths;
networks: Networks;
solc: SolcConfig;
analytics: AnalyticsConfig;
}
export interface SolcInput {
settings: {
metadata: {
useLiteralContent: boolean;
};
optimizer: SolcOptimizerConfig;
outputSelection: {
"*": {
"": string[];
"*": string[];
};
};
evmVersion?: string;
};
sources: {
[p: string]: {
content: string;
};
};
language: string;
}
/**
* A function that receives a BuidlerRuntimeEnvironment and
* modify its properties or add new ones.
*/
export declare type EnvironmentExtender = (env: BuidlerRuntimeEnvironment) => void;
export declare type ConfigExtender = (config: ResolvedBuidlerConfig, userConfig: DeepReadonly) => void;
export interface TasksMap {
[name: string]: TaskDefinition;
}
export interface ConfigurableTaskDefinition {
setDescription(description: string): this;
setAction(action: ActionType): this;
addParam(name: string, description?: string, defaultValue?: T, type?: types.ArgumentType, isOptional?: boolean): this;
addOptionalParam(name: string, description?: string, defaultValue?: T, type?: types.ArgumentType): this;
addPositionalParam(name: string, description?: string, defaultValue?: T, type?: types.ArgumentType, isOptional?: boolean): this;
addOptionalPositionalParam(name: string, description?: string, defaultValue?: T, type?: types.ArgumentType): this;
addVariadicPositionalParam(name: string, description?: string, defaultValue?: T[], type?: types.ArgumentType, isOptional?: boolean): this;
addOptionalVariadicPositionalParam(name: string, description?: string, defaultValue?: T[], type?: types.ArgumentType): this;
addFlag(name: string, description?: string): this;
}
export interface ParamDefinition {
name: string;
defaultValue?: T;
type: types.ArgumentType;
description?: string;
isOptional: boolean;
isFlag: boolean;
isVariadic: boolean;
}
export interface OptionalParamDefinition extends ParamDefinition {
defaultValue: T;
isOptional: true;
}
export interface ParamDefinitionsMap {
[paramName: string]: ParamDefinition;
}
/**
* Buidler arguments:
* * network: the network to be used.
* * showStackTraces: flag to show stack traces.
* * version: flag to show buidler's version.
* * help: flag to show buidler's help message.
* * emoji:
* * config: used to specify buidler's config file.
*/
export interface BuidlerArguments {
network?: string;
showStackTraces: boolean;
version: boolean;
help: boolean;
emoji: boolean;
config?: string;
verbose: boolean;
maxMemory?: number;
}
export declare type BuidlerParamDefinitions = {
[param in keyof Required]: OptionalParamDefinition;
};
export interface TaskDefinition extends ConfigurableTaskDefinition {
readonly name: string;
readonly description?: string;
readonly action: ActionType;
readonly isInternal: boolean;
readonly paramDefinitions: ParamDefinitionsMap;
readonly positionalParamDefinitions: Array>;
}
export declare type TaskArguments = any;
export declare type RunTaskFunction = (name: string, taskArguments?: TaskArguments) => Promise;
export interface RunSuperFunction {
(taskArguments?: ArgT): Promise;
isDefined: boolean;
}
export declare type ActionType = (taskArgs: ArgsT, env: BuidlerRuntimeEnvironment, runSuper: RunSuperFunction) => Promise;
export interface EthereumProvider extends EventEmitter {
send(method: string, params?: any[]): Promise;
}
export declare type IEthereumProvider = EthereumProvider;
export interface Network {
name: string;
config: NetworkConfig;
provider: EthereumProvider;
}
export interface BuidlerRuntimeEnvironment {
readonly config: ResolvedBuidlerConfig;
readonly buidlerArguments: BuidlerArguments;
readonly tasks: TasksMap;
readonly run: RunTaskFunction;
readonly network: Network;
readonly ethereum: EthereumProvider;
}
export interface Artifact {
contractName: string;
abi: any;
bytecode: string;
deployedBytecode: string;
linkReferences: LinkReferences;
deployedLinkReferences: LinkReferences;
}
export interface LinkReferences {
[libraryFileName: string]: {
[libraryName: string]: Array<{
length: number;
start: number;
}>;
};
}
export {};
//# sourceMappingURL=types.d.ts.map