From 8d69d8553c2ff12dbc25dd18c3df7a2ec497a42a Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 13 Nov 2017 12:43:22 -0500 Subject: Add interface type --- packages/0x.js/src/contract_wrappers/exchange_wrapper.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'packages/0x.js/src') diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts index 6a783b76e..654637a38 100644 --- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts @@ -42,6 +42,10 @@ import {artifacts} from '../artifacts'; const SHOULD_VALIDATE_BY_DEFAULT = true; +interface ExchangeContractErrCodesToMsgs { + [exchangeContractErrCodes: number]: string; +} + /** * This class includes all the functionality related to calling methods and subscribing to * events of the 0x Exchange smart contract. @@ -50,7 +54,7 @@ export class ExchangeWrapper extends ContractWrapper { private _exchangeContractIfExists?: ExchangeContract; private _orderValidationUtils: OrderValidationUtils; private _tokenWrapper: TokenWrapper; - private _exchangeContractErrCodesToMsg = { + private _exchangeContractErrCodesToMsg: ExchangeContractErrCodesToMsgs = { [ExchangeContractErrCodes.ERROR_FILL_EXPIRED]: ExchangeContractErrs.OrderFillExpired, [ExchangeContractErrCodes.ERROR_CANCEL_EXPIRED]: ExchangeContractErrs.OrderFillExpired, [ExchangeContractErrCodes.ERROR_FILL_NO_VALUE]: ExchangeContractErrs.OrderRemainingFillAmountZero, @@ -807,7 +811,7 @@ export class ExchangeWrapper extends ContractWrapper { if (!_.isUndefined(errLog)) { const logArgs = errLog.args; const errCode = logArgs.errorId.toNumber(); - const errMessage: string = this._exchangeContractErrCodesToMsg[errCode]; + const errMessage = this._exchangeContractErrCodesToMsg[errCode]; throw new Error(errMessage); } } -- cgit