aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2017-07-12 09:22:22 +0800
committerGitHub <noreply@github.com>2017-07-12 09:22:22 +0800
commit5fe128ccf6aa71494b71c6a8ecb07c3a6145140f (patch)
tree835a231e28ed0fff4d70e98b46940b5bfe3b4ffa /src/utils
parent89236fff410563c0d290e0a8090864cf21bae62e (diff)
parent41f0be48f1360ca6241b399593212cdf767c2db0 (diff)
downloaddexon-sol-tools-5fe128ccf6aa71494b71c6a8ecb07c3a6145140f.tar
dexon-sol-tools-5fe128ccf6aa71494b71c6a8ecb07c3a6145140f.tar.gz
dexon-sol-tools-5fe128ccf6aa71494b71c6a8ecb07c3a6145140f.tar.bz2
dexon-sol-tools-5fe128ccf6aa71494b71c6a8ecb07c3a6145140f.tar.lz
dexon-sol-tools-5fe128ccf6aa71494b71c6a8ecb07c3a6145140f.tar.xz
dexon-sol-tools-5fe128ccf6aa71494b71c6a8ecb07c3a6145140f.tar.zst
dexon-sol-tools-5fe128ccf6aa71494b71c6a8ecb07c3a6145140f.zip
Merge pull request #104 from 0xProject/ts-2.4
Update to typescript@2.4
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/assert.ts4
-rw-r--r--src/utils/decorators.ts4
-rw-r--r--src/utils/utils.ts24
3 files changed, 16 insertions, 16 deletions
diff --git a/src/utils/assert.ts b/src/utils/assert.ts
index bdd38721e..dab796c4e 100644
--- a/src/utils/assert.ts
+++ b/src/utils/assert.ts
@@ -4,7 +4,6 @@ import * as Web3 from 'web3';
import {Web3Wrapper} from '../web3_wrapper';
import {SchemaValidator} from './schema_validator';
import {utils} from './utils';
-import {StringEnum} from '../types';
const HEX_REGEX = /^0x[0-9A-F]*$/i;
@@ -27,7 +26,8 @@ export const assert = {
const web3 = new Web3();
this.assert(web3.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value));
},
- doesBelongToStringEnum(variableName: string, value: string, stringEnum: StringEnum): void {
+ doesBelongToStringEnum(variableName: string, value: string,
+ stringEnum: any /* There is no base type for every string enum */): void {
const doesBelongToStringEnum = !_.isUndefined(stringEnum[value]);
const enumValues = _.keys(stringEnum);
const enumValuesAsStrings = _.map(enumValues, enumValue => `'${enumValue}'`);
diff --git a/src/utils/decorators.ts b/src/utils/decorators.ts
index a25f2cff5..ec750b891 100644
--- a/src/utils/decorators.ts
+++ b/src/utils/decorators.ts
@@ -21,10 +21,10 @@ export const decorators = {
return result;
} catch (error) {
if (_.includes(error.message, constants.INVALID_JUMP_PATTERN)) {
- throw new Error(ZeroExError.INVALID_JUMP);
+ throw new Error(ZeroExError.InvalidJump);
}
if (_.includes(error.message, constants.OUT_OF_GAS_PATTERN)) {
- throw new Error(ZeroExError.OUT_OF_GAS);
+ throw new Error(ZeroExError.OutOfGas);
}
throw error;
}
diff --git a/src/utils/utils.ts b/src/utils/utils.ts
index ecc171bfe..6702de218 100644
--- a/src/utils/utils.ts
+++ b/src/utils/utils.ts
@@ -30,18 +30,18 @@ export const utils = {
},
getOrderHashHex(order: Order|SignedOrder): string {
const orderParts = [
- {value: order.exchangeContractAddress, type: SolidityTypes.address},
- {value: order.maker, type: SolidityTypes.address},
- {value: order.taker, type: SolidityTypes.address},
- {value: order.makerTokenAddress, type: SolidityTypes.address},
- {value: order.takerTokenAddress, type: SolidityTypes.address},
- {value: order.feeRecipient, type: SolidityTypes.address},
- {value: utils.bigNumberToBN(order.makerTokenAmount), type: SolidityTypes.uint256},
- {value: utils.bigNumberToBN(order.takerTokenAmount), type: SolidityTypes.uint256},
- {value: utils.bigNumberToBN(order.makerFee), type: SolidityTypes.uint256},
- {value: utils.bigNumberToBN(order.takerFee), type: SolidityTypes.uint256},
- {value: utils.bigNumberToBN(order.expirationUnixTimestampSec), type: SolidityTypes.uint256},
- {value: utils.bigNumberToBN(order.salt), type: SolidityTypes.uint256},
+ {value: order.exchangeContractAddress, type: SolidityTypes.Address},
+ {value: order.maker, type: SolidityTypes.Address},
+ {value: order.taker, type: SolidityTypes.Address},
+ {value: order.makerTokenAddress, type: SolidityTypes.Address},
+ {value: order.takerTokenAddress, type: SolidityTypes.Address},
+ {value: order.feeRecipient, type: SolidityTypes.Address},
+ {value: utils.bigNumberToBN(order.makerTokenAmount), type: SolidityTypes.Uint256},
+ {value: utils.bigNumberToBN(order.takerTokenAmount), type: SolidityTypes.Uint256},
+ {value: utils.bigNumberToBN(order.makerFee), type: SolidityTypes.Uint256},
+ {value: utils.bigNumberToBN(order.takerFee), type: SolidityTypes.Uint256},
+ {value: utils.bigNumberToBN(order.expirationUnixTimestampSec), type: SolidityTypes.Uint256},
+ {value: utils.bigNumberToBN(order.salt), type: SolidityTypes.Uint256},
];
const types = _.map(orderParts, o => o.type);
const values = _.map(orderParts, o => o.value);