aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-10-10 14:10:33 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-10-16 04:38:33 +0800
commit1e9ea09f087c7b3120e758d931a88812b655da08 (patch)
treeb0da3efc0733d566356ed2a938d18eb08192f674 /packages/order-watcher
parentfa346d94613a43034e1cdaf6b7a3d2de270c58fc (diff)
downloaddexon-0x-contracts-1e9ea09f087c7b3120e758d931a88812b655da08.tar.gz
dexon-0x-contracts-1e9ea09f087c7b3120e758d931a88812b655da08.tar.zst
dexon-0x-contracts-1e9ea09f087c7b3120e758d931a88812b655da08.zip
Introduce new contract-addresses package and use it everywhere
Diffstat (limited to 'packages/order-watcher')
-rw-r--r--packages/order-watcher/package.json1
-rw-r--r--packages/order-watcher/src/order_watcher/order_watcher.ts17
-rw-r--r--packages/order-watcher/test/utils/migrate.ts2
3 files changed, 9 insertions, 11 deletions
diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json
index ca352b754..a3f7b1fc7 100644
--- a/packages/order-watcher/package.json
+++ b/packages/order-watcher/package.json
@@ -60,6 +60,7 @@
"@0xproject/abi-gen-wrappers": "^1.0.0",
"@0xproject/assert": "^1.0.13",
"@0xproject/base-contract": "^3.0.1",
+ "@0xproject/contract-addresses": "^1.0.0",
"@0xproject/contract-artifacts": "^1.0.0",
"@0xproject/contract-wrappers": "^2.0.2",
"@0xproject/fill-scenarios": "^1.0.7",
diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts
index 8afed3924..2f0dd2f2d 100644
--- a/packages/order-watcher/src/order_watcher/order_watcher.ts
+++ b/packages/order-watcher/src/order_watcher/order_watcher.ts
@@ -1,4 +1,5 @@
// tslint:disable:no-unnecessary-type-assertion
+import { ContractAddresses } from '@0xproject/contract-addresses';
import * as artifacts from '@0xproject/contract-artifacts';
import {
AssetBalanceAndProxyAllowanceFetcher,
@@ -31,14 +32,7 @@ import {
orderHashUtils,
OrderStateUtils,
} from '@0xproject/order-utils';
-import {
- AssetProxyId,
- ContractAddresses,
- ExchangeContractErrs,
- OrderState,
- SignedOrder,
- Stats,
-} from '@0xproject/types';
+import { AssetProxyId, ExchangeContractErrs, OrderState, SignedOrder, Stats } from '@0xproject/types';
import { errorUtils, intervalUtils } from '@0xproject/utils';
import { BlockParamLiteral, LogEntryEvent, LogWithDecodedArgs, Provider } from 'ethereum-types';
import * as _ from 'lodash';
@@ -98,12 +92,14 @@ export class OrderWatcher {
* Instantiate a new OrderWatcher
* @param provider Web3 provider to use for JSON RPC calls
* @param networkId NetworkId to watch orders on
+ * @param contractAddresses Optional contract addresses. Defaults to known
+ * addresses based on networkId.
* @param partialConfig Optional configurations
*/
constructor(
provider: Provider,
networkId: number,
- contractAddresses: ContractAddresses,
+ contractAddresses?: ContractAddresses,
partialConfig: Partial<OrderWatcherConfig> = DEFAULT_ORDER_WATCHER_CONFIG,
) {
assert.isWeb3Provider('provider', provider);
@@ -122,7 +118,8 @@ export class OrderWatcher {
);
const contractWrappers = new ContractWrappers(provider, {
networkId,
- // TODO(albrow): Make contract addresses optional.
+ // Note(albrow): We let the contract-wrappers package handle
+ // default values for contractAddresses.
contractAddresses,
});
this._eventWatcher = new EventWatcher(provider, config.eventPollingIntervalMs, STATE_LAYER, config.isVerbose);
diff --git a/packages/order-watcher/test/utils/migrate.ts b/packages/order-watcher/test/utils/migrate.ts
index 26412d246..53319a383 100644
--- a/packages/order-watcher/test/utils/migrate.ts
+++ b/packages/order-watcher/test/utils/migrate.ts
@@ -1,6 +1,6 @@
+import { ContractAddresses } from '@0xproject/contract-addresses';
import { devConstants } from '@0xproject/dev-utils';
import { runMigrationsOnceAsync } from '@0xproject/migrations';
-import { ContractAddresses } from '@0xproject/types';
import { provider } from './web3_wrapper';