diff options
author | Kadinsky <kandinsky454@protonmail.ch> | 2018-10-15 19:25:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-15 19:25:24 +0800 |
commit | 79db7147a4f9664372516fb391f69f2d9e1c0b8c (patch) | |
tree | b3306cd8f798906d7577f7900ed602105dcf2d45 /packages/order-watcher/src | |
parent | 23fb8dab132c0228c90ae1a9ceb8fce56fade139 (diff) | |
parent | 69e9dbd68323439ac817e71c610dfae3716bee26 (diff) | |
download | dexon-sol-tools-79db7147a4f9664372516fb391f69f2d9e1c0b8c.tar dexon-sol-tools-79db7147a4f9664372516fb391f69f2d9e1c0b8c.tar.gz dexon-sol-tools-79db7147a4f9664372516fb391f69f2d9e1c0b8c.tar.bz2 dexon-sol-tools-79db7147a4f9664372516fb391f69f2d9e1c0b8c.tar.lz dexon-sol-tools-79db7147a4f9664372516fb391f69f2d9e1c0b8c.tar.xz dexon-sol-tools-79db7147a4f9664372516fb391f69f2d9e1c0b8c.tar.zst dexon-sol-tools-79db7147a4f9664372516fb391f69f2d9e1c0b8c.zip |
Merge pull request #1118 from BEcorp/development
[order-watcher] Public function getStats
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); |