aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Ukustov <sergey@ukstv.me>2017-07-10 07:30:10 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-01-10 18:24:33 +0800
commit4ff5afecc8f7314ebd04bd4a41c393d05e790ed9 (patch)
tree52ed8d1a457f0b3a29855813c3875c96a232f5a5
parent2eabb439d91f77f73ac37d6fc794cdbdffc45c98 (diff)
downloaddexon-sol-tools-4ff5afecc8f7314ebd04bd4a41c393d05e790ed9.tar.gz
dexon-sol-tools-4ff5afecc8f7314ebd04bd4a41c393d05e790ed9.tar.zst
dexon-sol-tools-4ff5afecc8f7314ebd04bd4a41c393d05e790ed9.zip
Revamp AbiDefinition
-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 */