Extend from DecodedLogArgs and fix type names
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
import { BaseContract } from '@0xproject/base-contract';
|
||||
import { ContractArtifact } from '@0xproject/sol-compiler';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, DataItem, MethodAbi, Provider, TxData, TxDataPayable } from '@0xproject/types';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, DataItem, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from '@0xproject/types';
|
||||
import { BigNumber, classUtils, logUtils, promisify } from '@0xproject/utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export interface {{name}}ContractEventArgs {
|
||||
export interface {{name}}ContractEventArgs extends DecodedLogArgs {
|
||||
{{#each inputs}}
|
||||
{{name}}: {{#returnType type components}}{{/returnType}};
|
||||
{{/each}}
|
||||
|
||||
@@ -20,22 +20,22 @@ import * as _ from 'lodash';
|
||||
|
||||
import { artifacts } from '../artifacts';
|
||||
import {
|
||||
EtherTokenDepositEventArgs,
|
||||
EtherTokenEventArgs,
|
||||
DepositContractEventArgs,
|
||||
EtherTokenContractEventArgs,
|
||||
EtherTokenEvents,
|
||||
EtherTokenWithdrawalEventArgs,
|
||||
WithdrawalContractEventArgs,
|
||||
} from '../generated_contract_wrappers/ether_token';
|
||||
import {
|
||||
ExchangeEventArgs,
|
||||
ExchangeContractEventArgs,
|
||||
ExchangeEvents,
|
||||
ExchangeLogCancelEventArgs,
|
||||
ExchangeLogFillEventArgs,
|
||||
LogCancelContractEventArgs,
|
||||
LogFillContractEventArgs,
|
||||
} from '../generated_contract_wrappers/exchange';
|
||||
import {
|
||||
TokenApprovalEventArgs,
|
||||
TokenEventArgs,
|
||||
ApprovalContractEventArgs,
|
||||
TokenContractEventArgs,
|
||||
TokenEvents,
|
||||
TokenTransferEventArgs,
|
||||
TransferContractEventArgs,
|
||||
} from '../generated_contract_wrappers/token';
|
||||
import { OnOrderStateChangeCallback, OrderWatcherConfig, OrderWatcherError } from '../types';
|
||||
import { assert } from '../utils/assert';
|
||||
@@ -43,7 +43,7 @@ import { assert } from '../utils/assert';
|
||||
import { EventWatcher } from './event_watcher';
|
||||
import { ExpirationWatcher } from './expiration_watcher';
|
||||
|
||||
type ContractEventArgs = EtherTokenEventArgs | ExchangeEventArgs | TokenEventArgs;
|
||||
type ContractEventArgs = EtherTokenContractEventArgs | ExchangeContractEventArgs | TokenContractEventArgs;
|
||||
|
||||
interface DependentOrderHashes {
|
||||
[makerAddress: string]: {
|
||||
@@ -252,7 +252,7 @@ export class OrderWatcher {
|
||||
switch (decodedLog.event) {
|
||||
case TokenEvents.Approval: {
|
||||
// Invalidate cache
|
||||
const args = decodedLog.args as TokenApprovalEventArgs;
|
||||
const args = decodedLog.args as ApprovalContractEventArgs;
|
||||
this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(decodedLog.address, args._owner);
|
||||
// Revalidate orders
|
||||
makerToken = decodedLog.address;
|
||||
@@ -268,7 +268,7 @@ export class OrderWatcher {
|
||||
}
|
||||
case TokenEvents.Transfer: {
|
||||
// Invalidate cache
|
||||
const args = decodedLog.args as TokenTransferEventArgs;
|
||||
const args = decodedLog.args as TransferContractEventArgs;
|
||||
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._from);
|
||||
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._to);
|
||||
// Revalidate orders
|
||||
@@ -285,7 +285,7 @@ export class OrderWatcher {
|
||||
}
|
||||
case EtherTokenEvents.Deposit: {
|
||||
// Invalidate cache
|
||||
const args = decodedLog.args as EtherTokenDepositEventArgs;
|
||||
const args = decodedLog.args as DepositContractEventArgs;
|
||||
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._owner);
|
||||
// Revalidate orders
|
||||
makerToken = decodedLog.address;
|
||||
@@ -301,7 +301,7 @@ export class OrderWatcher {
|
||||
}
|
||||
case EtherTokenEvents.Withdrawal: {
|
||||
// Invalidate cache
|
||||
const args = decodedLog.args as EtherTokenWithdrawalEventArgs;
|
||||
const args = decodedLog.args as WithdrawalContractEventArgs;
|
||||
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._owner);
|
||||
// Revalidate orders
|
||||
makerToken = decodedLog.address;
|
||||
@@ -317,7 +317,7 @@ export class OrderWatcher {
|
||||
}
|
||||
case ExchangeEvents.LogFill: {
|
||||
// Invalidate cache
|
||||
const args = decodedLog.args as ExchangeLogFillEventArgs;
|
||||
const args = decodedLog.args as LogFillContractEventArgs;
|
||||
this._orderFilledCancelledLazyStore.deleteFilledTakerAmount(args.orderHash);
|
||||
// Revalidate orders
|
||||
const orderHash = args.orderHash;
|
||||
@@ -329,7 +329,7 @@ export class OrderWatcher {
|
||||
}
|
||||
case ExchangeEvents.LogCancel: {
|
||||
// Invalidate cache
|
||||
const args = decodedLog.args as ExchangeLogCancelEventArgs;
|
||||
const args = decodedLog.args as LogCancelContractEventArgs;
|
||||
this._orderFilledCancelledLazyStore.deleteCancelledTakerAmount(args.orderHash);
|
||||
// Revalidate orders
|
||||
const orderHash = args.orderHash;
|
||||
|
||||
Reference in New Issue
Block a user