aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher
diff options
context:
space:
mode:
authorJacob Evans <jacob@dekz.net>2018-07-03 13:39:15 +0800
committerJacob Evans <jacob@dekz.net>2018-07-03 13:39:15 +0800
commit1a901554cceab03ead6129a1f41d87349fc3fe07 (patch)
tree4adc968e7a2526844a0bb317a00512b8730e0fe4 /packages/order-watcher
parentd6f40a9281ef3db8f6daffc17712008a2509a7f0 (diff)
downloaddexon-0x-contracts-1a901554cceab03ead6129a1f41d87349fc3fe07.tar.gz
dexon-0x-contracts-1a901554cceab03ead6129a1f41d87349fc3fe07.tar.zst
dexon-0x-contracts-1a901554cceab03ead6129a1f41d87349fc3fe07.zip
compiler and ts lint are confused about ContractEventArgs
Diffstat (limited to 'packages/order-watcher')
-rw-r--r--packages/order-watcher/src/order_watcher/order_watcher.ts31
1 files changed, 23 insertions, 8 deletions
diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts
index d0acf2e6b..3418b4ee9 100644
--- a/packages/order-watcher/src/order_watcher/order_watcher.ts
+++ b/packages/order-watcher/src/order_watcher/order_watcher.ts
@@ -1,7 +1,10 @@
import {
BalanceAndProxyAllowanceLazyStore,
ContractWrappers,
+ LogCancelContractEventArgs,
+ LogFillContractEventArgs,
OrderFilledCancelledLazyStore,
+ WithdrawalContractEventArgs,
} from '@0xproject/contract-wrappers';
import { schemas } from '@0xproject/json-schemas';
import { getOrderHashHex, OrderStateUtils } from '@0xproject/order-utils';
@@ -19,9 +22,18 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import { artifacts } from '../artifacts';
-import { EtherTokenContractEventArgs, EtherTokenEvents } from '../generated_contract_wrappers/ether_token';
+import {
+ DepositContractEventArgs,
+ EtherTokenContractEventArgs,
+ EtherTokenEvents,
+} from '../generated_contract_wrappers/ether_token';
import { ExchangeContractEventArgs, ExchangeEvents } from '../generated_contract_wrappers/exchange';
-import { TokenContractEventArgs, TokenEvents } from '../generated_contract_wrappers/token';
+import {
+ ApprovalContractEventArgs,
+ TokenContractEventArgs,
+ TokenEvents,
+ TransferContractEventArgs,
+} from '../generated_contract_wrappers/token';
import { OnOrderStateChangeCallback, OrderWatcherConfig, OrderWatcherError } from '../types';
import { assert } from '../utils/assert';
@@ -237,7 +249,7 @@ export class OrderWatcher {
switch (decodedLog.event) {
case TokenEvents.Approval: {
// Invalidate cache
- const args = decodedLog.args;
+ const args = decodedLog.args as ApprovalContractEventArgs;
this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(decodedLog.address, args._owner);
// Revalidate orders
makerToken = decodedLog.address;
@@ -253,7 +265,7 @@ export class OrderWatcher {
}
case TokenEvents.Transfer: {
// Invalidate cache
- const args = decodedLog.args;
+ const args = decodedLog.args as TransferContractEventArgs;
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._from);
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._to);
// Revalidate orders
@@ -270,7 +282,7 @@ export class OrderWatcher {
}
case EtherTokenEvents.Deposit: {
// Invalidate cache
- const args = decodedLog.args;
+ const args = decodedLog.args as DepositContractEventArgs;
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._owner);
// Revalidate orders
makerToken = decodedLog.address;
@@ -286,7 +298,8 @@ export class OrderWatcher {
}
case EtherTokenEvents.Withdrawal: {
// Invalidate cache
- const args = decodedLog.args;
+ // tslint:disable-next-line
+ const args = decodedLog.args as WithdrawalContractEventArgs;
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._owner);
// Revalidate orders
makerToken = decodedLog.address;
@@ -302,7 +315,8 @@ export class OrderWatcher {
}
case ExchangeEvents.LogFill: {
// Invalidate cache
- const args = decodedLog.args;
+ // tslint:disable-next-line
+ const args = decodedLog.args as LogFillContractEventArgs;
this._orderFilledCancelledLazyStore.deleteFilledTakerAmount(args.orderHash);
// Revalidate orders
const orderHash = args.orderHash;
@@ -314,7 +328,8 @@ export class OrderWatcher {
}
case ExchangeEvents.LogCancel: {
// Invalidate cache
- const args = decodedLog.args;
+ // tslint:disable-next-line
+ const args = decodedLog.args as LogCancelContractEventArgs;
this._orderFilledCancelledLazyStore.deleteCancelledTakerAmount(args.orderHash);
// Revalidate orders
const orderHash = args.orderHash;