add devdoc support to solc typings, and use it

This commit is contained in:
F. Eugene Aumson
2018-08-24 09:18:33 -04:00
parent 775d1efd46
commit a1959df911
6 changed files with 104 additions and 69 deletions

View File

@@ -1,4 +1,5 @@
declare module 'solc' {
import { SolcError } from 'ethereum-types';
export interface ContractCompilationResult {
srcmap: string;
srcmapRuntime: string;
@@ -87,62 +88,7 @@ declare module 'solc' {
};
settings: CompilerSettings;
}
export type ErrorType =
| 'JSONError'
| 'IOError'
| 'ParserError'
| 'DocstringParsingError'
| 'SyntaxError'
| 'DeclarationError'
| 'TypeError'
| 'UnimplementedFeatureError'
| 'InternalCompilerError'
| 'Exception'
| 'CompilerError'
| 'FatalError'
| 'Warning';
export type ErrorSeverity = 'error' | 'warning';
export interface Error {
sourceLocation?: {
file: string;
start: number;
end: number;
};
type: ErrorType;
component: 'general' | 'ewasm';
severity: ErrorSeverity;
message: string;
formattedMessage?: string;
}
import { ContractAbi } from 'ethereum-types';
export interface StandardContractOutput {
abi: ContractAbi;
evm: {
bytecode: {
object: string;
sourceMap: string;
};
deployedBytecode: {
object: string;
sourceMap: string;
};
};
}
export interface StandardOutput {
errors: Error[];
sources: {
[fileName: string]: {
id: number;
ast?: object;
legacyAST?: object;
};
};
contracts: {
[fileName: string]: {
[contractName: string]: StandardContractOutput;
};
};
}
export { ErrorType, ErrorSeverity, SolcError, StandardContractOutput, StandardOutput } from 'ethereum-types';
export interface SolcInstance {
compile(
sources: InputSources,
@@ -151,6 +97,9 @@ declare module 'solc' {
): CompilationResult;
compileStandardWrapper(input: string, findImports: (importPath: string) => ImportContents): string;
}
export function loadRemoteVersion(versionName: string, cb: (err: Error | null, res?: SolcInstance) => void): void;
export function loadRemoteVersion(
versionName: string,
cb: (err: SolcError | null, res?: SolcInstance) => void,
): void;
export function setupMethods(solcBin: any): SolcInstance;
}