@swapkit/core 1.0.0-rc.71 → 1.0.0-rc.73
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 +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +53 -54
- package/dist/index.es.js.map +1 -1
- package/package.json +13 -13
package/dist/index.es.js
CHANGED
|
@@ -624,7 +624,7 @@ const Ze = [
|
|
|
624
624
|
"TC-BEP20"
|
|
625
625
|
/* TC_SUPPORTED_TO_BSC */
|
|
626
626
|
];
|
|
627
|
-
var
|
|
627
|
+
var Se = /* @__PURE__ */ ((e) => (e.VALIDATION_ERROR = "VALIDATION_ERROR", e.REQUEST_PARAMETER_ERROR = "REQUEST_PARAMETER_ERROR", e.RESPONSE_PARSING_ERROR = "RESPONSE_PARSING_ERROR", e.UNSUPPORTED = "UNSUPPORTED", e.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", e.INCOMPATIBLE_ASSETS_OPERATIONS = "INCOMPATIBLE_ASSETS_OPERATIONS", e.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", e.DOWN_FOR_MAINTENANCE = "DOWN_FOR_MAINTENANCE", e.MISSING_INBOUND_INFO = "MISSING_INBOUND_INFO", e.QUOTE_FETCHING_ERROR = "QUOTE_FETCHING_ERROR", e.AIRDROP_ERROR = "AIRDROP_ERROR", e.UNHANDLED_ERROR = "UNHANDLED_ERROR", e))(Se || {}), nt = /* @__PURE__ */ ((e) => (e.HEALTH_CONTROLLER = "1000", e.LIQUIDITY_CONTROLLER = "1001", e.PROVIDER_CONTROLLER = "1002", e.QUOTE_CONTROLLER = "1003", e.SWAP_CONTROLLER = "1004", e.UTIL_CONTROLLER = "1005", e.AIRDROP_CONTROLLER = "1006", e.PROVIDER = "2000", e.ASSET = "2001", e.TOKEN_LIST = "2002", e.QUOTE = "2100", e.QUOTE_TXN_DETAILS = "2101", e.THORCHAIN_PROVIDER = "3000", e.UNISWAPV2_ETH_PROVIDER = "3001", e.UNISWAPV3_ETH_PROVIDER = "3002", e.SUSHISWAP_ETH_PROVIDER = "3003", e.PANCAKESWAP_BSC_PROVIDER = "3004", e.PANCAKESWAP_ETH_PROVIDER = "3005", e.ONEINCH_ETH_PROVIDER = "3006", e.ONEINCH_BSC_PROVIDER = "3007", e.ONEINCH_AVAX_PROVIDER = "3008", e.ZEROX_ETH_PROVIDER = "3009", e.WOOFI_AVAX_PROVIDER = "3010", e.PANGOLIN_AVAX_PROVIDER = "3011", e.TRADERJOE_AVAX_PROVIDER = "3012", e.KYBER_ETH_PROVIDER = "3013", e.KYBER_AVAX_PROVIDER = "3014", e.WOOFI_BSC_PROVIDER = "3015", e.STARGATE_PROVIDER = "3016", e.PROVIDER_UTIL = "4000", e.TXN_DETAILS = "5000", e.AIRDROP_UTIL = "6000", e))(nt || {}), y = /* @__PURE__ */ ((e) => (e.INVALID_INPUT_PARAMETERS = "1000", e.UNKNOWN_PROVIDERS = "1001", e.CANNOT_FIND_INBOUND_ADDRESS = "1002", e.NO_INBOUND_ADDRESSES = "1003", e.CHAIN_HALTED_OR_UNSUPPORTED = "1004", e.MISSING_INPUT_PARAMETER = "1005", e.INVALID_TYPE_GENERIC = "1100", e.INVALID_NUMBER_STRING = "1101", e.INVALID_NUMBER = "1102", e.INVALID_BOOLEAN = "1103", e.INVALID_OBJECT = "1104", e.INVALID_ARRAY = "1105", e.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", e.SELL_BUY_ASSETS_ARE_THE_SAME = "2001", e.MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", e.AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", e.AFF_ADDRESS_TOO_LONG = "2004", e.AFF_BPS_INTEGER_MAX_500 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROVIDER_NOT_SUPPORTED = "2008", e.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", e.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", e.SOURCE_ADDRESS_SMART_CONTRACT = "2011", e.INVALID_PROVIDER = "2100", e.MISSING_CROSS_CHAIN_PROVIDER = "2101", e.MISSING_AVAX_PROVIDER = "2102", e.MISSING_BSC_PROVIDER = "2103", e.MISSING_ETH_PROVIDER = "2104", e.INVALID_PROVIDER_FOR_SWAP_OUT = "2105", e.MISSING_ARB_PROVIDER = "2106", e.INVALID_CHAIN = "2200", e.INVALID_ASSET = "2201", e.INVALID_ASSET_IDENTIFIER = "2202", e.UNSUPPORTED_CHAIN = "2204", e.UNSUPPORTED_ASSET = "2203", e.UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205", e.INVALID_SOURCE_ADDRESS = "2300", e.INVALID_DESTINATION_ADDRESS = "2301", e.THORNODE_QUOTE_GENERIC_ERROR = "3000", e.NOT_ENOUGH_SYNTH_BALANCE = "3001", e.SYNTH_MINTING_CAP_REACHED = "3002", e.INVALID_QUOTE_MODE = "4000", e.NO_QUOTES = "4001", e.SERVICE_UNAVAILABLE_GENERIC = "5000", e.MISSING_GAS_DATA_GENERIC = "5100", e.MISSING_TOKEN_INFO_GENERIC = "5200", e.CANT_FIND_TOKEN_LIST = "5201", e.NO_PRICE = "5202", e.PRICE_IS_STALE = "5203", e.ADDRESS_NOT_WHITELISTED = "6000", e.ADDRESS_ALREADY_CLAIMED = "6001", e.TEMPORARY_ERROR = "9999", e))(y || {});
|
|
628
628
|
const at = {
|
|
629
629
|
[y.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
|
|
630
630
|
[y.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
|
|
@@ -698,7 +698,7 @@ let bn = class ve extends Error {
|
|
|
698
698
|
displayMessageParams: u
|
|
699
699
|
}) {
|
|
700
700
|
const m = r || pe(s, u || []) || "";
|
|
701
|
-
super(m), 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 = m, this.display = pe(s, u || []), this.code = s, this.type = o ||
|
|
701
|
+
super(m), 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 = m, this.display = pe(s, u || []), this.code = s, this.type = o || Se.UNHANDLED_ERROR, this.options = {
|
|
702
702
|
shouldLog: p || !0,
|
|
703
703
|
shouldTrace: l || !0,
|
|
704
704
|
shouldThrow: d || !1
|
|
@@ -836,10 +836,10 @@ const ie = Object.values(i), ot = Object.keys(i), fe = ie.reduce(
|
|
|
836
836
|
MATIC: "https://polygonscan.com",
|
|
837
837
|
THOR: "https://runescan.io"
|
|
838
838
|
};
|
|
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.OKX_MOBILE = "OKX_MOBILE", 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,
|
|
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.OKX_MOBILE = "OKX_MOBILE", 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, S = (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);
|
|
@@ -971,7 +971,7 @@ const Tt = "0x313ce567", Ne = async ({ chain: e, to: t }) => {
|
|
|
971
971
|
case i.Optimism:
|
|
972
972
|
return [i.Ethereum, i.Optimism].includes(t) ? "Native" : "OPTIMISM";
|
|
973
973
|
}
|
|
974
|
-
},
|
|
974
|
+
}, In = (e) => {
|
|
975
975
|
var t;
|
|
976
976
|
const [n, ...a] = e.split("."), s = e.includes("/"), r = a.join("."), o = (t = r == null ? void 0 : r.split("-")) == null ? void 0 : t[0];
|
|
977
977
|
return { chain: n, symbol: r, ticker: o, synth: s };
|
|
@@ -984,7 +984,7 @@ const Tt = "0x313ce567", Ne = async ({ chain: e, to: t }) => {
|
|
|
984
984
|
return !0;
|
|
985
985
|
const [, a] = n.split("-");
|
|
986
986
|
return xe({ chain: t, symbol: n }) || !!a;
|
|
987
|
-
},
|
|
987
|
+
}, Sn = (e) => e.filter((t) => {
|
|
988
988
|
const n = `${t.chain}.${t.symbol}`;
|
|
989
989
|
return !Rt.test(n) && gt(n) && t.value !== "0";
|
|
990
990
|
});
|
|
@@ -996,7 +996,7 @@ function Ot({
|
|
|
996
996
|
const a = g(e), s = g(t), r = g(n), o = a.mul(r), p = s.mul(s).mul(2), d = s.mul(a).mul(2), l = a.mul(a), u = s.mul(s).mul(s);
|
|
997
997
|
return o.mul(p.sub(d).add(l)).div(u);
|
|
998
998
|
}
|
|
999
|
-
function
|
|
999
|
+
function It({
|
|
1000
1000
|
liquidityUnits: e,
|
|
1001
1001
|
poolUnits: t,
|
|
1002
1002
|
assetDepth: n
|
|
@@ -1018,12 +1018,12 @@ function Cn({
|
|
|
1018
1018
|
liquidityUnits: n,
|
|
1019
1019
|
poolUnits: a
|
|
1020
1020
|
}) {
|
|
1021
|
-
return
|
|
1021
|
+
return It({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
|
|
1022
1022
|
}
|
|
1023
1023
|
function g(e) {
|
|
1024
1024
|
return x.fromBigInt(BigInt(e), b.THOR);
|
|
1025
1025
|
}
|
|
1026
|
-
function
|
|
1026
|
+
function St({
|
|
1027
1027
|
liquidityUnits: e,
|
|
1028
1028
|
poolUnits: t,
|
|
1029
1029
|
runeDepth: n,
|
|
@@ -1042,7 +1042,7 @@ function Mn({
|
|
|
1042
1042
|
percent: s
|
|
1043
1043
|
}) {
|
|
1044
1044
|
return Object.fromEntries(
|
|
1045
|
-
Object.entries(
|
|
1045
|
+
Object.entries(St({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
|
|
1046
1046
|
([r, o]) => [r, o.mul(s)]
|
|
1047
1047
|
)
|
|
1048
1048
|
);
|
|
@@ -1055,8 +1055,8 @@ function Nn({
|
|
|
1055
1055
|
runeAmount: s,
|
|
1056
1056
|
assetAmount: r
|
|
1057
1057
|
}) {
|
|
1058
|
-
const o = new x({ value: e, decimal: 8 }), p = new x({ value: n, decimal: 8 }), d = new x({ value: t, decimal: 8 }), l = new x({ value: s, decimal: 8 }), u = new x({ value: r, decimal: 8 }), m = l.mul(p), _ = u.mul(o), w = l.mul(u), A = o.mul(p), E = d.mul(m.add(_.add(w.mul(2)))), O = m.add(_.add(A.mul(2))),
|
|
1059
|
-
if (
|
|
1058
|
+
const o = new x({ value: e, decimal: 8 }), p = new x({ value: n, decimal: 8 }), d = new x({ value: t, decimal: 8 }), l = new x({ value: s, decimal: 8 }), u = new x({ value: r, decimal: 8 }), m = l.mul(p), _ = u.mul(o), w = l.mul(u), A = o.mul(p), E = d.mul(m.add(_.add(w.mul(2)))), O = m.add(_.add(A.mul(2))), I = E.div(O), D = g(a).add(I);
|
|
1059
|
+
if (I.getBaseValue("number") === 0)
|
|
1060
1060
|
return D.div(d).getBaseValue("number");
|
|
1061
1061
|
const oe = d.add(D);
|
|
1062
1062
|
return D.div(oe).getBaseValue("number");
|
|
@@ -1249,7 +1249,7 @@ const z = (e) => e !== null && typeof e == "object", Q = (...e) => {
|
|
|
1249
1249
|
afterStatusCodes: Ve
|
|
1250
1250
|
};
|
|
1251
1251
|
};
|
|
1252
|
-
async function
|
|
1252
|
+
async function Ht(e, t, n, a) {
|
|
1253
1253
|
return new Promise((s, r) => {
|
|
1254
1254
|
const o = setTimeout(() => {
|
|
1255
1255
|
n && n.abort(), r(new De(e));
|
|
@@ -1259,7 +1259,7 @@ async function $t(e, t, n, a) {
|
|
|
1259
1259
|
});
|
|
1260
1260
|
});
|
|
1261
1261
|
}
|
|
1262
|
-
async function
|
|
1262
|
+
async function $t(e, { signal: t }) {
|
|
1263
1263
|
return new Promise((n, a) => {
|
|
1264
1264
|
t && (t.throwIfAborted(), t.addEventListener("abort", s, { once: !0 }));
|
|
1265
1265
|
function s() {
|
|
@@ -1410,7 +1410,7 @@ class te {
|
|
|
1410
1410
|
} catch (n) {
|
|
1411
1411
|
const a = Math.min(this._calculateRetryDelay(n), de);
|
|
1412
1412
|
if (a !== 0 && this._retryCount > 0) {
|
|
1413
|
-
await
|
|
1413
|
+
await $t(a, { signal: this._options.signal });
|
|
1414
1414
|
for (const s of this._options.hooks.beforeRetry)
|
|
1415
1415
|
if (await s({
|
|
1416
1416
|
request: this.request,
|
|
@@ -1435,7 +1435,7 @@ class te {
|
|
|
1435
1435
|
return a;
|
|
1436
1436
|
}
|
|
1437
1437
|
const t = kt(this.request, this._options);
|
|
1438
|
-
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) :
|
|
1438
|
+
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Ht(this.request.clone(), t, this.abortController, this._options);
|
|
1439
1439
|
}
|
|
1440
1440
|
/* istanbul ignore next */
|
|
1441
1441
|
_stream(t, n) {
|
|
@@ -1511,15 +1511,15 @@ function re({
|
|
|
1511
1511
|
""
|
|
1512
1512
|
);
|
|
1513
1513
|
}
|
|
1514
|
-
var U, k, B,
|
|
1515
|
-
const jt = class
|
|
1514
|
+
var U, k, B, H, me, Ue, Z, ue, ne, Te;
|
|
1515
|
+
const jt = class He {
|
|
1516
1516
|
constructor(t) {
|
|
1517
|
-
|
|
1517
|
+
$(this, U), $(this, B), $(this, me), $(this, Z), $(this, ne), S(this, "decimalMultiplier", 10n ** 8n), S(this, "bigIntValue", 0n), S(this, "decimal");
|
|
1518
1518
|
const n = he(t), a = typeof t == "object";
|
|
1519
1519
|
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier : L(Math.max(ke(ae(n)), this.decimal || 0)), R(this, me, Ue).call(this, n);
|
|
1520
1520
|
}
|
|
1521
1521
|
static fromBigInt(t, n) {
|
|
1522
|
-
return new
|
|
1522
|
+
return new He({
|
|
1523
1523
|
decimal: n,
|
|
1524
1524
|
value: re({ value: t, bigIntDecimal: n, decimal: n })
|
|
1525
1525
|
});
|
|
@@ -1550,19 +1550,19 @@ const jt = class $e {
|
|
|
1550
1550
|
return R(this, U, k).call(this, "div", ...t);
|
|
1551
1551
|
}
|
|
1552
1552
|
gt(t) {
|
|
1553
|
-
return R(this, B,
|
|
1553
|
+
return R(this, B, H).call(this, "gt", t);
|
|
1554
1554
|
}
|
|
1555
1555
|
gte(t) {
|
|
1556
|
-
return R(this, B,
|
|
1556
|
+
return R(this, B, H).call(this, "gte", t);
|
|
1557
1557
|
}
|
|
1558
1558
|
lt(t) {
|
|
1559
|
-
return R(this, B,
|
|
1559
|
+
return R(this, B, H).call(this, "lt", t);
|
|
1560
1560
|
}
|
|
1561
1561
|
lte(t) {
|
|
1562
|
-
return R(this, B,
|
|
1562
|
+
return R(this, B, H).call(this, "lte", t);
|
|
1563
1563
|
}
|
|
1564
1564
|
eqValue(t) {
|
|
1565
|
-
return R(this, B,
|
|
1565
|
+
return R(this, B, H).call(this, "eqValue", t);
|
|
1566
1566
|
}
|
|
1567
1567
|
// @ts-expect-error False positive
|
|
1568
1568
|
getValue(t) {
|
|
@@ -1685,7 +1685,7 @@ U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
|
1685
1685
|
value: o,
|
|
1686
1686
|
identifier: this.toString()
|
|
1687
1687
|
});
|
|
1688
|
-
}, B = /* @__PURE__ */ new WeakSet(),
|
|
1688
|
+
}, B = /* @__PURE__ */ new WeakSet(), H = function(e, ...t) {
|
|
1689
1689
|
const n = R(this, Z, ue).call(this, this, ...t), a = this.getBigIntValue(t[0], n), s = this.getBigIntValue(this, n);
|
|
1690
1690
|
switch (e) {
|
|
1691
1691
|
case "gt":
|
|
@@ -1709,7 +1709,7 @@ U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
|
1709
1709
|
const n = t ? L(t) : this.decimalMultiplier, a = G(n), [s = "", r = ""] = e.split(".");
|
|
1710
1710
|
return BigInt(`${s}${r.padEnd(a, "0")}`);
|
|
1711
1711
|
};
|
|
1712
|
-
let
|
|
1712
|
+
let $e = jt;
|
|
1713
1713
|
const Kt = Intl.NumberFormat("fullwide", {
|
|
1714
1714
|
useGrouping: !1,
|
|
1715
1715
|
maximumFractionDigits: 20
|
|
@@ -1727,7 +1727,7 @@ function he(e) {
|
|
|
1727
1727
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1728
1728
|
}
|
|
1729
1729
|
const q = /* @__PURE__ */ new Map();
|
|
1730
|
-
class N extends
|
|
1730
|
+
class N extends $e {
|
|
1731
1731
|
constructor({
|
|
1732
1732
|
value: t,
|
|
1733
1733
|
decimal: n,
|
|
@@ -1736,7 +1736,7 @@ class N extends He {
|
|
|
1736
1736
|
symbol: r,
|
|
1737
1737
|
identifier: o
|
|
1738
1738
|
}) {
|
|
1739
|
-
super(typeof t == "object" ? t : { decimal: n, value: t }),
|
|
1739
|
+
super(typeof t == "object" ? t : { decimal: n, value: t }), S(this, "address"), S(this, "chain"), S(this, "isGasAsset", !1), S(this, "isSynthetic", !1), S(this, "symbol"), S(this, "tax"), S(this, "ticker"), S(this, "type");
|
|
1740
1740
|
const p = ee(o || `${s}.${r}`);
|
|
1741
1741
|
this.type = Et(p), this.tax = a, this.chain = p.chain, this.ticker = p.ticker, this.symbol = p.symbol, this.address = p.address, this.isSynthetic = p.isSynthetic, this.isGasAsset = p.isGasAsset;
|
|
1742
1742
|
}
|
|
@@ -1769,9 +1769,6 @@ class N extends He {
|
|
|
1769
1769
|
const { chain: a, isSynthetic: s } = ee(t), r = q.get(t.toUpperCase());
|
|
1770
1770
|
if (s)
|
|
1771
1771
|
return Oe(t, n);
|
|
1772
|
-
r || console.error(
|
|
1773
|
-
`Asset ${t} is not loaded. Use AssetValue.loadStaticAssets() to load it`
|
|
1774
|
-
);
|
|
1775
1772
|
const { tax: o, decimal: p, identifier: d } = r || {
|
|
1776
1773
|
decimal: b[a],
|
|
1777
1774
|
identifier: t
|
|
@@ -1787,9 +1784,6 @@ class N extends He {
|
|
|
1787
1784
|
const { chain: a, isSynthetic: s } = ee(t), r = q.get(t);
|
|
1788
1785
|
if (s)
|
|
1789
1786
|
return Oe(t, n);
|
|
1790
|
-
r || console.error(
|
|
1791
|
-
`Asset ${t} is not loaded. - Loading with base Chain. Use AssetValue.loadStaticAssets() to load it`
|
|
1792
|
-
);
|
|
1793
1787
|
const { tax: o, decimal: p, identifier: d } = r || {
|
|
1794
1788
|
decimal: b[a],
|
|
1795
1789
|
identifier: t
|
|
@@ -1850,7 +1844,9 @@ async function ye(e, t = 0) {
|
|
|
1850
1844
|
return n || q.set(e.toUpperCase(), { identifier: e, decimal: a }), new N({ decimal: a, value: W(t, a), identifier: e });
|
|
1851
1845
|
}
|
|
1852
1846
|
function Oe(e, t = 0) {
|
|
1853
|
-
const [n, a] = e.split("/");
|
|
1847
|
+
const [n, a] = e.split(".")[0].toUpperCase() === i.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
|
|
1848
|
+
if (!n || !a)
|
|
1849
|
+
throw new Error("Invalid asset identifier");
|
|
1854
1850
|
return new N({
|
|
1855
1851
|
decimal: 8,
|
|
1856
1852
|
value: W(t, 8),
|
|
@@ -1861,7 +1857,10 @@ function W(e, t) {
|
|
|
1861
1857
|
return typeof e == "bigint" ? re({ value: e, bigIntDecimal: t, decimal: t }) : e;
|
|
1862
1858
|
}
|
|
1863
1859
|
function ee(e) {
|
|
1864
|
-
const t = e.slice(0, 14).includes("/"), [n, a] = e.split(".").
|
|
1860
|
+
const t = e.slice(0, 14).includes("/"), [n, a] = e.split(".")[0].toUpperCase() === i.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
|
|
1861
|
+
if (t && (!n || !a))
|
|
1862
|
+
throw new Error("Invalid asset identifier");
|
|
1863
|
+
const s = e.includes(".") && !t ? e : `${i.THORChain}.${a}`, [r, o] = s.split("."), [p, d] = (t ? a : o).split("-");
|
|
1865
1864
|
return {
|
|
1866
1865
|
address: d == null ? void 0 : d.toLowerCase(),
|
|
1867
1866
|
chain: r,
|
|
@@ -1934,7 +1933,7 @@ class c extends Error {
|
|
|
1934
1933
|
console.error(n, { stack: n == null ? void 0 : n.stack, message: n == null ? void 0 : n.message }), super(t, { cause: { code: Xt[t], message: t } }), Object.setPrototypeOf(this, c.prototype);
|
|
1935
1934
|
}
|
|
1936
1935
|
}
|
|
1937
|
-
class x extends
|
|
1936
|
+
class x extends $e {
|
|
1938
1937
|
eq(t) {
|
|
1939
1938
|
return this.eqValue(t);
|
|
1940
1939
|
}
|
|
@@ -3674,7 +3673,7 @@ const Yt = [
|
|
|
3674
3673
|
const O = !!Fe[t.toLowerCase()];
|
|
3675
3674
|
if (O && !l)
|
|
3676
3675
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
3677
|
-
const
|
|
3676
|
+
const I = m || d, D = e && u || I;
|
|
3678
3677
|
if (!w && !A)
|
|
3679
3678
|
throw new Error("TC Vault is required on calldata");
|
|
3680
3679
|
if (!_ && !l)
|
|
@@ -3746,7 +3745,7 @@ const Yt = [
|
|
|
3746
3745
|
}, Tn = (e) => {
|
|
3747
3746
|
const t = e ? j.ThornodeStagenet : j.ThornodeMainnet;
|
|
3748
3747
|
return we.get(`${t}/thorchain/mimir`);
|
|
3749
|
-
},
|
|
3748
|
+
}, Ie = () => Object.values(i).reduce(
|
|
3750
3749
|
(e, t) => (e[t] = null, e),
|
|
3751
3750
|
{}
|
|
3752
3751
|
), hn = async ({ chain: e, address: t }) => {
|
|
@@ -3762,8 +3761,8 @@ const Yt = [
|
|
|
3762
3761
|
var V, se, X, v, Y, J;
|
|
3763
3762
|
class Ln {
|
|
3764
3763
|
constructor({ stagenet: t } = {}) {
|
|
3765
|
-
T(this, "connectedChains",
|
|
3766
|
-
T(this, "connectedWallets",
|
|
3764
|
+
T(this, "connectedChains", Ie());
|
|
3765
|
+
T(this, "connectedWallets", Ie());
|
|
3767
3766
|
T(this, "stagenet", !1);
|
|
3768
3767
|
T(this, "getAddress", (t) => {
|
|
3769
3768
|
var n;
|
|
@@ -3806,11 +3805,11 @@ class Ln {
|
|
|
3806
3805
|
const { address: u } = await f(this, V).call(this, l.chain), {
|
|
3807
3806
|
contract: m,
|
|
3808
3807
|
calldata: { expiration: _, amountIn: w, memo: A, memoStreamingSwap: E }
|
|
3809
|
-
} = a, O = l.add(x.fromBigInt(BigInt(w), l.decimal)),
|
|
3808
|
+
} = a, O = l.add(x.fromBigInt(BigInt(w), l.decimal)), I = t && E || A;
|
|
3810
3809
|
return this.deposit({
|
|
3811
3810
|
expiration: _,
|
|
3812
3811
|
assetValue: O,
|
|
3813
|
-
memo:
|
|
3812
|
+
memo: I,
|
|
3814
3813
|
feeOptionKey: s,
|
|
3815
3814
|
router: m,
|
|
3816
3815
|
recipient: u
|
|
@@ -3977,8 +3976,8 @@ class Ln {
|
|
|
3977
3976
|
assetValue: t,
|
|
3978
3977
|
memo: M(h.DEPOSIT, { chain: p, symbol: d, address: A })
|
|
3979
3978
|
});
|
|
3980
|
-
} catch (
|
|
3981
|
-
throw new c("core_transaction_add_liquidity_rune_error",
|
|
3979
|
+
} catch (I) {
|
|
3980
|
+
throw new c("core_transaction_add_liquidity_rune_error", I);
|
|
3982
3981
|
}
|
|
3983
3982
|
if (m && n)
|
|
3984
3983
|
try {
|
|
@@ -3986,8 +3985,8 @@ class Ln {
|
|
|
3986
3985
|
assetValue: n,
|
|
3987
3986
|
memo: M(h.DEPOSIT, { chain: p, symbol: d, address: w })
|
|
3988
3987
|
});
|
|
3989
|
-
} catch (
|
|
3990
|
-
throw new c("core_transaction_add_liquidity_asset_error",
|
|
3988
|
+
} catch (I) {
|
|
3989
|
+
throw new c("core_transaction_add_liquidity_asset_error", I);
|
|
3991
3990
|
}
|
|
3992
3991
|
return { runeTx: E, assetTx: O };
|
|
3993
3992
|
});
|
|
@@ -4230,7 +4229,7 @@ export {
|
|
|
4230
4229
|
j as ApiUrl,
|
|
4231
4230
|
N as AssetValue,
|
|
4232
4231
|
b as BaseDecimal,
|
|
4233
|
-
|
|
4232
|
+
$e as BigIntArithmetics,
|
|
4234
4233
|
i as Chain,
|
|
4235
4234
|
_e as ChainId,
|
|
4236
4235
|
On as ChainIdToChain,
|
|
@@ -4243,7 +4242,7 @@ export {
|
|
|
4243
4242
|
it as DerivationPath,
|
|
4244
4243
|
y as ERROR_CODE,
|
|
4245
4244
|
nt as ERROR_MODULE,
|
|
4246
|
-
|
|
4245
|
+
Se as ERROR_TYPE,
|
|
4247
4246
|
rt as EVMChainList,
|
|
4248
4247
|
ut as ErrorCode,
|
|
4249
4248
|
F as FeeOption,
|
|
@@ -4263,14 +4262,14 @@ export {
|
|
|
4263
4262
|
Rn as TCSupportedChainList,
|
|
4264
4263
|
An as UTXOChainList,
|
|
4265
4264
|
lt as WalletOption,
|
|
4266
|
-
|
|
4265
|
+
In as assetFromString,
|
|
4267
4266
|
Bn as derivationPathToString,
|
|
4268
4267
|
fn as erc20ABI,
|
|
4269
|
-
|
|
4268
|
+
Sn as filterAssets,
|
|
4270
4269
|
re as formatBigIntToSafeValue,
|
|
4271
4270
|
wt as gasFeeMultiplier,
|
|
4272
4271
|
Et as getAssetType,
|
|
4273
|
-
|
|
4272
|
+
It as getAsymmetricAssetShare,
|
|
4274
4273
|
Cn as getAsymmetricAssetWithdrawAmount,
|
|
4275
4274
|
Ot as getAsymmetricRuneShare,
|
|
4276
4275
|
vn as getAsymmetricRuneWithdrawAmount,
|
|
@@ -4280,7 +4279,7 @@ export {
|
|
|
4280
4279
|
xn as getLiquiditySlippage,
|
|
4281
4280
|
M as getMemoFor,
|
|
4282
4281
|
le as getMinAmountByChain,
|
|
4283
|
-
|
|
4282
|
+
St as getSymmetricPoolShare,
|
|
4284
4283
|
Mn as getSymmetricWithdraw,
|
|
4285
4284
|
Dn as getTHORNameCost,
|
|
4286
4285
|
xe as isGasAsset,
|