aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/web3-typescript-typings/index.d.ts36
1 files changed, 26 insertions, 10 deletions
diff --git a/packages/web3-typescript-typings/index.d.ts b/packages/web3-typescript-typings/index.d.ts
index b604d3450..3deb96c24 100644
--- a/packages/web3-typescript-typings/index.d.ts
+++ b/packages/web3-typescript-typings/index.d.ts
@@ -19,7 +19,7 @@ declare module 'web3' {
sign(address: string, message: string, callback: (err: Error, signData: string) => void): string;
getBlock(blockHash: string, callback: (err: Error, blockObj: any) => void): BigNumber.BigNumber;
getBlockNumber(callback: (err: Error, blockNumber: number) => void): void;
- contract(abi: Web3.AbiDefinition[]): Web3.Contract;
+ contract<A>(abi: Web3.ContractAbi): Web3.Contract<A>;
getBalance(addressHexString: string,
callback?: (err: any, result: BigNumber.BigNumber) => void): BigNumber.BigNumber;
getCode(addressHexString: string,
@@ -44,21 +44,39 @@ declare module 'web3' {
}
namespace Web3 {
- interface AbiIOParameter {
+ type ContractAbi = Array<AbiDefinition>;
+
+ type AbiDefinition = FunctionDescription | EventDescription;
+
+ interface FunctionDescription {
+ type: "function" | "constructor" | "fallback";
+ name: string;
+ inputs: Array<FunctionParameter>;
+ outputs?: Array<FunctionParameter>;
+ constant: boolean;
+ payable: boolean;
+ }
+
+ interface EventParameter {
name: string;
type: string;
+ indexed: boolean;
}
- interface AbiDefinition {
- constants: boolean;
- inputs: AbiIOParameter[];
+ interface EventDescription {
+ type: "event";
+ name: string;
+ inputs: Array<EventParameter>;
+ anonymous: boolean;
+ }
+
+ interface FunctionParameter {
name: string;
- outputs: AbiIOParameter[];
type: string;
}
- interface Contract {
- at(address: string): ContractInstance;
+ interface Contract<A> {
+ at(address: string): A;
}
interface FilterObject {
@@ -80,8 +98,6 @@ declare module 'web3' {
stopWatching(callback: () => void): void;
}
- interface ContractInstance {}
-
interface Provider {}
}
/* tslint:disable */