aboutsummaryrefslogtreecommitdiffstats
path: root/src/order_watcher/order_state_watcher.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-11-13 07:10:47 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-13 09:06:13 +0800
commit84c965d459b948eb03cb8a70a66663bd7b35f463 (patch)
treefbcb47a43d4b029c2f1a46644eb64ca1d75f5921 /src/order_watcher/order_state_watcher.ts
parent22cd6989a0217f2a49e59ce64bcc69b2c238aba4 (diff)
downloaddexon-sol-tools-84c965d459b948eb03cb8a70a66663bd7b35f463.tar
dexon-sol-tools-84c965d459b948eb03cb8a70a66663bd7b35f463.tar.gz
dexon-sol-tools-84c965d459b948eb03cb8a70a66663bd7b35f463.tar.bz2
dexon-sol-tools-84c965d459b948eb03cb8a70a66663bd7b35f463.tar.lz
dexon-sol-tools-84c965d459b948eb03cb8a70a66663bd7b35f463.tar.xz
dexon-sol-tools-84c965d459b948eb03cb8a70a66663bd7b35f463.tar.zst
dexon-sol-tools-84c965d459b948eb03cb8a70a66663bd7b35f463.zip
Remove blockStore and default to numConfirmations === 0
Diffstat (limited to 'src/order_watcher/order_state_watcher.ts')
-rw-r--r--src/order_watcher/order_state_watcher.ts20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/order_watcher/order_state_watcher.ts b/src/order_watcher/order_state_watcher.ts
index ab80f231f..c40131bcb 100644
--- a/src/order_watcher/order_state_watcher.ts
+++ b/src/order_watcher/order_state_watcher.ts
@@ -26,7 +26,6 @@ import {
ZeroExError,
} from '../types';
import {Web3Wrapper} from '../web3_wrapper';
-import {BlockStore} from '../stores/block_store';
import {TokenWrapper} from '../contract_wrappers/token_wrapper';
import {ExchangeWrapper} from '../contract_wrappers/exchange_wrapper';
import {OrderFilledCancelledLazyStore} from '../stores/order_filled_cancelled_lazy_store';
@@ -60,7 +59,6 @@ export class OrderStateWatcher {
private _exchange: ExchangeWrapper;
private _abiDecoder: AbiDecoder;
private _orderStateUtils: OrderStateUtils;
- private _blockStore: BlockStore;
private _orderFilledCancelledLazyStore: OrderFilledCancelledLazyStore;
private _balanceAndProxyAllowanceLazyStore: BalanceAndProxyAllowanceLazyStore;
constructor(
@@ -75,19 +73,11 @@ export class OrderStateWatcher {
this._dependentOrderHashes = {};
const eventPollingIntervalMs = _.isUndefined(config) ? undefined : config.eventPollingIntervalMs;
const blockPollingIntervalMs = _.isUndefined(config) ? undefined : config.blockPollingIntervalMs;
- const numConfirmations = (_.isUndefined(config) || _.isUndefined(config.numConfirmations)) ?
- DEFAULT_NUM_CONFIRMATIONS :
- config.numConfirmations;
- this._blockStore = new BlockStore(numConfirmations, this._web3Wrapper, blockPollingIntervalMs);
- this._eventWatcher = new EventWatcher(
- web3Wrapper, this._blockStore, eventPollingIntervalMs,
- );
+ this._eventWatcher = new EventWatcher(web3Wrapper, eventPollingIntervalMs);
this._balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(
- this._token, this._blockStore,
- );
- this._orderFilledCancelledLazyStore = new OrderFilledCancelledLazyStore(
- this._exchange, this._blockStore,
+ this._token,
);
+ this._orderFilledCancelledLazyStore = new OrderFilledCancelledLazyStore(this._exchange);
this._orderStateUtils = new OrderStateUtils(
this._balanceAndProxyAllowanceLazyStore, this._orderFilledCancelledLazyStore,
);
@@ -123,12 +113,11 @@ export class OrderStateWatcher {
* @param callback Receives the orderHash of the order that should be re-validated, together
* with all the order-relevant blockchain state needed to re-validate the order.
*/
- public async subscribeAsync(callback: OnOrderStateChangeCallback): Promise<void> {
+ public subscribe(callback: OnOrderStateChangeCallback): void {
assert.isFunction('callback', callback);
if (!_.isUndefined(this._callbackIfExistsAsync)) {
throw new Error(ZeroExError.SubscriptionAlreadyPresent);
}
- await this._blockStore.startAsync();
this._callbackIfExistsAsync = callback;
this._eventWatcher.subscribe(this._onEventWatcherCallbackAsync.bind(this));
}
@@ -139,7 +128,6 @@ export class OrderStateWatcher {
if (_.isUndefined(this._callbackIfExistsAsync)) {
throw new Error(ZeroExError.SubscriptionNotFound);
}
- this._blockStore.stop();
this._balanceAndProxyAllowanceLazyStore.deleteAll();
this._orderFilledCancelledLazyStore.deleteAll();
delete this._callbackIfExistsAsync;