aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher/src
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-12-17 10:00:23 +0800
committerFabio Berger <me@fabioberger.com>2018-12-17 10:00:23 +0800
commita12b9e82f61ac136876f9d4b72b45aad266317cf (patch)
treecedc18a79b993efafaf07dd937f803d0c482794e /packages/order-watcher/src
parent5d0e715d9ac9f358c1cdf23c9c96d622e0f1060c (diff)
downloaddexon-sol-tools-a12b9e82f61ac136876f9d4b72b45aad266317cf.tar
dexon-sol-tools-a12b9e82f61ac136876f9d4b72b45aad266317cf.tar.gz
dexon-sol-tools-a12b9e82f61ac136876f9d4b72b45aad266317cf.tar.bz2
dexon-sol-tools-a12b9e82f61ac136876f9d4b72b45aad266317cf.tar.lz
dexon-sol-tools-a12b9e82f61ac136876f9d4b72b45aad266317cf.tar.xz
dexon-sol-tools-a12b9e82f61ac136876f9d4b72b45aad266317cf.tar.zst
dexon-sol-tools-a12b9e82f61ac136876f9d4b72b45aad266317cf.zip
Consolidate use of isVerbose in orderWatcherConfig
Diffstat (limited to 'packages/order-watcher/src')
-rw-r--r--packages/order-watcher/src/order_watcher/order_watcher_websocket_server.ts16
1 files changed, 9 insertions, 7 deletions
diff --git a/packages/order-watcher/src/order_watcher/order_watcher_websocket_server.ts b/packages/order-watcher/src/order_watcher/order_watcher_websocket_server.ts
index 2e29e775a..b75b07603 100644
--- a/packages/order-watcher/src/order_watcher/order_watcher_websocket_server.ts
+++ b/packages/order-watcher/src/order_watcher/order_watcher_websocket_server.ts
@@ -47,18 +47,20 @@ export class OrderWatcherWebSocketServer {
* @param networkId NetworkId to watch orders on.
* @param contractAddresses Optional contract addresses. Defaults to known
* addresses based on networkId.
- * @param partialConfig Optional configurations.
+ * @param orderWatcherConfig OrderWatcher configurations. isVerbose sets the verbosity for the WebSocket server aswell.
* @param isVerbose Whether to enable verbose logging. Defaults to true.
*/
constructor(
provider: Provider,
networkId: number,
contractAddresses?: ContractAddresses,
- isVerbose: boolean = true,
- partialConfig?: Partial<OrderWatcherConfig>,
+ orderWatcherConfig?: Partial<OrderWatcherConfig>,
) {
- this._isVerbose = isVerbose;
- this._orderWatcher = new OrderWatcher(provider, networkId, contractAddresses, partialConfig);
+ this._isVerbose =
+ orderWatcherConfig !== undefined && orderWatcherConfig.isVerbose !== undefined
+ ? orderWatcherConfig.isVerbose
+ : true;
+ this._orderWatcher = new OrderWatcher(provider, networkId, contractAddresses, orderWatcherConfig);
this._connectionStore = new Set();
this._httpServer = http.createServer();
this._wsServer = new WebSocket.server({
@@ -161,10 +163,10 @@ export class OrderWatcherWebSocketServer {
}
case OrderWatcherMethod.GetStats: {
return this._orderWatcher.getStats();
- break;
}
default:
- // Should never reach here. Should be caught by JSON schema check.
+ // Should never reach here. Should be caught by JSON schema check.
+ throw new Error(`Unexpected default case hit for request.method`);
}
return undefined;
}