aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/0x.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-04-02 01:41:28 +0800
committerFabio Berger <me@fabioberger.com>2018-04-02 01:41:28 +0800
commit08b30b0706751eb2a4318f8287dd8a7502276a59 (patch)
tree51e77fd3fc031d1bd7381422c4e8f90263b89e87 /packages/0x.js/src/0x.ts
parentbf52ce7e725224de23c2a5318b8224cc92e5188a (diff)
parent19454a92dcf29c3c50d3d62cbda3c62b7bafe37f (diff)
downloaddexon-sol-tools-08b30b0706751eb2a4318f8287dd8a7502276a59.tar
dexon-sol-tools-08b30b0706751eb2a4318f8287dd8a7502276a59.tar.gz
dexon-sol-tools-08b30b0706751eb2a4318f8287dd8a7502276a59.tar.bz2
dexon-sol-tools-08b30b0706751eb2a4318f8287dd8a7502276a59.tar.lz
dexon-sol-tools-08b30b0706751eb2a4318f8287dd8a7502276a59.tar.xz
dexon-sol-tools-08b30b0706751eb2a4318f8287dd8a7502276a59.tar.zst
dexon-sol-tools-08b30b0706751eb2a4318f8287dd8a7502276a59.zip
Merge branch 'development' into refactor/publishProcess
* development: Add HACK comment and reorganize use other wallet button Fixed comment(s) for PR #488 OrderStateWatcher fixes for PR #488 Amended comments to clarify changes on PR #488 Monitor different state layers with OrderWatcher Implement wallet locked and uninstalled states Style changes Remove props that are covered by the defaults Implement ETH/WETH conversion and allowance toggle styling
Diffstat (limited to 'packages/0x.js/src/0x.ts')
-rw-r--r--packages/0x.js/src/0x.ts29
1 files changed, 16 insertions, 13 deletions
diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts
index 0dd728ff1..7627f1d6e 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,21 @@ export class ZeroEx {
const txReceipt = await txReceiptPromise;
return txReceipt;
}
+ /**
+ * Instantiates and returns a new OrderStateWatcher instance.
+ * Defaults to watching the pending state.
+ * @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.