UNPKG

1.4 kBTypeScriptView Raw
1export interface ABIDefinition {
2 constant?: boolean;
3 payable?: boolean;
4 anonymous?: boolean;
5 inputs?: Array<{ name: string; type: ABIDataTypes; indexed?: boolean }>;
6 name?: string;
7 outputs?: Array<{ name: string; type: ABIDataTypes }>;
8 type: "function" | "constructor" | "event" | "fallback";
9}
10
11type ABIDataTypes = "uint256" | "boolean" | "string" | "bytes" | string; // TODO complete list
12
13export default interface ABI {
14 decodeLog(inputs: object, hexString: string, topics: string[]): object;
15 encodeParameter(type: string, parameter: any): string;
16 encodeParameters(types: string[], paramaters: any[]): string;
17 encodeEventSignature(name: string | object): string;
18 encodeFunctionCall(jsonInterface: object, parameters: any[]): string;
19 encodeFunctionSignature(name: string | object): string;
20 decodeParameter(type: string, hex: string): any;
21 decodeParameters(
22 types: string[],
23 hex: string
24 ): EthAbiDecodeParametersResultArray;
25 decodeParameters(
26 types: EthAbiDecodeParametersType[],
27 hex: string
28 ): EthAbiDecodeParametersResultObject;
29}
30
31interface EthAbiDecodeParametersType {
32 name: string;
33 type: string;
34}
35interface EthAbiDecodeParametersResultArray {
36 [index: number]: any;
37}
38type EthAbiDecodeParametersResultObject = EthAbiDecodeParametersResultArray & {
39 [key: string]: any;
40};