diff options
author | Fabio Berger <me@fabioberger.com> | 2017-11-14 01:43:22 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-11-14 01:43:22 +0800 |
commit | 8d69d8553c2ff12dbc25dd18c3df7a2ec497a42a (patch) | |
tree | 389d3a19441295e825d217e345d4a3c730930801 /packages | |
parent | a072954176ef6b943e45a515ec6d97a662d67a28 (diff) | |
download | dexon-sol-tools-8d69d8553c2ff12dbc25dd18c3df7a2ec497a42a.tar dexon-sol-tools-8d69d8553c2ff12dbc25dd18c3df7a2ec497a42a.tar.gz dexon-sol-tools-8d69d8553c2ff12dbc25dd18c3df7a2ec497a42a.tar.bz2 dexon-sol-tools-8d69d8553c2ff12dbc25dd18c3df7a2ec497a42a.tar.lz dexon-sol-tools-8d69d8553c2ff12dbc25dd18c3df7a2ec497a42a.tar.xz dexon-sol-tools-8d69d8553c2ff12dbc25dd18c3df7a2ec497a42a.tar.zst dexon-sol-tools-8d69d8553c2ff12dbc25dd18c3df7a2ec497a42a.zip |
Add interface type
Diffstat (limited to 'packages')
-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); } } |