diff options
author | Leonid <logvinov.leon@gmail.com> | 2017-10-06 20:24:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-06 20:24:42 +0800 |
commit | f38d2f80a6e3af4ff7e2454d42abdf2a389e4303 (patch) | |
tree | 9e2f94e7d8236f7612628288d7eab3333d240b6b /src/web3_wrapper.ts | |
parent | cd5327bc31618b4ea268de1902a74cf862987ee6 (diff) | |
parent | 0c112a2a1c1811e1fc7c4b03881f960b952c788c (diff) | |
download | dexon-sol-tools-f38d2f80a6e3af4ff7e2454d42abdf2a389e4303.tar dexon-sol-tools-f38d2f80a6e3af4ff7e2454d42abdf2a389e4303.tar.gz dexon-sol-tools-f38d2f80a6e3af4ff7e2454d42abdf2a389e4303.tar.bz2 dexon-sol-tools-f38d2f80a6e3af4ff7e2454d42abdf2a389e4303.tar.lz dexon-sol-tools-f38d2f80a6e3af4ff7e2454d42abdf2a389e4303.tar.xz dexon-sol-tools-f38d2f80a6e3af4ff7e2454d42abdf2a389e4303.tar.zst dexon-sol-tools-f38d2f80a6e3af4ff7e2454d42abdf2a389e4303.zip |
Merge pull request #182 from 0xProject/feature/ethereumjs-blockstream
Rewrite subscriptions
Diffstat (limited to 'src/web3_wrapper.ts')
-rw-r--r-- | src/web3_wrapper.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/web3_wrapper.ts b/src/web3_wrapper.ts index 7576f3d40..9de75c809 100644 --- a/src/web3_wrapper.ts +++ b/src/web3_wrapper.ts @@ -94,8 +94,12 @@ export class Web3Wrapper { const signData = await promisify(this.web3.eth.sign)(address, message); return signData; } - public async getBlockTimestampAsync(blockHash: string): Promise<number> { - const {timestamp} = await promisify(this.web3.eth.getBlock)(blockHash); + public async getBlockAsync(blockParam: string|Web3.BlockParam): Promise<Web3.BlockWithoutTransactionData> { + const block = await promisify(this.web3.eth.getBlock)(blockParam); + return block; + } + public async getBlockTimestampAsync(blockParam: string|Web3.BlockParam): Promise<number> { + const {timestamp} = await this.getBlockAsync(blockParam); return timestamp; } public async getAvailableAddressesAsync(): Promise<string[]> { @@ -112,10 +116,6 @@ export class Web3Wrapper { const logs = await this.sendRawPayloadAsync(payload); return logs; } - public keccak256(data: string): string { - const hash = this.web3.sha3(data); - return hash; - } private getContractInstance<A extends Web3.ContractInstance>(abi: Web3.ContractAbi, address: string): A { const web3ContractInstance = this.web3.eth.contract(abi).at(address); const contractInstance = new Contract(web3ContractInstance, this.defaults) as any as A; |