aboutsummaryrefslogtreecommitdiffstats
path: root/src/contract_wrappers
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-10-04 20:36:57 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-10-05 20:35:37 +0800
commite37a3155cd52d35da3eef9a8dc450b9b3df0b888 (patch)
treede2e57b09c63e734d81f7635d7cd9c2ffe2a46de /src/contract_wrappers
parent542cf7b1cb04cd86da86fc1ff39fdcbd1b9b0403 (diff)
downloaddexon-sol-tools-e37a3155cd52d35da3eef9a8dc450b9b3df0b888.tar
dexon-sol-tools-e37a3155cd52d35da3eef9a8dc450b9b3df0b888.tar.gz
dexon-sol-tools-e37a3155cd52d35da3eef9a8dc450b9b3df0b888.tar.bz2
dexon-sol-tools-e37a3155cd52d35da3eef9a8dc450b9b3df0b888.tar.lz
dexon-sol-tools-e37a3155cd52d35da3eef9a8dc450b9b3df0b888.tar.xz
dexon-sol-tools-e37a3155cd52d35da3eef9a8dc450b9b3df0b888.tar.zst
dexon-sol-tools-e37a3155cd52d35da3eef9a8dc450b9b3df0b888.zip
Instantiate logAndBlockStreamer
Diffstat (limited to 'src/contract_wrappers')
-rw-r--r--src/contract_wrappers/contract_wrapper.ts7
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,