UNPKG

@mysten/suins

Version:
64 lines (63 loc) 2.41 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, { getCoinDiscountConfigType: () => getCoinDiscountConfigType, getConfigType: () => getConfigType, getDomainType: () => getDomainType, getPricelistConfigType: () => getPricelistConfigType, getRenewalPricelistConfigType: () => getRenewalPricelistConfigType, isNestedSubName: () => isNestedSubName, isSubName: () => isSubName, validateYears: () => validateYears, zeroCoin: () => zeroCoin }); module.exports = __toCommonJS(helpers_exports); var import_utils = require("@mysten/sui/utils"); function isSubName(name) { return (0, import_utils.normalizeSuiNSName)(name, "dot").split(".").length > 2; } function isNestedSubName(name) { return (0, import_utils.normalizeSuiNSName)(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(suinsPackageV1, innerType) { return `${suinsPackageV1}::suins::ConfigKey<${innerType}>`; } function getDomainType(suinsPackageV1) { return `${suinsPackageV1}::domain::Domain`; } function getPricelistConfigType(suinsPackageId) { return `${suinsPackageId}::pricing_config::PricingConfig`; } function getRenewalPricelistConfigType(suinsPackageId) { return `${suinsPackageId}::pricing_config::RenewalConfig`; } function getCoinDiscountConfigType(paymentPackageId) { return `${paymentPackageId}::payments::PaymentsConfig`; } //# sourceMappingURL=helpers.js.map