diff options
Diffstat (limited to 'packages/order-watcher')
-rw-r--r-- | packages/order-watcher/package.json | 4 | ||||
-rw-r--r-- | packages/order-watcher/src/order_watcher/order_watcher.ts | 35 |
2 files changed, 21 insertions, 18 deletions
diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 40613ea96..19ddf4358 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -77,9 +77,9 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/assert": "^0.2.12", + "@0xproject/assert": "0.2.12", "@0xproject/base-contract": "^0.3.4", - "@0xproject/contract-wrappers": "^0.0.5", + "@0xproject/contract-wrappers": "0.0.5", "@0xproject/fill-scenarios": "^0.0.4", "@0xproject/json-schemas": "0.8.1", "@0xproject/order-utils": "^0.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 0ee56592e..c541af8e6 100644 --- a/packages/order-watcher/src/order_watcher/order_watcher.ts +++ b/packages/order-watcher/src/order_watcher/order_watcher.ts @@ -23,16 +23,22 @@ import * as _ from 'lodash'; import { artifacts } from '../artifacts'; import { - DepositContractEventArgs, - EtherTokenContractEventArgs, + EtherTokenDepositEventArgs, + EtherTokenEventArgs, EtherTokenEvents, + EtherTokenWithdrawalEventArgs, } from '../generated_contract_wrappers/ether_token'; -import { ExchangeContractEventArgs, ExchangeEvents } from '../generated_contract_wrappers/exchange'; import { - ApprovalContractEventArgs, - TokenContractEventArgs, + ExchangeEventArgs, + ExchangeEvents, + ExchangeLogCancelEventArgs, + ExchangeLogFillEventArgs, +} from '../generated_contract_wrappers/exchange'; +import { + TokenApprovalEventArgs, + TokenEventArgs, TokenEvents, - TransferContractEventArgs, + TokenTransferEventArgs, } from '../generated_contract_wrappers/token'; import { OnOrderStateChangeCallback, OrderWatcherConfig, OrderWatcherError } from '../types'; import { assert } from '../utils/assert'; @@ -40,7 +46,7 @@ import { assert } from '../utils/assert'; import { EventWatcher } from './event_watcher'; import { ExpirationWatcher } from './expiration_watcher'; -type ContractEventArgs = EtherTokenContractEventArgs | ExchangeContractEventArgs | TokenContractEventArgs; +type ContractEventArgs = EtherTokenEventArgs | ExchangeEventArgs | TokenEventArgs; interface DependentOrderHashes { [makerAddress: string]: { @@ -249,7 +255,7 @@ export class OrderWatcher { switch (decodedLog.event) { case TokenEvents.Approval: { // Invalidate cache - const args = decodedLog.args as ApprovalContractEventArgs; + const args = decodedLog.args as TokenApprovalEventArgs; this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(decodedLog.address, args._owner); // Revalidate orders makerToken = decodedLog.address; @@ -265,7 +271,7 @@ export class OrderWatcher { } case TokenEvents.Transfer: { // Invalidate cache - const args = decodedLog.args as TransferContractEventArgs; + const args = decodedLog.args as TokenTransferEventArgs; this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._from); this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._to); // Revalidate orders @@ -282,7 +288,7 @@ export class OrderWatcher { } case EtherTokenEvents.Deposit: { // Invalidate cache - const args = decodedLog.args as DepositContractEventArgs; + const args = decodedLog.args as EtherTokenDepositEventArgs; this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._owner); // Revalidate orders makerToken = decodedLog.address; @@ -298,8 +304,7 @@ export class OrderWatcher { } case EtherTokenEvents.Withdrawal: { // Invalidate cache - // tslint:disable-next-line:no-unnecessary-type-assertion - const args = decodedLog.args as WithdrawalContractEventArgs; + const args = decodedLog.args as EtherTokenWithdrawalEventArgs; this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._owner); // Revalidate orders makerToken = decodedLog.address; @@ -315,8 +320,7 @@ export class OrderWatcher { } case ExchangeEvents.LogFill: { // Invalidate cache - // tslint:disable-next-line:no-unnecessary-type-assertion - const args = decodedLog.args as LogFillContractEventArgs; + const args = decodedLog.args as ExchangeLogFillEventArgs; this._orderFilledCancelledLazyStore.deleteFilledTakerAmount(args.orderHash); // Revalidate orders const orderHash = args.orderHash; @@ -328,8 +332,7 @@ export class OrderWatcher { } case ExchangeEvents.LogCancel: { // Invalidate cache - // tslint:disable-next-line:no-unnecessary-type-assertion - const args = decodedLog.args as LogCancelContractEventArgs; + const args = decodedLog.args as ExchangeLogCancelEventArgs; this._orderFilledCancelledLazyStore.deleteCancelledTakerAmount(args.orderHash); // Revalidate orders const orderHash = args.orderHash; |