aboutsummaryrefslogtreecommitdiffstats
path: root/src/ts/types.ts
blob: c3da8d81e8d654035158c8e8519327583110cba2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import * as _ from 'lodash';
import * as BigNumber from 'bignumber.js';

// Utility function to create a K:V from a list of strings
// Adapted from: https://basarat.gitbooks.io/typescript/content/docs/types/literal-types.html
function strEnum(values: string[]): {[key: string]: string} {
    return _.reduce(values, (result, key) => {
        result[key] = key;
        return result;
    }, Object.create(null));
}

export const SolidityTypes = strEnum([
    'address',
    'uint256',
    'uint8',
    'string',
    'bool',
]);

export type SolidityTypes = keyof typeof SolidityTypes;