Consolidate use of isVerbose in orderWatcherConfig
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ interface WsMessage {
|
||||
data: string;
|
||||
}
|
||||
|
||||
describe.only('OrderWatcherWebSocketServer', async () => {
|
||||
describe('OrderWatcherWebSocketServer', async () => {
|
||||
let contractWrappers: ContractWrappers;
|
||||
let wsServer: OrderWatcherWebSocketServer;
|
||||
let wsClient: WebSocket.w3cwebsocket;
|
||||
@@ -42,8 +42,6 @@ describe.only('OrderWatcherWebSocketServer', async () => {
|
||||
let zrxTokenAddress: string;
|
||||
let signedOrder: SignedOrder;
|
||||
let orderHash: string;
|
||||
// Manually encode types rather than use /src/types to mimick real data that user
|
||||
// would input. Otherwise we would be forced to use enums, which hide problems.
|
||||
let addOrderPayload: AddOrderRequest;
|
||||
let removeOrderPayload: RemoveOrderRequest;
|
||||
const decimals = constants.ZRX_DECIMALS;
|
||||
@@ -104,15 +102,10 @@ describe.only('OrderWatcherWebSocketServer', async () => {
|
||||
};
|
||||
|
||||
// Prepare OrderWatcher WebSocket server
|
||||
const orderWatcherConfig = {};
|
||||
const isVerbose = true;
|
||||
wsServer = new OrderWatcherWebSocketServer(
|
||||
provider,
|
||||
networkId,
|
||||
contractAddresses,
|
||||
isVerbose,
|
||||
orderWatcherConfig,
|
||||
);
|
||||
const orderWatcherConfig = {
|
||||
isVerbose: true,
|
||||
};
|
||||
wsServer = new OrderWatcherWebSocketServer(provider, networkId, contractAddresses, orderWatcherConfig);
|
||||
wsServer.start();
|
||||
});
|
||||
after(async () => {
|
||||
|
Reference in New Issue
Block a user