UNPKG

@colony/colony-js-client

Version:

Reference implementation of the Colony API

46 lines (35 loc) 1.55 kB
'use strict'; var _colonyJsUtils = require('@colony/colony-js-utils'); var _web3Utils = require('web3-utils'); var _colonyJsContractClient = require('@colony/colony-js-contract-client'); var _constants = require('./constants'); var dictType = function dictType(dict) { return { validate: function validate(value) { return Object.hasOwnProperty.call(dict, value); }, convertInput: function convertInput(value) { return dict[value]; }, convertOutput: function convertOutput(value) { var converted = void 0; if ((0, _web3Utils.isHexStrict)(value)) { converted = (0, _web3Utils.hexToNumber)(value); } else if ((0, _colonyJsUtils.isBigNumber)(value)) { converted = value.toNumber(); } else { converted = value; } return Object.keys(dict).find(function (name) { return dict[name] === converted; }) || null; } }; }; (0, _colonyJsContractClient.addParamType)('colonyRole', dictType(_constants.COLONY_ROLES)); (0, _colonyJsContractClient.addParamType)('fundingPotType', dictType(_constants.FUNDING_POT_TYPES)); (0, _colonyJsContractClient.addParamType)('taskRatings', dictType(_constants.TASK_RATINGS)); (0, _colonyJsContractClient.addParamType)('taskRole', dictType(_constants.TASK_ROLES)); (0, _colonyJsContractClient.addParamType)('taskStatus', dictType(_constants.TASK_STATUSES)); (0, _colonyJsContractClient.addParamType)('expenditureStatus', dictType(_constants.EXPENDITURE_STATUSES)); //# sourceMappingURL=paramTypes.js.map