diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-10-04 20:36:57 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-10-05 20:35:37 +0800 |
commit | e37a3155cd52d35da3eef9a8dc450b9b3df0b888 (patch) | |
tree | de2e57b09c63e734d81f7635d7cd9c2ffe2a46de /src/contract_wrappers/contract_wrapper.ts | |
parent | 542cf7b1cb04cd86da86fc1ff39fdcbd1b9b0403 (diff) | |
download | dexon-0x-contracts-e37a3155cd52d35da3eef9a8dc450b9b3df0b888.tar.gz dexon-0x-contracts-e37a3155cd52d35da3eef9a8dc450b9b3df0b888.tar.zst dexon-0x-contracts-e37a3155cd52d35da3eef9a8dc450b9b3df0b888.zip |
Instantiate logAndBlockStreamer
Diffstat (limited to 'src/contract_wrappers/contract_wrapper.ts')
-rw-r--r-- | src/contract_wrappers/contract_wrapper.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/contract_wrappers/contract_wrapper.ts b/src/contract_wrappers/contract_wrapper.ts index 743dfc9b2..927a09b52 100644 --- a/src/contract_wrappers/contract_wrapper.ts +++ b/src/contract_wrappers/contract_wrapper.ts @@ -1,6 +1,7 @@ import * as _ from 'lodash'; import * as Web3 from 'web3'; import * as ethUtil from 'ethereumjs-util'; +import {BlockAndLogStreamer} from 'ethereumjs-blockstream'; import {Web3Wrapper} from '../web3_wrapper'; import {AbiDecoder} from '../utils/abi_decoder'; import { @@ -19,9 +20,15 @@ const TOPIC_LENGTH = 32; export class ContractWrapper { protected _web3Wrapper: Web3Wrapper; private _abiDecoder?: AbiDecoder; + private _blockAndLogStreamer: BlockAndLogStreamer; constructor(web3Wrapper: Web3Wrapper, abiDecoder?: AbiDecoder) { this._web3Wrapper = web3Wrapper; this._abiDecoder = abiDecoder; + const getBlockAsync = async (hash: string) => this._web3Wrapper.getBlockAsync(hash); + this._blockAndLogStreamer = new BlockAndLogStreamer( + this._web3Wrapper.getBlockAsync.bind(this._web3Wrapper), + this._web3Wrapper.getLogsAsync.bind(this._web3Wrapper), + ); } protected async _getLogsAsync(address: string, eventName: ContractEvents, subscriptionOpts: SubscriptionOpts, indexFilterValues: IndexedFilterValues, |