aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/src/utils/utils.ts
blob: 7cf9450a01e3cd6c93011919652d9c01be87acd6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { BigNumber } from '@0xproject/utils';

export const utils = {
    spawnSwitchErr(name: string, value: any): Error {
        return new Error(`Unexpected switch value: ${value} encountered for ${name}`);
    },
    getCurrentUnixTimestampSec(): BigNumber {
        const milisecondsInSecond = 1000;
        return new BigNumber(Date.now() / milisecondsInSecond).round();
    },
    getCurrentUnixTimestampMs(): BigNumber {
        return new BigNumber(Date.now());
    },
};