From da404b9acca1dbe0111d2a1662dffe85fe8a3cd9 Mon Sep 17 00:00:00 2001 From: Sergey Ukustov Date: Tue, 18 Jul 2017 23:15:34 +0300 Subject: Extract API interfaces: web3.version, web3.eth, web3.personal --- packages/web3-typescript-typings/index.d.ts | 61 +++++++++++++++++------------ 1 file changed, 36 insertions(+), 25 deletions(-) (limited to 'packages') 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(abi: Web3.ContractAbi): Web3.Contract; - 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(abi: Web3.ContractAbi): Web3.Contract; + 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; -- cgit v1.2.3