"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.toPrice = void 0; const decimal_js_1 = __importDefault(require("decimal.js")); /** * * @param price formatted as `` */ function toPrice(price) { if (typeof price === "string") { const matchResult = price.match(/^([0-9.]+)([a-z][a-z0-9]*)$/i); if (!matchResult) { throw new Error("Invalid price string. Please check if the format is ``"); } const [, amount, denom] = matchResult; return { amount: new decimal_js_1.default(amount), denom, }; } return price; } exports.toPrice = toPrice; //# sourceMappingURL=price.js.map