UNPKG

6.48 kBTypeScriptView Raw
1/** sources object with name of the file and content **/
2export interface SrcIfc {
3 [key: string]: {
4 content: string;
5 };
6}
7/** An object with final results of test **/
8export interface FinalResult {
9 totalPassing: number;
10 totalFailing: number;
11 totalTime: number;
12 errors: any[];
13}
14/** List of tests to run **/
15export interface RunListInterface {
16 name: string;
17 type: string;
18 constant: boolean;
19 payable: boolean;
20 signature?: any;
21}
22export interface ResultsInterface {
23 passingNum: number;
24 failureNum: number;
25 timePassed: number;
26}
27export interface TestResultInterface {
28 type: string;
29 value: any;
30 time?: number;
31 context?: string;
32 errMsg?: string;
33 filename?: string;
34}
35export interface TestCbInterface {
36 (error: Error | null | undefined, result: TestResultInterface): void;
37}
38export interface ResultCbInterface {
39 (error: Error | null | undefined, result: ResultsInterface): void;
40}
41export interface Options {
42 accounts?: string[] | null;
43 web3?: any;
44}
45export interface CompilerConfiguration {
46 currentCompilerUrl: string;
47 evmVersion: string;
48 optimize: boolean;
49 usingWorker: boolean;
50}
51/** sources object with name of the file and content **/
52export interface CompilationSource {
53 /** Identifier of the source (used in source maps) */
54 id: number;
55 /** The AST object */
56 ast: AstNode;
57 /** The legacy AST object */
58 legacyAST: AstNodeLegacy;
59}
60export interface AstNodeLegacy {
61 id: number;
62 name: string;
63 src: string;
64 children?: Array<AstNodeLegacy>;
65 attributes?: AstNodeAtt;
66}
67export interface AstNodeAtt {
68 operator?: string;
69 string?: null;
70 type?: string;
71 value?: string;
72 constant?: boolean;
73 name?: string;
74 public?: boolean;
75 exportedSymbols?: Object;
76 argumentTypes?: null;
77 absolutePath?: string;
78 [x: string]: any;
79}
80export interface AstNode {
81 absolutePath?: string;
82 exportedSymbols?: Object;
83 id: number;
84 nodeType: string;
85 nodes?: Array<AstNode>;
86 src: string;
87 literals?: Array<string>;
88 file?: string;
89 scope?: number;
90 sourceUnit?: number;
91 symbolAliases?: Array<string>;
92 [x: string]: any;
93}
94export interface compilationInterface {
95 [fileName: string]: {
96 [contract: string]: CompiledContract;
97 };
98}
99export interface ASTInterface {
100 [contractName: string]: CompilationSource;
101}
102export interface CompiledContract {
103 /** The Ethereum Contract ABI. If empty, it is represented as an empty array. */
104 abi: ABIDescription[];
105 metadata: string;
106 /** User documentation (natural specification) */
107 userdoc: UserDocumentation;
108 /** Developer documentation (natural specification) */
109 devdoc: DeveloperDocumentation;
110 /** Intermediate representation (string) */
111 ir: string;
112 /** EVM-related outputs */
113 evm: {
114 assembly: string;
115 legacyAssembly: {};
116 /** Bytecode and related details. */
117 bytecode: BytecodeObject;
118 deployedBytecode: BytecodeObject;
119 /** The list of function hashes */
120 methodIdentifiers: {
121 [functionIdentifier: string]: string;
122 };
123 gasEstimates: {
124 creation: {
125 codeDepositCost: string;
126 executionCost: 'infinite' | string;
127 totalCost: 'infinite' | string;
128 };
129 external: {
130 [functionIdentifier: string]: string;
131 };
132 internal: {
133 [functionIdentifier: string]: 'infinite' | string;
134 };
135 };
136 };
137}
138export declare type ABIDescription = FunctionDescription | EventDescription;
139export interface FunctionDescription {
140 /** Type of the method. default is 'function' */
141 type?: 'function' | 'constructor' | 'fallback' | 'receive';
142 /** The name of the function. Constructor and fallback function never have name */
143 name?: string;
144 /** List of parameters of the method. Fallback function doesn’t have inputs. */
145 inputs?: ABIParameter[];
146 /** List of the outputs parameters for the method, if any */
147 outputs?: ABIParameter[];
148 /** State mutability of the method */
149 stateMutability: 'pure' | 'view' | 'nonpayable' | 'payable';
150 /** true if function accepts Ether, false otherwise. Default is false */
151 payable?: boolean;
152 /** true if function is either pure or view, false otherwise. Default is false */
153 constant?: boolean;
154 signature?: string;
155}
156export interface EventDescription {
157 type: 'event';
158 name: string;
159 inputs: ABIParameter & {
160 /** true if the field is part of the log’s topics, false if it one of the log’s data segment. */
161 indexed: boolean;
162 }[];
163 /** true if the event was declared as anonymous. */
164 anonymous: boolean;
165}
166export interface ABIParameter {
167 /** The name of the parameter */
168 name: string;
169 /** The canonical type of the parameter */
170 type: ABITypeParameter;
171 /** Used for tuple types */
172 components?: ABIParameter[];
173}
174export declare type ABITypeParameter = 'uint' | 'uint[]' | 'int' | 'int[]' | 'address' | 'address[]' | 'bool' | 'bool[]' | 'fixed' | 'fixed[]' | 'ufixed' | 'ufixed[]' | 'bytes' | 'bytes[]' | 'function' | 'function[]' | 'tuple' | 'tuple[]' | string;
175export interface UserDocumentation {
176 methods: UserMethodList;
177 notice: string;
178}
179export declare type UserMethodList = {
180 [functionIdentifier: string]: UserMethodDoc;
181} & {
182 'constructor'?: string;
183};
184export interface UserMethodDoc {
185 notice: string;
186}
187export interface DeveloperDocumentation {
188 author: string;
189 title: string;
190 details: string;
191 methods: DevMethodList;
192}
193export interface DevMethodList {
194 [functionIdentifier: string]: DevMethodDoc;
195}
196export interface DevMethodDoc {
197 author: string;
198 details: string;
199 return: string;
200 params: {
201 [param: string]: string;
202 };
203}
204export interface BytecodeObject {
205 /** The bytecode as a hex string. */
206 object: string;
207 /** Opcodes list */
208 opcodes: string;
209 /** The source mapping as a string. See the source mapping definition. */
210 sourceMap: string;
211 /** If given, this is an unlinked object. */
212 linkReferences?: {
213 [contractName: string]: {
214 /** Byte offsets into the bytecode. */
215 [library: string]: {
216 start: number;
217 length: number;
218 }[];
219 };
220 };
221}