aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher/src/order_watcher/order_watcher.ts
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-10-05 07:33:10 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-10-16 04:37:56 +0800
commit29063cab186196dc7051ca16ca9409e8619c6673 (patch)
tree39b285cde57c1df15aecae9649aaaae66f49f857 /packages/order-watcher/src/order_watcher/order_watcher.ts
parent3da032fb24a7b3d27fd388ce4fbc6bd194971201 (diff)
downloaddexon-sol-tools-29063cab186196dc7051ca16ca9409e8619c6673.tar
dexon-sol-tools-29063cab186196dc7051ca16ca9409e8619c6673.tar.gz
dexon-sol-tools-29063cab186196dc7051ca16ca9409e8619c6673.tar.bz2
dexon-sol-tools-29063cab186196dc7051ca16ca9409e8619c6673.tar.lz
dexon-sol-tools-29063cab186196dc7051ca16ca9409e8619c6673.tar.xz
dexon-sol-tools-29063cab186196dc7051ca16ca9409e8619c6673.tar.zst
dexon-sol-tools-29063cab186196dc7051ca16ca9409e8619c6673.zip
update order-watcher to use new artifacts and abi-gen wrappers packages
Diffstat (limited to 'packages/order-watcher/src/order_watcher/order_watcher.ts')
-rw-r--r--packages/order-watcher/src/order_watcher/order_watcher.ts20
1 files changed, 16 insertions, 4 deletions
diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts
index eb37bd617..8afed3924 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 * as artifacts from '@0xproject/contract-artifacts';
import {
AssetBalanceAndProxyAllowanceFetcher,
ContractWrappers,
@@ -30,12 +31,18 @@ import {
orderHashUtils,
OrderStateUtils,
} from '@0xproject/order-utils';
-import { AssetProxyId, ExchangeContractErrs, OrderState, SignedOrder, Stats } from '@0xproject/types';
+import {
+ AssetProxyId,
+ ContractAddresses,
+ 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';
-import { artifacts } from '../artifacts';
import { orderWatcherPartialConfigSchema } from '../schemas/order_watcher_partial_config_schema';
import { OnOrderStateChangeCallback, OrderWatcherConfig, OrderWatcherError } from '../types';
import { assert } from '../utils/assert';
@@ -96,6 +103,7 @@ export class OrderWatcher {
constructor(
provider: Provider,
networkId: number,
+ contractAddresses: ContractAddresses,
partialConfig: Partial<OrderWatcherConfig> = DEFAULT_ORDER_WATCHER_CONFIG,
) {
assert.isWeb3Provider('provider', provider);
@@ -110,9 +118,13 @@ export class OrderWatcher {
this._collisionResistantAbiDecoder = new CollisionResistanceAbiDecoder(
artifacts.ERC20Token.compilerOutput.abi,
artifacts.ERC721Token.compilerOutput.abi,
- [artifacts.EtherToken.compilerOutput.abi, artifacts.Exchange.compilerOutput.abi],
+ [artifacts.WETH9.compilerOutput.abi, artifacts.Exchange.compilerOutput.abi],
);
- const contractWrappers = new ContractWrappers(provider, { networkId });
+ const contractWrappers = new ContractWrappers(provider, {
+ networkId,
+ // TODO(albrow): Make contract addresses optional.
+ contractAddresses,
+ });
this._eventWatcher = new EventWatcher(provider, config.eventPollingIntervalMs, STATE_LAYER, config.isVerbose);
const balanceAndProxyAllowanceFetcher = new AssetBalanceAndProxyAllowanceFetcher(
contractWrappers.erc20Token,