aboutsummaryrefslogtreecommitdiffstats
path: root/src/0x.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-10-31 00:38:10 +0800
committerFabio Berger <me@fabioberger.com>2017-10-31 00:49:16 +0800
commita896904ae7c453f51b1f46de2be3a28416db72d1 (patch)
treec50c3638b0b9bee982816bb48a4c935de798476a /src/0x.ts
parent6bfcd253f8e9689ce787899a42f80914b067a4f1 (diff)
downloaddexon-sol-tools-a896904ae7c453f51b1f46de2be3a28416db72d1.tar
dexon-sol-tools-a896904ae7c453f51b1f46de2be3a28416db72d1.tar.gz
dexon-sol-tools-a896904ae7c453f51b1f46de2be3a28416db72d1.tar.bz2
dexon-sol-tools-a896904ae7c453f51b1f46de2be3a28416db72d1.tar.lz
dexon-sol-tools-a896904ae7c453f51b1f46de2be3a28416db72d1.tar.xz
dexon-sol-tools-a896904ae7c453f51b1f46de2be3a28416db72d1.tar.zst
dexon-sol-tools-a896904ae7c453f51b1f46de2be3a28416db72d1.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