aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/utils.ts')
-rw-r--r--src/utils/utils.ts14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/utils/utils.ts b/src/utils/utils.ts
index 1d2e2f908..5786bab07 100644
--- a/src/utils/utils.ts
+++ b/src/utils/utils.ts
@@ -1,8 +1,9 @@
import * as _ from 'lodash';
import * as BN from 'bn.js';
-import * as ethUtil from 'ethereumjs-util';
import * as ethABI from 'ethereumjs-abi';
-import {SolidityTypes, Order} from '../types';
+import * as ethUtil from 'ethereumjs-util';
+import {Order, SignedOrder, SolidityTypes} from '../types';
+import * as BigNumber from 'bignumber.js';
export const utils = {
/**
@@ -25,7 +26,10 @@ export const utils = {
const isValid = /^0x[0-9A-F]{64}$/i.test(orderHashHex);
return isValid;
},
- getOrderHashHex(order: Order, exchangeContractAddr: string) {
+ spawnSwitchErr(name: string, value: any) {
+ return new Error(`Unexpected switch value: ${value} encountered for ${name}`);
+ },
+ getOrderHashHex(order: Order|SignedOrder, exchangeContractAddr: string): string {
const orderParts = [
{value: exchangeContractAddr, type: SolidityTypes.address},
{value: order.maker, type: SolidityTypes.address},
@@ -46,7 +50,7 @@ export const utils = {
const hashHex = ethUtil.bufferToHex(hashBuff);
return hashHex;
},
- spawnSwitchErr(name: string, value: any) {
- return new Error(`Unexpected switch value: ${value} encountered for ${name}`);
+ getCurrentUnixTimestamp(): BigNumber.BigNumber {
+ return new BigNumber(Date.now() / 1000);
},
};