diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-10 14:10:33 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-16 04:38:33 +0800 |
commit | 1e9ea09f087c7b3120e758d931a88812b655da08 (patch) | |
tree | b0da3efc0733d566356ed2a938d18eb08192f674 /packages/order-watcher/src | |
parent | fa346d94613a43034e1cdaf6b7a3d2de270c58fc (diff) | |
download | dexon-sol-tools-1e9ea09f087c7b3120e758d931a88812b655da08.tar.gz dexon-sol-tools-1e9ea09f087c7b3120e758d931a88812b655da08.tar.zst dexon-sol-tools-1e9ea09f087c7b3120e758d931a88812b655da08.zip |
Introduce new contract-addresses package and use it everywhere
Diffstat (limited to 'packages/order-watcher/src')
-rw-r--r-- | packages/order-watcher/src/order_watcher/order_watcher.ts | 17 |
1 files changed, 7 insertions, 10 deletions
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); |