aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Ukustov <sergey@ukstv.me>2017-07-19 04:15:34 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-01-10 18:24:34 +0800
commitda404b9acca1dbe0111d2a1662dffe85fe8a3cd9 (patch)
treeda4cfaf98e7013e8fb7bf915f9083836362e549e
parentda8db153beac5e33351ba93c9769a413d073f5fe (diff)
downloaddexon-sol-tools-da404b9acca1dbe0111d2a1662dffe85fe8a3cd9.tar
dexon-sol-tools-da404b9acca1dbe0111d2a1662dffe85fe8a3cd9.tar.gz
dexon-sol-tools-da404b9acca1dbe0111d2a1662dffe85fe8a3cd9.tar.bz2
dexon-sol-tools-da404b9acca1dbe0111d2a1662dffe85fe8a3cd9.tar.lz
dexon-sol-tools-da404b9acca1dbe0111d2a1662dffe85fe8a3cd9.tar.xz
dexon-sol-tools-da404b9acca1dbe0111d2a1662dffe85fe8a3cd9.tar.zst
dexon-sol-tools-da404b9acca1dbe0111d2a1662dffe85fe8a3cd9.zip
Extract API interfaces: web3.version, web3.eth, web3.personal
-rw-r--r--packages/web3-typescript-typings/index.d.ts61
1 files changed, 36 insertions, 25 deletions
diff --git a/packages/web3-typescript-typings/index.d.ts b/packages/web3-typescript-typings/index.d.ts
index 6e1c2655c..18ad5a27f 100644
--- a/packages/web3-typescript-typings/index.d.ts
+++ b/packages/web3-typescript-typings/index.d.ts
@@ -7,31 +7,9 @@ declare module 'web3' {
public constructor(provider?: Web3.Provider);
- public version: {
- getNetwork(cd: (err: Error, networkId: string) => void): void;
- getNode(cd: (err: Error, nodeVersion: string) => void): void;
- };
-
- public eth: {
- coinbase: string;
- defaultAccount: string;
- compile: {
- solidity(sourceString: string, cb?: (err: any, result: any) => void): object,
- };
- blockNumber: number;
- 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<A>(abi: Web3.ContractAbi): Web3.Contract<A>;
- getBalance(addressHexString: string,
- callback?: (err: any, result: BigNumber.BigNumber) => void): BigNumber.BigNumber;
- getCode(addressHexString: string,
- callback?: (err: any, code: string) => void): string;
- filter(value: string|Web3.FilterObject): Web3.FilterResult;
- getAccounts(callback: (err: Error, value: any) => void): string[];
- sendTransaction(txData: any, callback: (err: Error, value: any) => void): void;
- getTransactionReceipt(txHash: string, callback: (err: Error, receipt: any) => void): void;
- };
+ public version: Web3.VersionApi;
+ public eth: Web3.EthApi;
+ public personal: Web3.PersonalApi | undefined;
public setProvider(provider: Web3.Provider): void;
public currentProvider: Web3.Provider;
@@ -107,6 +85,39 @@ declare module 'web3' {
interface Sha3Options {
encoding: string;
}
+
+ interface EthApi {
+ coinbase: string;
+ defaultAccount: string;
+ compile: {
+ solidity(sourceString: string, cb?: (err: any, result: any) => void): object,
+ };
+ blockNumber: number;
+ 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<A>(abi: Web3.ContractAbi): Web3.Contract<A>;
+ getBalance(addressHexString: string,
+ callback?: (err: any, result: BigNumber.BigNumber) => void): BigNumber.BigNumber;
+ getCode(addressHexString: string,
+ callback?: (err: any, code: string) => void): string;
+ filter(value: string|Web3.FilterObject): Web3.FilterResult;
+ getAccounts(callback: (err: Error, value: any) => void): string[];
+ sendTransaction(txData: any, callback: (err: Error, value: any) => void): void;
+ getTransactionReceipt(txHash: string, callback: (err: Error, receipt: any) => void): void;
+ }
+
+ interface VersionApi {
+ getNetwork(cd: (err: Error, networkId: string) => void): void;
+ getNode(cd: (err: Error, nodeVersion: string) => void): void;
+ }
+
+ interface PersonalApi {
+ listAccounts: string[] | undefined;
+ newAccount(password?: string): string;
+ unlockAccount(address: string, password?: string, duration?: number): boolean
+ lockAccount(address: string): boolean
+ }
}
/* tslint:disable */
export = Web3;