@tribecahq/registry
Version:
Registry of Tribeca DAOs.
25 lines • 986 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateConfig = exports.validateTokenInfo = void 0;
const constants_1 = require("../constants");
const validateTokenInfo = ({ address, decimals, symbol, name, chainId, ...rest }) => {
if (decimals === undefined) {
throw new Error("decimals required");
}
if (symbol === undefined) {
throw new Error("symbol required");
}
if (name === undefined) {
throw new Error("name required");
}
return { address, decimals, symbol, name, chainId, ...rest };
};
exports.validateTokenInfo = validateTokenInfo;
const validateConfig = (cfg) => {
if (cfg.description.length > constants_1.DESCRIPTION_CHARACTER_LIMIT) {
throw new Error(`Description for ${cfg.name} is too long (${cfg.description.length} > ${constants_1.DESCRIPTION_CHARACTER_LIMIT}).`);
}
return cfg;
};
exports.validateConfig = validateConfig;
//# sourceMappingURL=validate.js.map