aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/contract_wrappers/exchange_wrapper.ts3
-rw-r--r--src/index.ts4
-rw-r--r--src/types.ts31
3 files changed, 36 insertions, 2 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts
index 4698089eb..3ffe927c7 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -22,6 +22,7 @@ import {
ContractResponse,
OrderCancellationRequest,
OrderFillRequest,
+ LogErrorContractEventArgs,
} from '../types';
import {assert} from '../utils/assert';
import {utils} from '../utils/utils';
@@ -712,7 +713,7 @@ export class ExchangeWrapper extends ContractWrapper {
private _throwErrorLogsAsErrors(logs: ContractEvent[]): void {
const errEvent = _.find(logs, {event: 'LogError'});
if (!_.isUndefined(errEvent)) {
- const errCode = errEvent.args.errorId.toNumber();
+ const errCode = (errEvent.args as LogErrorContractEventArgs).errorId.toNumber()
const errMessage = this._exchangeContractErrCodesToMsg[errCode];
throw new Error(errMessage);
}
diff --git a/src/index.ts b/src/index.ts
index 7b1a16125..109718462 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -19,5 +19,9 @@ export {
OrderCancellationRequest,
OrderFillRequest,
ContractEventEmitter,
+ LogErrorContractEventArgs,
+ LogCancelArgs,
+ LogFillArgs,
+ ContractEventArgs,
Web3Provider,
} from './types';
diff --git a/src/types.ts b/src/types.ts
index 5be64da53..c4191ebd8 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -191,9 +191,38 @@ export interface ContractEvent {
address: string;
type: string;
event: string;
- args: any;
+ args: ContractEventArgs;
}
+export interface LogFillArgs {
+ maker: string;
+ taker: string;
+ feeRecipient: string;
+ tokenM: string;
+ tokenT: string;
+ filledValueM: BigNumber.BigNumber;
+ filledValueT: BigNumber.BigNumber;
+ feeMPaid: BigNumber.BigNumber;
+ feeTPaid: BigNumber.BigNumber;
+ tokens: string;
+ orderHash: string;
+}
+export interface LogCancelArgs {
+ maker: string;
+ feeRecipient: string;
+ tokenM: string;
+ tokenT: string;
+ cancelledValueM: BigNumber.BigNumber;
+ cancelledValueT: BigNumber.BigNumber;
+ tokens: string;
+ orderHash: string;
+}
+export interface LogErrorContractEventArgs {
+ errorId: BigNumber.BigNumber;
+ orderHash: string;
+}
+export type ContractEventArgs = LogFillArgs|LogCancelArgs|LogErrorContractEventArgs;
+
export interface Order {
maker: string;
taker: string;