Extend Abi types

This commit is contained in:
Leonid Logvinov
2017-09-04 12:57:03 +02:00
parent d9df82f31d
commit be20e04c7b

View File

@@ -42,15 +42,28 @@ declare module 'web3' {
namespace Web3 { namespace Web3 {
type ContractAbi = AbiDefinition[]; type ContractAbi = AbiDefinition[];
type AbiDefinition = FunctionDescription|EventDescription; type AbiDefinition = FunctionAbi|EventAbi;
interface FunctionDescription { type FunctionAbi = MethodAbi|ConstructorAbi|FallbackAbi;
type: 'function'|'constructor'|'fallback';
name?: string; interface MethodAbi {
type: 'function';
name: string;
inputs: FunctionParameter[]; inputs: FunctionParameter[];
outputs?: FunctionParameter[]; outputs: FunctionParameter[];
constant?: boolean; constant: boolean;
payable?: boolean; payable: boolean;
}
interface ConstructorAbi {
type: 'constructor';
inputs: FunctionParameter[];
payable: boolean;
}
interface FallbackAbi {
type: 'fallback';
payable: boolean;
} }
interface EventParameter { interface EventParameter {
@@ -59,7 +72,7 @@ declare module 'web3' {
indexed: boolean; indexed: boolean;
} }
interface EventDescription { interface EventAbi {
type: 'event'; type: 'event';
name: string; name: string;
inputs: EventParameter[]; inputs: EventParameter[];