@swapkit/helpers 1.0.0-rc.57 → 1.0.0-rc.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var Tt=Object.create;var j=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var $t=Object.getOwnPropertyNames;var Rt=Object.getPrototypeOf,St=Object.prototype.hasOwnProperty;var Bt=(s,t,e)=>t in s?j(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var It=(s,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of $t(t))!St.call(s,r)&&r!==e&&j(s,r,{get:()=>t[r],enumerable:!(n=vt(t,r))||n.enumerable});return s};var Ot=(s,t,e)=>(e=s!=null?Tt(Rt(s)):{},It(t||!s||!s.__esModule?j(e,"default",{value:s,enumerable:!0}):e,s));var p=(s,t,e)=>(Bt(s,typeof t!="symbol"?t+"":t,e),e),Mt=(s,t,e)=>{if(!t.has(s))throw TypeError("Cannot "+e)};var w=(s,t,e)=>{if(t.has(s))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(s):t.set(s,e)};var d=(s,t,e)=>(Mt(s,t,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@swapkit/types"),Et="0x313ce567",rt=async({chain:s,to:t})=>{try{const{result:e}=await gt.post(i.ChainToRPC[s],{headers:{accept:"*/*","content-type":"application/json","cache-control":"no-cache"},body:JSON.stringify({id:44,jsonrpc:"2.0",method:"eth_call",params:[{to:t.toLowerCase(),data:Et},"latest"]})});return parseInt(BigInt(e).toString())}catch(e){return console.error(e),i.BaseDecimal[s]}},qt=async s=>{if(s===i.Chain.Ethereum)return i.BaseDecimal.ETH;const[,t]=s.split("-");return t!=null&&t.startsWith("0x")?rt({chain:i.Chain.Ethereum,to:t}):i.BaseDecimal.ETH},xt=async s=>{const[,t]=s.split("-");return t!=null&&t.startsWith("0x")?rt({chain:i.Chain.Avalanche,to:t.toLowerCase()}):i.BaseDecimal.AVAX},Pt=async s=>(s===i.Chain.BinanceSmartChain,i.BaseDecimal.BSC),it=async({chain:s,symbol:t})=>{switch(s){case i.Chain.Ethereum:return qt(t);case i.Chain.Avalanche:return xt(t);case i.Chain.BinanceSmartChain:return Pt(t);default:return i.BaseDecimal[s]}},Vt={[i.FeeOption.Average]:1.2,[i.FeeOption.Fast]:1.5,[i.FeeOption.Fastest]:2},K=({chain:s,symbol:t})=>{switch(s){case i.Chain.Bitcoin:case i.Chain.BitcoinCash:case i.Chain.Litecoin:case i.Chain.Dogecoin:case i.Chain.Binance:case i.Chain.Ethereum:case i.Chain.Avalanche:return t===s;case i.Chain.Arbitrum:case i.Chain.Optimism:return t==="ETH";case i.Chain.Maya:return t==="CACAO";case i.Chain.Kujira:return t==="KUJI";case i.Chain.Cosmos:return t==="ATOM";case i.Chain.Polygon:return t==="MATIC";case i.Chain.BinanceSmartChain:return t==="BNB";case i.Chain.THORChain:return t==="RUNE"}},at=s=>{switch(s){case"ETH.THOR":return{identifier:"ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044",decimal:18};case"ETH.vTHOR":return{identifier:"ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d",decimal:18};case i.Chain.Cosmos:return{identifier:"GAIA.ATOM",decimal:i.BaseDecimal[s]};case i.Chain.THORChain:return{identifier:"THOR.RUNE",decimal:i.BaseDecimal[s]};case i.Chain.BinanceSmartChain:return{identifier:"BSC.BNB",decimal:i.BaseDecimal[s]};case i.Chain.Maya:return{identifier:"MAYA.CACAO",decimal:i.BaseDecimal.MAYA};case"MAYA.MAYA":return{identifier:"MAYA.MAYA",decimal:4};case i.Chain.Kujira:case i.Chain.Arbitrum:case i.Chain.Optimism:case i.Chain.BitcoinCash:case i.Chain.Litecoin:case i.Chain.Dogecoin:case i.Chain.Binance:case i.Chain.Avalanche:case i.Chain.Polygon:case i.Chain.Bitcoin:case i.Chain.Ethereum:return{identifier:`${s}.${s}`,decimal:i.BaseDecimal[s]}}},ot=({chain:s,symbol:t})=>{if(t.includes("/"))return"Synth";switch(s){case i.Chain.Bitcoin:case i.Chain.BitcoinCash:case i.Chain.Dogecoin:case i.Chain.Litecoin:case i.Chain.Maya:case i.Chain.THORChain:return"Native";case i.Chain.Cosmos:return t==="ATOM"?"Native":i.Chain.Cosmos;case i.Chain.Kujira:return t===i.Chain.Kujira?"Native":i.Chain.Kujira;case i.Chain.Binance:return t===i.Chain.Binance?"Native":"BEP2";case i.Chain.BinanceSmartChain:return t===i.Chain.Binance?"Native":"BEP20";case i.Chain.Ethereum:return t===i.Chain.Ethereum?"Native":"ERC20";case i.Chain.Avalanche:return t===i.Chain.Avalanche?"Native":i.Chain.Avalanche;case i.Chain.Polygon:return t===i.Chain.Polygon?"Native":"POLYGON";case i.Chain.Arbitrum:return[i.Chain.Ethereum,i.Chain.Arbitrum].includes(t)?"Native":"ARBITRUM";case i.Chain.Optimism:return[i.Chain.Ethereum,i.Chain.Optimism].includes(t)?"Native":"OPTIMISM"}},Dt=s=>{var c;const[t,...e]=s.split("."),n=s.includes("/"),r=e.join("."),a=(c=r==null?void 0:r.split("-"))==null?void 0:c[0];return{chain:t,symbol:r,ticker:a,synth:n}},kt=new RegExp(/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,"gmi"),Nt=s=>{const[t,e]=s.split(".");if(!i.EVMChainList.includes(t))return!0;const[,n]=e.split("-");return K({chain:t,symbol:e})||!!n},jt=s=>s.filter(t=>{const e=`${t.chain}.${t.symbol}`;return!kt.test(e)&&Nt(e)&&t.value!=="0"});function ct({liquidityUnits:s,poolUnits:t,runeDepth:e}){const n=m(s),r=m(t),a=m(e),c=n.mul(a),o=r.mul(r).mul(2),u=r.mul(n).mul(2),l=n.mul(n),h=r.mul(r).mul(r);return c.mul(o.sub(u).add(l)).div(h)}function ut({liquidityUnits:s,poolUnits:t,assetDepth:e}){const n=m(s),r=m(t),a=m(e),c=n.mul(a),o=r.mul(r).mul(2),u=r.mul(n).mul(2),l=n.mul(n),h=c.mul(o.sub(u).add(l)),C=r.mul(r).mul(r);return h.div(C)}function Ht({percent:s,runeDepth:t,liquidityUnits:e,poolUnits:n}){return ct({runeDepth:t,liquidityUnits:e,poolUnits:n}).mul(s)}function Ut({percent:s,assetDepth:t,liquidityUnits:e,poolUnits:n}){return ut({assetDepth:t,liquidityUnits:e,poolUnits:n}).mul(s)}function m(s){return f.fromBigInt(BigInt(s),i.BaseDecimal.THOR)}function lt({liquidityUnits:s,poolUnits:t,runeDepth:e,assetDepth:n}){return{assetAmount:m(n).mul(s).div(t),runeAmount:m(e).mul(s).div(t)}}function Lt({liquidityUnits:s,poolUnits:t,runeDepth:e,assetDepth:n,percent:r}){return Object.fromEntries(Object.entries(lt({liquidityUnits:s,poolUnits:t,runeDepth:e,assetDepth:n})).map(([a,c])=>[a,c.mul(r)]))}function Ft({runeDepth:s,poolUnits:t,assetDepth:e,liquidityUnits:n,runeAmount:r,assetAmount:a}){const c=new f({value:s,decimal:8}),o=new f({value:e,decimal:8}),u=new f({value:t,decimal:8}),l=new f({value:r,decimal:8}),h=new f({value:a,decimal:8}),C=l.mul(o),k=h.mul(c),yt=l.mul(h),bt=c.mul(o),Ct=u.mul(C.add(k.add(yt.mul(2)))),wt=C.add(k.add(bt.mul(2))),Q=Ct.div(wt),N=m(n).add(Q);if(Q.getBaseValue("number")===0)return N.div(u).getBaseValue("number");const At=u.add(N);return N.div(At).getBaseValue("number")}function Wt({runeAmount:s,assetAmount:t,runeDepth:e,assetDepth:n}){if(s==="0"||t==="0"||e==="0"||n==="0")return 0;const r=m(e),a=m(n),c=m(t),o=m(s),u=c.mul(r).sub(a.mul(o)),l=a.mul(o).add(r.mul(a));return Math.abs(u.div(l).getBaseValue("number"))}const Gt=(s,t)=>{switch(s){case i.MemoType.LEAVE:case i.MemoType.BOND:{const{address:e}=t;return`${s}:${e}`}case i.MemoType.UNBOND:{const{address:e,unbondAmount:n}=t;return`${s}:${e}:${n*10**8}`}case i.MemoType.THORNAME_REGISTER:{const{name:e,chain:n,address:r,owner:a}=t;return`${s}:${e}:${n}:${r}${a?`:${a}`:""}`}case i.MemoType.DEPOSIT:{const{chain:e,symbol:n,address:r,singleSide:a}=t;return a?`${s}:${e}/${n}::t:0`:`${s}:${((o,u)=>{switch(o){case i.Chain.Litecoin:return"l";case i.Chain.Dogecoin:return"d";case i.Chain.BitcoinCash:return"c";default:return`${o}.${u}`}})(e,n)}:${r||""}:t:0`}case i.MemoType.WITHDRAW:{const{chain:e,ticker:n,symbol:r,basisPoints:a,targetAssetString:c,singleSide:o}=t,u=e==="ETH"&&n!=="ETH"?`${n}-${r.slice(-3)}`:r,l=!o&&c?`:${c}`:"";return`${s}:${e}${o?"/":"."}${u}:${a}${l}`}case i.MemoType.OPEN_LOAN:case i.MemoType.CLOSE_LOAN:{const{asset:e,address:n}=t;return`${s}:${e}:${n}`}default:return""}};function Kt(s){if(s<0)throw new Error("Invalid number of year");return 10+s}function Yt(s){if(s.length>30)return!1;const t=/^[a-zA-Z0-9+_-]+$/g;return!!s.match(t)}function zt([s,t,e,n,r]){return`${s}'/${t}'/${e}'/${n}${typeof r!="number"?"":`/${r}`}`}class X extends Error{constructor(t,e,n){const r=t.status||t.status===0?t.status:"",a=t.statusText||"",c=`${r} ${a}`.trim(),o=c?`status code ${c}`:"an unknown error";super(`Request failed with ${o}`),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="HTTPError",this.response=t,this.request=e,this.options=n}}class ht extends Error{constructor(t){super("Request timed out"),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="TimeoutError",this.request=t}}const x=s=>s!==null&&typeof s=="object",E=(...s)=>{for(const t of s)if((!x(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Y({},...s)},dt=(s={},t={})=>{const e=new globalThis.Headers(s),n=t instanceof globalThis.Headers,r=new globalThis.Headers(t);for(const[a,c]of r.entries())n&&c==="undefined"||c===void 0?e.delete(a):e.set(a,c);return e},Y=(...s)=>{let t={},e={};for(const n of s)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(x(n)){for(let[r,a]of Object.entries(n))x(a)&&r in t&&(a=Y(t[r],a)),t={...t,[r]:a};x(n.headers)&&(e=dt(e,n.headers),t.headers=e)}return t},Jt=(()=>{let s=!1,t=!1;const e=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";return e&&n&&(t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return s=!0,"half"}}).headers.has("Content-Type")),s&&!t})(),Qt=typeof globalThis.AbortController=="function",Xt=typeof globalThis.ReadableStream=="function",Zt=typeof globalThis.FormData=="function",mt=["get","post","put","patch","head","delete"],te={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},H=2147483647,pt=Symbol("stop"),ee={json:!0,parseJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},ne={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0},se=s=>mt.includes(s)?s.toUpperCase():s,re=["get","put","head","delete","options","trace"],ie=[408,413,429,500,502,503,504],ft=[413,429,503],Z={limit:2,methods:re,statusCodes:ie,afterStatusCodes:ft,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:s=>.3*2**(s-1)*1e3},ae=(s={})=>{if(typeof s=="number")return{...Z,limit:s};if(s.methods&&!Array.isArray(s.methods))throw new Error("retry.methods must be an array");if(s.statusCodes&&!Array.isArray(s.statusCodes))throw new Error("retry.statusCodes must be an array");return{...Z,...s,afterStatusCodes:ft}};async function oe(s,t,e,n){return new Promise((r,a)=>{const c=setTimeout(()=>{e&&e.abort(),a(new ht(s))},n.timeout);n.fetch(s,t).then(r).catch(a).then(()=>{clearTimeout(c)})})}async function ce(s,{signal:t}){return new Promise((e,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",r,{once:!0}));function r(){clearTimeout(a),n(t.reason)}const a=setTimeout(()=>{t==null||t.removeEventListener("abort",r),e()},s)})}const ue=(s,t)=>{const e={};for(const n in t)!(n in ne)&&!(n in ee)&&!(n in s)&&(e[n]=t[n]);return e};class V{static create(t,e){const n=new V(t,e),r=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>H)throw new RangeError(`The \`timeout\` option cannot be greater than ${H}`);await Promise.resolve();let o=await n._fetch();for(const u of n._options.hooks.afterResponse){const l=await u(n.request,n._options,n._decorateResponse(o.clone()));l instanceof globalThis.Response&&(o=l)}if(n._decorateResponse(o),!o.ok&&n._options.throwHttpErrors){let u=new X(o,n.request,n._options);for(const l of n._options.hooks.beforeError)u=await l(u);throw u}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!Xt)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return n._stream(o.clone(),n._options.onDownloadProgress)}return o},c=n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(r):r();for(const[o,u]of Object.entries(te))c[o]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||u);const h=(await c).clone();if(o==="json"){if(h.status===204||(await h.clone().arrayBuffer()).byteLength===0)return"";if(e.parseJson)return e.parseJson(await h.text())}return h[o]()};return c}constructor(t,e={}){if(Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"abortController",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_retryCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._input=t,this._options={credentials:this._input.credentials||"same-origin",...e,headers:dt(this._input.headers,e.headers),hooks:Y({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},e.hooks),method:se(e.method??this._input.method),prefixUrl:String(e.prefixUrl||""),retry:ae(e.retry),throwHttpErrors:e.throwHttpErrors!==!1,timeout:e.timeout??1e4,fetch:e.fetch??globalThis.fetch.bind(globalThis)},typeof this._input!="string"&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&typeof this._input=="string"){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(Qt){if(this.abortController=new globalThis.AbortController,this._options.signal){const n=this._options.signal;this._options.signal.addEventListener("abort",()=>{this.abortController.abort(n.reason)})}this._options.signal=this.abortController.signal}if(Jt&&(this._options.duplex="half"),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){const r="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,r);(Zt&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}this._options.json!==void 0&&(this._options.body=JSON.stringify(this._options.json),this.request.headers.set("content-type",this._options.headers.get("content-type")??"application/json"),this.request=new globalThis.Request(this.request,{body:this._options.body}))}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount<this._options.retry.limit&&!(t instanceof ht)){if(t instanceof X){if(!this._options.retry.statusCodes.includes(t.response.status))return 0;const n=t.response.headers.get("Retry-After");if(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let r=Number(n);return Number.isNaN(r)?r=Date.parse(n)-Date.now():r*=1e3,this._options.retry.maxRetryAfter!==void 0&&r>this._options.retry.maxRetryAfter?0:r}if(t.response.status===413)return 0}const e=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,e)}return 0}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(e){const n=Math.min(this._calculateRetryDelay(e),H);if(n!==0&&this._retryCount>0){await ce(n,{signal:this._options.signal});for(const r of this._options.hooks.beforeRetry)if(await r({request:this.request,options:this._options,error:e,retryCount:this._retryCount})===pt)return;return this._retry(t)}throw e}}async _fetch(){for(const e of this._options.hooks.beforeRequest){const n=await e(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}const t=ue(this.request,this._options);return this._options.timeout===!1?this._options.fetch(this.request.clone(),t):oe(this.request.clone(),t,this.abortController,this._options)}_stream(t,e){const n=Number(t.headers.get("content-length"))||0;let r=0;return t.status===204?(e&&e({percent:1,totalBytes:n,transferredBytes:r},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){const c=t.body.getReader();e&&e({percent:0,transferredBytes:0,totalBytes:n},new Uint8Array);async function o(){const{done:u,value:l}=await c.read();if(u){a.close();return}if(e){r+=l.byteLength;const h=n===0?0:r/n;e({percent:h,transferredBytes:r,totalBytes:n},l)}a.enqueue(l),await o()}await o()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}}/*! MIT License © Sindre Sorhus */const L=s=>{const t=(e,n)=>V.create(e,E(s,n));for(const e of mt)t[e]=(n,r)=>V.create(n,E(s,r,{method:e}));return t.create=e=>L(E(e)),t.extend=e=>L(E(s,e)),t.stop=pt,t},le=L(),he=le,de=typeof window<"u"?{}:{referrer:"https://sk.thorswap.net",referer:"https://sk.thorswap.net"},tt=he.create({headers:de}),gt={get:(s,t)=>tt.get(s,t).json(),post:(s,t)=>tt.post(s,t).json()},et=[...Object.values(i.Chain),"TERRA"];function me(s=""){const t=s.toUpperCase(),[e]=t.split(".");if(et.includes(e))return!0;const[n]=t.split("/");if(et.includes(n))return!0;throw new Error(`Invalid identifier: ${s}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`)}const S=8,y=s=>10n**BigInt(s),T=s=>Math.log10(parseFloat(s.toString()));function B({value:s,bigIntDecimal:t=S,decimal:e=S}){if(e===0)return s.toString();const n=s<0n;let r=s.toString().substring(n?1:0);const a=e-(r.length-1);a>0&&(r="0".repeat(a)+r);const c=r.length-e;let o=r.slice(-e);return parseInt(o[t])>=5?o=`${o.substring(0,t-1)}${(parseInt(o[t-1])+1).toString()}`:o=o.substring(0,t),`${n?"-":""}${r.slice(0,c)}.${o}`.replace(/\.?0*$/,"")}var b,v,g,A,D,_t,O,F,M,W;const J=class J{constructor(t){w(this,b);w(this,g);w(this,D);w(this,O);w(this,M);p(this,"decimalMultiplier",10n**8n);p(this,"bigIntValue",0n);p(this,"decimal");const e=G(t),n=typeof t=="object";this.decimal=n?t.decimal:void 0,this.decimalMultiplier=n&&"decimalMultiplier"in t?t.decimalMultiplier:y(Math.max(nt(q(e)),this.decimal||0)),d(this,D,_t).call(this,e)}static fromBigInt(t,e){return new J({decimal:e,value:B({value:t,bigIntDecimal:e,decimal:e})})}static shiftDecimals({value:t,from:e,to:n}){return this.fromBigInt(t.getBaseValue("bigint")*y(n)/y(e),n)}set(t){return new this.constructor({decimal:this.decimal,value:t,identifier:this.toString()})}add(...t){return d(this,b,v).call(this,"add",...t)}sub(...t){return d(this,b,v).call(this,"sub",...t)}mul(...t){return d(this,b,v).call(this,"mul",...t)}div(...t){return d(this,b,v).call(this,"div",...t)}gt(t){return d(this,g,A).call(this,"gt",t)}gte(t){return d(this,g,A).call(this,"gte",t)}lt(t){return d(this,g,A).call(this,"lt",t)}lte(t){return d(this,g,A).call(this,"lte",t)}eqValue(t){return d(this,g,A).call(this,"eqValue",t)}getValue(t){const e=this.formatBigIntToSafeValue(this.bigIntValue,this.decimal||T(this.decimalMultiplier));switch(t){case"number":return Number(e);case"string":return e;case"bigint":return this.bigIntValue*10n**BigInt(this.decimal||8n)/this.decimalMultiplier}}getBaseValue(t){const e=this.decimalMultiplier/y(this.decimal||i.BaseDecimal.THOR),n=this.bigIntValue/e;switch(t){case"number":return Number(n);case"string":return n.toString();case"bigint":return n}}getBigIntValue(t,e){if(!e&&typeof t=="object")return t.bigIntValue;const n=G(t),r=q(n);return r==="0"||r==="undefined"?0n:d(this,M,W).call(this,r,e)}toSignificant(t=6){const[e,n]=this.getValue("string").split("."),r=e||"",a=n||"";if((parseInt(r)?r.length+a.length:a.length)<=t)return this.getValue("string");if(r.length>=t)return r.slice(0,t).padEnd(r.length,"0");if(parseInt(r))return`${r}.${a.slice(0,t-r.length)}`.padEnd(t-r.length,"0");const o=parseInt(a),u=`${o}`.slice(0,t);return`0.${u.padStart(a.length-`${o}`.length+u.length,"0")}`}toFixed(t=6){const[e,n]=this.getValue("string").split("."),r=e||"",a=n||"";if(parseInt(r))return`${r}.${a.slice(0,t)}`.padEnd(t,"0");const c=parseInt(a),o=`${c}`.slice(0,t);return`0.${o.padStart(a.length-`${c}`.length+o.length,"0")}`}toAbbreviation(t=2){const e=this.getValue("number"),n=["","K","M","B","T","Q","Qi","S"],r=Math.floor(Math.log10(Math.abs(e))/3),a=n[r];if(!a)return this.getValue("string");const c=10**(r*3);return`${(e/c).toFixed(t)}${a}`}toCurrency(t="$",{currencyPosition:e="start",decimal:n=2,decimalSeparator:r=".",thousandSeparator:a=","}={}){const c=this.getValue("number"),[o,u=""]=c.toFixed(6).split("."),l=o.replace(/\B(?=(\d{3})+(?!\d))/g,a),h=!o&&!u?"0.00":o==="0"?`${parseFloat(`0.${u}`)}`.replace(".",r):`${l}${parseInt(u)?`${r}${u.slice(0,n)}`:""}`;return`${e==="start"?t:""}${h}${e==="end"?t:""}`}formatBigIntToSafeValue(t,e){const n=e||this.decimal||S,r=Math.max(n,T(this.decimalMultiplier)),a=t<0n,c=t.toString().substring(a?1:0),o=r-(c.length-1),u=o>0?"0".repeat(o)+c:c,l=u.length-r;let h=u.slice(-r);return parseInt(h[n])>=5?h=`${h.substring(0,n-1)}${(parseInt(h[n-1])+1).toString()}`:h=h.substring(0,n),`${a?"-":""}${u.slice(0,l)}.${h}`.replace(/\.?0*$/,"")}};b=new WeakSet,v=function(t,...e){const n=d(this,O,F).call(this,this,...e),r=Math.max(n,T(this.decimalMultiplier)),a=y(r),c=e.reduce((u,l)=>{const h=this.getBigIntValue(l,r);switch(t){case"add":return u+h;case"sub":return u-h;case"mul":return u*h/a;case"div":{if(h===0n)throw new RangeError("Division by zero");return u*a/h}default:return u}},this.bigIntValue*a/this.decimalMultiplier),o=B({bigIntDecimal:r,decimal:r,value:c});return new this.constructor({decimalMultiplier:y(r),decimal:this.decimal,value:o,identifier:this.toString()})},g=new WeakSet,A=function(t,...e){const n=d(this,O,F).call(this,this,...e),r=this.getBigIntValue(e[0],n),a=this.getBigIntValue(this,n);switch(t){case"gt":return a>r;case"gte":return a>=r;case"lt":return a<r;case"lte":return a<=r;case"eqValue":return a===r}},D=new WeakSet,_t=function(t){const e=q(t)||"0";this.bigIntValue=d(this,M,W).call(this,e)},O=new WeakSet,F=function(...t){const e=t.map(n=>typeof n=="object"?n.decimal||T(n.decimalMultiplier):nt(q(n))).filter(Boolean);return Math.max(...e,S)},M=new WeakSet,W=function(t,e){const n=e?y(e):this.decimalMultiplier,r=T(n),[a="",c=""]=t.split(".");return BigInt(`${a}${c.padEnd(r,"0")}`)};let I=J;const pe=Intl.NumberFormat("fullwide",{useGrouping:!1,maximumFractionDigits:20});function q(s){const e=`${typeof s=="number"?pe.format(s):G(s)}`.replaceAll(",",".").split(".");return e.length>1?`${e.slice(0,-1).join("")}.${e.at(-1)}`:e[0]}function nt(s){var e;const t=((e=s.split(".")[1])==null?void 0:e.length)||0;return Math.max(t,S)}function G(s){return typeof s=="object"?"getValue"in s?s.getValue("string"):s.value:s}const $=new Map;class _ extends I{constructor({value:e,decimal:n,tax:r,chain:a,symbol:c,identifier:o}){super(typeof e=="object"?e:{decimal:n,value:e});p(this,"address");p(this,"chain");p(this,"isGasAsset",!1);p(this,"isSynthetic",!1);p(this,"symbol");p(this,"tax");p(this,"ticker");p(this,"type");const u=P(o||`${a}.${c}`);this.type=ot(u),this.tax=r,this.chain=u.chain,this.ticker=u.ticker,this.symbol=u.symbol,this.address=u.address,this.isSynthetic=u.isSynthetic,this.isGasAsset=u.isGasAsset}toString(){return this.isSynthetic?this.symbol:`${this.chain}.${this.symbol}`}toUrl(){return this.isSynthetic?`${this.chain}.${this.symbol.replace("/",".")}`:this.toString()}eq({chain:e,symbol:n}){return this.chain===e&&this.symbol===n}static fromUrl(e,n=0){const[r,a,c]=e.split(".");if(!r||!a)throw new Error("Invalid asset url");const o=r===i.Chain.THORChain&&c?`${r}.${a}/${c}`:e;return U(o,n)}static fromString(e,n=0){return U(e,n)}static fromIdentifier(e,n=0){return U(e,n)}static fromStringSync(e,n=0){const{chain:r,isSynthetic:a}=P(e),c=$.get(e.toUpperCase());if(a)return st(e,n);const{tax:o,decimal:u,identifier:l}=c||{decimal:i.BaseDecimal[r],identifier:e};return new _({tax:o,value:R(n,u),identifier:a?e:l,decimal:a?8:u})}static fromIdentifierSync(e,n=0){const{chain:r,isSynthetic:a}=P(e),c=$.get(e);if(a)return st(e,n);const{tax:o,decimal:u,identifier:l}=c||{decimal:i.BaseDecimal[r],identifier:e};return new _({tax:o,decimal:u,identifier:l,value:R(n,u)})}static fromChainOrSignature(e,n=0){const{decimal:r,identifier:a}=at(e);return new _({value:R(n,r),decimal:r,identifier:a})}static loadStaticAssets(){return new Promise(async(e,n)=>{try{const r=await import("@swapkit/tokens");Object.values(r).forEach(a=>{var c;(c=a==null?void 0:a.tokens)==null||c.forEach(({identifier:o,chain:u,...l})=>{$.set(o.toUpperCase(),{identifier:o,decimal:"decimals"in l?l.decimals:i.BaseDecimal[u]})})}),e({ok:!0})}catch(r){console.error(r),n({ok:!1,error:r,message:"Couldn't load static assets. Ensure you have installed @swapkit/tokens package"})}})}}function fe(s){const t=_.fromChainOrSignature(s);switch(s){case i.Chain.Bitcoin:case i.Chain.Litecoin:case i.Chain.BitcoinCash:return t.set(10001e-8);case i.Chain.Dogecoin:return t.set(1.00000001);case i.Chain.Avalanche:case i.Chain.Ethereum:return t.set(1e-8);case i.Chain.THORChain:case i.Chain.Maya:return t.set(0);default:return t.set(1e-8)}}async function U(s,t=0){me(s);const e=$.get(s.toUpperCase()),n=(e==null?void 0:e.decimal)||await it(P(s));return e||$.set(s.toUpperCase(),{identifier:s,decimal:n}),new _({decimal:n,value:R(t,n),identifier:s})}function st(s,t=0){const[e,n]=s.split(".")[0].toUpperCase()===i.Chain.THORChain?s.split(".").slice(1).join().split("/"):s.split("/");if(!e||!n)throw new Error("Invalid asset identifier");return new _({decimal:8,value:R(t,8),identifier:`${i.Chain.THORChain}.${e}/${n}`})}function R(s,t){return typeof s=="bigint"?B({value:s,bigIntDecimal:t,decimal:t}):s}function P(s){const t=s.slice(0,14).includes("/"),[e,n]=s.split(".")[0].toUpperCase()===i.Chain.THORChain?s.split(".").slice(1).join().split("/"):s.split("/");if(t&&(!e||!n))throw new Error("Invalid asset identifier");const r=s.includes(".")&&!t?s:`${i.Chain.THORChain}.${n}`,[a,c]=r.split("."),[o,u]=(t?n:c).split("-");return{address:u==null?void 0:u.toLowerCase(),chain:a,isGasAsset:K({chain:a,symbol:c}),isSynthetic:t,symbol:(t?`${e}/`:"")+(u?`${o}-${(u==null?void 0:u.toLowerCase())??""}`:c),ticker:o}}const ge={core_wallet_connection_not_found:10001,core_estimated_max_spendable_chain_not_supported:10002,core_extend_error:10003,core_inbound_data_not_found:10004,core_approve_asset_address_or_from_not_found:10005,core_chain_halted:10099,core_wallet_xdefi_not_installed:10101,core_wallet_evmwallet_not_installed:10102,core_wallet_walletconnect_not_installed:10103,core_wallet_keystore_not_installed:10104,core_wallet_ledger_not_installed:10105,core_wallet_trezor_not_installed:10106,core_wallet_keplr_not_installed:10107,core_wallet_okx_not_installed:10108,core_swap_invalid_params:10200,core_swap_route_not_complete:10201,core_swap_asset_not_recognized:10202,core_swap_contract_not_found:10203,core_swap_route_transaction_not_found:10204,core_swap_contract_not_supported:10205,core_swap_transaction_error:10206,core_swap_quote_mode_not_supported:10207,core_transaction_deposit_error:10301,core_transaction_create_liquidity_rune_error:10302,core_transaction_create_liquidity_asset_error:10303,core_transaction_create_liquidity_invalid_params:10304,core_transaction_add_liquidity_invalid_params:10305,core_transaction_add_liquidity_no_rune_address:10306,core_transaction_add_liquidity_rune_error:10307,core_transaction_add_liquidity_asset_error:10308,core_transaction_withdraw_error:10309,core_transaction_deposit_to_pool_error:10310,core_transaction_deposit_insufficient_funds_error:10311,core_transaction_deposit_gas_error:10312,core_transaction_invalid_sender_address:10313,core_transaction_deposit_server_error:10313,wallet_ledger_connection_error:20001,helpers_number_different_decimals:99101};class z extends Error{constructor(t,e){console.error(e,{stack:e==null?void 0:e.stack,message:e==null?void 0:e.message}),super(t,{cause:{code:ge[t],message:t}}),Object.setPrototypeOf(this,z.prototype)}}class f extends I{eq(t){return this.eqValue(t)}static fromBigInt(t,e){return new f({decimal:e,value:B({value:t,bigIntDecimal:e,decimal:e})})}}exports.AssetValue=_;exports.BigIntArithmetics=I;exports.RequestClient=gt;exports.SwapKitError=z;exports.SwapKitNumber=f;exports.assetFromString=Dt;exports.derivationPathToString=zt;exports.filterAssets=jt;exports.formatBigIntToSafeValue=B;exports.gasFeeMultiplier=Vt;exports.getAssetType=ot;exports.getAsymmetricAssetShare=ut;exports.getAsymmetricAssetWithdrawAmount=Ut;exports.getAsymmetricRuneShare=ct;exports.getAsymmetricRuneWithdrawAmount=Ht;exports.getCommonAssetInfo=at;exports.getDecimal=it;exports.getEstimatedPoolShare=Ft;exports.getLiquiditySlippage=Wt;exports.getMemoFor=Gt;exports.getMinAmountByChain=fe;exports.getSymmetricPoolShare=lt;exports.getSymmetricWithdraw=Lt;exports.getTHORNameCost=Kt;exports.isGasAsset=K;exports.validateTHORName=Yt;
1
+ "use strict";var Tt=Object.create;var j=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var $t=Object.getOwnPropertyNames;var Rt=Object.getPrototypeOf,St=Object.prototype.hasOwnProperty;var Bt=(s,t,e)=>t in s?j(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var It=(s,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of $t(t))!St.call(s,r)&&r!==e&&j(s,r,{get:()=>t[r],enumerable:!(n=vt(t,r))||n.enumerable});return s};var Ot=(s,t,e)=>(e=s!=null?Tt(Rt(s)):{},It(t||!s||!s.__esModule?j(e,"default",{value:s,enumerable:!0}):e,s));var p=(s,t,e)=>(Bt(s,typeof t!="symbol"?t+"":t,e),e),Mt=(s,t,e)=>{if(!t.has(s))throw TypeError("Cannot "+e)};var w=(s,t,e)=>{if(t.has(s))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(s):t.set(s,e)};var d=(s,t,e)=>(Mt(s,t,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@swapkit/types"),Et="0x313ce567",rt=async({chain:s,to:t})=>{try{const{result:e}=await gt.post(i.ChainToRPC[s],{headers:{accept:"*/*","content-type":"application/json","cache-control":"no-cache"},body:JSON.stringify({id:44,jsonrpc:"2.0",method:"eth_call",params:[{to:t.toLowerCase(),data:Et},"latest"]})});return parseInt(BigInt(e).toString())}catch(e){return console.error(e),i.BaseDecimal[s]}},qt=async s=>{if(s===i.Chain.Ethereum)return i.BaseDecimal.ETH;const[,t]=s.split("-");return t!=null&&t.startsWith("0x")?rt({chain:i.Chain.Ethereum,to:t}):i.BaseDecimal.ETH},xt=async s=>{const[,t]=s.split("-");return t!=null&&t.startsWith("0x")?rt({chain:i.Chain.Avalanche,to:t.toLowerCase()}):i.BaseDecimal.AVAX},Pt=async s=>(s===i.Chain.BinanceSmartChain,i.BaseDecimal.BSC),it=async({chain:s,symbol:t})=>{switch(s){case i.Chain.Ethereum:return qt(t);case i.Chain.Avalanche:return xt(t);case i.Chain.BinanceSmartChain:return Pt(t);default:return i.BaseDecimal[s]}},Vt={[i.FeeOption.Average]:1.2,[i.FeeOption.Fast]:1.5,[i.FeeOption.Fastest]:2},K=({chain:s,symbol:t})=>{switch(s){case i.Chain.Bitcoin:case i.Chain.BitcoinCash:case i.Chain.Litecoin:case i.Chain.Dogecoin:case i.Chain.Binance:case i.Chain.Ethereum:case i.Chain.Avalanche:return t===s;case i.Chain.Arbitrum:case i.Chain.Optimism:return t==="ETH";case i.Chain.Maya:return t==="CACAO";case i.Chain.Kujira:return t==="KUJI";case i.Chain.Cosmos:return t==="ATOM";case i.Chain.Polygon:return t==="MATIC";case i.Chain.BinanceSmartChain:return t==="BNB";case i.Chain.THORChain:return t==="RUNE"}},at=s=>{switch(s){case"ETH.THOR":return{identifier:"ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044",decimal:18};case"ETH.vTHOR":return{identifier:"ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d",decimal:18};case i.Chain.Cosmos:return{identifier:"GAIA.ATOM",decimal:i.BaseDecimal[s]};case i.Chain.THORChain:return{identifier:"THOR.RUNE",decimal:i.BaseDecimal[s]};case i.Chain.BinanceSmartChain:return{identifier:"BSC.BNB",decimal:i.BaseDecimal[s]};case i.Chain.Maya:return{identifier:"MAYA.CACAO",decimal:i.BaseDecimal.MAYA};case"MAYA.MAYA":return{identifier:"MAYA.MAYA",decimal:4};case i.Chain.Kujira:case i.Chain.Arbitrum:case i.Chain.Optimism:case i.Chain.BitcoinCash:case i.Chain.Litecoin:case i.Chain.Dogecoin:case i.Chain.Binance:case i.Chain.Avalanche:case i.Chain.Polygon:case i.Chain.Bitcoin:case i.Chain.Ethereum:return{identifier:`${s}.${s}`,decimal:i.BaseDecimal[s]}}},ot=({chain:s,symbol:t})=>{if(t.includes("/"))return"Synth";switch(s){case i.Chain.Bitcoin:case i.Chain.BitcoinCash:case i.Chain.Dogecoin:case i.Chain.Litecoin:case i.Chain.Maya:case i.Chain.THORChain:return"Native";case i.Chain.Cosmos:return t==="ATOM"?"Native":i.Chain.Cosmos;case i.Chain.Kujira:return t===i.Chain.Kujira?"Native":i.Chain.Kujira;case i.Chain.Binance:return t===i.Chain.Binance?"Native":"BEP2";case i.Chain.BinanceSmartChain:return t===i.Chain.Binance?"Native":"BEP20";case i.Chain.Ethereum:return t===i.Chain.Ethereum?"Native":"ERC20";case i.Chain.Avalanche:return t===i.Chain.Avalanche?"Native":i.Chain.Avalanche;case i.Chain.Polygon:return t===i.Chain.Polygon?"Native":"POLYGON";case i.Chain.Arbitrum:return[i.Chain.Ethereum,i.Chain.Arbitrum].includes(t)?"Native":"ARBITRUM";case i.Chain.Optimism:return[i.Chain.Ethereum,i.Chain.Optimism].includes(t)?"Native":"OPTIMISM"}},Dt=s=>{var c;const[t,...e]=s.split("."),n=s.includes("/"),r=e.join("."),a=(c=r==null?void 0:r.split("-"))==null?void 0:c[0];return{chain:t,symbol:r,ticker:a,synth:n}},kt=new RegExp(/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,"gmi"),Nt=s=>{const[t,e]=s.split(".");if(!i.EVMChainList.includes(t))return!0;const[,n]=e.split("-");return K({chain:t,symbol:e})||!!n},jt=s=>s.filter(t=>{const e=`${t.chain}.${t.symbol}`;return!kt.test(e)&&Nt(e)&&t.value!=="0"});function ct({liquidityUnits:s,poolUnits:t,runeDepth:e}){const n=m(s),r=m(t),a=m(e),c=n.mul(a),o=r.mul(r).mul(2),u=r.mul(n).mul(2),l=n.mul(n),h=r.mul(r).mul(r);return c.mul(o.sub(u).add(l)).div(h)}function ut({liquidityUnits:s,poolUnits:t,assetDepth:e}){const n=m(s),r=m(t),a=m(e),c=n.mul(a),o=r.mul(r).mul(2),u=r.mul(n).mul(2),l=n.mul(n),h=c.mul(o.sub(u).add(l)),C=r.mul(r).mul(r);return h.div(C)}function Ht({percent:s,runeDepth:t,liquidityUnits:e,poolUnits:n}){return ct({runeDepth:t,liquidityUnits:e,poolUnits:n}).mul(s)}function Ut({percent:s,assetDepth:t,liquidityUnits:e,poolUnits:n}){return ut({assetDepth:t,liquidityUnits:e,poolUnits:n}).mul(s)}function m(s){return f.fromBigInt(BigInt(s),i.BaseDecimal.THOR)}function lt({liquidityUnits:s,poolUnits:t,runeDepth:e,assetDepth:n}){return{assetAmount:m(n).mul(s).div(t),runeAmount:m(e).mul(s).div(t)}}function Lt({liquidityUnits:s,poolUnits:t,runeDepth:e,assetDepth:n,percent:r}){return Object.fromEntries(Object.entries(lt({liquidityUnits:s,poolUnits:t,runeDepth:e,assetDepth:n})).map(([a,c])=>[a,c.mul(r)]))}function Ft({runeDepth:s,poolUnits:t,assetDepth:e,liquidityUnits:n,runeAmount:r,assetAmount:a}){const c=new f({value:s,decimal:8}),o=new f({value:e,decimal:8}),u=new f({value:t,decimal:8}),l=new f({value:r,decimal:8}),h=new f({value:a,decimal:8}),C=l.mul(o),k=h.mul(c),yt=l.mul(h),bt=c.mul(o),Ct=u.mul(C.add(k.add(yt.mul(2)))),wt=C.add(k.add(bt.mul(2))),Q=Ct.div(wt),N=m(n).add(Q);if(Q.getBaseValue("number")===0)return N.div(u).getBaseValue("number");const At=u.add(N);return N.div(At).getBaseValue("number")}function Wt({runeAmount:s,assetAmount:t,runeDepth:e,assetDepth:n}){if(s==="0"||t==="0"||e==="0"||n==="0")return 0;const r=m(e),a=m(n),c=m(t),o=m(s),u=c.mul(r).sub(a.mul(o)),l=a.mul(o).add(r.mul(a));return Math.abs(u.div(l).getBaseValue("number"))}const Gt=(s,t)=>{switch(s){case i.MemoType.LEAVE:case i.MemoType.BOND:{const{address:e}=t;return`${s}:${e}`}case i.MemoType.UNBOND:{const{address:e,unbondAmount:n}=t;return`${s}:${e}:${n}`}case i.MemoType.THORNAME_REGISTER:{const{name:e,chain:n,address:r,owner:a}=t;return`${s}:${e}:${n}:${r}${a?`:${a}`:""}`}case i.MemoType.DEPOSIT:{const{chain:e,symbol:n,address:r,singleSide:a}=t;return a?`${s}:${e}/${n}::t:0`:`${s}:${((o,u)=>{switch(o){case i.Chain.Litecoin:return"l";case i.Chain.Dogecoin:return"d";case i.Chain.BitcoinCash:return"c";default:return`${o}.${u}`}})(e,n)}:${r||""}:t:0`}case i.MemoType.WITHDRAW:{const{chain:e,ticker:n,symbol:r,basisPoints:a,targetAssetString:c,singleSide:o}=t,u=e==="ETH"&&n!=="ETH"?`${n}-${r.slice(-3)}`:r,l=!o&&c?`:${c}`:"";return`${s}:${e}${o?"/":"."}${u}:${a}${l}`}case i.MemoType.OPEN_LOAN:case i.MemoType.CLOSE_LOAN:{const{asset:e,address:n}=t;return`${s}:${e}:${n}`}default:return""}};function Kt(s){if(s<0)throw new Error("Invalid number of year");return 10+s}function Yt(s){if(s.length>30)return!1;const t=/^[a-zA-Z0-9+_-]+$/g;return!!s.match(t)}function zt([s,t,e,n,r]){return`${s}'/${t}'/${e}'/${n}${typeof r!="number"?"":`/${r}`}`}class X extends Error{constructor(t,e,n){const r=t.status||t.status===0?t.status:"",a=t.statusText||"",c=`${r} ${a}`.trim(),o=c?`status code ${c}`:"an unknown error";super(`Request failed with ${o}`),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="HTTPError",this.response=t,this.request=e,this.options=n}}class ht extends Error{constructor(t){super("Request timed out"),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="TimeoutError",this.request=t}}const x=s=>s!==null&&typeof s=="object",E=(...s)=>{for(const t of s)if((!x(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Y({},...s)},dt=(s={},t={})=>{const e=new globalThis.Headers(s),n=t instanceof globalThis.Headers,r=new globalThis.Headers(t);for(const[a,c]of r.entries())n&&c==="undefined"||c===void 0?e.delete(a):e.set(a,c);return e},Y=(...s)=>{let t={},e={};for(const n of s)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(x(n)){for(let[r,a]of Object.entries(n))x(a)&&r in t&&(a=Y(t[r],a)),t={...t,[r]:a};x(n.headers)&&(e=dt(e,n.headers),t.headers=e)}return t},Jt=(()=>{let s=!1,t=!1;const e=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";return e&&n&&(t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return s=!0,"half"}}).headers.has("Content-Type")),s&&!t})(),Qt=typeof globalThis.AbortController=="function",Xt=typeof globalThis.ReadableStream=="function",Zt=typeof globalThis.FormData=="function",mt=["get","post","put","patch","head","delete"],te={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},H=2147483647,pt=Symbol("stop"),ee={json:!0,parseJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},ne={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0},se=s=>mt.includes(s)?s.toUpperCase():s,re=["get","put","head","delete","options","trace"],ie=[408,413,429,500,502,503,504],ft=[413,429,503],Z={limit:2,methods:re,statusCodes:ie,afterStatusCodes:ft,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:s=>.3*2**(s-1)*1e3},ae=(s={})=>{if(typeof s=="number")return{...Z,limit:s};if(s.methods&&!Array.isArray(s.methods))throw new Error("retry.methods must be an array");if(s.statusCodes&&!Array.isArray(s.statusCodes))throw new Error("retry.statusCodes must be an array");return{...Z,...s,afterStatusCodes:ft}};async function oe(s,t,e,n){return new Promise((r,a)=>{const c=setTimeout(()=>{e&&e.abort(),a(new ht(s))},n.timeout);n.fetch(s,t).then(r).catch(a).then(()=>{clearTimeout(c)})})}async function ce(s,{signal:t}){return new Promise((e,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",r,{once:!0}));function r(){clearTimeout(a),n(t.reason)}const a=setTimeout(()=>{t==null||t.removeEventListener("abort",r),e()},s)})}const ue=(s,t)=>{const e={};for(const n in t)!(n in ne)&&!(n in ee)&&!(n in s)&&(e[n]=t[n]);return e};class V{static create(t,e){const n=new V(t,e),r=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>H)throw new RangeError(`The \`timeout\` option cannot be greater than ${H}`);await Promise.resolve();let o=await n._fetch();for(const u of n._options.hooks.afterResponse){const l=await u(n.request,n._options,n._decorateResponse(o.clone()));l instanceof globalThis.Response&&(o=l)}if(n._decorateResponse(o),!o.ok&&n._options.throwHttpErrors){let u=new X(o,n.request,n._options);for(const l of n._options.hooks.beforeError)u=await l(u);throw u}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!Xt)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return n._stream(o.clone(),n._options.onDownloadProgress)}return o},c=n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(r):r();for(const[o,u]of Object.entries(te))c[o]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||u);const h=(await c).clone();if(o==="json"){if(h.status===204||(await h.clone().arrayBuffer()).byteLength===0)return"";if(e.parseJson)return e.parseJson(await h.text())}return h[o]()};return c}constructor(t,e={}){if(Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"abortController",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_retryCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._input=t,this._options={credentials:this._input.credentials||"same-origin",...e,headers:dt(this._input.headers,e.headers),hooks:Y({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},e.hooks),method:se(e.method??this._input.method),prefixUrl:String(e.prefixUrl||""),retry:ae(e.retry),throwHttpErrors:e.throwHttpErrors!==!1,timeout:e.timeout??1e4,fetch:e.fetch??globalThis.fetch.bind(globalThis)},typeof this._input!="string"&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&typeof this._input=="string"){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(Qt){if(this.abortController=new globalThis.AbortController,this._options.signal){const n=this._options.signal;this._options.signal.addEventListener("abort",()=>{this.abortController.abort(n.reason)})}this._options.signal=this.abortController.signal}if(Jt&&(this._options.duplex="half"),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){const r="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,r);(Zt&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}this._options.json!==void 0&&(this._options.body=JSON.stringify(this._options.json),this.request.headers.set("content-type",this._options.headers.get("content-type")??"application/json"),this.request=new globalThis.Request(this.request,{body:this._options.body}))}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount<this._options.retry.limit&&!(t instanceof ht)){if(t instanceof X){if(!this._options.retry.statusCodes.includes(t.response.status))return 0;const n=t.response.headers.get("Retry-After");if(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let r=Number(n);return Number.isNaN(r)?r=Date.parse(n)-Date.now():r*=1e3,this._options.retry.maxRetryAfter!==void 0&&r>this._options.retry.maxRetryAfter?0:r}if(t.response.status===413)return 0}const e=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,e)}return 0}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(e){const n=Math.min(this._calculateRetryDelay(e),H);if(n!==0&&this._retryCount>0){await ce(n,{signal:this._options.signal});for(const r of this._options.hooks.beforeRetry)if(await r({request:this.request,options:this._options,error:e,retryCount:this._retryCount})===pt)return;return this._retry(t)}throw e}}async _fetch(){for(const e of this._options.hooks.beforeRequest){const n=await e(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}const t=ue(this.request,this._options);return this._options.timeout===!1?this._options.fetch(this.request.clone(),t):oe(this.request.clone(),t,this.abortController,this._options)}_stream(t,e){const n=Number(t.headers.get("content-length"))||0;let r=0;return t.status===204?(e&&e({percent:1,totalBytes:n,transferredBytes:r},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){const c=t.body.getReader();e&&e({percent:0,transferredBytes:0,totalBytes:n},new Uint8Array);async function o(){const{done:u,value:l}=await c.read();if(u){a.close();return}if(e){r+=l.byteLength;const h=n===0?0:r/n;e({percent:h,transferredBytes:r,totalBytes:n},l)}a.enqueue(l),await o()}await o()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}}/*! MIT License © Sindre Sorhus */const L=s=>{const t=(e,n)=>V.create(e,E(s,n));for(const e of mt)t[e]=(n,r)=>V.create(n,E(s,r,{method:e}));return t.create=e=>L(E(e)),t.extend=e=>L(E(s,e)),t.stop=pt,t},le=L(),he=le,de=typeof window<"u"?{}:{referrer:"https://sk.thorswap.net",referer:"https://sk.thorswap.net"},tt=he.create({headers:de}),gt={get:(s,t)=>tt.get(s,t).json(),post:(s,t)=>tt.post(s,t).json()},et=[...Object.values(i.Chain),"TERRA"];function me(s=""){const t=s.toUpperCase(),[e]=t.split(".");if(et.includes(e))return!0;const[n]=t.split("/");if(et.includes(n))return!0;throw new Error(`Invalid identifier: ${s}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`)}const S=8,y=s=>10n**BigInt(s),T=s=>Math.log10(parseFloat(s.toString()));function B({value:s,bigIntDecimal:t=S,decimal:e=S}){if(e===0)return s.toString();const n=s<0n;let r=s.toString().substring(n?1:0);const a=e-(r.length-1);a>0&&(r="0".repeat(a)+r);const c=r.length-e;let o=r.slice(-e);return parseInt(o[t])>=5?o=`${o.substring(0,t-1)}${(parseInt(o[t-1])+1).toString()}`:o=o.substring(0,t),`${n?"-":""}${r.slice(0,c)}.${o}`.replace(/\.?0*$/,"")}var b,v,g,A,D,_t,O,F,M,W;const J=class J{constructor(t){w(this,b);w(this,g);w(this,D);w(this,O);w(this,M);p(this,"decimalMultiplier",10n**8n);p(this,"bigIntValue",0n);p(this,"decimal");const e=G(t),n=typeof t=="object";this.decimal=n?t.decimal:void 0,this.decimalMultiplier=n&&"decimalMultiplier"in t?t.decimalMultiplier:y(Math.max(nt(q(e)),this.decimal||0)),d(this,D,_t).call(this,e)}static fromBigInt(t,e){return new J({decimal:e,value:B({value:t,bigIntDecimal:e,decimal:e})})}static shiftDecimals({value:t,from:e,to:n}){return this.fromBigInt(t.getBaseValue("bigint")*y(n)/y(e),n)}set(t){return new this.constructor({decimal:this.decimal,value:t,identifier:this.toString()})}add(...t){return d(this,b,v).call(this,"add",...t)}sub(...t){return d(this,b,v).call(this,"sub",...t)}mul(...t){return d(this,b,v).call(this,"mul",...t)}div(...t){return d(this,b,v).call(this,"div",...t)}gt(t){return d(this,g,A).call(this,"gt",t)}gte(t){return d(this,g,A).call(this,"gte",t)}lt(t){return d(this,g,A).call(this,"lt",t)}lte(t){return d(this,g,A).call(this,"lte",t)}eqValue(t){return d(this,g,A).call(this,"eqValue",t)}getValue(t){const e=this.formatBigIntToSafeValue(this.bigIntValue,this.decimal||T(this.decimalMultiplier));switch(t){case"number":return Number(e);case"string":return e;case"bigint":return this.bigIntValue*10n**BigInt(this.decimal||8n)/this.decimalMultiplier}}getBaseValue(t){const e=this.decimalMultiplier/y(this.decimal||i.BaseDecimal.THOR),n=this.bigIntValue/e;switch(t){case"number":return Number(n);case"string":return n.toString();case"bigint":return n}}getBigIntValue(t,e){if(!e&&typeof t=="object")return t.bigIntValue;const n=G(t),r=q(n);return r==="0"||r==="undefined"?0n:d(this,M,W).call(this,r,e)}toSignificant(t=6){const[e,n]=this.getValue("string").split("."),r=e||"",a=n||"";if((parseInt(r)?r.length+a.length:a.length)<=t)return this.getValue("string");if(r.length>=t)return r.slice(0,t).padEnd(r.length,"0");if(parseInt(r))return`${r}.${a.slice(0,t-r.length)}`.padEnd(t-r.length,"0");const o=parseInt(a),u=`${o}`.slice(0,t);return`0.${u.padStart(a.length-`${o}`.length+u.length,"0")}`}toFixed(t=6){const[e,n]=this.getValue("string").split("."),r=e||"",a=n||"";if(parseInt(r))return`${r}.${a.slice(0,t)}`.padEnd(t,"0");const c=parseInt(a),o=`${c}`.slice(0,t);return`0.${o.padStart(a.length-`${c}`.length+o.length,"0")}`}toAbbreviation(t=2){const e=this.getValue("number"),n=["","K","M","B","T","Q","Qi","S"],r=Math.floor(Math.log10(Math.abs(e))/3),a=n[r];if(!a)return this.getValue("string");const c=10**(r*3);return`${(e/c).toFixed(t)}${a}`}toCurrency(t="$",{currencyPosition:e="start",decimal:n=2,decimalSeparator:r=".",thousandSeparator:a=","}={}){const c=this.getValue("number"),[o,u=""]=c.toFixed(6).split("."),l=o.replace(/\B(?=(\d{3})+(?!\d))/g,a),h=!o&&!u?"0.00":o==="0"?`${parseFloat(`0.${u}`)}`.replace(".",r):`${l}${parseInt(u)?`${r}${u.slice(0,n)}`:""}`;return`${e==="start"?t:""}${h}${e==="end"?t:""}`}formatBigIntToSafeValue(t,e){const n=e||this.decimal||S,r=Math.max(n,T(this.decimalMultiplier)),a=t<0n,c=t.toString().substring(a?1:0),o=r-(c.length-1),u=o>0?"0".repeat(o)+c:c,l=u.length-r;let h=u.slice(-r);return parseInt(h[n])>=5?h=`${h.substring(0,n-1)}${(parseInt(h[n-1])+1).toString()}`:h=h.substring(0,n),`${a?"-":""}${u.slice(0,l)}.${h}`.replace(/\.?0*$/,"")}};b=new WeakSet,v=function(t,...e){const n=d(this,O,F).call(this,this,...e),r=Math.max(n,T(this.decimalMultiplier)),a=y(r),c=e.reduce((u,l)=>{const h=this.getBigIntValue(l,r);switch(t){case"add":return u+h;case"sub":return u-h;case"mul":return u*h/a;case"div":{if(h===0n)throw new RangeError("Division by zero");return u*a/h}default:return u}},this.bigIntValue*a/this.decimalMultiplier),o=B({bigIntDecimal:r,decimal:r,value:c});return new this.constructor({decimalMultiplier:y(r),decimal:this.decimal,value:o,identifier:this.toString()})},g=new WeakSet,A=function(t,...e){const n=d(this,O,F).call(this,this,...e),r=this.getBigIntValue(e[0],n),a=this.getBigIntValue(this,n);switch(t){case"gt":return a>r;case"gte":return a>=r;case"lt":return a<r;case"lte":return a<=r;case"eqValue":return a===r}},D=new WeakSet,_t=function(t){const e=q(t)||"0";this.bigIntValue=d(this,M,W).call(this,e)},O=new WeakSet,F=function(...t){const e=t.map(n=>typeof n=="object"?n.decimal||T(n.decimalMultiplier):nt(q(n))).filter(Boolean);return Math.max(...e,S)},M=new WeakSet,W=function(t,e){const n=e?y(e):this.decimalMultiplier,r=T(n),[a="",c=""]=t.split(".");return BigInt(`${a}${c.padEnd(r,"0")}`)};let I=J;const pe=Intl.NumberFormat("fullwide",{useGrouping:!1,maximumFractionDigits:20});function q(s){const e=`${typeof s=="number"?pe.format(s):G(s)}`.replaceAll(",",".").split(".");return e.length>1?`${e.slice(0,-1).join("")}.${e.at(-1)}`:e[0]}function nt(s){var e;const t=((e=s.split(".")[1])==null?void 0:e.length)||0;return Math.max(t,S)}function G(s){return typeof s=="object"?"getValue"in s?s.getValue("string"):s.value:s}const $=new Map;class _ extends I{constructor({value:e,decimal:n,tax:r,chain:a,symbol:c,identifier:o}){super(typeof e=="object"?e:{decimal:n,value:e});p(this,"address");p(this,"chain");p(this,"isGasAsset",!1);p(this,"isSynthetic",!1);p(this,"symbol");p(this,"tax");p(this,"ticker");p(this,"type");const u=P(o||`${a}.${c}`);this.type=ot(u),this.tax=r,this.chain=u.chain,this.ticker=u.ticker,this.symbol=u.symbol,this.address=u.address,this.isSynthetic=u.isSynthetic,this.isGasAsset=u.isGasAsset}toString(){return this.isSynthetic?this.symbol:`${this.chain}.${this.symbol}`}toUrl(){return this.isSynthetic?`${this.chain}.${this.symbol.replace("/",".")}`:this.toString()}eq({chain:e,symbol:n}){return this.chain===e&&this.symbol===n}static fromUrl(e,n=0){const[r,a,c]=e.split(".");if(!r||!a)throw new Error("Invalid asset url");const o=r===i.Chain.THORChain&&c?`${r}.${a}/${c}`:e;return U(o,n)}static fromString(e,n=0){return U(e,n)}static fromIdentifier(e,n=0){return U(e,n)}static fromStringSync(e,n=0){const{chain:r,isSynthetic:a}=P(e),c=$.get(e.toUpperCase());if(a)return st(e,n);const{tax:o,decimal:u,identifier:l}=c||{decimal:i.BaseDecimal[r],identifier:e};return new _({tax:o,value:R(n,u),identifier:a?e:l,decimal:a?8:u})}static fromIdentifierSync(e,n=0){const{chain:r,isSynthetic:a}=P(e),c=$.get(e);if(a)return st(e,n);const{tax:o,decimal:u,identifier:l}=c||{decimal:i.BaseDecimal[r],identifier:e};return new _({tax:o,decimal:u,identifier:l,value:R(n,u)})}static fromChainOrSignature(e,n=0){const{decimal:r,identifier:a}=at(e);return new _({value:R(n,r),decimal:r,identifier:a})}static loadStaticAssets(){return new Promise(async(e,n)=>{try{const r=await import("@swapkit/tokens");Object.values(r).forEach(a=>{var c;(c=a==null?void 0:a.tokens)==null||c.forEach(({identifier:o,chain:u,...l})=>{$.set(o.toUpperCase(),{identifier:o,decimal:"decimals"in l?l.decimals:i.BaseDecimal[u]})})}),e({ok:!0})}catch(r){console.error(r),n({ok:!1,error:r,message:"Couldn't load static assets. Ensure you have installed @swapkit/tokens package"})}})}}function fe(s){const t=_.fromChainOrSignature(s);switch(s){case i.Chain.Bitcoin:case i.Chain.Litecoin:case i.Chain.BitcoinCash:return t.set(10001e-8);case i.Chain.Dogecoin:return t.set(1.00000001);case i.Chain.Avalanche:case i.Chain.Ethereum:return t.set(1e-8);case i.Chain.THORChain:case i.Chain.Maya:return t.set(0);default:return t.set(1e-8)}}async function U(s,t=0){me(s);const e=$.get(s.toUpperCase()),n=(e==null?void 0:e.decimal)||await it(P(s));return e||$.set(s.toUpperCase(),{identifier:s,decimal:n}),new _({decimal:n,value:R(t,n),identifier:s})}function st(s,t=0){const[e,n]=s.split(".")[0].toUpperCase()===i.Chain.THORChain?s.split(".").slice(1).join().split("/"):s.split("/");if(!e||!n)throw new Error("Invalid asset identifier");return new _({decimal:8,value:R(t,8),identifier:`${i.Chain.THORChain}.${e}/${n}`})}function R(s,t){return typeof s=="bigint"?B({value:s,bigIntDecimal:t,decimal:t}):s}function P(s){const t=s.slice(0,14).includes("/"),[e,n]=s.split(".")[0].toUpperCase()===i.Chain.THORChain?s.split(".").slice(1).join().split("/"):s.split("/");if(t&&(!e||!n))throw new Error("Invalid asset identifier");const r=s.includes(".")&&!t?s:`${i.Chain.THORChain}.${n}`,[a,c]=r.split("."),[o,u]=(t?n:c).split("-");return{address:u==null?void 0:u.toLowerCase(),chain:a,isGasAsset:K({chain:a,symbol:c}),isSynthetic:t,symbol:(t?`${e}/`:"")+(u?`${o}-${(u==null?void 0:u.toLowerCase())??""}`:c),ticker:o}}const ge={core_wallet_connection_not_found:10001,core_estimated_max_spendable_chain_not_supported:10002,core_extend_error:10003,core_inbound_data_not_found:10004,core_approve_asset_address_or_from_not_found:10005,core_chain_halted:10099,core_wallet_xdefi_not_installed:10101,core_wallet_evmwallet_not_installed:10102,core_wallet_walletconnect_not_installed:10103,core_wallet_keystore_not_installed:10104,core_wallet_ledger_not_installed:10105,core_wallet_trezor_not_installed:10106,core_wallet_keplr_not_installed:10107,core_wallet_okx_not_installed:10108,core_swap_invalid_params:10200,core_swap_route_not_complete:10201,core_swap_asset_not_recognized:10202,core_swap_contract_not_found:10203,core_swap_route_transaction_not_found:10204,core_swap_contract_not_supported:10205,core_swap_transaction_error:10206,core_swap_quote_mode_not_supported:10207,core_transaction_deposit_error:10301,core_transaction_create_liquidity_rune_error:10302,core_transaction_create_liquidity_asset_error:10303,core_transaction_create_liquidity_invalid_params:10304,core_transaction_add_liquidity_invalid_params:10305,core_transaction_add_liquidity_no_rune_address:10306,core_transaction_add_liquidity_rune_error:10307,core_transaction_add_liquidity_asset_error:10308,core_transaction_withdraw_error:10309,core_transaction_deposit_to_pool_error:10310,core_transaction_deposit_insufficient_funds_error:10311,core_transaction_deposit_gas_error:10312,core_transaction_invalid_sender_address:10313,core_transaction_deposit_server_error:10313,wallet_ledger_connection_error:20001,helpers_number_different_decimals:99101};class z extends Error{constructor(t,e){console.error(e,{stack:e==null?void 0:e.stack,message:e==null?void 0:e.message}),super(t,{cause:{code:ge[t],message:t}}),Object.setPrototypeOf(this,z.prototype)}}class f extends I{eq(t){return this.eqValue(t)}static fromBigInt(t,e){return new f({decimal:e,value:B({value:t,bigIntDecimal:e,decimal:e})})}}exports.AssetValue=_;exports.BigIntArithmetics=I;exports.RequestClient=gt;exports.SwapKitError=z;exports.SwapKitNumber=f;exports.assetFromString=Dt;exports.derivationPathToString=zt;exports.filterAssets=jt;exports.formatBigIntToSafeValue=B;exports.gasFeeMultiplier=Vt;exports.getAssetType=ot;exports.getAsymmetricAssetShare=ut;exports.getAsymmetricAssetWithdrawAmount=Ut;exports.getAsymmetricRuneShare=ct;exports.getAsymmetricRuneWithdrawAmount=Ht;exports.getCommonAssetInfo=at;exports.getDecimal=it;exports.getEstimatedPoolShare=Ft;exports.getLiquiditySlippage=Wt;exports.getMemoFor=Gt;exports.getMinAmountByChain=fe;exports.getSymmetricPoolShare=lt;exports.getSymmetricWithdraw=Lt;exports.getTHORNameCost=Kt;exports.isGasAsset=K;exports.validateTHORName=Yt;
2
2
  //# sourceMappingURL=index.cjs.map