aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/0x.ts
diff options
context:
space:
mode:
authorAra Kevonian <=>2018-03-30 20:45:24 +0800
committerAra Kevonian <=>2018-03-30 20:59:09 +0800
commit57ca611e12d2e40c3f0f33023544a890be7ccb87 (patch)
treea5ca930194d4295a25b5af7aa683d34a36b5b273 /packages/0x.js/src/0x.ts
parent6122840241a47119b046b639e326cfead1ea3e10 (diff)
downloaddexon-sol-tools-57ca611e12d2e40c3f0f33023544a890be7ccb87.tar
dexon-sol-tools-57ca611e12d2e40c3f0f33023544a890be7ccb87.tar.gz
dexon-sol-tools-57ca611e12d2e40c3f0f33023544a890be7ccb87.tar.bz2
dexon-sol-tools-57ca611e12d2e40c3f0f33023544a890be7ccb87.tar.lz
dexon-sol-tools-57ca611e12d2e40c3f0f33023544a890be7ccb87.tar.xz
dexon-sol-tools-57ca611e12d2e40c3f0f33023544a890be7ccb87.tar.zst
dexon-sol-tools-57ca611e12d2e40c3f0f33023544a890be7ccb87.zip
Monitor different state layers with OrderWatcher
Allow instantiation of stand-alone OrderWatchers that can monitor different blockchain state layers (e.g. pending or latest)
Diffstat (limited to 'packages/0x.js/src/0x.ts')
-rw-r--r--packages/0x.js/src/0x.ts28
1 files changed, 15 insertions, 13 deletions
diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts
index 0dd728ff1..418d0ba34 100644
--- a/packages/0x.js/src/0x.ts
+++ b/packages/0x.js/src/0x.ts
@@ -15,7 +15,7 @@ import { OrderStateWatcher } from './order_watcher/order_state_watcher';
import { zeroExConfigSchema } from './schemas/zero_ex_config_schema';
import { zeroExPrivateNetworkConfigSchema } from './schemas/zero_ex_private_network_config_schema';
import { zeroExPublicNetworkConfigSchema } from './schemas/zero_ex_public_network_config_schema';
-import { Web3Provider, ZeroExConfig, ZeroExError } from './types';
+import { OrderStateWatcherConfig, ZeroExConfig, ZeroExError } from './types';
import { assert } from './utils/assert';
import { constants } from './utils/constants';
import { decorators } from './utils/decorators';
@@ -57,11 +57,6 @@ export class ZeroEx {
* tokenTransferProxy smart contract.
*/
public proxy: TokenTransferProxyWrapper;
- /**
- * An instance of the OrderStateWatcher class containing methods for watching a set of orders for relevant
- * blockchain state changes.
- */
- public orderStateWatcher: OrderStateWatcher;
private _web3Wrapper: Web3Wrapper;
private _abiDecoder: AbiDecoder;
/**
@@ -197,13 +192,6 @@ export class ZeroEx {
config.tokenRegistryContractAddress,
);
this.etherToken = new EtherTokenWrapper(this._web3Wrapper, config.networkId, this._abiDecoder, this.token);
- this.orderStateWatcher = new OrderStateWatcher(
- this._web3Wrapper,
- this._abiDecoder,
- this.token,
- this.exchange,
- config.orderWatcherConfig,
- );
}
/**
* Sets a new web3 provider for 0x.js. Updating the provider will stop all
@@ -336,6 +324,20 @@ export class ZeroEx {
const txReceipt = await txReceiptPromise;
return txReceipt;
}
+ /**
+ * Instantiates and returns a new OrderStateWatcher instance.
+ * @param config The configuration object. Look up the type for the description.
+ * @return An instance of the 0x.js OrderStateWatcher class.
+ */
+ public createOrderStateWatcher(config?: OrderStateWatcherConfig) {
+ return new OrderStateWatcher(
+ this._web3Wrapper,
+ this._abiDecoder,
+ this.token,
+ this.exchange,
+ config,
+ );
+ }
/*
* HACK: `TokenWrapper` needs a token transfer proxy address. `TokenTransferProxy` address is fetched from
* an `ExchangeWrapper`. `ExchangeWrapper` needs `TokenWrapper` to validate orders, creating a dependency cycle.