aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/utils/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/0x.js/src/utils/utils.ts')
-rw-r--r--packages/0x.js/src/utils/utils.ts45
1 files changed, 30 insertions, 15 deletions
diff --git a/packages/0x.js/src/utils/utils.ts b/packages/0x.js/src/utils/utils.ts
index 04ae34aac..e42a1a853 100644
--- a/packages/0x.js/src/utils/utils.ts
+++ b/packages/0x.js/src/utils/utils.ts
@@ -1,10 +1,10 @@
-import BigNumber from 'bignumber.js';
+import { BigNumber } from '@0xproject/utils';
import BN = require('bn.js');
import * as ethABI from 'ethereumjs-abi';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
-import {Order, SignedOrder, SolidityTypes} from '../types';
+import { Order, SignedOrder, SolidityTypes } from '../types';
export const utils = {
/**
@@ -29,20 +29,35 @@ export const utils = {
spawnSwitchErr(name: string, value: any): Error {
return new Error(`Unexpected switch value: ${value} encountered for ${name}`);
},
- getOrderHashHex(order: Order|SignedOrder): string {
+ 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);