diff options
author | Fabio Berger <me@fabioberger.com> | 2018-07-17 18:04:29 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-07-17 18:04:29 +0800 |
commit | 1e787a764615bd3df839f2cb117b711be297b9d5 (patch) | |
tree | 43a61a3a8b75b3f69428525fb4ec3a9d97d46b18 | |
parent | 766ac3f1febcb6f6e4f6c20198283f01b278f671 (diff) | |
download | dexon-sol-tools-1e787a764615bd3df839f2cb117b711be297b9d5.tar dexon-sol-tools-1e787a764615bd3df839f2cb117b711be297b9d5.tar.gz dexon-sol-tools-1e787a764615bd3df839f2cb117b711be297b9d5.tar.bz2 dexon-sol-tools-1e787a764615bd3df839f2cb117b711be297b9d5.tar.lz dexon-sol-tools-1e787a764615bd3df839f2cb117b711be297b9d5.tar.xz dexon-sol-tools-1e787a764615bd3df839f2cb117b711be297b9d5.tar.zst dexon-sol-tools-1e787a764615bd3df839f2cb117b711be297b9d5.zip |
Remove stateLayer OrderWatcher config and instead temporarily hard-code until we get pending block to work with Blockstream
-rw-r--r-- | packages/0x.js/CHANGELOG.json | 4 | ||||
-rw-r--r-- | packages/order-watcher/CHANGELOG.json | 4 | ||||
-rw-r--r-- | packages/order-watcher/src/order_watcher/event_watcher.ts | 2 | ||||
-rw-r--r-- | packages/order-watcher/src/order_watcher/order_watcher.ts | 9 | ||||
-rw-r--r-- | packages/order-watcher/src/types.ts | 2 |
5 files changed, 13 insertions, 8 deletions
diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index 3ec09cd7e..9419311dd 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -32,6 +32,10 @@ { "note": "0x.js exports renamed contract events and event arg types", "pr": 863 + }, + { + "note": "Remove stateLayer config from OrderWatcher. It now always operates on the latest block", + "pr": 875 } ] }, diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index d80231dae..e747a2129 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -13,6 +13,10 @@ { "note": "Fixed a bug that caused the incorrect block to be fetched via JSON-RPC within Blockstream", "pr": 875 + }, + { + "note": "Remove stateLayer config from OrderWatcher. It now always operates on the latest block", + "pr": 875 } ], "timestamp": 1531149657 diff --git a/packages/order-watcher/src/order_watcher/event_watcher.ts b/packages/order-watcher/src/order_watcher/event_watcher.ts index 1cd198a62..60a3c6297 100644 --- a/packages/order-watcher/src/order_watcher/event_watcher.ts +++ b/packages/order-watcher/src/order_watcher/event_watcher.ts @@ -30,7 +30,7 @@ export class EventWatcher { constructor( web3Wrapper: Web3Wrapper, pollingIntervalIfExistsMs: undefined | number, - stateLayer: BlockParamLiteral = BlockParamLiteral.Latest, + stateLayer: BlockParamLiteral, isVerbose: boolean, ) { this._isVerbose = isVerbose; diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts index b09ba8d9d..95671684f 100644 --- a/packages/order-watcher/src/order_watcher/order_watcher.ts +++ b/packages/order-watcher/src/order_watcher/order_watcher.ts @@ -61,6 +61,7 @@ interface OrderStateByOrderHash { // tslint:disable-next-line:custom-no-magic-numbers const DEFAULT_CLEANUP_JOB_INTERVAL_MS = 1000 * 60 * 60; // 1h +const STATE_LAYER = BlockParamLiteral.Latest; /** * This class includes all the functionality related to watching a set of orders @@ -91,17 +92,15 @@ export class OrderWatcher { }); this._contractWrappers = new ContractWrappers(provider, { networkId }); const pollingIntervalIfExistsMs = _.isUndefined(config) ? undefined : config.eventPollingIntervalMs; - const stateLayer = - _.isUndefined(config) || _.isUndefined(config.stateLayer) ? BlockParamLiteral.Latest : config.stateLayer; const isVerbose = !_.isUndefined(config) && !_.isUndefined(config.isVerbose) ? config.isVerbose : false; - this._eventWatcher = new EventWatcher(this._web3Wrapper, pollingIntervalIfExistsMs, stateLayer, isVerbose); + this._eventWatcher = new EventWatcher(this._web3Wrapper, pollingIntervalIfExistsMs, STATE_LAYER, isVerbose); this._balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore( this._contractWrappers.token, - stateLayer, + STATE_LAYER, ); this._orderFilledCancelledLazyStore = new OrderFilledCancelledLazyStore( this._contractWrappers.exchange, - stateLayer, + STATE_LAYER, ); this._orderStateUtils = new OrderStateUtils( this._balanceAndProxyAllowanceLazyStore, diff --git a/packages/order-watcher/src/types.ts b/packages/order-watcher/src/types.ts index 63e4e7848..f8ec91a51 100644 --- a/packages/order-watcher/src/types.ts +++ b/packages/order-watcher/src/types.ts @@ -13,10 +13,8 @@ export type EventWatcherCallback = (err: null | Error, log?: LogEntryEvent) => v * expirationMarginMs: Amount of time before order expiry that you'd like to be notified * of an orders expiration. Default=0. * cleanupJobIntervalMs: How often to run a cleanup job which revalidates all the orders. Default=1hr. - * stateLayer: Optional blockchain state layer OrderWatcher will monitor for new events. Default=latest. */ export interface OrderWatcherConfig { - stateLayer: BlockParamLiteral; orderExpirationCheckingIntervalMs?: number; eventPollingIntervalMs?: number; expirationMarginMs?: number; |