UNPKG

3.43 kBTypeScriptView Raw
1declare module 'solc' {
2 export { ErrorType, ErrorSeverity, SolcError, StandardContractOutput, StandardOutput } from 'ethereum-types';
3 import { SolcError } from 'ethereum-types';
4 export interface ContractCompilationResult {
5 srcmap: string;
6 srcmapRuntime: string;
7 bytecode: string;
8 runtimeBytecode: string;
9 interface: string;
10 }
11 export interface CompilationResult {
12 errors: string[];
13 contracts: {
14 [contractIdentifier: string]: ContractCompilationResult;
15 };
16 sources: {
17 [sourceName: string]: {
18 AST: any;
19 };
20 };
21 sourceList: string[];
22 }
23 export interface ImportContents {
24 contents: string;
25 }
26 export interface InputSources {
27 sources: {
28 [fileName: string]: string;
29 };
30 }
31 export interface BaseSource {
32 keccak256?: string;
33 }
34 export interface InMemorySource extends BaseSource {
35 content: string;
36 }
37 export interface UrlSource extends BaseSource {
38 urls: string[];
39 }
40 export type Source = UrlSource | InMemorySource;
41 export type OutputField =
42 | '*'
43 | 'ast'
44 | 'legacyAST'
45 | 'abi'
46 | 'devdoc'
47 | 'userdoc'
48 | 'metadata'
49 | 'ir'
50 | 'evm.assembly'
51 | 'evm.legacyAssembly'
52 | 'evm.bytecode.object'
53 | 'evm.bytecode.opcodes'
54 | 'evm.bytecode.sourceMap'
55 | 'evm.bytecode.linkReferences'
56 | 'evm.deployedBytecode.object'
57 | 'evm.deployedBytecode.opcodes'
58 | 'evm.deployedBytecode.sourceMap'
59 | 'evm.deployedBytecode.linkReferences'
60 | 'evm.methodIdentifiers'
61 | 'evm.gasEstimates'
62 | 'ewasm.wast'
63 | 'ewasm.wasm';
64 export interface CompilerSettings {
65 remappings?: string[];
66 optimizer?: {
67 enabled: boolean;
68 runs?: number;
69 details?: {
70 peephole?: boolean;
71 jumpdestRemover?: boolean;
72 orderLiterals?: boolean;
73 deduplicate?: boolean;
74 cse?: boolean;
75 constantOptimizer?: boolean;
76 yul?: boolean;
77 };
78 };
79 evmVersion?: 'homestead' | 'tangerineWhistle' | 'spuriousDragon' | 'byzantium' | 'constantinople';
80 metadata?: {
81 useLiteralContent: true;
82 };
83 libraries?: {
84 [fileName: string]: {
85 [libName: string]: string;
86 };
87 };
88 outputSelection: {
89 [fileName: string]: {
90 [contractName: string]: OutputField[];
91 };
92 };
93 }
94 export interface StandardInput {
95 language: 'Solidity' | 'serpent' | 'lll' | 'assembly';
96 sources: {
97 [fileName: string]: Source;
98 };
99 settings: CompilerSettings;
100 }
101 export interface SolcInstance {
102 compile(sources: InputSources, findImports?: (importPath: string) => ImportContents): CompilationResult;
103 compile(sources: string, findImports?: (importPath: string) => ImportContents): string;
104 version(): string;
105 }
106 export function loadRemoteVersion(
107 versionName: string,
108 cb: (err: SolcError | null, res?: SolcInstance) => void,
109 ): void;
110 export function setupMethods(solcBin: any): SolcInstance;
111}