diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-11-13 01:53:03 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-11-13 09:06:13 +0800 |
commit | f5608d2c94bcee05a76ef102f235f5e860820567 (patch) | |
tree | 5749dd899f803e4f2357d60cf038a607b1852759 /src/order_watcher/order_state_watcher.ts | |
parent | bcad937003fa925878d34e5fa83e5a89369d0957 (diff) | |
download | dexon-sol-tools-f5608d2c94bcee05a76ef102f235f5e860820567.tar dexon-sol-tools-f5608d2c94bcee05a76ef102f235f5e860820567.tar.gz dexon-sol-tools-f5608d2c94bcee05a76ef102f235f5e860820567.tar.bz2 dexon-sol-tools-f5608d2c94bcee05a76ef102f235f5e860820567.tar.lz dexon-sol-tools-f5608d2c94bcee05a76ef102f235f5e860820567.tar.xz dexon-sol-tools-f5608d2c94bcee05a76ef102f235f5e860820567.tar.zst dexon-sol-tools-f5608d2c94bcee05a76ef102f235f5e860820567.zip |
Pass blockStore to eventWatcher
Diffstat (limited to 'src/order_watcher/order_state_watcher.ts')
-rw-r--r-- | src/order_watcher/order_state_watcher.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/order_watcher/order_state_watcher.ts b/src/order_watcher/order_state_watcher.ts index 59de1cc2f..685d67455 100644 --- a/src/order_watcher/order_state_watcher.ts +++ b/src/order_watcher/order_state_watcher.ts @@ -61,7 +61,6 @@ export class OrderStateWatcher { private _abiDecoder: AbiDecoder; private _orderStateUtils: OrderStateUtils; private _blockStore: BlockStore; - private _numConfirmations: number; private _orderFilledCancelledLazyStore: OrderFilledCancelledLazyStore; private _balanceAndProxyAllowanceLazyStore: BalanceAndProxyAllowanceLazyStore; constructor( @@ -76,15 +75,18 @@ 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(this._web3Wrapper, blockPollingIntervalMs); this._eventWatcher = new EventWatcher( - web3Wrapper, eventPollingIntervalMs, this._numConfirmations, + web3Wrapper, this._blockStore, eventPollingIntervalMs, numConfirmations, ); - this._blockStore = new BlockStore(this._web3Wrapper, blockPollingIntervalMs); this._balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore( - this._token, this._blockStore, this._numConfirmations, + this._token, this._blockStore, numConfirmations, ); this._orderFilledCancelledLazyStore = new OrderFilledCancelledLazyStore( - this._exchange, this._blockStore, this._numConfirmations, + this._exchange, this._blockStore, numConfirmations, ); this._orderStateUtils = new OrderStateUtils( this._balanceAndProxyAllowanceLazyStore, this._orderFilledCancelledLazyStore, @@ -159,6 +161,7 @@ export class OrderStateWatcher { // Invalidate cache const args = decodedLog.args as ApprovalContractEventArgs; this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(decodedLog.address, args._owner); + // Revalidate orders makerToken = decodedLog.address; makerAddress = args._owner; orderHashesSet = _.get(this._dependentOrderHashes, [makerAddress, makerToken]); |