@swapkit/core 1.0.0-rc.19 → 1.0.0-rc.20

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
@@ -1,6 +1,6 @@
1
- var qe = Object.defineProperty;
2
- var We = (e, t, n) => t in e ? qe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var T = (e, t, n) => (We(e, typeof t != "symbol" ? t + "" : t, n), n), je = (e, t, n) => {
1
+ var We = Object.defineProperty;
2
+ var qe = (e, t, n) => t in e ? We(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var T = (e, t, n) => (qe(e, typeof t != "symbol" ? t + "" : t, n), n), je = (e, t, n) => {
4
4
  if (!t.has(e))
5
5
  throw TypeError("Cannot " + n);
6
6
  };
@@ -676,7 +676,7 @@ const at = {
676
676
  [l.PRICE_IS_STALE]: "Price is stale for asset {0}.",
677
677
  [l.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
678
678
  [l.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
679
- }, ie = (e, t) => {
679
+ }, re = (e, t) => {
680
680
  let n = at[e];
681
681
  for (let a = 0; a < t.length; a++)
682
682
  n = n.replace(`{${a}}`, t[a]);
@@ -690,19 +690,19 @@ let Tn = class Ne extends Error {
690
690
  code: s,
691
691
  message: r,
692
692
  type: o,
693
- options: { shouldLog: p, shouldThrow: u, shouldTrace: y } = {
693
+ options: { shouldLog: p, shouldThrow: d, shouldTrace: y } = {
694
694
  shouldLog: !0,
695
695
  shouldThrow: !0,
696
696
  shouldTrace: !0
697
697
  },
698
- displayMessageParams: d
698
+ displayMessageParams: u
699
699
  }) {
700
- const c = r || ie(s, d || []) || "";
701
- super(c), C(this, "status"), C(this, "revision"), C(this, "type"), C(this, "module"), C(this, "code"), C(this, "message"), C(this, "display"), C(this, "stack"), C(this, "options"), C(this, "displayMessageParams"), this.status = t, this.revision = n || "NO_REVISION", this.module = a, this.message = c, this.display = ie(s, d || []), this.code = s, this.type = o || Me.UNHANDLED_ERROR, this.options = {
700
+ const c = r || re(s, u || []) || "";
701
+ super(c), C(this, "status"), C(this, "revision"), C(this, "type"), C(this, "module"), C(this, "code"), C(this, "message"), C(this, "display"), C(this, "stack"), C(this, "options"), C(this, "displayMessageParams"), this.status = t, this.revision = n || "NO_REVISION", this.module = a, this.message = c, this.display = re(s, u || []), this.code = s, this.type = o || Me.UNHANDLED_ERROR, this.options = {
702
702
  shouldLog: p || !0,
703
703
  shouldTrace: y || !0,
704
- shouldThrow: u || !1
705
- }, this.displayMessageParams = d || [], this.options.shouldTrace && Error.captureStackTrace(this);
704
+ shouldThrow: d || !1
705
+ }, this.displayMessageParams = u || [], this.options.shouldTrace && Error.captureStackTrace(this);
706
706
  }
707
707
  static fromErrorInfo(t) {
708
708
  return new Ne(t);
@@ -714,7 +714,7 @@ let Tn = class Ne extends Error {
714
714
  return `${this.revision}-${this.type || "NO_TYPE"}-${this.module}-${this.code}`;
715
715
  }
716
716
  get displayMessage() {
717
- return ie(this.code, this.displayMessageParams || []);
717
+ return re(this.code, this.displayMessageParams || []);
718
718
  }
719
719
  handle() {
720
720
  const t = `[${this.identifier}]: ${this.message}`;
@@ -763,20 +763,20 @@ const _n = [
763
763
  "BNB"
764
764
  /* Binance */
765
765
  ];
766
- var fe = /* @__PURE__ */ ((e) => (e.Arbitrum = "42161", e.ArbitrumHex = "0xa4b1", e.Avalanche = "43114", e.AvalancheHex = "0xa86a", e.Binance = "Binance-Chain-Tigris", e.BinanceSmartChain = "56", e.BinanceSmartChainHex = "0x38", e.Bitcoin = "bitcoin", e.BitcoinCash = "bitcoincash", e.Cosmos = "cosmoshub-4", e.Dogecoin = "dogecoin", e.Kujira = "kaiyo-1", e.Ethereum = "1", e.EthereumHex = "0x1", e.Litecoin = "litecoin", e.Maya = "mayachain-mainnet-v1", e.MayaStagenet = "mayachain-stagenet-v1", e.Optimism = "10", e.OptimismHex = "0xa", e.Polygon = "137", e.PolygonHex = "0x89", e.THORChain = "thorchain-mainnet-v1", e.THORChainStagenet = "thorchain-stagenet-v2", e))(fe || {}), xe = /* @__PURE__ */ ((e) => (e.Arbitrum = "https://arb1.arbitrum.io/rpc", e.Avalanche = "https://node-router.thorswap.net/avalanche-c", e.Binance = "", e.BinanceSmartChain = "https://bsc-dataseed.binance.org", e.Bitcoin = "https://node-router.thorswap.net/bitcoin", e.BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash", e.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", e.Kujira = "https://rpc-kujira.synergynodes.com/", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Litecoin = "https://node-router.thorswap.net/litecoin", e.Maya = "https://tendermint.mayachain.info", e.MayaStagenet = "https://stagenet.tendermint.mayachain.info", e.Optimism = "https://mainnet.optimism.io", e.Polygon = "https://polygon-rpc.com", e.THORChain = "https://rpc.thorswap.net", e.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", e))(xe || {}), q = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.finance", e.ThorswapStatic = "https://static.thorswap.net", e))(q || {});
767
- const ae = Object.values(i), rt = Object.keys(i), be = ae.reduce(
766
+ var fe = /* @__PURE__ */ ((e) => (e.Arbitrum = "42161", e.ArbitrumHex = "0xa4b1", e.Avalanche = "43114", e.AvalancheHex = "0xa86a", e.Binance = "Binance-Chain-Tigris", e.BinanceSmartChain = "56", e.BinanceSmartChainHex = "0x38", e.Bitcoin = "bitcoin", e.BitcoinCash = "bitcoincash", e.Cosmos = "cosmoshub-4", e.Dogecoin = "dogecoin", e.Kujira = "kaiyo-1", e.Ethereum = "1", e.EthereumHex = "0x1", e.Litecoin = "litecoin", e.Maya = "mayachain-mainnet-v1", e.MayaStagenet = "mayachain-stagenet-v1", e.Optimism = "10", e.OptimismHex = "0xa", e.Polygon = "137", e.PolygonHex = "0x89", e.THORChain = "thorchain-mainnet-v1", e.THORChainStagenet = "thorchain-stagenet-v2", e))(fe || {}), xe = /* @__PURE__ */ ((e) => (e.Arbitrum = "https://arb1.arbitrum.io/rpc", e.Avalanche = "https://node-router.thorswap.net/avalanche-c", e.Binance = "", e.BinanceSmartChain = "https://bsc-dataseed.binance.org", e.Bitcoin = "https://node-router.thorswap.net/bitcoin", e.BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash", e.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", e.Kujira = "https://rpc-kujira.synergynodes.com/", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Litecoin = "https://node-router.thorswap.net/litecoin", e.Maya = "https://tendermint.mayachain.info", e.MayaStagenet = "https://stagenet.tendermint.mayachain.info", e.Optimism = "https://mainnet.optimism.io", e.Polygon = "https://polygon-rpc.com", e.THORChain = "https://rpc.thorswap.net", e.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", e))(xe || {}), W = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.finance", e.ThorswapStatic = "https://static.thorswap.net", e))(W || {});
767
+ const se = Object.values(i), rt = Object.keys(i), be = se.reduce(
768
768
  (e, t) => {
769
769
  const n = rt.find((a) => i[a] === t);
770
770
  return n && (e[t] = n), e;
771
771
  },
772
772
  {}
773
- ), ot = ae.reduce(
773
+ ), ot = se.reduce(
774
774
  (e, t) => (e[t] = fe[be[t]], e),
775
775
  {}
776
- ), pt = ae.reduce(
776
+ ), pt = se.reduce(
777
777
  (e, t) => (e[t] = xe[be[t]], e),
778
778
  {}
779
- ), wn = ae.reduce(
779
+ ), wn = se.reduce(
780
780
  (e, t) => {
781
781
  const n = `${be[t]}Hex`;
782
782
  return e[t] = fe[n], e;
@@ -969,15 +969,15 @@ const mt = "0x313ce567", Pe = async ({ chain: e, to: t }) => {
969
969
  poolUnits: t,
970
970
  runeDepth: n
971
971
  }) => {
972
- const a = w(e), s = w(t), r = w(n), o = a.mul(r), p = s.mul(s).mul(2), u = s.mul(a).mul(2), y = a.mul(a), d = s.mul(s).mul(s);
973
- return o.mul(p.sub(u).add(y)).div(d);
972
+ const a = w(e), s = w(t), r = w(n), o = a.mul(r), p = s.mul(s).mul(2), d = s.mul(a).mul(2), y = a.mul(a), u = s.mul(s).mul(s);
973
+ return o.mul(p.sub(d).add(y)).div(u);
974
974
  }, gt = ({
975
975
  liquidityUnits: e,
976
976
  poolUnits: t,
977
977
  assetDepth: n
978
978
  }) => {
979
- const a = w(e), s = w(t), r = w(n), o = a.mul(r), p = s.mul(s).mul(2), u = s.mul(a).mul(2), y = a.mul(a), d = o.mul(p.sub(u).add(y)), c = s.mul(s).mul(s);
980
- return d.div(c);
979
+ const a = w(e), s = w(t), r = w(n), o = a.mul(r), p = s.mul(s).mul(2), d = s.mul(a).mul(2), y = a.mul(a), u = o.mul(p.sub(d).add(y)), c = s.mul(s).mul(s);
980
+ return u.div(c);
981
981
  }, gn = ({
982
982
  percent: e,
983
983
  runeDepth: t,
@@ -1014,19 +1014,19 @@ const mt = "0x313ce567", Pe = async ({ chain: e, to: t }) => {
1014
1014
  runeAmount: s,
1015
1015
  assetAmount: r
1016
1016
  }) => {
1017
- const o = w(e), p = w(n), u = w(t), y = w(s), d = w(r), c = y.mul(p), _ = d.mul(o), A = y.mul(d), R = o.mul(p), g = u.mul(c.add(_.add(A.mul(2)))), E = c.add(_.add(R.mul(2))), I = g.div(E), S = w(a).add(I);
1017
+ const o = w(e), p = w(n), d = w(t), y = w(s), u = w(r), c = y.mul(p), _ = u.mul(o), A = y.mul(u), R = o.mul(p), g = d.mul(c.add(_.add(A.mul(2)))), E = c.add(_.add(R.mul(2))), I = g.div(E), v = w(a).add(I);
1018
1018
  if (I.baseValueNumber === 0)
1019
- return S.div(u).baseValueNumber;
1020
- const D = u.add(S);
1021
- return S.div(D).baseValueNumber;
1019
+ return v.div(d).baseValueNumber;
1020
+ const D = d.add(v);
1021
+ return v.div(D).baseValueNumber;
1022
1022
  }, vn = ({
1023
1023
  runeAmount: e,
1024
1024
  assetAmount: t,
1025
1025
  runeDepth: n,
1026
1026
  assetDepth: a
1027
1027
  }) => {
1028
- const s = w(n), r = w(a), o = w(t), p = w(e), u = o.mul(s).sub(r.mul(p)), y = r.mul(p).add(s.mul(r));
1029
- return Math.abs(u.div(y).baseValueNumber);
1028
+ const s = w(n), r = w(a), o = w(t), p = w(e), d = o.mul(s).sub(r.mul(p)), y = r.mul(p).add(s.mul(r));
1029
+ return Math.abs(d.div(y).baseValueNumber);
1030
1030
  }, It = ({
1031
1031
  symbol: e,
1032
1032
  ticker: t,
@@ -1051,8 +1051,8 @@ const mt = "0x313ce567", Pe = async ({ chain: e, to: t }) => {
1051
1051
  return r ? `${e}:${n}/${a}::t:0` : `${e}:${n}.${a}:${s || ""}:t:0`;
1052
1052
  }
1053
1053
  case h.WITHDRAW: {
1054
- const { chain: n, ticker: a, symbol: s, basisPoints: r, targetAssetString: o, singleSide: p } = t, u = !p && o ? `:${o}` : "", y = It({ chain: n, symbol: s, ticker: a });
1055
- return `${e}:${n}${p ? "/" : "."}${y}:${r}${u}`;
1054
+ const { chain: n, ticker: a, symbol: s, basisPoints: r, targetAssetString: o, singleSide: p } = t, d = !p && o ? `:${o}` : "", y = It({ chain: n, symbol: s, ticker: a });
1055
+ return `${e}:${n}${p ? "/" : "."}${y}:${r}${d}`;
1056
1056
  }
1057
1057
  case h.OPEN_LOAN:
1058
1058
  case h.CLOSE_LOAN: {
@@ -1141,7 +1141,7 @@ const Q = (e) => e !== null && typeof e == "object", J = (...e) => {
1141
1141
  formData: "multipart/form-data",
1142
1142
  arrayBuffer: "*/*",
1143
1143
  blob: "*/*"
1144
- }, re = 2147483647, He = Symbol("stop"), xt = {
1144
+ }, oe = 2147483647, He = Symbol("stop"), xt = {
1145
1145
  json: !0,
1146
1146
  parseJson: !0,
1147
1147
  searchParams: !0,
@@ -1219,21 +1219,21 @@ const $t = (e, t) => {
1219
1219
  !(a in Dt) && !(a in xt) && !(a in e) && (n[a] = t[a]);
1220
1220
  return n;
1221
1221
  };
1222
- class Z {
1222
+ class ee {
1223
1223
  static create(t, n) {
1224
- const a = new Z(t, n), s = async () => {
1225
- if (typeof a._options.timeout == "number" && a._options.timeout > re)
1226
- throw new RangeError(`The \`timeout\` option cannot be greater than ${re}`);
1224
+ const a = new ee(t, n), s = async () => {
1225
+ if (typeof a._options.timeout == "number" && a._options.timeout > oe)
1226
+ throw new RangeError(`The \`timeout\` option cannot be greater than ${oe}`);
1227
1227
  await Promise.resolve();
1228
1228
  let o = await a._fetch();
1229
1229
  for (const p of a._options.hooks.afterResponse) {
1230
- const u = await p(a.request, a._options, a._decorateResponse(o.clone()));
1231
- u instanceof globalThis.Response && (o = u);
1230
+ const d = await p(a.request, a._options, a._decorateResponse(o.clone()));
1231
+ d instanceof globalThis.Response && (o = d);
1232
1232
  }
1233
1233
  if (a._decorateResponse(o), !o.ok && a._options.throwHttpErrors) {
1234
1234
  let p = new Ee(o, a.request, a._options);
1235
- for (const u of a._options.hooks.beforeError)
1236
- p = await u(p);
1235
+ for (const d of a._options.hooks.beforeError)
1236
+ p = await d(p);
1237
1237
  throw p;
1238
1238
  }
1239
1239
  if (a._options.onDownloadProgress) {
@@ -1248,14 +1248,14 @@ class Z {
1248
1248
  for (const [o, p] of Object.entries(Nt))
1249
1249
  r[o] = async () => {
1250
1250
  a.request.headers.set("accept", a.request.headers.get("accept") || p);
1251
- const u = (await r).clone();
1251
+ const d = (await r).clone();
1252
1252
  if (o === "json") {
1253
- if (u.status === 204 || (await u.clone().arrayBuffer()).byteLength === 0)
1253
+ if (d.status === 204 || (await d.clone().arrayBuffer()).byteLength === 0)
1254
1254
  return "";
1255
1255
  if (n.parseJson)
1256
- return n.parseJson(await u.text());
1256
+ return n.parseJson(await d.text());
1257
1257
  }
1258
- return u[o]();
1258
+ return d[o]();
1259
1259
  };
1260
1260
  return r;
1261
1261
  }
@@ -1351,7 +1351,7 @@ class Z {
1351
1351
  try {
1352
1352
  return await t();
1353
1353
  } catch (n) {
1354
- const a = Math.min(this._calculateRetryDelay(n), re);
1354
+ const a = Math.min(this._calculateRetryDelay(n), oe);
1355
1355
  if (a !== 0 && this._retryCount > 0) {
1356
1356
  await Ht(a, { signal: this._options.signal });
1357
1357
  for (const s of this._options.hooks.beforeRetry)
@@ -1393,15 +1393,15 @@ class Z {
1393
1393
  const o = t.body.getReader();
1394
1394
  n && n({ percent: 0, transferredBytes: 0, totalBytes: a }, new Uint8Array());
1395
1395
  async function p() {
1396
- const { done: u, value: y } = await o.read();
1397
- if (u) {
1396
+ const { done: d, value: y } = await o.read();
1397
+ if (d) {
1398
1398
  r.close();
1399
1399
  return;
1400
1400
  }
1401
1401
  if (n) {
1402
1402
  s += y.byteLength;
1403
- const d = a === 0 ? 0 : s / a;
1404
- n({ percent: d, transferredBytes: s, totalBytes: a }, y);
1403
+ const u = a === 0 ? 0 : s / a;
1404
+ n({ percent: u, transferredBytes: s, totalBytes: a }, y);
1405
1405
  }
1406
1406
  r.enqueue(y), await p();
1407
1407
  }
@@ -1415,12 +1415,12 @@ class Z {
1415
1415
  }
1416
1416
  }
1417
1417
  /*! MIT License © Sindre Sorhus */
1418
- const pe = (e) => {
1419
- const t = (n, a) => Z.create(n, J(e, a));
1418
+ const de = (e) => {
1419
+ const t = (n, a) => ee.create(n, J(e, a));
1420
1420
  for (const n of Ue)
1421
- t[n] = (a, s) => Z.create(a, J(e, s, { method: n }));
1422
- return t.create = (n) => pe(J(n)), t.extend = (n) => pe(J(e, n)), t.stop = He, t;
1423
- }, kt = pe(), Ft = kt, ge = Ft.create({
1421
+ t[n] = (a, s) => ee.create(a, J(e, s, { method: n }));
1422
+ return t.create = (n) => de(J(n)), t.extend = (n) => de(J(e, n)), t.stop = He, t;
1423
+ }, kt = de(), Ft = kt, ge = Ft.create({
1424
1424
  headers: {
1425
1425
  referrer: "https://sk.thorswap.net",
1426
1426
  referer: "https://sk.thorswap.net",
@@ -1439,11 +1439,11 @@ const pe = (e) => {
1439
1439
  throw new Error(
1440
1440
  `Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
1441
1441
  );
1442
- }, W = 8, U = (e) => 10n ** BigInt(e), F = (e) => Math.log10(parseFloat(e.toString()));
1443
- function se({
1442
+ }, q = 8, U = (e) => 10n ** BigInt(e), F = (e) => Math.log10(parseFloat(e.toString()));
1443
+ function ie({
1444
1444
  value: e,
1445
- bigIntDecimal: t = W,
1446
- decimal: n = W
1445
+ bigIntDecimal: t = q,
1446
+ decimal: n = q
1447
1447
  }) {
1448
1448
  const a = e < 0n;
1449
1449
  let s = e.toString().substring(a ? 1 : 0);
@@ -1456,19 +1456,19 @@ function se({
1456
1456
  ""
1457
1457
  );
1458
1458
  }
1459
- var L, $, de, ke, ue, Ie, ee, le, H, G, te, ye;
1460
- const qt = class ce {
1459
+ var L, $, ue, ke, le, Ie, te, ye, H, G, ne, ce;
1460
+ const Wt = class me {
1461
1461
  constructor(t) {
1462
- V(this, L), V(this, de), V(this, ue), V(this, ee), V(this, H), V(this, te), M(this, "decimalMultiplier", 10n ** 8n), M(this, "bigIntValue", 0n), M(this, "decimal");
1463
- const n = Te(t);
1462
+ V(this, L), V(this, ue), V(this, le), V(this, te), V(this, H), V(this, ne), M(this, "decimalMultiplier", 10n ** 8n), M(this, "bigIntValue", 0n), M(this, "decimal");
1463
+ const n = he(t);
1464
1464
  this.decimal = typeof t == "object" ? t.decimal : void 0, this.decimalMultiplier = U(
1465
- Math.max(O(this, te, ye).call(this, O(this, H, G).call(this, n)), this.decimal || 0)
1466
- ), O(this, de, ke).call(this, n);
1465
+ Math.max(O(this, ne, ce).call(this, O(this, H, G).call(this, n)), this.decimal || 0)
1466
+ ), O(this, ue, ke).call(this, n);
1467
1467
  }
1468
1468
  static fromBigInt(t, n) {
1469
- return new ce({
1469
+ return new me({
1470
1470
  decimal: n,
1471
- value: se({ value: t, bigIntDecimal: n, decimal: n })
1471
+ value: ie({ value: t, bigIntDecimal: n, decimal: n })
1472
1472
  });
1473
1473
  }
1474
1474
  static shiftDecimals({
@@ -1477,7 +1477,7 @@ const qt = class ce {
1477
1477
  to: a
1478
1478
  }) {
1479
1479
  return this.fromBigInt(
1480
- new ce(t).bigIntValue * U(a) / U(n),
1480
+ new me(t).bigIntValue * U(a) / U(n),
1481
1481
  a
1482
1482
  );
1483
1483
  }
@@ -1557,19 +1557,19 @@ const qt = class ce {
1557
1557
  getBigIntValue(t, n) {
1558
1558
  if (!n && typeof t == "object")
1559
1559
  return t.bigIntValue;
1560
- const a = Te(t), s = O(this, H, G).call(this, a);
1561
- return s === "0" || s === "undefined" ? 0n : O(this, ee, le).call(this, s, n);
1560
+ const a = he(t), s = O(this, H, G).call(this, a);
1561
+ return s === "0" || s === "undefined" ? 0n : O(this, te, ye).call(this, s, n);
1562
1562
  }
1563
1563
  formatBigIntToSafeValue(t, n) {
1564
- const a = n || this.decimal || W, s = Math.max(
1564
+ const a = n || this.decimal || q, s = Math.max(
1565
1565
  a,
1566
1566
  F(this.decimalMultiplier)
1567
- ), r = t < 0n, o = t.toString().substring(r ? 1 : 0), p = s - (o.length - 1), u = p > 0 ? "0".repeat(p) + o : o, y = u.length - s;
1568
- let d = u.slice(-s);
1569
- return parseInt(d[a]) >= 5 ? d = `${d.substring(0, a - 1)}${(parseInt(d[a - 1]) + 1).toString()}` : d = d.substring(0, a), `${r ? "-" : ""}${u.slice(
1567
+ ), r = t < 0n, o = t.toString().substring(r ? 1 : 0), p = s - (o.length - 1), d = p > 0 ? "0".repeat(p) + o : o, y = d.length - s;
1568
+ let u = d.slice(-s);
1569
+ return parseInt(u[a]) >= 5 ? u = `${u.substring(0, a - 1)}${(parseInt(u[a - 1]) + 1).toString()}` : u = u.substring(0, a), `${r ? "-" : ""}${d.slice(
1570
1570
  0,
1571
1571
  y
1572
- )}.${d}`.replace(/\.?0*$/, "");
1572
+ )}.${u}`.replace(/\.?0*$/, "");
1573
1573
  }
1574
1574
  toSignificant(t = 6) {
1575
1575
  const [n, a] = this.getValue("string").split("."), s = n || "", r = a || "", o = parseInt(s) ? s.length + r.length : r.length;
@@ -1582,9 +1582,9 @@ const qt = class ce {
1582
1582
  o - t,
1583
1583
  "0"
1584
1584
  );
1585
- const p = parseInt(r), u = `${p}`.slice(0, t);
1586
- return `0.${u.padStart(
1587
- r.length - `${p}`.length + u.length,
1585
+ const p = parseInt(r), d = `${p}`.slice(0, t);
1586
+ return `0.${d.padStart(
1587
+ r.length - `${p}`.length + d.length,
1588
1588
  "0"
1589
1589
  )}`;
1590
1590
  }
@@ -1607,20 +1607,20 @@ const qt = class ce {
1607
1607
  }
1608
1608
  };
1609
1609
  L = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
1610
- const n = O(this, ue, Ie).call(this, this, ...t), a = U(n), s = t.reduce(
1610
+ const n = O(this, le, Ie).call(this, this, ...t), a = U(n), s = t.reduce(
1611
1611
  (o, p) => {
1612
- const u = this.getBigIntValue(p, n);
1612
+ const d = this.getBigIntValue(p, n);
1613
1613
  switch (e) {
1614
1614
  case "add":
1615
- return o + u;
1615
+ return o + d;
1616
1616
  case "sub":
1617
- return o - u;
1617
+ return o - d;
1618
1618
  case "mul":
1619
- return o * u / a;
1619
+ return o * d / a;
1620
1620
  case "div": {
1621
- if (u === 0n)
1621
+ if (d === 0n)
1622
1622
  throw new RangeError("Division by zero");
1623
- return o * a / u;
1623
+ return o * a / d;
1624
1624
  }
1625
1625
  default:
1626
1626
  return o;
@@ -1628,62 +1628,62 @@ L = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
1628
1628
  },
1629
1629
  //normalize is to precision multiplier base
1630
1630
  this.bigIntValue * a / this.decimalMultiplier
1631
- ), r = se({
1631
+ ), r = ie({
1632
1632
  bigIntDecimal: n,
1633
1633
  decimal: Math.max(n, F(this.decimalMultiplier)),
1634
1634
  value: s
1635
1635
  });
1636
1636
  return new this.constructor({ decimal: this.decimal, value: r, identifier: this.toString() });
1637
- }, de = /* @__PURE__ */ new WeakSet(), ke = function(e) {
1637
+ }, ue = /* @__PURE__ */ new WeakSet(), ke = function(e) {
1638
1638
  const t = O(this, H, G).call(this, e) || "0";
1639
- this.bigIntValue = O(this, ee, le).call(this, t);
1640
- }, ue = /* @__PURE__ */ new WeakSet(), Ie = function(...e) {
1639
+ this.bigIntValue = O(this, te, ye).call(this, t);
1640
+ }, le = /* @__PURE__ */ new WeakSet(), Ie = function(...e) {
1641
1641
  const t = e.map(
1642
- (n) => typeof n == "object" ? n.decimal || F(n.decimalMultiplier) : O(this, te, ye).call(this, O(this, H, G).call(this, n))
1642
+ (n) => typeof n == "object" ? n.decimal || F(n.decimalMultiplier) : O(this, ne, ce).call(this, O(this, H, G).call(this, n))
1643
1643
  ).filter(Boolean);
1644
- return Math.max(...t, W);
1645
- }, ee = /* @__PURE__ */ new WeakSet(), le = function(e, t) {
1644
+ return Math.max(...t, q);
1645
+ }, te = /* @__PURE__ */ new WeakSet(), ye = function(e, t) {
1646
1646
  const n = t ? U(t) : this.decimalMultiplier, a = F(n), [s = "", r = ""] = e.split(".");
1647
1647
  return BigInt(`${s}${r.padEnd(a, "0")}`);
1648
1648
  }, H = /* @__PURE__ */ new WeakSet(), G = function(e) {
1649
1649
  const t = `${typeof e == "number" ? Number(e).toLocaleString("fullwide", {
1650
1650
  useGrouping: !1,
1651
1651
  maximumFractionDigits: 20
1652
- }) : Te(e)}`.replaceAll(",", ".").split(".");
1652
+ }) : he(e)}`.replaceAll(",", ".").split(".");
1653
1653
  return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
1654
- }, te = /* @__PURE__ */ new WeakSet(), ye = function(e) {
1654
+ }, ne = /* @__PURE__ */ new WeakSet(), ce = function(e) {
1655
1655
  var t;
1656
1656
  const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
1657
- return Math.max(n, W);
1657
+ return Math.max(n, q);
1658
1658
  };
1659
- let me = qt;
1660
- function Te(e) {
1659
+ let Te = Wt;
1660
+ function he(e) {
1661
1661
  return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
1662
1662
  }
1663
- const z = (e, t) => typeof e == "bigint" ? se({ value: e, bigIntDecimal: t, decimal: t }) : e;
1664
- let he;
1665
- const oe = (e) => {
1666
- if (!he)
1663
+ const z = (e, t) => typeof e == "bigint" ? ie({ value: e, bigIntDecimal: t, decimal: t }) : e;
1664
+ let _e;
1665
+ const pe = (e) => {
1666
+ if (!_e)
1667
1667
  throw new Error("Static assets not loaded, call await AssetValue.loadStaticAssets() first");
1668
- return he.get(e.toUpperCase()) || { decimal: b.THOR, identifier: "" };
1668
+ return _e.get(e.toUpperCase()) || { decimal: b.THOR, identifier: "" };
1669
1669
  }, Se = async (e, t = 0) => {
1670
1670
  Gt(e);
1671
- const n = await Be(_e(e)), a = z(t, n);
1672
- return new v({ decimal: n, value: a, identifier: e });
1671
+ const n = await Be(Z(e)), a = z(t, n);
1672
+ return new S({ decimal: n, value: a, identifier: e });
1673
1673
  };
1674
- class v extends me {
1674
+ class S extends Te {
1675
1675
  constructor(t) {
1676
1676
  super(
1677
- t.value instanceof me ? t.value : { decimal: t.decimal, value: t.value }
1677
+ t.value instanceof Te ? t.value : { decimal: t.decimal, value: t.value }
1678
1678
  ), M(this, "address"), M(this, "chain"), M(this, "isSynthetic", !1), M(this, "isGasAsset", !1), M(this, "symbol"), M(this, "ticker"), M(this, "type");
1679
- const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a = _e(n);
1679
+ const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a = Z(n);
1680
1680
  this.type = At(a), this.chain = a.chain, this.ticker = a.ticker, this.symbol = a.symbol, this.address = a.address, this.isSynthetic = a.isSynthetic, this.isGasAsset = a.isGasAsset;
1681
1681
  }
1682
1682
  get assetValue() {
1683
1683
  return `${this.getValue("string")} ${this.ticker}`;
1684
1684
  }
1685
1685
  toString(t = !1) {
1686
- const n = this.isSynthetic ? this.ticker : `${this.chain}.${this.ticker}`;
1686
+ const n = this.isSynthetic ? this.symbol.split("-")[0] : `${this.chain}.${this.ticker}`;
1687
1687
  return t ? n : (
1688
1688
  // THOR.ETH/ETH | ETH.USDT-0x1234567890
1689
1689
  `${this.chain}.${this.symbol}`
@@ -1696,33 +1696,33 @@ class v extends me {
1696
1696
  return Se(t, n);
1697
1697
  }
1698
1698
  static fromStringSync(t, n = 0) {
1699
- const { decimal: a, identifier: s } = oe(
1699
+ const { isSynthetic: a } = Z(t), { decimal: s, identifier: r } = pe(
1700
1700
  t
1701
- ), r = z(n, a);
1702
- return s ? new v({ decimal: a, identifier: s, value: r }) : void 0;
1701
+ ), o = z(n, s);
1702
+ return r ? new S({ decimal: s, identifier: r, value: o }) : a ? new S({ decimal: 8, identifier: t, value: o }) : void 0;
1703
1703
  }
1704
1704
  static async fromIdentifier(t, n = 0) {
1705
1705
  return Se(t, n);
1706
1706
  }
1707
1707
  static fromIdentifierSync(t, n = 0) {
1708
- const { decimal: a, identifier: s } = oe(t), r = z(n, a);
1709
- return new v({ decimal: a, identifier: s, value: r });
1708
+ const { decimal: a, identifier: s } = pe(t), r = z(n, a);
1709
+ return new S({ decimal: a, identifier: s, value: r });
1710
1710
  }
1711
1711
  static fromChainOrSignature(t, n = 0) {
1712
1712
  const { decimal: a, identifier: s } = wt(t), r = z(n, a);
1713
- return new v({ value: r, decimal: a, identifier: s });
1713
+ return new S({ value: r, decimal: a, identifier: s });
1714
1714
  }
1715
1715
  static async fromTCQuote(t, n = 0) {
1716
- const a = await Be(_e(t)), s = this.shiftDecimals({ value: n, from: b.THOR, to: a });
1717
- return new v({ value: s, identifier: t, decimal: a });
1716
+ const a = await Be(Z(t)), s = this.shiftDecimals({ value: n, from: b.THOR, to: a });
1717
+ return new S({ value: s, identifier: t, decimal: a });
1718
1718
  }
1719
1719
  static fromTCQuoteStatic(t, n = 0) {
1720
- const a = oe(t), s = this.shiftDecimals({
1720
+ const a = pe(t), s = this.shiftDecimals({
1721
1721
  value: n,
1722
1722
  from: b.THOR,
1723
1723
  to: a.decimal
1724
1724
  });
1725
- return new v({ ...a, value: s });
1725
+ return new S({ ...a, value: s });
1726
1726
  }
1727
1727
  static async loadStaticAssets() {
1728
1728
  return new Promise(
@@ -1735,10 +1735,10 @@ class v extends me {
1735
1735
  NativeList: s,
1736
1736
  ...r
1737
1737
  } = await import("@swapkit/tokens");
1738
- he = [s, ...Object.values(r)].reduce(
1739
- (o, { tokens: p }) => (p.forEach(({ identifier: u, chain: y, ...d }) => {
1740
- const c = "decimals" in d ? d.decimals : b[y];
1741
- o.set(u, { identifier: u, decimal: c });
1738
+ _e = [s, ...Object.values(r)].reduce(
1739
+ (o, { tokens: p }) => (p.forEach(({ identifier: d, chain: y, ...u }) => {
1740
+ const c = "decimals" in u ? u.decimals : b[y];
1741
+ o.set(d, { identifier: d, decimal: c });
1742
1742
  }), o),
1743
1743
  /* @__PURE__ */ new Map()
1744
1744
  ), t({ ok: !0 });
@@ -1754,7 +1754,7 @@ class v extends me {
1754
1754
  }
1755
1755
  }
1756
1756
  const ve = (e) => {
1757
- const t = v.fromChainOrSignature(e);
1757
+ const t = S.fromChainOrSignature(e);
1758
1758
  switch (e) {
1759
1759
  case i.Bitcoin:
1760
1760
  case i.Litecoin:
@@ -1771,17 +1771,17 @@ const ve = (e) => {
1771
1771
  default:
1772
1772
  return t.add(1);
1773
1773
  }
1774
- }, _e = (e) => {
1775
- const t = e.slice(0, 14).includes("/"), n = e.includes(".") ? e : `${i.THORChain}.${e}`, [a, s] = n.split("."), [r, o] = s.split("-");
1774
+ }, Z = (e) => {
1775
+ const t = e.slice(0, 14).includes("/"), [n, a] = e.split(".").pop().split("/"), s = e.includes(".") && !t ? e : `${i.THORChain}.${a}`, [r, o] = s.split("."), [p, d] = (t ? a : o).split("-");
1776
1776
  return {
1777
- address: o == null ? void 0 : o.toLowerCase(),
1778
- chain: a,
1779
- isGasAsset: bt({ chain: a, symbol: s }),
1777
+ address: d == null ? void 0 : d.toLowerCase(),
1778
+ chain: r,
1779
+ isGasAsset: bt({ chain: r, symbol: o }),
1780
1780
  isSynthetic: t,
1781
- symbol: o ? `${r}-${(o == null ? void 0 : o.toLowerCase()) ?? ""}` : s,
1782
- ticker: t ? s : r
1781
+ symbol: (t ? `${n}/` : "") + (d ? `${p}-${(d == null ? void 0 : d.toLowerCase()) ?? ""}` : o),
1782
+ ticker: p
1783
1783
  };
1784
- }, Wt = {
1784
+ }, qt = {
1785
1785
  /**
1786
1786
  * Core
1787
1787
  */
@@ -1840,17 +1840,17 @@ const ve = (e) => {
1840
1840
  };
1841
1841
  class m extends Error {
1842
1842
  constructor(t, n) {
1843
- console.error(n), super(t, { cause: { code: Wt[t], message: t } }), Object.setPrototypeOf(this, m.prototype);
1843
+ console.error(n), super(t, { cause: { code: qt[t], message: t } }), Object.setPrototypeOf(this, m.prototype);
1844
1844
  }
1845
1845
  }
1846
- class j extends me {
1846
+ class j extends Te {
1847
1847
  eq(t) {
1848
1848
  return this.eqValue(t);
1849
1849
  }
1850
1850
  static fromBigInt(t, n) {
1851
1851
  return new j({
1852
1852
  decimal: n,
1853
- value: se({ value: t, bigIntDecimal: n, decimal: n })
1853
+ value: ie({ value: t, bigIntDecimal: n, decimal: n })
1854
1854
  });
1855
1855
  }
1856
1856
  }
@@ -3570,9 +3570,9 @@ const jt = [
3570
3570
  amountOutMin: r = "",
3571
3571
  data: o = "",
3572
3572
  deadline: p,
3573
- memo: u,
3573
+ memo: d,
3574
3574
  router: y,
3575
- memoStreamingSwap: d,
3575
+ memoStreamingSwap: u,
3576
3576
  tcMemo: c,
3577
3577
  tcRouter: _,
3578
3578
  tcVault: A,
@@ -3583,12 +3583,12 @@ const jt = [
3583
3583
  const E = !!Fe[t.toLowerCase()];
3584
3584
  if (E && !y)
3585
3585
  throw new Error("Router is required on calldata for swapIn with GenericContract");
3586
- const I = c || u, S = e && d || I;
3586
+ const I = c || d, v = e && u || I;
3587
3587
  if (!A && !R)
3588
3588
  throw new Error("TC Vault is required on calldata");
3589
3589
  if (!_ && !y)
3590
3590
  throw new Error("TC Router is required on calldata");
3591
- if (!S)
3591
+ if (!v)
3592
3592
  throw new Error("TC Memo is required on calldata");
3593
3593
  if (!g)
3594
3594
  throw new Error("Token is required on calldata");
@@ -3596,7 +3596,7 @@ const jt = [
3596
3596
  // v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
3597
3597
  a(_ || y),
3598
3598
  a(A || R),
3599
- S.replace("{recipientAddress}", n),
3599
+ v.replace("{recipientAddress}", n),
3600
3600
  a(g),
3601
3601
  s
3602
3602
  ], Ge = E ? [a(y), o, p] : [r, p];
@@ -3652,16 +3652,16 @@ const jt = [
3652
3652
  throw new Error(`Unsupported chain: ${e}`);
3653
3653
  }
3654
3654
  }, ln = (e) => {
3655
- const t = e ? q.ThornodeStagenet : q.ThornodeMainnet;
3655
+ const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
3656
3656
  return Ae.get(`${t}/thorchain/inbound_addresses`);
3657
3657
  }, yn = (e) => {
3658
- const t = e ? q.ThornodeStagenet : q.ThornodeMainnet;
3658
+ const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
3659
3659
  return Ae.get(`${t}/thorchain/mimir`);
3660
3660
  }, Ce = () => Object.values(i).reduce(
3661
3661
  (e, t) => (e[t] = null, e),
3662
3662
  {}
3663
3663
  );
3664
- var B, ne, K, N, Y, X;
3664
+ var B, ae, K, N, Y, X;
3665
3665
  class xn {
3666
3666
  constructor({ stagenet: t } = {}) {
3667
3667
  T(this, "connectedChains", Ce());
@@ -3679,7 +3679,7 @@ class xn {
3679
3679
  return (a == null ? void 0 : a.balance) || [];
3680
3680
  });
3681
3681
  T(this, "swap", async ({ streamSwap: t, recipient: n, route: a, feeOptionKey: s }) => {
3682
- var p, u;
3682
+ var p, d;
3683
3683
  const { quoteMode: r } = a.meta, o = r.startsWith("ERC20-") ? i.Ethereum : r.startsWith("ARC20-") ? i.Avalanche : i.BinanceSmartChain;
3684
3684
  if (!a.complete)
3685
3685
  throw new m("core_swap_route_not_complete");
@@ -3704,10 +3704,10 @@ class xn {
3704
3704
  if (tt.includes(r)) {
3705
3705
  if (!a.calldata.fromAsset)
3706
3706
  throw new m("core_swap_asset_not_recognized");
3707
- const y = await v.fromString(a.calldata.fromAsset);
3707
+ const y = await S.fromString(a.calldata.fromAsset);
3708
3708
  if (!y)
3709
3709
  throw new m("core_swap_asset_not_recognized");
3710
- const { address: d } = await f(this, B).call(this, y.chain), {
3710
+ const { address: u } = await f(this, B).call(this, y.chain), {
3711
3711
  contract: c,
3712
3712
  calldata: { expiration: _, amountIn: A, memo: R, memoStreamingSwap: g }
3713
3713
  } = a, E = y.add(j.fromBigInt(BigInt(A), y.decimal)), I = t && g || R;
@@ -3717,30 +3717,30 @@ class xn {
3717
3717
  memo: I,
3718
3718
  feeOptionKey: s,
3719
3719
  router: c,
3720
- recipient: d
3720
+ recipient: u
3721
3721
  });
3722
3722
  }
3723
3723
  if (et.includes(r)) {
3724
- const { calldata: y, contract: d } = a;
3725
- if (!d)
3724
+ const { calldata: y, contract: u } = a;
3725
+ if (!u)
3726
3726
  throw new m("core_swap_contract_not_found");
3727
3727
  const c = this.connectedWallets[o], _ = this.getAddress(o);
3728
3728
  if (!(c != null && c.sendTransaction) || !_)
3729
3729
  throw new m("core_wallet_connection_not_found");
3730
- const { getProvider: A, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), g = A(o), E = on[d.toLowerCase()];
3730
+ const { getProvider: A, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), g = A(o), E = on[u.toLowerCase()];
3731
3731
  if (!E)
3732
- throw new m("core_swap_contract_not_supported", { contractAddress: d });
3733
- const S = await (await ((u = c.createContract) == null ? void 0 : u.call(c, d, E, g))).getFunction("swapIn").populateTransaction(
3732
+ throw new m("core_swap_contract_not_supported", { contractAddress: u });
3733
+ const v = await (await ((d = c.createContract) == null ? void 0 : d.call(c, u, E, g))).getFunction("swapIn").populateTransaction(
3734
3734
  ...pn({
3735
3735
  streamSwap: t,
3736
3736
  toChecksumAddress: R,
3737
- contractAddress: d,
3737
+ contractAddress: u,
3738
3738
  recipient: n,
3739
3739
  calldata: y
3740
3740
  }),
3741
3741
  { from: _ }
3742
3742
  );
3743
- return c.sendTransaction(S, s);
3743
+ return c.sendTransaction(v, s);
3744
3744
  }
3745
3745
  throw new m("core_swap_quote_mode_not_supported", { quoteMode: r });
3746
3746
  } catch (y) {
@@ -3753,7 +3753,7 @@ class xn {
3753
3753
  if (!a)
3754
3754
  return null;
3755
3755
  const s = await ((r = this.getWallet(t)) == null ? void 0 : r.getBalance(a, n)) ?? [
3756
- v.fromChainOrSignature(t)
3756
+ S.fromChainOrSignature(t)
3757
3757
  ];
3758
3758
  return this.connectedChains[t] = {
3759
3759
  address: a,
@@ -3783,27 +3783,27 @@ class xn {
3783
3783
  router: a,
3784
3784
  ...s
3785
3785
  }) => {
3786
- const { chain: r, symbol: o, ticker: p } = t, u = this.connectedWallets[r];
3787
- if (!u)
3786
+ const { chain: r, symbol: o, ticker: p } = t, d = this.connectedWallets[r];
3787
+ if (!d)
3788
3788
  throw new m("core_wallet_connection_not_found");
3789
3789
  const y = f(this, X).call(this, { assetValue: t, recipient: n, router: a, ...s });
3790
3790
  try {
3791
3791
  switch (r) {
3792
3792
  case i.THORChain: {
3793
- const d = u;
3794
- return await (n === "" ? d.deposit(y) : d.transfer(y));
3793
+ const u = d;
3794
+ return await (n === "" ? u.deposit(y) : u.transfer(y));
3795
3795
  }
3796
3796
  case i.Ethereum:
3797
3797
  case i.BinanceSmartChain:
3798
3798
  case i.Avalanche: {
3799
- const { getChecksumAddressFromAsset: d } = await import("@swapkit/toolbox-evm"), c = r === i.Avalanche ? Je : r === i.BinanceSmartChain ? Qe : Xe;
3800
- return await u.call({
3799
+ const { getChecksumAddressFromAsset: u } = await import("@swapkit/toolbox-evm"), c = r === i.Avalanche ? Je : r === i.BinanceSmartChain ? Qe : Xe;
3800
+ return await d.call({
3801
3801
  abi: c,
3802
3802
  contractAddress: a || (await f(this, B).call(this, r)).router,
3803
3803
  funcName: "depositWithExpiry",
3804
3804
  funcParams: [
3805
3805
  n,
3806
- d({ chain: r, symbol: o, ticker: p }, r),
3806
+ u({ chain: r, symbol: o, ticker: p }, r),
3807
3807
  // TODO: (@Towan) Re-Check on that conversion 🙏
3808
3808
  t.getBaseValue("bigint").toString(),
3809
3809
  y.memo,
@@ -3816,11 +3816,11 @@ class xn {
3816
3816
  });
3817
3817
  }
3818
3818
  default:
3819
- return await u.transfer(y);
3819
+ return await d.transfer(y);
3820
3820
  }
3821
- } catch (d) {
3822
- const c = ((d == null ? void 0 : d.message) || (d == null ? void 0 : d.toString())).toLowerCase(), _ = c == null ? void 0 : c.includes("insufficient funds"), A = c == null ? void 0 : c.includes("gas"), R = c == null ? void 0 : c.includes("server"), g = _ ? "core_transaction_deposit_insufficient_funds_error" : A ? "core_transaction_deposit_gas_error" : R ? "core_transaction_deposit_server_error" : "core_transaction_deposit_error";
3823
- throw new m(g, d);
3821
+ } catch (u) {
3822
+ const c = ((u == null ? void 0 : u.message) || (u == null ? void 0 : u.toString())).toLowerCase(), _ = c == null ? void 0 : c.includes("insufficient funds"), A = c == null ? void 0 : c.includes("gas"), R = c == null ? void 0 : c.includes("server"), g = _ ? "core_transaction_deposit_insufficient_funds_error" : A ? "core_transaction_deposit_gas_error" : R ? "core_transaction_deposit_server_error" : "core_transaction_deposit_error";
3823
+ throw new m(g, u);
3824
3824
  }
3825
3825
  });
3826
3826
  /**
@@ -3866,18 +3866,18 @@ class xn {
3866
3866
  isPendingSymmAsset: o,
3867
3867
  mode: p = "sym"
3868
3868
  }) => {
3869
- const [u, ...y] = t.split("."), d = p === "sym", c = (n == null ? void 0 : n.gt(0)) && (d || p === "rune"), _ = (a == null ? void 0 : a.gt(0)) && (d || p === "asset"), A = o || c, R = A ? s || this.getAddress(i.THORChain) : "", g = d || p === "asset" ? r || this.getAddress(u) : "";
3869
+ const [d, ...y] = t.split("."), u = p === "sym", c = (n == null ? void 0 : n.gt(0)) && (u || p === "rune"), _ = (a == null ? void 0 : a.gt(0)) && (u || p === "asset"), A = o || c, R = A ? s || this.getAddress(i.THORChain) : "", g = u || p === "asset" ? r || this.getAddress(d) : "";
3870
3870
  if (!c && !_)
3871
3871
  throw new m("core_transaction_add_liquidity_invalid_params");
3872
3872
  if (A && !R)
3873
3873
  throw new m("core_transaction_add_liquidity_no_rune_address");
3874
3874
  let E, I;
3875
- const S = { chain: u, symbol: y.join(".") };
3875
+ const v = { chain: d, symbol: y.join(".") };
3876
3876
  if (c && n)
3877
3877
  try {
3878
3878
  E = await f(this, N).call(this, {
3879
3879
  assetValue: n,
3880
- memo: x(h.DEPOSIT, { ...S, address: g })
3880
+ memo: x(h.DEPOSIT, { ...v, address: g })
3881
3881
  });
3882
3882
  } catch (D) {
3883
3883
  throw new m("core_transaction_add_liquidity_rune_error", D);
@@ -3886,7 +3886,7 @@ class xn {
3886
3886
  try {
3887
3887
  I = await f(this, N).call(this, {
3888
3888
  assetValue: a,
3889
- memo: x(h.DEPOSIT, { ...S, address: R })
3889
+ memo: x(h.DEPOSIT, { ...v, address: R })
3890
3890
  });
3891
3891
  } catch (D) {
3892
3892
  throw new m("core_transaction_add_liquidity_asset_error", D);
@@ -3900,7 +3900,7 @@ class xn {
3900
3900
  from: s,
3901
3901
  to: r
3902
3902
  }) => {
3903
- const o = r === "rune" ? v.fromChainOrSignature(i.THORChain) : s === "sym" && r === "sym" || s === "rune" || s === "asset" ? void 0 : n;
3903
+ const o = r === "rune" ? S.fromChainOrSignature(i.THORChain) : s === "sym" && r === "sym" || s === "rune" || s === "asset" ? void 0 : n;
3904
3904
  try {
3905
3905
  return await f(this, N).call(this, {
3906
3906
  assetValue: ve(s === "asset" ? n.chain : i.THORChain),
@@ -3967,7 +3967,7 @@ class xn {
3967
3967
  try {
3968
3968
  t.forEach((r) => {
3969
3969
  this[r.connectMethodName] = r.connect({
3970
- addChain: f(this, ne),
3970
+ addChain: f(this, ae),
3971
3971
  config: n || {},
3972
3972
  apis: a,
3973
3973
  rpcUrls: s
@@ -4059,7 +4059,7 @@ class xn {
4059
4059
  throw new m("core_chain_halted");
4060
4060
  return a;
4061
4061
  });
4062
- P(this, ne, ({ chain: t, wallet: n, walletMethods: a }) => {
4062
+ P(this, ae, ({ chain: t, wallet: n, walletMethods: a }) => {
4063
4063
  this.connectedChains[t] = n, this.connectedWallets[t] = a;
4064
4064
  });
4065
4065
  P(this, K, async ({
@@ -4067,10 +4067,10 @@ class xn {
4067
4067
  type: o = "checkOnly",
4068
4068
  contractAddress: p
4069
4069
  }) => {
4070
- const u = [i.Ethereum, i.Avalanche, i.BinanceSmartChain].includes(a);
4071
- if (u && s || !u || r)
4070
+ const d = [i.Ethereum, i.Avalanche, i.BinanceSmartChain].includes(a);
4071
+ if (d && s || !d || r)
4072
4072
  return !0;
4073
- const d = this.connectedWallets[a], c = o === "checkOnly" ? d == null ? void 0 : d.isApproved : d == null ? void 0 : d.approve;
4073
+ const u = this.connectedWallets[a], c = o === "checkOnly" ? u == null ? void 0 : u.isApproved : u == null ? void 0 : u.approve;
4074
4074
  if (!c)
4075
4075
  throw new m("core_wallet_connection_not_found");
4076
4076
  const _ = this.getAddress(a);
@@ -4117,14 +4117,14 @@ class xn {
4117
4117
  this.stagenet = !!t;
4118
4118
  }
4119
4119
  }
4120
- B = new WeakMap(), ne = new WeakMap(), K = new WeakMap(), N = new WeakMap(), Y = new WeakMap(), X = new WeakMap();
4120
+ B = new WeakMap(), ae = new WeakMap(), K = new WeakMap(), N = new WeakMap(), Y = new WeakMap(), X = new WeakMap();
4121
4121
  export {
4122
4122
  Ze as AGG_SWAP,
4123
4123
  Tn as ApiError,
4124
- q as ApiUrl,
4125
- v as AssetValue,
4124
+ W as ApiUrl,
4125
+ S as AssetValue,
4126
4126
  b as BaseDecimal,
4127
- me as BigIntArithmetics,
4127
+ Te as BigIntArithmetics,
4128
4128
  i as Chain,
4129
4129
  fe as ChainId,
4130
4130
  An as ChainIdToChain,
@@ -4160,7 +4160,7 @@ export {
4160
4160
  Nn as derivationPathToString,
4161
4161
  mn as erc20ABI,
4162
4162
  Rn as filterAssets,
4163
- se as formatBigIntToSafeValue,
4163
+ ie as formatBigIntToSafeValue,
4164
4164
  ft as gasFeeMultiplier,
4165
4165
  At as getAssetType,
4166
4166
  gt as getAsymmetricAssetShare,