diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-10-16 05:11:05 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-10-16 05:11:05 +0800 |
commit | e7130af6a9756af303624c274116391c2244fe2e (patch) | |
tree | 00e34779131a462eee5e5e99b42b62450c143ea4 /packages/order-watcher/src | |
parent | f39541436a5088e928660b61bde7cef5153bc7a1 (diff) | |
parent | 83a36aff3fa750560cf6dd6b08b84a5915ea4c5d (diff) | |
download | dexon-sol-tools-e7130af6a9756af303624c274116391c2244fe2e.tar dexon-sol-tools-e7130af6a9756af303624c274116391c2244fe2e.tar.gz dexon-sol-tools-e7130af6a9756af303624c274116391c2244fe2e.tar.bz2 dexon-sol-tools-e7130af6a9756af303624c274116391c2244fe2e.tar.lz dexon-sol-tools-e7130af6a9756af303624c274116391c2244fe2e.tar.xz dexon-sol-tools-e7130af6a9756af303624c274116391c2244fe2e.tar.zst dexon-sol-tools-e7130af6a9756af303624c274116391c2244fe2e.zip |
Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/move-features-over-from-zrx-buyer
Diffstat (limited to 'packages/order-watcher/src')
-rw-r--r-- | packages/order-watcher/src/index.ts | 1 | ||||
-rw-r--r-- | packages/order-watcher/src/order_watcher/order_watcher.ts | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/packages/order-watcher/src/index.ts b/packages/order-watcher/src/index.ts index d2f91eab1..8280c73a4 100644 --- a/packages/order-watcher/src/index.ts +++ b/packages/order-watcher/src/index.ts @@ -7,6 +7,7 @@ export { OrderState, ExchangeContractErrs, OrderRelevantState, + Stats, } from '@0xproject/types'; export { OnOrderStateChangeCallback, OrderWatcherConfig } from './types'; diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts index f9a63efe3..eb37bd617 100644 --- a/packages/order-watcher/src/order_watcher/order_watcher.ts +++ b/packages/order-watcher/src/order_watcher/order_watcher.ts @@ -30,7 +30,7 @@ import { orderHashUtils, OrderStateUtils, } from '@0xproject/order-utils'; -import { AssetProxyId, ExchangeContractErrs, OrderState, SignedOrder } from '@0xproject/types'; +import { AssetProxyId, ExchangeContractErrs, OrderState, SignedOrder, Stats } from '@0xproject/types'; import { errorUtils, intervalUtils } from '@0xproject/utils'; import { BlockParamLiteral, LogEntryEvent, LogWithDecodedArgs, Provider } from 'ethereum-types'; import * as _ from 'lodash'; @@ -213,6 +213,14 @@ export class OrderWatcher { this._expirationWatcher.unsubscribe(); intervalUtils.clearAsyncExcludingInterval(this._cleanupJobIntervalIdIfExists); } + /** + * Gets statistics of the OrderWatcher Instance. + */ + public getStats(): Stats { + return { + orderCount: _.size(this._orderByOrderHash), + }; + } private async _cleanupAsync(): Promise<void> { for (const orderHash of _.keys(this._orderByOrderHash)) { this._cleanupOrderRelatedState(orderHash); |