@swapkit/core 1.0.0-rc.64 → 1.0.0-rc.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -0
- package/dist/index.es.js +36 -35
- package/dist/index.es.js.map +1 -0
- package/package.json +17 -20
- package/src/client/__tests__/helpers.test.ts +14 -30
- package/src/client/explorerUrls.ts +6 -7
- package/src/client/index.ts +5 -12
package/dist/index.es.js
CHANGED
|
@@ -824,13 +824,13 @@ const ae = Object.values(i), ot = Object.keys(i), be = ae.reduce(
|
|
|
824
824
|
AVAX: "https://snowtrace.io",
|
|
825
825
|
BSC: "https://bscscan.com",
|
|
826
826
|
BNB: "https://explorer.binance.org",
|
|
827
|
-
BCH: "https://www.
|
|
828
|
-
BTC: "https://
|
|
827
|
+
BCH: "https://www.blockchair.com/bitcoin-cash",
|
|
828
|
+
BTC: "https://blockchair.com/bitcoin",
|
|
829
829
|
GAIA: "https://cosmos.bigdipper.live",
|
|
830
830
|
DOGE: "https://blockchair.com/dogecoin",
|
|
831
831
|
KUJI: "https://finder.kujira.network/kaiyo-1",
|
|
832
832
|
ETH: "https://etherscan.io",
|
|
833
|
-
LTC: "https://
|
|
833
|
+
LTC: "https://blockchair.com/litecoin",
|
|
834
834
|
MAYA: "https://www.mayascan.org",
|
|
835
835
|
OP: "https://optimistic.etherscan.io",
|
|
836
836
|
MATIC: "https://polygonscan.com",
|
|
@@ -839,7 +839,7 @@ const ae = Object.values(i), ot = Object.keys(i), be = ae.reduce(
|
|
|
839
839
|
var ut = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(ut || {}), h = /* @__PURE__ */ ((e) => (e.BOND = "BOND", e.DEPOSIT = "+", e.LEAVE = "LEAVE", e.THORNAME_REGISTER = "~", e.UNBOND = "UNBOND", e.WITHDRAW = "-", e.OPEN_LOAN = "$+", e.CLOSE_LOAN = "$-", e))(h || {}), F = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(F || {}), lt = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", e.XDEFI = "XDEFI", e.METAMASK = "METAMASK", e.COINBASE_WEB = "COINBASE_WEB", e.TREZOR = "TREZOR", e.TRUSTWALLET_WEB = "TRUSTWALLET_WEB", e.LEDGER = "LEDGER", e.KEPLR = "KEPLR", e.OKX = "OKX", e.BRAVE = "BRAVE", e.WALLETCONNECT = "WALLETCONNECT", e))(lt || {}), yt = Object.defineProperty, ct = (e, t, n) => t in e ? yt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, I = (e, t, n) => (ct(e, typeof t != "symbol" ? t + "" : t, n), n), mt = (e, t, n) => {
|
|
840
840
|
if (!t.has(e))
|
|
841
841
|
throw TypeError("Cannot " + n);
|
|
842
|
-
},
|
|
842
|
+
}, $ = (e, t, n) => {
|
|
843
843
|
if (t.has(e))
|
|
844
844
|
throw TypeError("Cannot add the same private member more than once");
|
|
845
845
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
@@ -1212,7 +1212,7 @@ const J = (e) => e !== null && typeof e == "object", X = (...e) => {
|
|
|
1212
1212
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
1213
1213
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
1214
1214
|
delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
|
|
1215
|
-
},
|
|
1215
|
+
}, Ht = (e = {}) => {
|
|
1216
1216
|
if (typeof e == "number")
|
|
1217
1217
|
return {
|
|
1218
1218
|
...Re,
|
|
@@ -1228,7 +1228,7 @@ const J = (e) => e !== null && typeof e == "object", X = (...e) => {
|
|
|
1228
1228
|
afterStatusCodes: Ue
|
|
1229
1229
|
};
|
|
1230
1230
|
};
|
|
1231
|
-
async function
|
|
1231
|
+
async function $t(e, t, n, a) {
|
|
1232
1232
|
return new Promise((s, r) => {
|
|
1233
1233
|
const o = setTimeout(() => {
|
|
1234
1234
|
n && n.abort(), r(new Pe(e));
|
|
@@ -1336,7 +1336,7 @@ class Z {
|
|
|
1336
1336
|
method: Lt(n.method ?? this._input.method),
|
|
1337
1337
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
1338
1338
|
prefixUrl: String(n.prefixUrl || ""),
|
|
1339
|
-
retry:
|
|
1339
|
+
retry: Ht(n.retry),
|
|
1340
1340
|
throwHttpErrors: n.throwHttpErrors !== !1,
|
|
1341
1341
|
timeout: n.timeout ?? 1e4,
|
|
1342
1342
|
fetch: n.fetch ?? globalThis.fetch.bind(globalThis)
|
|
@@ -1414,7 +1414,7 @@ class Z {
|
|
|
1414
1414
|
return a;
|
|
1415
1415
|
}
|
|
1416
1416
|
const t = Ft(this.request, this._options);
|
|
1417
|
-
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) :
|
|
1417
|
+
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : $t(this.request.clone(), t, this.abortController, this._options);
|
|
1418
1418
|
}
|
|
1419
1419
|
/* istanbul ignore next */
|
|
1420
1420
|
_stream(t, n) {
|
|
@@ -1486,15 +1486,15 @@ function se({
|
|
|
1486
1486
|
""
|
|
1487
1487
|
);
|
|
1488
1488
|
}
|
|
1489
|
-
var U, k, B,
|
|
1490
|
-
const Kt = class
|
|
1489
|
+
var U, k, B, H, ye, He, Q, pe, ee, ce;
|
|
1490
|
+
const Kt = class $e {
|
|
1491
1491
|
constructor(t) {
|
|
1492
|
-
|
|
1492
|
+
$(this, U), $(this, B), $(this, ye), $(this, Q), $(this, ee), I(this, "decimalMultiplier", 10n ** 8n), I(this, "bigIntValue", 0n), I(this, "decimal");
|
|
1493
1493
|
const n = Te(t), a = typeof t == "object";
|
|
1494
|
-
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier : L(Math.max(ke(te(n)), this.decimal || 0)), R(this, ye,
|
|
1494
|
+
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier : L(Math.max(ke(te(n)), this.decimal || 0)), R(this, ye, He).call(this, n);
|
|
1495
1495
|
}
|
|
1496
1496
|
static fromBigInt(t, n) {
|
|
1497
|
-
return new
|
|
1497
|
+
return new $e({
|
|
1498
1498
|
decimal: n,
|
|
1499
1499
|
value: se({ value: t, bigIntDecimal: n, decimal: n })
|
|
1500
1500
|
});
|
|
@@ -1525,19 +1525,19 @@ const Kt = class He {
|
|
|
1525
1525
|
return R(this, U, k).call(this, "div", ...t);
|
|
1526
1526
|
}
|
|
1527
1527
|
gt(t) {
|
|
1528
|
-
return R(this, B,
|
|
1528
|
+
return R(this, B, H).call(this, "gt", t);
|
|
1529
1529
|
}
|
|
1530
1530
|
gte(t) {
|
|
1531
|
-
return R(this, B,
|
|
1531
|
+
return R(this, B, H).call(this, "gte", t);
|
|
1532
1532
|
}
|
|
1533
1533
|
lt(t) {
|
|
1534
|
-
return R(this, B,
|
|
1534
|
+
return R(this, B, H).call(this, "lt", t);
|
|
1535
1535
|
}
|
|
1536
1536
|
lte(t) {
|
|
1537
|
-
return R(this, B,
|
|
1537
|
+
return R(this, B, H).call(this, "lte", t);
|
|
1538
1538
|
}
|
|
1539
1539
|
eqValue(t) {
|
|
1540
|
-
return R(this, B,
|
|
1540
|
+
return R(this, B, H).call(this, "eqValue", t);
|
|
1541
1541
|
}
|
|
1542
1542
|
// @ts-expect-error False positive
|
|
1543
1543
|
getValue(t) {
|
|
@@ -1660,7 +1660,7 @@ U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
|
1660
1660
|
value: o,
|
|
1661
1661
|
identifier: this.toString()
|
|
1662
1662
|
});
|
|
1663
|
-
}, B = /* @__PURE__ */ new WeakSet(),
|
|
1663
|
+
}, B = /* @__PURE__ */ new WeakSet(), H = function(e, ...t) {
|
|
1664
1664
|
const n = R(this, Q, pe).call(this, this, ...t), a = this.getBigIntValue(t[0], n), s = this.getBigIntValue(this, n);
|
|
1665
1665
|
switch (e) {
|
|
1666
1666
|
case "gt":
|
|
@@ -1674,7 +1674,7 @@ U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
|
1674
1674
|
case "eqValue":
|
|
1675
1675
|
return s === a;
|
|
1676
1676
|
}
|
|
1677
|
-
}, ye = /* @__PURE__ */ new WeakSet(),
|
|
1677
|
+
}, ye = /* @__PURE__ */ new WeakSet(), He = function(e) {
|
|
1678
1678
|
const t = te(e) || "0";
|
|
1679
1679
|
this.bigIntValue = R(this, ee, ce).call(this, t);
|
|
1680
1680
|
}, Q = /* @__PURE__ */ new WeakSet(), pe = function(...e) {
|
|
@@ -1767,10 +1767,15 @@ class N extends me {
|
|
|
1767
1767
|
async (t, n) => {
|
|
1768
1768
|
try {
|
|
1769
1769
|
const a = await import("@swapkit/tokens");
|
|
1770
|
-
he = Object.values(a).reduce((s,
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1770
|
+
he = Object.values(a).reduce((s, r) => {
|
|
1771
|
+
var o;
|
|
1772
|
+
return (o = r == null ? void 0 : r.tokens) == null || o.forEach(({ identifier: p, chain: d, ...u }) => {
|
|
1773
|
+
s.set(p, {
|
|
1774
|
+
identifier: p,
|
|
1775
|
+
decimal: "decimals" in u ? u.decimals : w[d]
|
|
1776
|
+
});
|
|
1777
|
+
}), s;
|
|
1778
|
+
}, /* @__PURE__ */ new Map()), t({ ok: !0 });
|
|
1774
1779
|
} catch (a) {
|
|
1775
1780
|
console.error(a), n({
|
|
1776
1781
|
ok: !1,
|
|
@@ -3635,8 +3640,6 @@ const Jt = [
|
|
|
3635
3640
|
const n = Ne[e];
|
|
3636
3641
|
switch (e) {
|
|
3637
3642
|
case i.Binance:
|
|
3638
|
-
case i.Bitcoin:
|
|
3639
|
-
case i.BitcoinCash:
|
|
3640
3643
|
case i.Maya:
|
|
3641
3644
|
case i.Kujira:
|
|
3642
3645
|
case i.THORChain:
|
|
@@ -3650,10 +3653,11 @@ const Jt = [
|
|
|
3650
3653
|
return `${n}/tx/${t.startsWith("0x") ? t : `0x${t}`}`;
|
|
3651
3654
|
case i.Cosmos:
|
|
3652
3655
|
return `${n}/transactions/${t}`;
|
|
3656
|
+
case i.Litecoin:
|
|
3657
|
+
case i.Bitcoin:
|
|
3658
|
+
case i.BitcoinCash:
|
|
3653
3659
|
case i.Dogecoin:
|
|
3654
3660
|
return `${n}/transaction/${t.toLowerCase()}`;
|
|
3655
|
-
case i.Litecoin:
|
|
3656
|
-
return `${n}/${t}`;
|
|
3657
3661
|
default:
|
|
3658
3662
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3659
3663
|
}
|
|
@@ -3668,16 +3672,15 @@ const Jt = [
|
|
|
3668
3672
|
case i.BitcoinCash:
|
|
3669
3673
|
case i.Dogecoin:
|
|
3670
3674
|
case i.Ethereum:
|
|
3675
|
+
case i.Kujira:
|
|
3676
|
+
case i.Litecoin:
|
|
3671
3677
|
case i.Maya:
|
|
3672
3678
|
case i.Optimism:
|
|
3673
3679
|
case i.Polygon:
|
|
3674
|
-
case i.Kujira:
|
|
3675
3680
|
case i.THORChain:
|
|
3676
3681
|
return `${n}/address/${t}`;
|
|
3677
3682
|
case i.Cosmos:
|
|
3678
3683
|
return `${n}/account/${t}`;
|
|
3679
|
-
case i.Litecoin:
|
|
3680
|
-
return `${n}/${t}`;
|
|
3681
3684
|
default:
|
|
3682
3685
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3683
3686
|
}
|
|
@@ -3690,10 +3693,7 @@ const Jt = [
|
|
|
3690
3693
|
}, Ie = () => Object.values(i).reduce(
|
|
3691
3694
|
(e, t) => (e[t] = null, e),
|
|
3692
3695
|
{}
|
|
3693
|
-
), _n = async ({
|
|
3694
|
-
chain: e,
|
|
3695
|
-
address: t
|
|
3696
|
-
}) => {
|
|
3696
|
+
), _n = async ({ chain: e, address: t }) => {
|
|
3697
3697
|
if (!t)
|
|
3698
3698
|
return !1;
|
|
3699
3699
|
switch (e) {
|
|
@@ -4230,3 +4230,4 @@ export {
|
|
|
4230
4230
|
De as isGasAsset,
|
|
4231
4231
|
Bn as validateTHORName
|
|
4232
4232
|
};
|
|
4233
|
+
//# sourceMappingURL=index.es.js.map
|