"use strict";var l=Object.create;var c=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var h=(t,n)=>{for(var r in n)c(t,r,{get:n[r],enumerable:!0})},a=(t,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of y(n))!w.call(t,e)&&e!==r&&c(t,e,{get:()=>n[e],enumerable:!(o=A(n,e))||o.enumerable});return t};var v=(t,n,r)=>(r=t!=null?l(U(t)):{},a(n||!t||!t.__esModule?c(r,"default",{value:t,enumerable:!0}):r,t)),P=t=>a(c({},"__esModule",{value:!0}),t);var B={};h(B,{MRLTypes:()=>x,convertDecimals:()=>X,formatAssetIdToERC20:()=>V,getPolkadotApi:()=>L,getSovereignAccountAddresses:()=>I,hasDecimalOverflow:()=>S,isHexString:()=>R,toBigInt:()=>p,toDecimal:()=>u});module.exports=P(B);function R(t){return typeof t=="string"&&t.startsWith("0x")}function V(t){if(t.startsWith("0x"))return t;if(!/^\d{38,39}$/.test(t))throw new Error(`Asset id: ${t} must be a string and have 38-39 digits`);return`0xffffffff${BigInt(t).toString(16).padStart(32,"0")}`}var s=v(require("big.js"),1);s.default.NE=-18;function u(t,n,r=6,o){let e=(0,s.default)(t.toString().replace(/[^0-9]/g,"")),b=(0,s.default)(10).pow(n);return e.div(b).round(r,o).toString()}function p(t,n){if(typeof t=="bigint")return t;let r=(0,s.default)(10).pow(n),o=(0,s.default)(t).mul(r);return BigInt(o.toFixed(0,s.default.roundDown))}function X(t,n,r){let o=u(t,n,n);return p(o.toString(),r)}function S(t,n){let r=t.toString().split(".");return r.length>1&&r[1].length>n}var m=require("@polkadot/api"),d=require("@polkadot/apps-config"),f=require("lru-cache"),x=(e=>(e.XcmVersionedMultiLocation="XcmVersionedMultiLocation",e.XcmVersionedLocation="XcmVersionedLocation",e.XcmRoutingUserAction="XcmRoutingUserAction",e.VersionedUserAction="VersionedUserAction",e))(x||{}),g=new f.LRUCache({max:20,dispose:async t=>{let n=await t;n.isConnected&&n.disconnect()}});async function L(t){let n=Array.isArray(t)?t.join(";"):t,r=g.get(n)||m.ApiPromise.create({noInitWarn:!0,provider:new m.WsProvider(t),types:{XcmRoutingUserAction:{destination:"XcmVersionedLocation"},VersionedUserAction:{_enum:{V1:"XcmRoutingUserAction"}}},typesBundle:d.typesBundle});g.set(n,r);let o=await r;return await o.isReady,o}var i=require("@polkadot/util");function I(t){let n=(0,i.bnToU8a)(t,{bitLength:32}),r=(0,i.u8aToHex)(new Uint8Array([...(0,i.stringToU8a)("para"),...n])).padEnd(66,"0"),o=(0,i.u8aToHex)(new Uint8Array([...(0,i.stringToU8a)("sibl"),...n])).padEnd(66,"0"),e=o.slice(0,42);return{generic:o,moonbeam:e,relay:r}}0&&(module.exports={MRLTypes,convertDecimals,formatAssetIdToERC20,getPolkadotApi,getSovereignAccountAddresses,hasDecimalOverflow,isHexString,toBigInt,toDecimal}); //# sourceMappingURL=index.cjs.map