diff options
-rw-r--r-- | packages/0x.js/src/contract_wrappers/exchange_wrapper.ts | 8 |
1 files changed, 6 insertions, 2 deletions
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); } } |