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

export const utils = {
    getSignatureTypeIndexIfExists(signature: string): number {
        // tslint:disable-next-line:custom-no-magic-numbers
        const signatureTypeHex = signature.slice(-2);
        const base = 16;
        const signatureTypeInt = parseInt(signatureTypeHex, base);
        return signatureTypeInt;
    },
    getCurrentUnixTimestampSec(): BigNumber {
        const milisecondsInSecond = 1000;
        return new BigNumber(Date.now() / milisecondsInSecond).round();
    },
};