diff options
Diffstat (limited to 'src/mempool')
-rw-r--r-- | src/mempool/order_state_watcher.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mempool/order_state_watcher.ts b/src/mempool/order_state_watcher.ts index 63e812054..d0bf5d89c 100644 --- a/src/mempool/order_state_watcher.ts +++ b/src/mempool/order_state_watcher.ts @@ -17,6 +17,7 @@ import { OnOrderStateChangeCallback, ExchangeEvents, TokenEvents, + ZeroExError, } from '../types'; import {Web3Wrapper} from '../web3_wrapper'; @@ -85,6 +86,9 @@ export class OrderStateWatcher { */ public subscribe(callback: OnOrderStateChangeCallback, numConfirmations: number): void { assert.isFunction('callback', callback); + if (!_.isUndefined(this._callbackAsync)) { + throw new Error(ZeroExError.SubscriptionAlreadyPresent); + } this._callbackAsync = callback; this._eventWatcher.subscribe(this._onMempoolEventCallbackAsync.bind(this), numConfirmations); } |