@swapkit/helpers 1.0.0-rc.75 → 1.0.0-rc.76
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/LICENSE +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +159 -158
- package/dist/index.es.js.map +1 -1
- package/package.json +7 -7
- package/src/helpers/asset.ts +1 -1
- package/src/modules/bigIntArithmetics.ts +13 -12
- package/src/modules/swapKitError.ts +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var _ = (e, t, n) => (
|
|
1
|
+
var Ne = Object.defineProperty;
|
|
2
|
+
var ve = (e, t, n) => t in e ? Ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var _ = (e, t, n) => (ve(e, typeof t != "symbol" ? t + "" : t, n), n), $e = (e, t, n) => {
|
|
4
4
|
if (!t.has(e))
|
|
5
5
|
throw TypeError("Cannot " + n);
|
|
6
6
|
};
|
|
@@ -9,8 +9,8 @@ var R = (e, t, n) => {
|
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
10
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
11
11
|
};
|
|
12
|
-
var p = (e, t, n) => (
|
|
13
|
-
import { FeeOption as K, BaseDecimal as d, Chain as
|
|
12
|
+
var p = (e, t, n) => ($e(e, t, "access private method"), n);
|
|
13
|
+
import { FeeOption as K, BaseDecimal as d, Chain as u, EVMChains as Ie, ChainToRPC as Be, MemoType as C, ChainToChainId as De } from "@swapkit/types";
|
|
14
14
|
var F = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dash = "DASH", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polkadot = "DOT", e.Chainflip = "FLIP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(F || {}), ne = /* @__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.Chainflip = "chainflip", e.Cosmos = "cosmoshub-4", e.Dash = "dash", 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.Polkadot = "polkadot", e.Polygon = "137", e.PolygonHex = "0x89", e.THORChain = "thorchain-mainnet-v1", e.THORChainStagenet = "thorchain-stagenet-v2", e))(ne || {}), de = /* @__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.Chainflip = "wss://mainnet-archive.chainflip.io", e.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", e.Dash = "https://node-router.thorswap.net/dash", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Kujira = "https://rpc-kujira.synergynodes.com/", 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.Polkadot = "wss://rpc.polkadot.io", e.Polygon = "https://polygon-rpc.com", e.THORChain = "https://rpc.thorswap.net", e.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", e))(de || {}), S = /* @__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.net", e.ThorswapStatic = "https://static.thorswap.net", e))(S || {});
|
|
15
15
|
const G = Object.values(F), Ve = Object.keys(F), re = G.reduce(
|
|
16
16
|
(e, t) => {
|
|
@@ -223,7 +223,7 @@ class W {
|
|
|
223
223
|
}
|
|
224
224
|
// eslint-disable-next-line complexity
|
|
225
225
|
constructor(t, n = {}) {
|
|
226
|
-
|
|
226
|
+
Object.defineProperty(this, "request", {
|
|
227
227
|
enumerable: !0,
|
|
228
228
|
configurable: !0,
|
|
229
229
|
writable: !0,
|
|
@@ -248,9 +248,10 @@ class W {
|
|
|
248
248
|
configurable: !0,
|
|
249
249
|
writable: !0,
|
|
250
250
|
value: void 0
|
|
251
|
-
}), this._input = t
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
}), this._input = t;
|
|
252
|
+
const r = "credentials" in Request.prototype;
|
|
253
|
+
if (this._options = {
|
|
254
|
+
credentials: r ? this._input.credentials : void 0,
|
|
254
255
|
...n,
|
|
255
256
|
headers: me(this._input.headers, n.headers),
|
|
256
257
|
hooks: se({
|
|
@@ -275,16 +276,16 @@ class W {
|
|
|
275
276
|
}
|
|
276
277
|
if (xe) {
|
|
277
278
|
if (this.abortController = new globalThis.AbortController(), this._options.signal) {
|
|
278
|
-
const
|
|
279
|
+
const s = this._options.signal;
|
|
279
280
|
this._options.signal.addEventListener("abort", () => {
|
|
280
|
-
this.abortController.abort(
|
|
281
|
+
this.abortController.abort(s.reason);
|
|
281
282
|
});
|
|
282
283
|
}
|
|
283
284
|
this._options.signal = this.abortController.signal;
|
|
284
285
|
}
|
|
285
286
|
if (He && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
|
|
286
|
-
const
|
|
287
|
-
(ke && 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(
|
|
287
|
+
const s = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), i = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, s);
|
|
288
|
+
(ke && 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);
|
|
288
289
|
}
|
|
289
290
|
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 }));
|
|
290
291
|
}
|
|
@@ -355,17 +356,17 @@ class W {
|
|
|
355
356
|
const o = t.body.getReader();
|
|
356
357
|
n && n({ percent: 0, transferredBytes: 0, totalBytes: r }, new Uint8Array());
|
|
357
358
|
async function c() {
|
|
358
|
-
const { done: a, value:
|
|
359
|
+
const { done: a, value: l } = await o.read();
|
|
359
360
|
if (a) {
|
|
360
361
|
i.close();
|
|
361
362
|
return;
|
|
362
363
|
}
|
|
363
364
|
if (n) {
|
|
364
|
-
s +=
|
|
365
|
+
s += l.byteLength;
|
|
365
366
|
const h = r === 0 ? 0 : s / r;
|
|
366
|
-
n({ percent: h, transferredBytes: s, totalBytes: r },
|
|
367
|
+
n({ percent: h, transferredBytes: s, totalBytes: r }, l);
|
|
367
368
|
}
|
|
368
|
-
i.enqueue(
|
|
369
|
+
i.enqueue(l), await c();
|
|
369
370
|
}
|
|
370
371
|
await c();
|
|
371
372
|
}
|
|
@@ -392,14 +393,14 @@ const T = {
|
|
|
392
393
|
TokenlistProviders: `${S.ThorswapApi}/tokenlist/providers`,
|
|
393
394
|
TokenList: `${S.ThorswapStatic}/token-list`,
|
|
394
395
|
Thorname: `${S.ThorswapApi}/thorname`
|
|
395
|
-
}, Ae = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" },
|
|
396
|
+
}, Ae = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, ue = () => L || (L = ge.create({ headers: Ae }), L), Tt = ({ apiKey: e, ...t }) => {
|
|
396
397
|
L = ge.create({
|
|
397
398
|
...t,
|
|
398
399
|
headers: { ...Ae, ...t.headers, "x-api-key": e }
|
|
399
400
|
});
|
|
400
401
|
}, f = {
|
|
401
|
-
get: (e, t) =>
|
|
402
|
-
post: (e, t) =>
|
|
402
|
+
get: (e, t) => ue().get(e, t).json(),
|
|
403
|
+
post: (e, t) => ue().post(e, t).json()
|
|
403
404
|
}, Je = ({ tokens: e, ...t }) => {
|
|
404
405
|
const n = new URLSearchParams(), r = e.filter(
|
|
405
406
|
(s, i, o) => o.findIndex((c) => c === s) === i
|
|
@@ -437,25 +438,25 @@ const et = "0x313ce567", Ce = async ({ chain: e, to: t }) => {
|
|
|
437
438
|
params: [{ to: t.toLowerCase(), data: et }, "latest"]
|
|
438
439
|
})
|
|
439
440
|
});
|
|
440
|
-
return parseInt(BigInt(n).toString());
|
|
441
|
+
return Number.parseInt(BigInt(n).toString());
|
|
441
442
|
} catch (n) {
|
|
442
443
|
return console.error(n), d[e];
|
|
443
444
|
}
|
|
444
445
|
}, tt = (e) => {
|
|
445
|
-
if (e ===
|
|
446
|
+
if (e === u.Ethereum)
|
|
446
447
|
return d.ETH;
|
|
447
448
|
const [, t] = e.split("-");
|
|
448
|
-
return t != null && t.startsWith("0x") ? Ce({ chain:
|
|
449
|
+
return t != null && t.startsWith("0x") ? Ce({ chain: u.Ethereum, to: t }) : d.ETH;
|
|
449
450
|
}, nt = (e) => {
|
|
450
451
|
const [, t] = e.split("-");
|
|
451
|
-
return t != null && t.startsWith("0x") ? Ce({ chain:
|
|
452
|
-
}, rt = (e) => e ===
|
|
452
|
+
return t != null && t.startsWith("0x") ? Ce({ chain: u.Avalanche, to: t.toLowerCase() }) : d.AVAX;
|
|
453
|
+
}, rt = (e) => e === u.BinanceSmartChain ? d.BSC : d.BSC, st = ({ chain: e, symbol: t }) => {
|
|
453
454
|
switch (e) {
|
|
454
|
-
case
|
|
455
|
+
case u.Ethereum:
|
|
455
456
|
return tt(t);
|
|
456
|
-
case
|
|
457
|
+
case u.Avalanche:
|
|
457
458
|
return nt(t);
|
|
458
|
-
case
|
|
459
|
+
case u.BinanceSmartChain:
|
|
459
460
|
return rt(t);
|
|
460
461
|
default:
|
|
461
462
|
return d[e];
|
|
@@ -466,42 +467,42 @@ const et = "0x313ce567", Ce = async ({ chain: e, to: t }) => {
|
|
|
466
467
|
[K.Fastest]: 2
|
|
467
468
|
}, Se = ({ chain: e, symbol: t }) => {
|
|
468
469
|
switch (e) {
|
|
469
|
-
case
|
|
470
|
-
case
|
|
470
|
+
case u.Arbitrum:
|
|
471
|
+
case u.Optimism:
|
|
471
472
|
return t === "ETH";
|
|
472
|
-
case
|
|
473
|
+
case u.Maya:
|
|
473
474
|
return t === "CACAO";
|
|
474
|
-
case
|
|
475
|
+
case u.Kujira:
|
|
475
476
|
return t === "KUJI";
|
|
476
|
-
case
|
|
477
|
+
case u.Cosmos:
|
|
477
478
|
return t === "ATOM";
|
|
478
|
-
case
|
|
479
|
+
case u.Polygon:
|
|
479
480
|
return t === "MATIC";
|
|
480
|
-
case
|
|
481
|
+
case u.BinanceSmartChain:
|
|
481
482
|
return t === "BNB";
|
|
482
|
-
case
|
|
483
|
+
case u.THORChain:
|
|
483
484
|
return t === "RUNE";
|
|
484
485
|
default:
|
|
485
486
|
return t === e;
|
|
486
487
|
}
|
|
487
488
|
}, it = (e) => {
|
|
488
489
|
switch (e) {
|
|
489
|
-
case `${
|
|
490
|
+
case `${u.Ethereum}.THOR`:
|
|
490
491
|
return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
|
|
491
|
-
case `${
|
|
492
|
+
case `${u.Ethereum}.vTHOR`:
|
|
492
493
|
return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
|
|
493
|
-
case
|
|
494
|
+
case u.Cosmos:
|
|
494
495
|
return { identifier: "GAIA.ATOM", decimal: d[e] };
|
|
495
|
-
case
|
|
496
|
+
case u.THORChain:
|
|
496
497
|
return { identifier: "THOR.RUNE", decimal: d[e] };
|
|
497
|
-
case
|
|
498
|
+
case u.BinanceSmartChain:
|
|
498
499
|
return { identifier: "BSC.BNB", decimal: d[e] };
|
|
499
|
-
case
|
|
500
|
+
case u.Maya:
|
|
500
501
|
return { identifier: "MAYA.CACAO", decimal: d.MAYA };
|
|
501
|
-
case `${
|
|
502
|
+
case `${u.Maya}.MAYA`:
|
|
502
503
|
return { identifier: "MAYA.MAYA", decimal: 4 };
|
|
503
|
-
case `${
|
|
504
|
-
return { identifier: `${
|
|
504
|
+
case `${u.Kujira}.USK`:
|
|
505
|
+
return { identifier: `${u.Kujira}.USK`, decimal: 6 };
|
|
505
506
|
default:
|
|
506
507
|
return { identifier: `${e}.${e}`, decimal: d[e] };
|
|
507
508
|
}
|
|
@@ -509,24 +510,24 @@ const et = "0x313ce567", Ce = async ({ chain: e, to: t }) => {
|
|
|
509
510
|
if (t.includes("/"))
|
|
510
511
|
return "Synth";
|
|
511
512
|
switch (e) {
|
|
512
|
-
case
|
|
513
|
-
return t === "ATOM" ? "Native" :
|
|
514
|
-
case
|
|
515
|
-
return t ===
|
|
516
|
-
case
|
|
517
|
-
return t ===
|
|
518
|
-
case
|
|
519
|
-
return t ===
|
|
520
|
-
case
|
|
521
|
-
return t ===
|
|
522
|
-
case
|
|
523
|
-
return t ===
|
|
524
|
-
case
|
|
525
|
-
return t ===
|
|
526
|
-
case
|
|
527
|
-
return [
|
|
528
|
-
case
|
|
529
|
-
return [
|
|
513
|
+
case u.Cosmos:
|
|
514
|
+
return t === "ATOM" ? "Native" : u.Cosmos;
|
|
515
|
+
case u.Kujira:
|
|
516
|
+
return t === u.Kujira ? "Native" : u.Kujira;
|
|
517
|
+
case u.Binance:
|
|
518
|
+
return t === u.Binance ? "Native" : "BEP2";
|
|
519
|
+
case u.BinanceSmartChain:
|
|
520
|
+
return t === u.Binance ? "Native" : "BEP20";
|
|
521
|
+
case u.Ethereum:
|
|
522
|
+
return t === u.Ethereum ? "Native" : "ERC20";
|
|
523
|
+
case u.Avalanche:
|
|
524
|
+
return t === u.Avalanche ? "Native" : u.Avalanche;
|
|
525
|
+
case u.Polygon:
|
|
526
|
+
return t === u.Polygon ? "Native" : "POLYGON";
|
|
527
|
+
case u.Arbitrum:
|
|
528
|
+
return [u.Ethereum, u.Arbitrum].includes(t) ? "Native" : "ARBITRUM";
|
|
529
|
+
case u.Optimism:
|
|
530
|
+
return [u.Ethereum, u.Optimism].includes(t) ? "Native" : "OPTIMISM";
|
|
530
531
|
default:
|
|
531
532
|
return "Native";
|
|
532
533
|
}
|
|
@@ -539,7 +540,7 @@ const et = "0x313ce567", Ce = async ({ chain: e, to: t }) => {
|
|
|
539
540
|
"gmi"
|
|
540
541
|
), ct = (e) => {
|
|
541
542
|
const [t, n] = e.split(".");
|
|
542
|
-
if (!
|
|
543
|
+
if (!Ie.includes(t))
|
|
543
544
|
return !0;
|
|
544
545
|
const [, r] = n.split("-");
|
|
545
546
|
return Se({ chain: t, symbol: n }) || !!r;
|
|
@@ -547,21 +548,21 @@ const et = "0x313ce567", Ce = async ({ chain: e, to: t }) => {
|
|
|
547
548
|
const s = `${t}.${r}`;
|
|
548
549
|
return !at.test(s) && ct(s) && n !== "0";
|
|
549
550
|
});
|
|
550
|
-
function
|
|
551
|
+
function ut({
|
|
551
552
|
liquidityUnits: e,
|
|
552
553
|
poolUnits: t,
|
|
553
554
|
runeDepth: n
|
|
554
555
|
}) {
|
|
555
|
-
const r = m(e), s = m(t), i = m(n), o = r.mul(i), c = s.mul(s).mul(2), a = s.mul(r).mul(2),
|
|
556
|
-
return o.mul(c.sub(a).add(
|
|
556
|
+
const r = m(e), s = m(t), i = m(n), o = r.mul(i), c = s.mul(s).mul(2), a = s.mul(r).mul(2), l = r.mul(r), h = s.mul(s).mul(s);
|
|
557
|
+
return o.mul(c.sub(a).add(l)).div(h);
|
|
557
558
|
}
|
|
558
|
-
function
|
|
559
|
+
function lt({
|
|
559
560
|
liquidityUnits: e,
|
|
560
561
|
poolUnits: t,
|
|
561
562
|
assetDepth: n
|
|
562
563
|
}) {
|
|
563
|
-
const r = m(e), s = m(t), i = m(n), o = r.mul(i), c = s.mul(s).mul(2), a = s.mul(r).mul(2),
|
|
564
|
-
return h.div(
|
|
564
|
+
const r = m(e), s = m(t), i = m(n), o = r.mul(i), c = s.mul(s).mul(2), a = s.mul(r).mul(2), l = r.mul(r), h = o.mul(c.sub(a).add(l)), N = s.mul(s).mul(s);
|
|
565
|
+
return h.div(N);
|
|
565
566
|
}
|
|
566
567
|
function bt({
|
|
567
568
|
percent: e,
|
|
@@ -569,15 +570,15 @@ function bt({
|
|
|
569
570
|
liquidityUnits: n,
|
|
570
571
|
poolUnits: r
|
|
571
572
|
}) {
|
|
572
|
-
return
|
|
573
|
+
return ut({ runeDepth: t, liquidityUnits: n, poolUnits: r }).mul(e);
|
|
573
574
|
}
|
|
574
|
-
function
|
|
575
|
+
function yt({
|
|
575
576
|
percent: e,
|
|
576
577
|
assetDepth: t,
|
|
577
578
|
liquidityUnits: n,
|
|
578
579
|
poolUnits: r
|
|
579
580
|
}) {
|
|
580
|
-
return
|
|
581
|
+
return lt({ assetDepth: t, liquidityUnits: n, poolUnits: r }).mul(e);
|
|
581
582
|
}
|
|
582
583
|
function m(e) {
|
|
583
584
|
return g.fromBigInt(BigInt(e), d.THOR);
|
|
@@ -593,7 +594,7 @@ function ht({
|
|
|
593
594
|
runeAmount: m(n).mul(e).div(t)
|
|
594
595
|
};
|
|
595
596
|
}
|
|
596
|
-
function
|
|
597
|
+
function wt({
|
|
597
598
|
liquidityUnits: e,
|
|
598
599
|
poolUnits: t,
|
|
599
600
|
runeDepth: n,
|
|
@@ -614,7 +615,7 @@ function Rt({
|
|
|
614
615
|
runeAmount: s,
|
|
615
616
|
assetAmount: i
|
|
616
617
|
}) {
|
|
617
|
-
const o = new g({ value: e, decimal: 8 }), c = new g({ value: n, decimal: 8 }), a = new g({ value: t, decimal: 8 }),
|
|
618
|
+
const o = new g({ value: e, decimal: 8 }), c = new g({ value: n, decimal: 8 }), a = new g({ value: t, decimal: 8 }), l = new g({ value: s, decimal: 8 }), h = new g({ value: i, decimal: 8 }), N = l.mul(c), ie = h.mul(o), we = l.mul(h), Re = o.mul(c), Ee = a.mul(N.add(ie.add(we.mul(2)))), Pe = N.add(ie.add(Re.mul(2))), oe = Ee.div(Pe), X = m(r).add(oe);
|
|
618
619
|
if (oe.getBaseValue("number") === 0)
|
|
619
620
|
return X.div(a).getBaseValue("number");
|
|
620
621
|
const Oe = a.add(X);
|
|
@@ -628,8 +629,8 @@ function Et({
|
|
|
628
629
|
}) {
|
|
629
630
|
if (e === "0" || t === "0" || n === "0" || r === "0")
|
|
630
631
|
return 0;
|
|
631
|
-
const s = m(n), i = m(r), o = m(t), c = m(e), a = o.mul(s).sub(i.mul(c)),
|
|
632
|
-
return Math.abs(a.div(
|
|
632
|
+
const s = m(n), i = m(r), o = m(t), c = m(e), a = o.mul(s).sub(i.mul(c)), l = i.mul(c).add(s.mul(i));
|
|
633
|
+
return Math.abs(a.div(l).getBaseValue("number"));
|
|
633
634
|
}
|
|
634
635
|
const Pt = (e, t) => {
|
|
635
636
|
switch (e) {
|
|
@@ -650,11 +651,11 @@ const Pt = (e, t) => {
|
|
|
650
651
|
const { chain: n, symbol: r, address: s, singleSide: i } = t;
|
|
651
652
|
return i ? `${e}:${n}/${r}` : `${e}:${((c, a) => {
|
|
652
653
|
switch (c) {
|
|
653
|
-
case
|
|
654
|
+
case u.Litecoin:
|
|
654
655
|
return "l";
|
|
655
|
-
case
|
|
656
|
+
case u.Dogecoin:
|
|
656
657
|
return "d";
|
|
657
|
-
case
|
|
658
|
+
case u.BitcoinCash:
|
|
658
659
|
return "c";
|
|
659
660
|
default:
|
|
660
661
|
return `${c}.${a}`;
|
|
@@ -662,8 +663,8 @@ const Pt = (e, t) => {
|
|
|
662
663
|
})(n, r)}:${s || ""}`;
|
|
663
664
|
}
|
|
664
665
|
case C.WITHDRAW: {
|
|
665
|
-
const { chain: n, ticker: r, symbol: s, basisPoints: i, targetAssetString: o, singleSide: c } = t, a = n === "ETH" && r !== "ETH" ? `${r}-${s.slice(-3)}` : s,
|
|
666
|
-
return `${e}:${n}${c ? "/" : "."}${a}:${i}${
|
|
666
|
+
const { chain: n, ticker: r, symbol: s, basisPoints: i, targetAssetString: o, singleSide: c } = t, a = n === "ETH" && r !== "ETH" ? `${r}-${s.slice(-3)}` : s, l = !c && o ? `:${o}` : "";
|
|
667
|
+
return `${e}:${n}${c ? "/" : "."}${a}:${i}${l}`;
|
|
667
668
|
}
|
|
668
669
|
case C.OPEN_LOAN:
|
|
669
670
|
case C.CLOSE_LOAN: {
|
|
@@ -679,39 +680,39 @@ function Ot(e) {
|
|
|
679
680
|
throw new Error("Invalid number of year");
|
|
680
681
|
return 10 + e;
|
|
681
682
|
}
|
|
682
|
-
function
|
|
683
|
+
function Nt(e) {
|
|
683
684
|
if (e < 0)
|
|
684
685
|
throw new Error("Invalid number of year");
|
|
685
686
|
return Math.round((10 + e * 1.0512) * 1e10) / 1e10;
|
|
686
687
|
}
|
|
687
|
-
function
|
|
688
|
+
function vt(e) {
|
|
688
689
|
if (e.length > 30)
|
|
689
690
|
return !1;
|
|
690
691
|
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
691
692
|
return !!e.match(t);
|
|
692
693
|
}
|
|
693
|
-
function
|
|
694
|
+
function $t(e) {
|
|
694
695
|
if (e.length > 30)
|
|
695
696
|
return !1;
|
|
696
697
|
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
697
698
|
return !!e.match(t);
|
|
698
699
|
}
|
|
699
|
-
function
|
|
700
|
+
function It([e, t, n, r, s]) {
|
|
700
701
|
return `${e}'/${t}'/${n}'/${r}${typeof s != "number" ? "" : `/${s}`}`;
|
|
701
702
|
}
|
|
702
|
-
const
|
|
703
|
+
const le = [...Object.values(u), "TERRA"];
|
|
703
704
|
function dt(e = "") {
|
|
704
705
|
const t = e.toUpperCase(), [n] = t.split(".");
|
|
705
|
-
if (
|
|
706
|
+
if (le.includes(n))
|
|
706
707
|
return !0;
|
|
707
708
|
const [r] = t.split("/");
|
|
708
|
-
if (
|
|
709
|
+
if (le.includes(r))
|
|
709
710
|
return !0;
|
|
710
711
|
throw new Error(
|
|
711
712
|
`Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
|
|
712
713
|
);
|
|
713
714
|
}
|
|
714
|
-
const B = 8,
|
|
715
|
+
const B = 8, y = (e) => 10n ** BigInt(e), v = (e) => Math.log10(Number.parseFloat(e.toString()));
|
|
715
716
|
function U({
|
|
716
717
|
value: e,
|
|
717
718
|
bigIntDecimal: t = B,
|
|
@@ -725,15 +726,15 @@ function U({
|
|
|
725
726
|
i > 0 && (s = "0".repeat(i) + s);
|
|
726
727
|
const o = s.length - n;
|
|
727
728
|
let c = s.slice(-n);
|
|
728
|
-
return parseInt(c[t]) >= 5 ? c = `${c.substring(0, t - 1)}${(parseInt(c[t - 1]) + 1).toString()}` : c = c.substring(0, t), `${r ? "-" : ""}${s.slice(0, o)}.${c}`.replace(
|
|
729
|
+
return Number.parseInt(c[t]) >= 5 ? c = `${c.substring(0, t - 1)}${(Number.parseInt(c[t - 1]) + 1).toString()}` : c = c.substring(0, t), `${r ? "-" : ""}${s.slice(0, o)}.${c}`.replace(
|
|
729
730
|
/\.?0*$/,
|
|
730
731
|
""
|
|
731
732
|
);
|
|
732
733
|
}
|
|
733
|
-
var
|
|
734
|
+
var w, $, b, E, j, be, V, Z, H, ee;
|
|
734
735
|
const q = class q {
|
|
735
736
|
constructor(t) {
|
|
736
|
-
R(this,
|
|
737
|
+
R(this, w);
|
|
737
738
|
R(this, b);
|
|
738
739
|
R(this, j);
|
|
739
740
|
R(this, V);
|
|
@@ -742,7 +743,7 @@ const q = class q {
|
|
|
742
743
|
_(this, "bigIntValue", 0n);
|
|
743
744
|
_(this, "decimal");
|
|
744
745
|
const n = te(t), r = typeof t == "object";
|
|
745
|
-
this.decimal = r ? t.decimal : void 0, this.decimalMultiplier = r && "decimalMultiplier" in t ? t.decimalMultiplier :
|
|
746
|
+
this.decimal = r ? t.decimal : void 0, this.decimalMultiplier = r && "decimalMultiplier" in t ? t.decimalMultiplier : y(Math.max(he(M(n)), this.decimal || 0)), p(this, j, be).call(this, n);
|
|
746
747
|
}
|
|
747
748
|
static fromBigInt(t, n) {
|
|
748
749
|
return new q({
|
|
@@ -756,7 +757,7 @@ const q = class q {
|
|
|
756
757
|
to: r
|
|
757
758
|
}) {
|
|
758
759
|
return q.fromBigInt(
|
|
759
|
-
t.getBaseValue("bigint") *
|
|
760
|
+
t.getBaseValue("bigint") * y(r) / y(n),
|
|
760
761
|
r
|
|
761
762
|
);
|
|
762
763
|
}
|
|
@@ -764,16 +765,16 @@ const q = class q {
|
|
|
764
765
|
return new this.constructor({ decimal: this.decimal, value: t, identifier: this.toString() });
|
|
765
766
|
}
|
|
766
767
|
add(...t) {
|
|
767
|
-
return p(this,
|
|
768
|
+
return p(this, w, $).call(this, "add", ...t);
|
|
768
769
|
}
|
|
769
770
|
sub(...t) {
|
|
770
|
-
return p(this,
|
|
771
|
+
return p(this, w, $).call(this, "sub", ...t);
|
|
771
772
|
}
|
|
772
773
|
mul(...t) {
|
|
773
|
-
return p(this,
|
|
774
|
+
return p(this, w, $).call(this, "mul", ...t);
|
|
774
775
|
}
|
|
775
776
|
div(...t) {
|
|
776
|
-
return p(this,
|
|
777
|
+
return p(this, w, $).call(this, "div", ...t);
|
|
777
778
|
}
|
|
778
779
|
gt(t) {
|
|
779
780
|
return p(this, b, E).call(this, "gt", t);
|
|
@@ -794,7 +795,7 @@ const q = class q {
|
|
|
794
795
|
getValue(t) {
|
|
795
796
|
const n = this.formatBigIntToSafeValue(
|
|
796
797
|
this.bigIntValue,
|
|
797
|
-
this.decimal ||
|
|
798
|
+
this.decimal || v(this.decimalMultiplier)
|
|
798
799
|
);
|
|
799
800
|
switch (t) {
|
|
800
801
|
case "number":
|
|
@@ -807,7 +808,7 @@ const q = class q {
|
|
|
807
808
|
}
|
|
808
809
|
// @ts-expect-error
|
|
809
810
|
getBaseValue(t) {
|
|
810
|
-
const n = this.decimalMultiplier /
|
|
811
|
+
const n = this.decimalMultiplier / y(this.decimal || d.THOR), r = this.bigIntValue / n;
|
|
811
812
|
switch (t) {
|
|
812
813
|
case "number":
|
|
813
814
|
return Number(r);
|
|
@@ -825,16 +826,16 @@ const q = class q {
|
|
|
825
826
|
}
|
|
826
827
|
toSignificant(t = 6) {
|
|
827
828
|
const [n, r] = this.getValue("string").split("."), s = n || "", i = r || "";
|
|
828
|
-
if ((parseInt(s) ? s.length + i.length : i.length) <= t)
|
|
829
|
+
if ((Number.parseInt(s) ? s.length + i.length : i.length) <= t)
|
|
829
830
|
return this.getValue("string");
|
|
830
831
|
if (s.length >= t)
|
|
831
832
|
return s.slice(0, t).padEnd(s.length, "0");
|
|
832
|
-
if (parseInt(s))
|
|
833
|
+
if (Number.parseInt(s))
|
|
833
834
|
return `${s}.${i.slice(0, t - s.length)}`.padEnd(
|
|
834
835
|
t - s.length,
|
|
835
836
|
"0"
|
|
836
837
|
);
|
|
837
|
-
const c = parseInt(i), a = `${c}`.slice(0, t);
|
|
838
|
+
const c = Number.parseInt(i), a = `${c}`.slice(0, t);
|
|
838
839
|
return `0.${a.padStart(
|
|
839
840
|
i.length - `${c}`.length + a.length,
|
|
840
841
|
"0"
|
|
@@ -842,9 +843,9 @@ const q = class q {
|
|
|
842
843
|
}
|
|
843
844
|
toFixed(t = 6) {
|
|
844
845
|
const [n, r] = this.getValue("string").split("."), s = n || "", i = r || "";
|
|
845
|
-
if (parseInt(s))
|
|
846
|
+
if (Number.parseInt(s))
|
|
846
847
|
return `${s}.${i.slice(0, t)}`.padEnd(t, "0");
|
|
847
|
-
const o = parseInt(i), c = `${o}`.slice(0, t);
|
|
848
|
+
const o = Number.parseInt(i), c = `${o}`.slice(0, t);
|
|
848
849
|
return `0.${c.padStart(
|
|
849
850
|
i.length - `${o}`.length + c.length,
|
|
850
851
|
"0"
|
|
@@ -863,25 +864,25 @@ const q = class q {
|
|
|
863
864
|
decimalSeparator: s = ".",
|
|
864
865
|
thousandSeparator: i = ","
|
|
865
866
|
} = {}) {
|
|
866
|
-
const o = this.getValue("number"), [c, a = ""] = o.toFixed(6).split("."),
|
|
867
|
+
const o = this.getValue("number"), [c, a = ""] = o.toFixed(6).split("."), l = c.replace(/\B(?=(\d{3})+(?!\d))/g, i), h = c || a ? c === "0" ? `${Number.parseFloat(`0.${a}`)}`.replace(".", s) : `${l}${Number.parseInt(a) ? `${s}${a.slice(0, r)}` : ""}` : "0.00";
|
|
867
868
|
return `${n === "start" ? t : ""}${h}${n === "end" ? t : ""}`;
|
|
868
869
|
}
|
|
869
870
|
formatBigIntToSafeValue(t, n) {
|
|
870
871
|
const r = n || this.decimal || B, s = Math.max(
|
|
871
872
|
r,
|
|
872
|
-
|
|
873
|
-
), i = t < 0n, o = t.toString().substring(i ? 1 : 0), c = s - (o.length - 1), a = c > 0 ? "0".repeat(c) + o : o,
|
|
873
|
+
v(this.decimalMultiplier)
|
|
874
|
+
), i = t < 0n, o = t.toString().substring(i ? 1 : 0), c = s - (o.length - 1), a = c > 0 ? "0".repeat(c) + o : o, l = a.length - s;
|
|
874
875
|
let h = a.slice(-s);
|
|
875
|
-
return parseInt(h[r]) >= 5 ? h = `${h.substring(0, r - 1)}${(parseInt(h[r - 1]) + 1).toString()}` : h = h.substring(0, r), `${i ? "-" : ""}${a.slice(
|
|
876
|
+
return Number.parseInt(h[r]) >= 5 ? h = `${h.substring(0, r - 1)}${(Number.parseInt(h[r - 1]) + 1).toString()}` : h = h.substring(0, r), `${i ? "-" : ""}${a.slice(
|
|
876
877
|
0,
|
|
877
|
-
|
|
878
|
+
l
|
|
878
879
|
)}.${h}`.replace(/\.?0*$/, "");
|
|
879
880
|
}
|
|
880
881
|
};
|
|
881
|
-
|
|
882
|
-
const r = p(this, V, Z).call(this, this, ...n), s = Math.max(r,
|
|
883
|
-
(a,
|
|
884
|
-
const h = this.getBigIntValue(
|
|
882
|
+
w = new WeakSet(), $ = function(t, ...n) {
|
|
883
|
+
const r = p(this, V, Z).call(this, this, ...n), s = Math.max(r, v(this.decimalMultiplier)), i = y(s), o = n.reduce(
|
|
884
|
+
(a, l) => {
|
|
885
|
+
const h = this.getBigIntValue(l, s);
|
|
885
886
|
switch (t) {
|
|
886
887
|
case "add":
|
|
887
888
|
return a + h;
|
|
@@ -906,7 +907,7 @@ y = new WeakSet(), I = function(t, ...n) {
|
|
|
906
907
|
value: o
|
|
907
908
|
});
|
|
908
909
|
return new this.constructor({
|
|
909
|
-
decimalMultiplier:
|
|
910
|
+
decimalMultiplier: y(s),
|
|
910
911
|
decimal: this.decimal,
|
|
911
912
|
value: c,
|
|
912
913
|
identifier: this.toString()
|
|
@@ -929,10 +930,10 @@ y = new WeakSet(), I = function(t, ...n) {
|
|
|
929
930
|
const n = M(t) || "0";
|
|
930
931
|
this.bigIntValue = p(this, H, ee).call(this, n);
|
|
931
932
|
}, V = new WeakSet(), Z = function(...t) {
|
|
932
|
-
const n = t.map((r) => typeof r == "object" ? r.decimal ||
|
|
933
|
+
const n = t.map((r) => typeof r == "object" ? r.decimal || v(r.decimalMultiplier) : he(M(r))).filter(Boolean);
|
|
933
934
|
return Math.max(...n, B);
|
|
934
935
|
}, H = new WeakSet(), ee = function(t, n) {
|
|
935
|
-
const r = n ?
|
|
936
|
+
const r = n ? y(n) : this.decimalMultiplier, s = v(r), [i = "", o = ""] = t.split(".");
|
|
936
937
|
return BigInt(`${i}${o.padEnd(s, "0")}`);
|
|
937
938
|
};
|
|
938
939
|
let D = q;
|
|
@@ -982,7 +983,7 @@ class A extends D {
|
|
|
982
983
|
_(this, "tax");
|
|
983
984
|
_(this, "ticker");
|
|
984
985
|
_(this, "type");
|
|
985
|
-
const a =
|
|
986
|
+
const a = I(c || `${i}.${o}`);
|
|
986
987
|
this.type = ot(a), this.tax = s, this.chain = a.chain, this.ticker = a.ticker, this.symbol = a.symbol, this.address = a.address, this.isSynthetic = a.isSynthetic, this.isGasAsset = a.isGasAsset;
|
|
987
988
|
}
|
|
988
989
|
toString() {
|
|
@@ -1004,7 +1005,7 @@ class A extends D {
|
|
|
1004
1005
|
const [s, i, o] = n.split(".");
|
|
1005
1006
|
if (!(s && i))
|
|
1006
1007
|
throw new Error("Invalid asset url");
|
|
1007
|
-
const c = s ===
|
|
1008
|
+
const c = s === u.THORChain && o ? `${s}.${i}/${o}` : n;
|
|
1008
1009
|
return J(c, r);
|
|
1009
1010
|
}
|
|
1010
1011
|
static fromString(n, r = 0) {
|
|
@@ -1014,17 +1015,17 @@ class A extends D {
|
|
|
1014
1015
|
return J(n, r);
|
|
1015
1016
|
}
|
|
1016
1017
|
static fromStringSync(n, r = 0) {
|
|
1017
|
-
const { chain: s, isSynthetic: i } =
|
|
1018
|
+
const { chain: s, isSynthetic: i } = I(n), o = P.get(n.toUpperCase());
|
|
1018
1019
|
if (i)
|
|
1019
1020
|
return Q(n, r);
|
|
1020
|
-
const { tax: c, decimal: a, identifier:
|
|
1021
|
+
const { tax: c, decimal: a, identifier: l } = o || {
|
|
1021
1022
|
decimal: d[s],
|
|
1022
1023
|
identifier: n
|
|
1023
1024
|
};
|
|
1024
1025
|
return new A({
|
|
1025
1026
|
tax: c,
|
|
1026
1027
|
value: O(r, a),
|
|
1027
|
-
identifier: i ? n :
|
|
1028
|
+
identifier: i ? n : l,
|
|
1028
1029
|
decimal: i ? 8 : a
|
|
1029
1030
|
});
|
|
1030
1031
|
}
|
|
@@ -1037,10 +1038,10 @@ class A extends D {
|
|
|
1037
1038
|
return (await A.fromString(n, r)).set(i);
|
|
1038
1039
|
}
|
|
1039
1040
|
static fromStringWithBaseSync(n, r = 0, s = d.THOR) {
|
|
1040
|
-
const { chain: i, isSynthetic: o } =
|
|
1041
|
+
const { chain: i, isSynthetic: o } = I(n), c = P.get(n.toUpperCase());
|
|
1041
1042
|
if (o)
|
|
1042
1043
|
return Q(n, r);
|
|
1043
|
-
const { tax: a, decimal:
|
|
1044
|
+
const { tax: a, decimal: l, identifier: h } = c || {
|
|
1044
1045
|
decimal: d[i],
|
|
1045
1046
|
identifier: n
|
|
1046
1047
|
};
|
|
@@ -1048,18 +1049,18 @@ class A extends D {
|
|
|
1048
1049
|
tax: a,
|
|
1049
1050
|
value: O(BigInt(r), s),
|
|
1050
1051
|
identifier: h,
|
|
1051
|
-
decimal:
|
|
1052
|
+
decimal: l
|
|
1052
1053
|
});
|
|
1053
1054
|
}
|
|
1054
1055
|
static fromIdentifierSync(n, r = 0) {
|
|
1055
|
-
const { chain: s, isSynthetic: i } =
|
|
1056
|
+
const { chain: s, isSynthetic: i } = I(n), o = P.get(n);
|
|
1056
1057
|
if (i)
|
|
1057
1058
|
return Q(n, r);
|
|
1058
|
-
const { tax: c, decimal: a, identifier:
|
|
1059
|
+
const { tax: c, decimal: a, identifier: l } = o || {
|
|
1059
1060
|
decimal: d[s],
|
|
1060
1061
|
identifier: n
|
|
1061
1062
|
};
|
|
1062
|
-
return new A({ tax: c, decimal: a, identifier:
|
|
1063
|
+
return new A({ tax: c, decimal: a, identifier: l, value: O(r, a) });
|
|
1063
1064
|
}
|
|
1064
1065
|
static fromChainOrSignature(n, r = 0) {
|
|
1065
1066
|
const { decimal: s, identifier: i } = it(n);
|
|
@@ -1092,19 +1093,19 @@ class A extends D {
|
|
|
1092
1093
|
function Bt(e) {
|
|
1093
1094
|
const t = A.fromChainOrSignature(e);
|
|
1094
1095
|
switch (e) {
|
|
1095
|
-
case
|
|
1096
|
-
case
|
|
1097
|
-
case
|
|
1096
|
+
case u.Bitcoin:
|
|
1097
|
+
case u.Litecoin:
|
|
1098
|
+
case u.BitcoinCash:
|
|
1098
1099
|
return t.set(10001e-8);
|
|
1099
|
-
case
|
|
1100
|
+
case u.Dogecoin:
|
|
1100
1101
|
return t.set(1.00000001);
|
|
1101
|
-
case
|
|
1102
|
-
case
|
|
1102
|
+
case u.Avalanche:
|
|
1103
|
+
case u.Ethereum:
|
|
1103
1104
|
return t.set(1e-8);
|
|
1104
|
-
case
|
|
1105
|
-
case
|
|
1105
|
+
case u.THORChain:
|
|
1106
|
+
case u.Maya:
|
|
1106
1107
|
return t.set(0);
|
|
1107
|
-
case
|
|
1108
|
+
case u.Cosmos:
|
|
1108
1109
|
return t.set(1e-6);
|
|
1109
1110
|
default:
|
|
1110
1111
|
return t.set(1e-8);
|
|
@@ -1112,33 +1113,33 @@ function Bt(e) {
|
|
|
1112
1113
|
}
|
|
1113
1114
|
async function J(e, t = 0) {
|
|
1114
1115
|
dt(e);
|
|
1115
|
-
const n = P.get(e.toUpperCase()), r = (n == null ? void 0 : n.decimal) || await st(
|
|
1116
|
+
const n = P.get(e.toUpperCase()), r = (n == null ? void 0 : n.decimal) || await st(I(e));
|
|
1116
1117
|
return n || P.set(e.toUpperCase(), { identifier: e, decimal: r }), new A({ decimal: r, value: O(t, r), identifier: e });
|
|
1117
1118
|
}
|
|
1118
1119
|
function Q(e, t = 0) {
|
|
1119
|
-
const [n, r] = e.split(".")[0].toUpperCase() ===
|
|
1120
|
+
const [n, r] = e.split(".")[0].toUpperCase() === u.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
|
|
1120
1121
|
if (!(n && r))
|
|
1121
1122
|
throw new Error("Invalid asset identifier");
|
|
1122
1123
|
return new A({
|
|
1123
1124
|
decimal: 8,
|
|
1124
1125
|
value: O(t, 8),
|
|
1125
|
-
identifier: `${
|
|
1126
|
+
identifier: `${u.THORChain}.${n}/${r}`
|
|
1126
1127
|
});
|
|
1127
1128
|
}
|
|
1128
1129
|
function O(e, t) {
|
|
1129
1130
|
return typeof e == "bigint" ? U({ value: e, bigIntDecimal: t, decimal: t }) : e;
|
|
1130
1131
|
}
|
|
1131
|
-
function
|
|
1132
|
-
const t = e.slice(0, 14).includes("/"), [n, r] = e.split(".")[0].toUpperCase() ===
|
|
1132
|
+
function I(e) {
|
|
1133
|
+
const t = e.slice(0, 14).includes("/"), [n, r] = e.split(".")[0].toUpperCase() === u.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
|
|
1133
1134
|
if (t && !(n && r))
|
|
1134
1135
|
throw new Error("Invalid asset identifier");
|
|
1135
|
-
const s = e.includes(".") && !t ? e : `${
|
|
1136
|
+
const s = e.includes(".") && !t ? e : `${u.THORChain}.${r}`, [i, ...o] = s.split("."), [c, a] = (t ? r : o.join(".")).split("-"), l = t ? r : o.join(".");
|
|
1136
1137
|
return {
|
|
1137
1138
|
address: a == null ? void 0 : a.toLowerCase(),
|
|
1138
1139
|
chain: i,
|
|
1139
|
-
isGasAsset: Se({ chain: i, symbol:
|
|
1140
|
+
isGasAsset: Se({ chain: i, symbol: l }),
|
|
1140
1141
|
isSynthetic: t,
|
|
1141
|
-
symbol: (t ? `${n}/` : "") + (a ? `${c}-${(a == null ? void 0 : a.toLowerCase()) ?? ""}` :
|
|
1142
|
+
symbol: (t ? `${n}/` : "") + (a ? `${c}-${(a == null ? void 0 : a.toLowerCase()) ?? ""}` : l),
|
|
1142
1143
|
ticker: c
|
|
1143
1144
|
};
|
|
1144
1145
|
}
|
|
@@ -1151,6 +1152,7 @@ const mt = {
|
|
|
1151
1152
|
core_extend_error: 10003,
|
|
1152
1153
|
core_inbound_data_not_found: 10004,
|
|
1153
1154
|
core_approve_asset_address_or_from_not_found: 10005,
|
|
1155
|
+
core_plugin_not_found: 10006,
|
|
1154
1156
|
core_chain_halted: 10099,
|
|
1155
1157
|
/**
|
|
1156
1158
|
* Core - Wallet Connection
|
|
@@ -1175,7 +1177,6 @@ const mt = {
|
|
|
1175
1177
|
core_swap_contract_not_supported: 10205,
|
|
1176
1178
|
core_swap_transaction_error: 10206,
|
|
1177
1179
|
core_swap_quote_mode_not_supported: 10207,
|
|
1178
|
-
core_swap_provider_not_found: 10208,
|
|
1179
1180
|
/**
|
|
1180
1181
|
* Core - Transaction
|
|
1181
1182
|
*/
|
|
@@ -1215,14 +1216,14 @@ const mt = {
|
|
|
1215
1216
|
*/
|
|
1216
1217
|
helpers_number_different_decimals: 99101
|
|
1217
1218
|
};
|
|
1218
|
-
class
|
|
1219
|
+
class ye extends Error {
|
|
1219
1220
|
constructor(t, n) {
|
|
1220
1221
|
n && console.error(n, {
|
|
1221
1222
|
stack: n == null ? void 0 : n.stack,
|
|
1222
1223
|
message: n == null ? void 0 : n.message
|
|
1223
1224
|
}), super(t, {
|
|
1224
1225
|
cause: { code: mt[t], message: t }
|
|
1225
|
-
}), Object.setPrototypeOf(this,
|
|
1226
|
+
}), Object.setPrototypeOf(this, ye.prototype);
|
|
1226
1227
|
}
|
|
1227
1228
|
}
|
|
1228
1229
|
export {
|
|
@@ -1232,34 +1233,34 @@ export {
|
|
|
1232
1233
|
f as RequestClient,
|
|
1233
1234
|
Ze as StreamingSwapProgressStatus,
|
|
1234
1235
|
gt as SwapKitApi,
|
|
1235
|
-
|
|
1236
|
+
ye as SwapKitError,
|
|
1236
1237
|
g as SwapKitNumber,
|
|
1237
1238
|
Qe as TransactionType,
|
|
1238
1239
|
ze as TxStatus,
|
|
1239
1240
|
Ct as assetFromString,
|
|
1240
1241
|
Ae as defaultRequestHeaders,
|
|
1241
|
-
|
|
1242
|
+
It as derivationPathToString,
|
|
1242
1243
|
St as filterAssets,
|
|
1243
1244
|
U as formatBigIntToSafeValue,
|
|
1244
1245
|
At as gasFeeMultiplier,
|
|
1245
1246
|
ot as getAssetType,
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1247
|
+
lt as getAsymmetricAssetShare,
|
|
1248
|
+
yt as getAsymmetricAssetWithdrawAmount,
|
|
1249
|
+
ut as getAsymmetricRuneShare,
|
|
1249
1250
|
bt as getAsymmetricRuneWithdrawAmount,
|
|
1250
1251
|
it as getCommonAssetInfo,
|
|
1251
1252
|
st as getDecimal,
|
|
1252
1253
|
Rt as getEstimatedPoolShare,
|
|
1253
1254
|
Et as getLiquiditySlippage,
|
|
1254
|
-
|
|
1255
|
+
Nt as getMAYANameCost,
|
|
1255
1256
|
Pt as getMemoFor,
|
|
1256
1257
|
Bt as getMinAmountByChain,
|
|
1257
1258
|
ht as getSymmetricPoolShare,
|
|
1258
|
-
|
|
1259
|
+
wt as getSymmetricWithdraw,
|
|
1259
1260
|
Ot as getTHORNameCost,
|
|
1260
1261
|
Se as isGasAsset,
|
|
1261
1262
|
Tt as setRequestClientConfig,
|
|
1262
|
-
|
|
1263
|
-
|
|
1263
|
+
$t as validateMAYAName,
|
|
1264
|
+
vt as validateTHORName
|
|
1264
1265
|
};
|
|
1265
1266
|
//# sourceMappingURL=index.es.js.map
|