UNPKG

@iota/iota-names-sdk

Version:
72 lines (71 loc) 2.79 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var helpers_exports = {}; __export(helpers_exports, { getConfigType: () => getConfigType, getCoreConfigType: () => getCoreConfigType, getNameRegistrationType: () => getNameRegistrationType, getNameType: () => getNameType, getPricelistConfigType: () => getPricelistConfigType, getRenewalPricelistConfigType: () => getRenewalPricelistConfigType, getSubnameRegistrationType: () => getSubnameRegistrationType, isNestedSubname: () => isNestedSubname, isSubname: () => isSubname, validateYears: () => validateYears, zeroCoin: () => zeroCoin }); module.exports = __toCommonJS(helpers_exports); var import_utils = require("./utils.js"); function isSubname(name) { return (0, import_utils.normalizeIotaName)(name, "dot").split(".").length > 2; } function isNestedSubname(name) { return (0, import_utils.normalizeIotaName)(name, "dot").split(".").length > 3; } function validateYears(years) { if (!(years > 0 && years < 6)) throw new Error("Years must be between 1 and 5"); } function zeroCoin(tx, type) { return tx.moveCall({ target: "0x2::coin::zero", typeArguments: [type] }); } function getConfigType(iotaNamesPackageV1, innerType) { return `${iotaNamesPackageV1}::iota_names::ConfigKey<${innerType}>`; } function getNameType(iotaNamesPackageV1) { return `${iotaNamesPackageV1}::name::Name`; } function getPricelistConfigType(iotaNamesPackageId) { return `${iotaNamesPackageId}::pricing_config::PricingConfig`; } function getRenewalPricelistConfigType(iotaNamesPackageId) { return `${iotaNamesPackageId}::pricing_config::RenewalConfig`; } function getNameRegistrationType(iotaNamesPackageId) { return `${iotaNamesPackageId}::name_registration::NameRegistration`; } function getSubnameRegistrationType(iotaNamesPackageId) { return `${iotaNamesPackageId}::subname_registration::SubnameRegistration`; } function getCoreConfigType(iotaNamesPackageId) { return `${iotaNamesPackageId}::core_config::CoreConfig`; } //# sourceMappingURL=helpers.js.map