@swapkit/helpers 1.0.0-rc.59 → 1.0.0-rc.60

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.es.js CHANGED
@@ -4,16 +4,16 @@ var f = (s, t, e) => (yt(s, typeof t != "symbol" ? t + "" : t, e), e), wt = (s,
4
4
  if (!t.has(s))
5
5
  throw TypeError("Cannot " + e);
6
6
  };
7
- var v = (s, t, e) => {
7
+ var $ = (s, t, e) => {
8
8
  if (t.has(s))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
10
  t instanceof WeakSet ? t.add(s) : t.set(s, e);
11
11
  };
12
12
  var m = (s, t, e) => (wt(s, t, "access private method"), e);
13
- import { FeeOption as U, BaseDecimal as d, Chain as o, EVMChainList as At, ChainToRPC as $t, MemoType as _ } from "@swapkit/types";
13
+ import { FeeOption as U, BaseDecimal as d, Chain as o, EVMChainList as At, ChainToRPC as Tt, MemoType as _, ChainToChainId as $t } from "@swapkit/types";
14
14
  const vt = "0x313ce567", nt = async ({ chain: s, to: t }) => {
15
15
  try {
16
- const { result: e } = await Xt.post($t[s], {
16
+ const { result: e } = await Zt.post(Tt[s], {
17
17
  headers: {
18
18
  accept: "*/*",
19
19
  "content-type": "application/json",
@@ -30,26 +30,26 @@ const vt = "0x313ce567", nt = async ({ chain: s, to: t }) => {
30
30
  } catch (e) {
31
31
  return console.error(e), d[s];
32
32
  }
33
- }, Tt = async (s) => {
33
+ }, Ct = async (s) => {
34
34
  if (s === o.Ethereum)
35
35
  return d.ETH;
36
36
  const [, t] = s.split("-");
37
37
  return t != null && t.startsWith("0x") ? nt({ chain: o.Ethereum, to: t }) : d.ETH;
38
- }, Ct = async (s) => {
38
+ }, Rt = async (s) => {
39
39
  const [, t] = s.split("-");
40
40
  return t != null && t.startsWith("0x") ? nt({ chain: o.Avalanche, to: t.toLowerCase() }) : d.AVAX;
41
- }, Rt = async (s) => s === o.BinanceSmartChain ? d.BSC : d.BSC, St = async ({ chain: s, symbol: t }) => {
41
+ }, St = async (s) => s === o.BinanceSmartChain ? d.BSC : d.BSC, It = async ({ chain: s, symbol: t }) => {
42
42
  switch (s) {
43
43
  case o.Ethereum:
44
- return Tt(t);
45
- case o.Avalanche:
46
44
  return Ct(t);
47
- case o.BinanceSmartChain:
45
+ case o.Avalanche:
48
46
  return Rt(t);
47
+ case o.BinanceSmartChain:
48
+ return St(t);
49
49
  default:
50
50
  return d[s];
51
51
  }
52
- }, ne = {
52
+ }, ie = {
53
53
  [U.Average]: 1.2,
54
54
  [U.Fast]: 1.5,
55
55
  [U.Fastest]: 2
@@ -79,7 +79,7 @@ const vt = "0x313ce567", nt = async ({ chain: s, to: t }) => {
79
79
  case o.THORChain:
80
80
  return t === "RUNE";
81
81
  }
82
- }, It = (s) => {
82
+ }, Ot = (s) => {
83
83
  switch (s) {
84
84
  case "ETH.THOR":
85
85
  return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
@@ -108,7 +108,7 @@ const vt = "0x313ce567", nt = async ({ chain: s, to: t }) => {
108
108
  case o.Ethereum:
109
109
  return { identifier: `${s}.${s}`, decimal: d[s] };
110
110
  }
111
- }, Ot = ({ chain: s, symbol: t }) => {
111
+ }, Et = ({ chain: s, symbol: t }) => {
112
112
  if (t.includes("/"))
113
113
  return "Synth";
114
114
  switch (s) {
@@ -138,24 +138,24 @@ const vt = "0x313ce567", nt = async ({ chain: s, to: t }) => {
138
138
  case o.Optimism:
139
139
  return [o.Ethereum, o.Optimism].includes(t) ? "Native" : "OPTIMISM";
140
140
  }
141
- }, ie = (s) => {
141
+ }, oe = (s) => {
142
142
  var c;
143
143
  const [t, ...e] = s.split("."), r = s.includes("/"), n = e.join("."), i = (c = n == null ? void 0 : n.split("-")) == null ? void 0 : c[0];
144
144
  return { chain: t, symbol: n, ticker: i, synth: r };
145
- }, Et = new RegExp(
145
+ }, Bt = new RegExp(
146
146
  /(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
147
147
  "gmi"
148
- ), Bt = (s) => {
148
+ ), Mt = (s) => {
149
149
  const [t, e] = s.split(".");
150
150
  if (!At.includes(t))
151
151
  return !0;
152
152
  const [, r] = e.split("-");
153
153
  return it({ chain: t, symbol: e }) || !!r;
154
- }, oe = (s) => s.filter((t) => {
154
+ }, ae = (s) => s.filter((t) => {
155
155
  const e = `${t.chain}.${t.symbol}`;
156
- return !Et.test(e) && Bt(e) && t.value !== "0";
156
+ return !Bt.test(e) && Mt(e) && t.value !== "0";
157
157
  });
158
- function Mt({
158
+ function xt({
159
159
  liquidityUnits: s,
160
160
  poolUnits: t,
161
161
  runeDepth: e
@@ -163,34 +163,34 @@ function Mt({
163
163
  const r = p(s), n = p(t), i = p(e), c = r.mul(i), a = n.mul(n).mul(2), u = n.mul(r).mul(2), l = r.mul(r), h = n.mul(n).mul(n);
164
164
  return c.mul(a.sub(u).add(l)).div(h);
165
165
  }
166
- function xt({
166
+ function qt({
167
167
  liquidityUnits: s,
168
168
  poolUnits: t,
169
169
  assetDepth: e
170
170
  }) {
171
- const r = p(s), n = p(t), i = p(e), c = r.mul(i), a = n.mul(n).mul(2), u = n.mul(r).mul(2), l = r.mul(r), h = c.mul(a.sub(u).add(l)), $ = n.mul(n).mul(n);
172
- return h.div($);
171
+ const r = p(s), n = p(t), i = p(e), c = r.mul(i), a = n.mul(n).mul(2), u = n.mul(r).mul(2), l = r.mul(r), h = c.mul(a.sub(u).add(l)), T = n.mul(n).mul(n);
172
+ return h.div(T);
173
173
  }
174
- function ae({
174
+ function ce({
175
175
  percent: s,
176
176
  runeDepth: t,
177
177
  liquidityUnits: e,
178
178
  poolUnits: r
179
179
  }) {
180
- return Mt({ runeDepth: t, liquidityUnits: e, poolUnits: r }).mul(s);
180
+ return xt({ runeDepth: t, liquidityUnits: e, poolUnits: r }).mul(s);
181
181
  }
182
- function ce({
182
+ function ue({
183
183
  percent: s,
184
184
  assetDepth: t,
185
185
  liquidityUnits: e,
186
186
  poolUnits: r
187
187
  }) {
188
- return xt({ assetDepth: t, liquidityUnits: e, poolUnits: r }).mul(s);
188
+ return qt({ assetDepth: t, liquidityUnits: e, poolUnits: r }).mul(s);
189
189
  }
190
190
  function p(s) {
191
191
  return g.fromBigInt(BigInt(s), d.THOR);
192
192
  }
193
- function qt({
193
+ function Pt({
194
194
  liquidityUnits: s,
195
195
  poolUnits: t,
196
196
  runeDepth: e,
@@ -201,7 +201,7 @@ function qt({
201
201
  runeAmount: p(e).mul(s).div(t)
202
202
  };
203
203
  }
204
- function ue({
204
+ function le({
205
205
  liquidityUnits: s,
206
206
  poolUnits: t,
207
207
  runeDepth: e,
@@ -209,12 +209,12 @@ function ue({
209
209
  percent: n
210
210
  }) {
211
211
  return Object.fromEntries(
212
- Object.entries(qt({ liquidityUnits: s, poolUnits: t, runeDepth: e, assetDepth: r })).map(
212
+ Object.entries(Pt({ liquidityUnits: s, poolUnits: t, runeDepth: e, assetDepth: r })).map(
213
213
  ([i, c]) => [i, c.mul(n)]
214
214
  )
215
215
  );
216
216
  }
217
- function le({
217
+ function he({
218
218
  runeDepth: s,
219
219
  poolUnits: t,
220
220
  assetDepth: e,
@@ -222,13 +222,13 @@ function le({
222
222
  runeAmount: n,
223
223
  assetAmount: i
224
224
  }) {
225
- const c = new g({ value: s, decimal: 8 }), a = new g({ value: e, decimal: 8 }), u = new g({ value: t, decimal: 8 }), l = new g({ value: n, decimal: 8 }), h = new g({ value: i, decimal: 8 }), $ = l.mul(a), H = h.mul(c), mt = l.mul(h), pt = c.mul(a), ft = u.mul($.add(H.add(mt.mul(2)))), _t = $.add(H.add(pt.mul(2))), Q = ft.div(_t), D = p(r).add(Q);
225
+ const c = new g({ value: s, decimal: 8 }), a = new g({ value: e, decimal: 8 }), u = new g({ value: t, decimal: 8 }), l = new g({ value: n, decimal: 8 }), h = new g({ value: i, decimal: 8 }), T = l.mul(a), H = h.mul(c), mt = l.mul(h), pt = c.mul(a), ft = u.mul(T.add(H.add(mt.mul(2)))), _t = T.add(H.add(pt.mul(2))), Q = ft.div(_t), D = p(r).add(Q);
226
226
  if (Q.getBaseValue("number") === 0)
227
227
  return D.div(u).getBaseValue("number");
228
228
  const gt = u.add(D);
229
229
  return D.div(gt).getBaseValue("number");
230
230
  }
231
- function he({
231
+ function de({
232
232
  runeAmount: s,
233
233
  assetAmount: t,
234
234
  runeDepth: e,
@@ -239,7 +239,7 @@ function he({
239
239
  const n = p(e), i = p(r), c = p(t), a = p(s), u = c.mul(n).sub(i.mul(a)), l = i.mul(a).add(n.mul(i));
240
240
  return Math.abs(u.div(l).getBaseValue("number"));
241
241
  }
242
- const de = (s, t) => {
242
+ const me = (s, t) => {
243
243
  switch (s) {
244
244
  case _.LEAVE:
245
245
  case _.BOND: {
@@ -282,18 +282,18 @@ const de = (s, t) => {
282
282
  return "";
283
283
  }
284
284
  };
285
- function me(s) {
285
+ function pe(s) {
286
286
  if (s < 0)
287
287
  throw new Error("Invalid number of year");
288
288
  return 10 + s;
289
289
  }
290
- function pe(s) {
290
+ function fe(s) {
291
291
  if (s.length > 30)
292
292
  return !1;
293
293
  const t = /^[a-zA-Z0-9+_-]+$/g;
294
294
  return !!s.match(t);
295
295
  }
296
- function fe([s, t, e, r, n]) {
296
+ function _e([s, t, e, r, n]) {
297
297
  return `${s}'/${t}'/${e}'/${r}${typeof n != "number" ? "" : `/${n}`}`;
298
298
  }
299
299
  class X extends Error {
@@ -348,7 +348,7 @@ const q = (s) => s !== null && typeof s == "object", M = (...s) => {
348
348
  q(r.headers) && (e = at(e, r.headers), t.headers = e);
349
349
  }
350
350
  return t;
351
- }, Pt = (() => {
351
+ }, Vt = (() => {
352
352
  let s = !1, t = !1;
353
353
  const e = typeof globalThis.ReadableStream == "function", r = typeof globalThis.Request == "function";
354
354
  return e && r && (t = new globalThis.Request("https://empty.invalid", {
@@ -359,13 +359,13 @@ const q = (s) => s !== null && typeof s == "object", M = (...s) => {
359
359
  return s = !0, "half";
360
360
  }
361
361
  }).headers.has("Content-Type")), s && !t;
362
- })(), Vt = typeof globalThis.AbortController == "function", kt = typeof globalThis.ReadableStream == "function", jt = typeof globalThis.FormData == "function", ct = ["get", "post", "put", "patch", "head", "delete"], Nt = {
362
+ })(), kt = typeof globalThis.AbortController == "function", jt = typeof globalThis.ReadableStream == "function", Nt = typeof globalThis.FormData == "function", ct = ["get", "post", "put", "patch", "head", "delete"], Ht = {
363
363
  json: "application/json",
364
364
  text: "text/*",
365
365
  formData: "multipart/form-data",
366
366
  arrayBuffer: "*/*",
367
367
  blob: "*/*"
368
- }, L = 2147483647, ut = Symbol("stop"), Ht = {
368
+ }, L = 2147483647, ut = Symbol("stop"), Dt = {
369
369
  json: !0,
370
370
  parseJson: !0,
371
371
  searchParams: !0,
@@ -376,7 +376,7 @@ const q = (s) => s !== null && typeof s == "object", M = (...s) => {
376
376
  throwHttpErrors: !0,
377
377
  onDownloadProgress: !0,
378
378
  fetch: !0
379
- }, Dt = {
379
+ }, Ut = {
380
380
  method: !0,
381
381
  headers: !0,
382
382
  body: !0,
@@ -392,15 +392,15 @@ const q = (s) => s !== null && typeof s == "object", M = (...s) => {
392
392
  window: !0,
393
393
  dispatcher: !0,
394
394
  duplex: !0
395
- }, Ut = (s) => ct.includes(s) ? s.toUpperCase() : s, Lt = ["get", "put", "head", "delete", "options", "trace"], Ft = [408, 413, 429, 500, 502, 503, 504], lt = [413, 429, 503], Z = {
395
+ }, Lt = (s) => ct.includes(s) ? s.toUpperCase() : s, Ft = ["get", "put", "head", "delete", "options", "trace"], Wt = [408, 413, 429, 500, 502, 503, 504], lt = [413, 429, 503], Z = {
396
396
  limit: 2,
397
- methods: Lt,
398
- statusCodes: Ft,
397
+ methods: Ft,
398
+ statusCodes: Wt,
399
399
  afterStatusCodes: lt,
400
400
  maxRetryAfter: Number.POSITIVE_INFINITY,
401
401
  backoffLimit: Number.POSITIVE_INFINITY,
402
402
  delay: (s) => 0.3 * 2 ** (s - 1) * 1e3
403
- }, Wt = (s = {}) => {
403
+ }, Gt = (s = {}) => {
404
404
  if (typeof s == "number")
405
405
  return {
406
406
  ...Z,
@@ -416,7 +416,7 @@ const q = (s) => s !== null && typeof s == "object", M = (...s) => {
416
416
  afterStatusCodes: lt
417
417
  };
418
418
  };
419
- async function Gt(s, t, e, r) {
419
+ async function Yt(s, t, e, r) {
420
420
  return new Promise((n, i) => {
421
421
  const c = setTimeout(() => {
422
422
  e && e.abort(), i(new ot(s));
@@ -426,7 +426,7 @@ async function Gt(s, t, e, r) {
426
426
  });
427
427
  });
428
428
  }
429
- async function Yt(s, { signal: t }) {
429
+ async function zt(s, { signal: t }) {
430
430
  return new Promise((e, r) => {
431
431
  t && (t.throwIfAborted(), t.addEventListener("abort", n, { once: !0 }));
432
432
  function n() {
@@ -437,10 +437,10 @@ async function Yt(s, { signal: t }) {
437
437
  }, s);
438
438
  });
439
439
  }
440
- const zt = (s, t) => {
440
+ const Jt = (s, t) => {
441
441
  const e = {};
442
442
  for (const r in t)
443
- !(r in Dt) && !(r in Ht) && !(r in s) && (e[r] = t[r]);
443
+ !(r in Ut) && !(r in Dt) && !(r in s) && (e[r] = t[r]);
444
444
  return e;
445
445
  };
446
446
  class V {
@@ -463,13 +463,13 @@ class V {
463
463
  if (r._options.onDownloadProgress) {
464
464
  if (typeof r._options.onDownloadProgress != "function")
465
465
  throw new TypeError("The `onDownloadProgress` option must be a function");
466
- if (!kt)
466
+ if (!jt)
467
467
  throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
468
468
  return r._stream(a.clone(), r._options.onDownloadProgress);
469
469
  }
470
470
  return a;
471
471
  }, c = r._options.retry.methods.includes(r.request.method.toLowerCase()) ? r._retry(n) : n();
472
- for (const [a, u] of Object.entries(Nt))
472
+ for (const [a, u] of Object.entries(Ht))
473
473
  c[a] = async () => {
474
474
  r.request.headers.set("accept", r.request.headers.get("accept") || u);
475
475
  const h = (await c).clone();
@@ -521,10 +521,10 @@ class V {
521
521
  beforeError: [],
522
522
  afterResponse: []
523
523
  }, e.hooks),
524
- method: Ut(e.method ?? this._input.method),
524
+ method: Lt(e.method ?? this._input.method),
525
525
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
526
526
  prefixUrl: String(e.prefixUrl || ""),
527
- retry: Wt(e.retry),
527
+ retry: Gt(e.retry),
528
528
  throwHttpErrors: e.throwHttpErrors !== !1,
529
529
  timeout: e.timeout ?? 1e4,
530
530
  fetch: e.fetch ?? globalThis.fetch.bind(globalThis)
@@ -535,7 +535,7 @@ class V {
535
535
  throw new Error("`input` must not begin with a slash when using `prefixUrl`");
536
536
  this._options.prefixUrl.endsWith("/") || (this._options.prefixUrl += "/"), this._input = this._options.prefixUrl + this._input;
537
537
  }
538
- if (Vt) {
538
+ if (kt) {
539
539
  if (this.abortController = new globalThis.AbortController(), this._options.signal) {
540
540
  const r = this._options.signal;
541
541
  this._options.signal.addEventListener("abort", () => {
@@ -544,9 +544,9 @@ class V {
544
544
  }
545
545
  this._options.signal = this.abortController.signal;
546
546
  }
547
- if (Pt && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
547
+ if (Vt && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
548
548
  const n = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), i = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, n);
549
- (jt && 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(i, { ...this.request }), this._options);
549
+ (Nt && 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(i, { ...this.request }), this._options);
550
550
  }
551
551
  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 }));
552
552
  }
@@ -577,7 +577,7 @@ class V {
577
577
  } catch (e) {
578
578
  const r = Math.min(this._calculateRetryDelay(e), L);
579
579
  if (r !== 0 && this._retryCount > 0) {
580
- await Yt(r, { signal: this._options.signal });
580
+ await zt(r, { signal: this._options.signal });
581
581
  for (const n of this._options.hooks.beforeRetry)
582
582
  if (await n({
583
583
  request: this.request,
@@ -601,8 +601,8 @@ class V {
601
601
  if (r instanceof Response)
602
602
  return r;
603
603
  }
604
- const t = zt(this.request, this._options);
605
- return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Gt(this.request.clone(), t, this.abortController, this._options);
604
+ const t = Jt(this.request, this._options);
605
+ return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Yt(this.request.clone(), t, this.abortController, this._options);
606
606
  }
607
607
  /* istanbul ignore next */
608
608
  _stream(t, e) {
@@ -644,11 +644,11 @@ const W = (s) => {
644
644
  for (const e of ct)
645
645
  t[e] = (r, n) => V.create(r, M(s, n, { method: e }));
646
646
  return t.create = (e) => W(M(e)), t.extend = (e) => W(M(s, e)), t.stop = ut, t;
647
- }, Jt = W(), Kt = Jt, Qt = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, tt = Kt.create({ headers: Qt }), Xt = {
647
+ }, Kt = W(), Qt = Kt, Xt = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, tt = Qt.create({ headers: Xt }), Zt = {
648
648
  get: (s, t) => tt.get(s, t).json(),
649
649
  post: (s, t) => tt.post(s, t).json()
650
650
  }, et = [...Object.values(o), "TERRA"];
651
- function Zt(s = "") {
651
+ function te(s = "") {
652
652
  const t = s.toUpperCase(), [e] = t.split(".");
653
653
  if (et.includes(e))
654
654
  return !0;
@@ -678,14 +678,14 @@ function k({
678
678
  ""
679
679
  );
680
680
  }
681
- var w, R, b, T, N, ht, E, G, B, Y;
681
+ var w, R, b, v, N, ht, E, G, B, Y;
682
682
  const K = class K {
683
683
  constructor(t) {
684
- v(this, w);
685
- v(this, b);
686
- v(this, N);
687
- v(this, E);
688
- v(this, B);
684
+ $(this, w);
685
+ $(this, b);
686
+ $(this, N);
687
+ $(this, E);
688
+ $(this, B);
689
689
  f(this, "decimalMultiplier", 10n ** 8n);
690
690
  f(this, "bigIntValue", 0n);
691
691
  f(this, "decimal");
@@ -724,19 +724,19 @@ const K = class K {
724
724
  return m(this, w, R).call(this, "div", ...t);
725
725
  }
726
726
  gt(t) {
727
- return m(this, b, T).call(this, "gt", t);
727
+ return m(this, b, v).call(this, "gt", t);
728
728
  }
729
729
  gte(t) {
730
- return m(this, b, T).call(this, "gte", t);
730
+ return m(this, b, v).call(this, "gte", t);
731
731
  }
732
732
  lt(t) {
733
- return m(this, b, T).call(this, "lt", t);
733
+ return m(this, b, v).call(this, "lt", t);
734
734
  }
735
735
  lte(t) {
736
- return m(this, b, T).call(this, "lte", t);
736
+ return m(this, b, v).call(this, "lte", t);
737
737
  }
738
738
  eqValue(t) {
739
- return m(this, b, T).call(this, "eqValue", t);
739
+ return m(this, b, v).call(this, "eqValue", t);
740
740
  }
741
741
  // @ts-expect-error False positive
742
742
  getValue(t) {
@@ -859,7 +859,7 @@ w = new WeakSet(), R = function(t, ...e) {
859
859
  value: a,
860
860
  identifier: this.toString()
861
861
  });
862
- }, b = new WeakSet(), T = function(t, ...e) {
862
+ }, b = new WeakSet(), v = function(t, ...e) {
863
863
  const r = m(this, E, G).call(this, this, ...e), n = this.getBigIntValue(e[0], r), i = this.getBigIntValue(this, r);
864
864
  switch (t) {
865
865
  case "gt":
@@ -884,12 +884,12 @@ w = new WeakSet(), R = function(t, ...e) {
884
884
  return BigInt(`${i}${c.padEnd(n, "0")}`);
885
885
  };
886
886
  let j = K;
887
- const te = Intl.NumberFormat("fullwide", {
887
+ const ee = Intl.NumberFormat("fullwide", {
888
888
  useGrouping: !1,
889
889
  maximumFractionDigits: 20
890
890
  });
891
891
  function x(s) {
892
- const e = `${typeof s == "number" ? te.format(s) : z(s)}`.replaceAll(",", ".").split(".");
892
+ const e = `${typeof s == "number" ? ee.format(s) : z(s)}`.replaceAll(",", ".").split(".");
893
893
  return e.length > 1 ? `${e.slice(0, -1).join("")}.${e.at(-1)}` : e[0];
894
894
  }
895
895
  function rt(s) {
@@ -920,7 +920,7 @@ class A extends j {
920
920
  f(this, "ticker");
921
921
  f(this, "type");
922
922
  const u = P(a || `${i}.${c}`);
923
- this.type = Ot(u), this.tax = n, this.chain = u.chain, this.ticker = u.ticker, this.symbol = u.symbol, this.address = u.address, this.isSynthetic = u.isSynthetic, this.isGasAsset = u.isGasAsset;
923
+ this.type = Et(u), this.tax = n, this.chain = u.chain, this.ticker = u.ticker, this.symbol = u.symbol, this.address = u.address, this.isSynthetic = u.isSynthetic, this.isGasAsset = u.isGasAsset;
924
924
  }
925
925
  toString() {
926
926
  return this.isSynthetic ? this.symbol : `${this.chain}.${this.symbol}`;
@@ -931,6 +931,9 @@ class A extends j {
931
931
  eq({ chain: e, symbol: r }) {
932
932
  return this.chain === e && this.symbol === r;
933
933
  }
934
+ chainId() {
935
+ return $t[this.chain];
936
+ }
934
937
  // THOR.RUNE
935
938
  // THOR.ETH.ETH
936
939
  // ETH.THOR-0x1234567890
@@ -973,7 +976,7 @@ class A extends j {
973
976
  return new A({ tax: a, decimal: u, identifier: l, value: I(r, u) });
974
977
  }
975
978
  static fromChainOrSignature(e, r = 0) {
976
- const { decimal: n, identifier: i } = It(e);
979
+ const { decimal: n, identifier: i } = Ot(e);
977
980
  return new A({ value: I(r, n), decimal: n, identifier: i });
978
981
  }
979
982
  static loadStaticAssets() {
@@ -1001,7 +1004,7 @@ class A extends j {
1001
1004
  );
1002
1005
  }
1003
1006
  }
1004
- function _e(s) {
1007
+ function ge(s) {
1005
1008
  const t = A.fromChainOrSignature(s);
1006
1009
  switch (s) {
1007
1010
  case o.Bitcoin:
@@ -1023,8 +1026,8 @@ function _e(s) {
1023
1026
  }
1024
1027
  }
1025
1028
  async function F(s, t = 0) {
1026
- Zt(s);
1027
- const e = S.get(s.toUpperCase()), r = (e == null ? void 0 : e.decimal) || await St(P(s));
1029
+ te(s);
1030
+ const e = S.get(s.toUpperCase()), r = (e == null ? void 0 : e.decimal) || await It(P(s));
1028
1031
  return e || S.set(s.toUpperCase(), { identifier: s, decimal: r }), new A({ decimal: r, value: I(t, r), identifier: s });
1029
1032
  }
1030
1033
  function st(s, t = 0) {
@@ -1054,7 +1057,7 @@ function P(s) {
1054
1057
  ticker: a
1055
1058
  };
1056
1059
  }
1057
- const ee = {
1060
+ const re = {
1058
1061
  /**
1059
1062
  * Core
1060
1063
  */
@@ -1114,7 +1117,7 @@ const ee = {
1114
1117
  };
1115
1118
  class dt extends Error {
1116
1119
  constructor(t, e) {
1117
- console.error(e, { stack: e == null ? void 0 : e.stack, message: e == null ? void 0 : e.message }), super(t, { cause: { code: ee[t], message: t } }), Object.setPrototypeOf(this, dt.prototype);
1120
+ console.error(e, { stack: e == null ? void 0 : e.stack, message: e == null ? void 0 : e.message }), super(t, { cause: { code: re[t], message: t } }), Object.setPrototypeOf(this, dt.prototype);
1118
1121
  }
1119
1122
  }
1120
1123
  class g extends j {
@@ -1131,29 +1134,29 @@ class g extends j {
1131
1134
  export {
1132
1135
  A as AssetValue,
1133
1136
  j as BigIntArithmetics,
1134
- Xt as RequestClient,
1137
+ Zt as RequestClient,
1135
1138
  dt as SwapKitError,
1136
1139
  g as SwapKitNumber,
1137
- ie as assetFromString,
1138
- fe as derivationPathToString,
1139
- oe as filterAssets,
1140
+ oe as assetFromString,
1141
+ _e as derivationPathToString,
1142
+ ae as filterAssets,
1140
1143
  k as formatBigIntToSafeValue,
1141
- ne as gasFeeMultiplier,
1142
- Ot as getAssetType,
1143
- xt as getAsymmetricAssetShare,
1144
- ce as getAsymmetricAssetWithdrawAmount,
1145
- Mt as getAsymmetricRuneShare,
1146
- ae as getAsymmetricRuneWithdrawAmount,
1147
- It as getCommonAssetInfo,
1148
- St as getDecimal,
1149
- le as getEstimatedPoolShare,
1150
- he as getLiquiditySlippage,
1151
- de as getMemoFor,
1152
- _e as getMinAmountByChain,
1153
- qt as getSymmetricPoolShare,
1154
- ue as getSymmetricWithdraw,
1155
- me as getTHORNameCost,
1144
+ ie as gasFeeMultiplier,
1145
+ Et as getAssetType,
1146
+ qt as getAsymmetricAssetShare,
1147
+ ue as getAsymmetricAssetWithdrawAmount,
1148
+ xt as getAsymmetricRuneShare,
1149
+ ce as getAsymmetricRuneWithdrawAmount,
1150
+ Ot as getCommonAssetInfo,
1151
+ It as getDecimal,
1152
+ he as getEstimatedPoolShare,
1153
+ de as getLiquiditySlippage,
1154
+ me as getMemoFor,
1155
+ ge as getMinAmountByChain,
1156
+ Pt as getSymmetricPoolShare,
1157
+ le as getSymmetricWithdraw,
1158
+ pe as getTHORNameCost,
1156
1159
  it as isGasAsset,
1157
- pe as validateTHORName
1160
+ fe as validateTHORName
1158
1161
  };
1159
1162
  //# sourceMappingURL=index.es.js.map