aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/0x.ts5
-rw-r--r--src/order_watcher/order_state_watcher.ts4
-rw-r--r--src/schemas/zero_ex_config_schema.ts11
-rw-r--r--src/types.ts11
4 files changed, 23 insertions, 8 deletions
diff --git a/src/0x.ts b/src/0x.ts
index 7c381a498..cb0090469 100644
--- a/src/0x.ts
+++ b/src/0x.ts
@@ -25,6 +25,7 @@ import {
SignedOrder,
Web3Provider,
ZeroExConfig,
+ OrderStateWatcherConfig,
TransactionReceiptWithDecodedLogs,
} from './types';
import {zeroExConfigSchema} from './schemas/zero_ex_config_schema';
@@ -214,10 +215,10 @@ export class ZeroEx {
this.tokenRegistry = new TokenRegistryWrapper(this._web3Wrapper, tokenRegistryContractAddressIfExists);
const etherTokenContractAddressIfExists = _.isUndefined(config) ? undefined : config.etherTokenContractAddress;
this.etherToken = new EtherTokenWrapper(this._web3Wrapper, this.token, etherTokenContractAddressIfExists);
- const mempoolPollingIntervalMs = _.isUndefined(config) ? undefined : config.mempoolPollingIntervalMs;
+ const orderWatcherConfig = _.isUndefined(config) ? undefined : config.orderWatcherConfig;
const orderStateUtils = new OrderStateUtils(this.token, this.exchange);
this.orderStateWatcher = new OrderStateWatcher(
- this._web3Wrapper, this._abiDecoder, orderStateUtils, mempoolPollingIntervalMs,
+ this._web3Wrapper, this._abiDecoder, orderStateUtils, orderWatcherConfig,
);
}
/**
diff --git a/src/order_watcher/order_state_watcher.ts b/src/order_watcher/order_state_watcher.ts
index e31fc962d..14b5b6cf9 100644
--- a/src/order_watcher/order_state_watcher.ts
+++ b/src/order_watcher/order_state_watcher.ts
@@ -15,6 +15,7 @@ import {
BlockParamLiteral,
LogWithDecodedArgs,
OnOrderStateChangeCallback,
+ OrderStateWatcherConfig,
ExchangeEvents,
TokenEvents,
ZeroExError,
@@ -41,10 +42,11 @@ export class OrderStateWatcher {
private _orderStateUtils: OrderStateUtils;
constructor(
web3Wrapper: Web3Wrapper, abiDecoder: AbiDecoder, orderStateUtils: OrderStateUtils,
- eventPollingIntervalMs?: number) {
+ config?: OrderStateWatcherConfig) {
this._web3Wrapper = web3Wrapper;
this._orders = {};
this._dependentOrderHashes = {};
+ const eventPollingIntervalMs = _.isUndefined(config) ? undefined : config.pollingIntervalMs;
this._eventWatcher = new EventWatcher(
this._web3Wrapper, eventPollingIntervalMs,
);
diff --git a/src/schemas/zero_ex_config_schema.ts b/src/schemas/zero_ex_config_schema.ts
index 5be651a9a..5a2afeaa2 100644
--- a/src/schemas/zero_ex_config_schema.ts
+++ b/src/schemas/zero_ex_config_schema.ts
@@ -5,9 +5,14 @@ export const zeroExConfigSchema = {
exchangeContractAddress: {$ref: '/Address'},
tokenRegistryContractAddress: {$ref: '/Address'},
etherTokenContractAddress: {$ref: '/Address'},
- mempoolPollingIntervalMs: {
- type: 'number',
- min: 0,
+ orderWatcherConfig: {
+ type: 'object',
+ properties: {
+ pollingIntervalMs: {
+ type: 'number',
+ minimum: 0,
+ },
+ },
},
},
type: 'object',
diff --git a/src/types.ts b/src/types.ts
index 4a0a74826..704c0b866 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -396,18 +396,25 @@ export interface JSONRPCPayload {
}
/*
+ * pollingIntervalMs: How often to check for new mempool events
+ */
+export interface OrderStateWatcherConfig {
+ pollingIntervalMs?: number;
+}
+
+/*
* gasPrice: Gas price to use with every transaction
* exchangeContractAddress: The address of an exchange contract to use
* tokenRegistryContractAddress: The address of a token registry contract to use
* etherTokenContractAddress: The address of an ether token contract to use
- * mempoolPollingIntervalMs: How often to check for new mempool events
+ * orderWatcherConfig: All the configs related to the orderWatcher
*/
export interface ZeroExConfig {
gasPrice?: BigNumber; // Gas price to use with every transaction
exchangeContractAddress?: string;
tokenRegistryContractAddress?: string;
etherTokenContractAddress?: string;
- mempoolPollingIntervalMs?: number;
+ orderWatcherConfig?: OrderStateWatcherConfig;
}
export type TransactionReceipt = Web3.TransactionReceipt;