aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-06-07 18:48:26 +0800
committerFabio Berger <me@fabioberger.com>2017-06-07 18:48:26 +0800
commit4eee0b52f13cb382329cc7061d4377561ac1cbd3 (patch)
treec560b5b90b0ec8bee67094711b17f0c16e53e23f /src/utils
parent918315e89f3408124d2e78bbd1acb58ed42d1766 (diff)
parent28d3528e42563f95255cee3bd7f85cc03141522e (diff)
downloaddexon-sol-tools-4eee0b52f13cb382329cc7061d4377561ac1cbd3.tar
dexon-sol-tools-4eee0b52f13cb382329cc7061d4377561ac1cbd3.tar.gz
dexon-sol-tools-4eee0b52f13cb382329cc7061d4377561ac1cbd3.tar.bz2
dexon-sol-tools-4eee0b52f13cb382329cc7061d4377561ac1cbd3.tar.lz
dexon-sol-tools-4eee0b52f13cb382329cc7061d4377561ac1cbd3.tar.xz
dexon-sol-tools-4eee0b52f13cb382329cc7061d4377561ac1cbd3.tar.zst
dexon-sol-tools-4eee0b52f13cb382329cc7061d4377561ac1cbd3.zip
merge master
Diffstat (limited to 'src/utils')
-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);
},
};