aboutsummaryrefslogtreecommitdiffstats
path: root/src/0x.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-10-31 00:38:10 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-10 03:11:46 +0800
commitbb5474660c5fa90080cc5950a21eb65e1896f9c4 (patch)
tree20daa7f67df04ed7ae66000c10f2adcea84cb8ea /src/0x.ts
parent63f16b5f99cd7ca0d71dd822c0e2ecd0eb3f7762 (diff)
downloaddexon-sol-tools-bb5474660c5fa90080cc5950a21eb65e1896f9c4.tar
dexon-sol-tools-bb5474660c5fa90080cc5950a21eb65e1896f9c4.tar.gz
dexon-sol-tools-bb5474660c5fa90080cc5950a21eb65e1896f9c4.tar.bz2
dexon-sol-tools-bb5474660c5fa90080cc5950a21eb65e1896f9c4.tar.lz
dexon-sol-tools-bb5474660c5fa90080cc5950a21eb65e1896f9c4.tar.xz
dexon-sol-tools-bb5474660c5fa90080cc5950a21eb65e1896f9c4.tar.zst
dexon-sol-tools-bb5474660c5fa90080cc5950a21eb65e1896f9c4.zip
Add naive order state watcher implementation
Revalidate all orders upon event received and emit order states even if not changed
Diffstat (limited to 'src/0x.ts')
-rw-r--r--src/0x.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/0x.ts b/src/0x.ts
index 62d1ff34f..f1b271810 100644
--- a/src/0x.ts
+++ b/src/0x.ts
@@ -16,6 +16,8 @@ import {TokenRegistryWrapper} from './contract_wrappers/token_registry_wrapper';
import {EtherTokenWrapper} from './contract_wrappers/ether_token_wrapper';
import {TokenWrapper} from './contract_wrappers/token_wrapper';
import {TokenTransferProxyWrapper} from './contract_wrappers/token_transfer_proxy_wrapper';
+import {OrderStateWatcher} from './mempool/order_state_watcher';
+import {OrderStateUtils} from './utils/order_state_utils';
import {
ECSignature,
ZeroExError,
@@ -65,6 +67,10 @@ export class ZeroEx {
* tokenTransferProxy smart contract.
*/
public proxy: TokenTransferProxyWrapper;
+ /**
+ * An instance of the OrderStateWatcher class containing methods for watching the order state changes.
+ */
+ public orderStateWatcher: OrderStateWatcher;
private _web3Wrapper: Web3Wrapper;
private _abiDecoder: AbiDecoder;
/**
@@ -207,6 +213,11 @@ 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 orderStateUtils = new OrderStateUtils(this.token, this.exchange);
+ this.orderStateWatcher = new OrderStateWatcher(
+ this._web3Wrapper, this._abiDecoder, orderStateUtils, mempoolPollingIntervalMs,
+ );
}
/**
* Sets a new web3 provider for 0x.js. Updating the provider will stop all