@swapkit/core 1.0.0-rc.28 → 1.0.0-rc.29
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.es.js +154 -154
- package/package.json +8 -8
package/dist/index.es.js
CHANGED
|
@@ -10,7 +10,7 @@ var f = (e, t, n) => (qe(e, t, "read from private field"), n ? n.call(e) : t.get
|
|
|
10
10
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
11
11
|
};
|
|
12
12
|
var je = Object.defineProperty, Ke = (e, t, n) => t in e ? je(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, v = (e, t, n) => (Ke(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
13
|
-
const
|
|
13
|
+
const _n = [
|
|
14
14
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
15
15
|
{
|
|
16
16
|
anonymous: !1,
|
|
@@ -682,7 +682,7 @@ const nt = {
|
|
|
682
682
|
n = n.replace(`{${a}}`, t[a]);
|
|
683
683
|
return t.length === 0 ? n.replace("{0}", "") : n;
|
|
684
684
|
};
|
|
685
|
-
let
|
|
685
|
+
let fn = class Me extends Error {
|
|
686
686
|
constructor({
|
|
687
687
|
status: t,
|
|
688
688
|
revision: n,
|
|
@@ -725,7 +725,7 @@ let hn = class Me extends Error {
|
|
|
725
725
|
}
|
|
726
726
|
};
|
|
727
727
|
var i = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(i || {}), at = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(at || {}), st = /* @__PURE__ */ ((e) => (e.ARB = "m/44'/60'/0'/0", e.AVAX = "m/44'/60'/0'/0", e.BCH = "m/44'/145'/0'/0", e.BNB = "m/44'/714'/0'/0", e.BSC = "m/44'/60'/0'/0", e.BTC = "m/84'/0'/0'/0", e.DOGE = "m/44'/3'/0'/0", e.ETH = "m/44'/60'/0'/0", e.GAIA = "m/44'/118'/0'/0", e.KUJI = "m/44'/118'/0'/0", e.LTC = "m/84'/2'/0'/0", e.MATIC = "m/44'/60'/0'/0", e.MAYA = "m/44'/931'/0'/0", e.OP = "m/44'/60'/0'/0", e.THOR = "m/44'/931'/0'/0", e))(st || {});
|
|
728
|
-
const
|
|
728
|
+
const bn = {
|
|
729
729
|
ARB: [44, 60, 0, 0, 0],
|
|
730
730
|
AVAX: [44, 60, 0, 0, 0],
|
|
731
731
|
BCH: [44, 145, 0, 0, 0],
|
|
@@ -743,7 +743,7 @@ const _n = {
|
|
|
743
743
|
THOR: [44, 931, 0, 0, 0]
|
|
744
744
|
};
|
|
745
745
|
var A = /* @__PURE__ */ ((e) => (e[e.ARB = 18] = "ARB", e[e.AVAX = 18] = "AVAX", e[e.BCH = 8] = "BCH", e[e.BNB = 8] = "BNB", e[e.BSC = 18] = "BSC", e[e.BTC = 8] = "BTC", e[e.DASH = 8] = "DASH", e[e.DOGE = 8] = "DOGE", e[e.ETH = 18] = "ETH", e[e.GAIA = 6] = "GAIA", e[e.KUJI = 6] = "KUJI", e[e.LTC = 8] = "LTC", e[e.MATIC = 18] = "MATIC", e[e.MAYA = 10] = "MAYA", e[e.OP = 18] = "OP", e[e.THOR = 8] = "THOR", e))(A || {});
|
|
746
|
-
const
|
|
746
|
+
const it = [
|
|
747
747
|
"ETH",
|
|
748
748
|
"AVAX",
|
|
749
749
|
"BSC",
|
|
@@ -751,18 +751,18 @@ const fn = [
|
|
|
751
751
|
"OP",
|
|
752
752
|
"MATIC"
|
|
753
753
|
/* Polygon */
|
|
754
|
-
],
|
|
754
|
+
], wn = [
|
|
755
755
|
"BTC",
|
|
756
756
|
"BCH",
|
|
757
757
|
"DOGE",
|
|
758
758
|
"LTC"
|
|
759
759
|
/* Litecoin */
|
|
760
|
-
],
|
|
760
|
+
], An = [
|
|
761
761
|
"GAIA",
|
|
762
762
|
"THOR",
|
|
763
763
|
"BNB"
|
|
764
764
|
/* Binance */
|
|
765
|
-
],
|
|
765
|
+
], En = [
|
|
766
766
|
"AVAX",
|
|
767
767
|
"BNB",
|
|
768
768
|
"BSC",
|
|
@@ -776,25 +776,25 @@ const fn = [
|
|
|
776
776
|
/* THORChain */
|
|
777
777
|
];
|
|
778
778
|
var _e = /* @__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))(_e || {}), Ne = /* @__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))(Ne || {}), 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 || {});
|
|
779
|
-
const ae = Object.values(i),
|
|
779
|
+
const ae = Object.values(i), rt = Object.keys(i), fe = ae.reduce(
|
|
780
780
|
(e, t) => {
|
|
781
|
-
const n =
|
|
781
|
+
const n = rt.find((a) => i[a] === t);
|
|
782
782
|
return n && (e[t] = n), e;
|
|
783
783
|
},
|
|
784
784
|
{}
|
|
785
|
-
),
|
|
785
|
+
), ot = ae.reduce(
|
|
786
786
|
(e, t) => (e[t] = _e[fe[t]], e),
|
|
787
787
|
{}
|
|
788
|
-
),
|
|
788
|
+
), pt = ae.reduce(
|
|
789
789
|
(e, t) => (e[t] = Ne[fe[t]], e),
|
|
790
790
|
{}
|
|
791
|
-
),
|
|
791
|
+
), Rn = ae.reduce(
|
|
792
792
|
(e, t) => {
|
|
793
793
|
const n = `${fe[t]}Hex`;
|
|
794
794
|
return e[t] = _e[n], e;
|
|
795
795
|
},
|
|
796
796
|
{}
|
|
797
|
-
),
|
|
797
|
+
), gn = {
|
|
798
798
|
"0xa4b1": "ARB",
|
|
799
799
|
42161: "ARB",
|
|
800
800
|
"0xa86a": "AVAX",
|
|
@@ -836,17 +836,17 @@ const ae = Object.values(i), it = Object.keys(i), fe = ae.reduce(
|
|
|
836
836
|
MATIC: "https://polygonscan.com",
|
|
837
837
|
THOR: "https://viewblock.io/thorchain"
|
|
838
838
|
};
|
|
839
|
-
var
|
|
839
|
+
var dt = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(dt || {}), 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 || {}), ut = /* @__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))(ut || {}), lt = Object.defineProperty, yt = (e, t, n) => t in e ? lt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (yt(e, typeof t != "symbol" ? t + "" : t, n), n), ct = (e, t, n) => {
|
|
840
840
|
if (!t.has(e))
|
|
841
841
|
throw TypeError("Cannot " + n);
|
|
842
842
|
}, V = (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);
|
|
846
|
-
}, R = (e, t, n) => (
|
|
847
|
-
const
|
|
846
|
+
}, R = (e, t, n) => (ct(e, t, "access private method"), n);
|
|
847
|
+
const mt = "0x313ce567", De = async ({ chain: e, to: t }) => {
|
|
848
848
|
try {
|
|
849
|
-
const { result: n } = await we.post(
|
|
849
|
+
const { result: n } = await we.post(pt[e], {
|
|
850
850
|
headers: {
|
|
851
851
|
accept: "*/*",
|
|
852
852
|
"content-type": "application/json",
|
|
@@ -856,37 +856,37 @@ const ct = "0x313ce567", De = async ({ chain: e, to: t }) => {
|
|
|
856
856
|
id: 44,
|
|
857
857
|
jsonrpc: "2.0",
|
|
858
858
|
method: "eth_call",
|
|
859
|
-
params: [{ to: t.toLowerCase(), data:
|
|
859
|
+
params: [{ to: t.toLowerCase(), data: mt }, "latest"]
|
|
860
860
|
})
|
|
861
861
|
});
|
|
862
862
|
return parseInt(BigInt(n).toString());
|
|
863
863
|
} catch (n) {
|
|
864
864
|
return console.error(n), A[e];
|
|
865
865
|
}
|
|
866
|
-
},
|
|
866
|
+
}, Tt = async (e) => {
|
|
867
867
|
if (e === i.Ethereum)
|
|
868
868
|
return A.ETH;
|
|
869
869
|
const [, t] = e.split("-");
|
|
870
870
|
return t != null && t.startsWith("0x") ? De({ chain: i.Ethereum, to: t }) : A.ETH;
|
|
871
|
-
},
|
|
871
|
+
}, ht = async (e) => {
|
|
872
872
|
const [, t] = e.split("-");
|
|
873
873
|
return t != null && t.startsWith("0x") ? De({ chain: i.Avalanche, to: t.toLowerCase() }) : A.AVAX;
|
|
874
|
-
},
|
|
874
|
+
}, _t = async (e) => (e === i.BinanceSmartChain, A.BSC), ft = async ({ chain: e, symbol: t }) => {
|
|
875
875
|
switch (e) {
|
|
876
876
|
case i.Ethereum:
|
|
877
|
-
return mt(t);
|
|
878
|
-
case i.Avalanche:
|
|
879
877
|
return Tt(t);
|
|
880
|
-
case i.
|
|
878
|
+
case i.Avalanche:
|
|
881
879
|
return ht(t);
|
|
880
|
+
case i.BinanceSmartChain:
|
|
881
|
+
return _t(t);
|
|
882
882
|
default:
|
|
883
883
|
return A[e];
|
|
884
884
|
}
|
|
885
|
-
},
|
|
885
|
+
}, bt = {
|
|
886
886
|
[F.Average]: 1.2,
|
|
887
887
|
[F.Fast]: 1.5,
|
|
888
888
|
[F.Fastest]: 2
|
|
889
|
-
},
|
|
889
|
+
}, wt = ({ chain: e, symbol: t }) => {
|
|
890
890
|
switch (e) {
|
|
891
891
|
case i.Bitcoin:
|
|
892
892
|
case i.BitcoinCash:
|
|
@@ -912,7 +912,7 @@ const ct = "0x313ce567", De = async ({ chain: e, to: t }) => {
|
|
|
912
912
|
case i.THORChain:
|
|
913
913
|
return t === "RUNE";
|
|
914
914
|
}
|
|
915
|
-
},
|
|
915
|
+
}, At = (e) => {
|
|
916
916
|
switch (e) {
|
|
917
917
|
case "ETH.THOR":
|
|
918
918
|
return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
|
|
@@ -941,7 +941,7 @@ const ct = "0x313ce567", De = async ({ chain: e, to: t }) => {
|
|
|
941
941
|
case i.Ethereum:
|
|
942
942
|
return { identifier: `${e}.${e}`, decimal: A[e] };
|
|
943
943
|
}
|
|
944
|
-
},
|
|
944
|
+
}, Et = ({ chain: e, symbol: t }) => {
|
|
945
945
|
if (t.includes("/"))
|
|
946
946
|
return "Synth";
|
|
947
947
|
switch (e) {
|
|
@@ -971,40 +971,40 @@ const ct = "0x313ce567", De = 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
|
+
}, On = (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 };
|
|
978
|
-
},
|
|
978
|
+
}, Rt = new RegExp(
|
|
979
979
|
/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
|
|
980
980
|
"gmi"
|
|
981
|
-
),
|
|
982
|
-
(t) => !
|
|
983
|
-
),
|
|
981
|
+
), gt = (e) => it.includes(e.chain) ? !e.isGasAsset && e.address && !Number.isNaN(e.decimal) : !0, In = (e) => e.filter(
|
|
982
|
+
(t) => !t.toString().includes("undefined") && !Rt.test(t.toString()) && gt(t)
|
|
983
|
+
), Ot = ({
|
|
984
984
|
liquidityUnits: e,
|
|
985
985
|
poolUnits: t,
|
|
986
986
|
runeDepth: n
|
|
987
987
|
}) => {
|
|
988
988
|
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), y = a.mul(a), u = s.mul(s).mul(s);
|
|
989
989
|
return o.mul(p.sub(d).add(y)).div(u);
|
|
990
|
-
},
|
|
990
|
+
}, It = ({
|
|
991
991
|
liquidityUnits: e,
|
|
992
992
|
poolUnits: t,
|
|
993
993
|
assetDepth: n
|
|
994
994
|
}) => {
|
|
995
995
|
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), y = a.mul(a), u = o.mul(p.sub(d).add(y)), c = s.mul(s).mul(s);
|
|
996
996
|
return u.div(c);
|
|
997
|
-
},
|
|
997
|
+
}, Sn = ({
|
|
998
998
|
percent: e,
|
|
999
999
|
runeDepth: t,
|
|
1000
1000
|
liquidityUnits: n,
|
|
1001
1001
|
poolUnits: a
|
|
1002
|
-
}) =>
|
|
1002
|
+
}) => Ot({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), vn = ({
|
|
1003
1003
|
percent: e,
|
|
1004
1004
|
assetDepth: t,
|
|
1005
1005
|
liquidityUnits: n,
|
|
1006
1006
|
poolUnits: a
|
|
1007
|
-
}) =>
|
|
1007
|
+
}) => It({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), g = (e) => D.fromBigInt(BigInt(e), A.THOR), St = ({
|
|
1008
1008
|
liquidityUnits: e,
|
|
1009
1009
|
poolUnits: t,
|
|
1010
1010
|
runeDepth: n,
|
|
@@ -1012,17 +1012,17 @@ const ct = "0x313ce567", De = async ({ chain: e, to: t }) => {
|
|
|
1012
1012
|
}) => ({
|
|
1013
1013
|
assetAmount: g(a).mul(e).div(t),
|
|
1014
1014
|
runeAmount: g(n).mul(e).div(t)
|
|
1015
|
-
}),
|
|
1015
|
+
}), Cn = ({
|
|
1016
1016
|
liquidityUnits: e,
|
|
1017
1017
|
poolUnits: t,
|
|
1018
1018
|
runeDepth: n,
|
|
1019
1019
|
assetDepth: a,
|
|
1020
1020
|
percent: s
|
|
1021
1021
|
}) => Object.fromEntries(
|
|
1022
|
-
Object.entries(
|
|
1022
|
+
Object.entries(St({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
|
|
1023
1023
|
([r, o]) => [r, o.mul(s)]
|
|
1024
1024
|
)
|
|
1025
|
-
),
|
|
1025
|
+
), Mn = ({
|
|
1026
1026
|
runeDepth: e,
|
|
1027
1027
|
poolUnits: t,
|
|
1028
1028
|
assetDepth: n,
|
|
@@ -1035,7 +1035,7 @@ const ct = "0x313ce567", De = async ({ chain: e, to: t }) => {
|
|
|
1035
1035
|
return S.div(d).getBaseValue("number");
|
|
1036
1036
|
const P = d.add(S);
|
|
1037
1037
|
return S.div(P).getBaseValue("number");
|
|
1038
|
-
},
|
|
1038
|
+
}, Nn = ({
|
|
1039
1039
|
runeAmount: e,
|
|
1040
1040
|
assetAmount: t,
|
|
1041
1041
|
runeDepth: n,
|
|
@@ -1045,7 +1045,7 @@ const ct = "0x313ce567", De = async ({ chain: e, to: t }) => {
|
|
|
1045
1045
|
return 0;
|
|
1046
1046
|
const s = g(n), r = g(a), o = g(t), p = g(e), d = o.mul(s).sub(r.mul(p)), y = r.mul(p).add(s.mul(r));
|
|
1047
1047
|
return Math.abs(d.div(y).getBaseValue("number"));
|
|
1048
|
-
},
|
|
1048
|
+
}, vt = ({
|
|
1049
1049
|
symbol: e,
|
|
1050
1050
|
ticker: t,
|
|
1051
1051
|
chain: n
|
|
@@ -1069,7 +1069,7 @@ const ct = "0x313ce567", De = async ({ chain: e, to: t }) => {
|
|
|
1069
1069
|
return r ? `${e}:${n}/${a}::t:0` : `${e}:${n}.${a}:${s || ""}:t:0`;
|
|
1070
1070
|
}
|
|
1071
1071
|
case h.WITHDRAW: {
|
|
1072
|
-
const { chain: n, ticker: a, symbol: s, basisPoints: r, targetAssetString: o, singleSide: p } = t, d = !p && o ? `:${o}` : "", y =
|
|
1072
|
+
const { chain: n, ticker: a, symbol: s, basisPoints: r, targetAssetString: o, singleSide: p } = t, d = !p && o ? `:${o}` : "", y = vt({ chain: n, symbol: s, ticker: a });
|
|
1073
1073
|
return `${e}:${n}${p ? "/" : "."}${y}:${r}${d}`;
|
|
1074
1074
|
}
|
|
1075
1075
|
case h.OPEN_LOAN:
|
|
@@ -1080,16 +1080,16 @@ const ct = "0x313ce567", De = async ({ chain: e, to: t }) => {
|
|
|
1080
1080
|
default:
|
|
1081
1081
|
return "";
|
|
1082
1082
|
}
|
|
1083
|
-
},
|
|
1083
|
+
}, xn = (e) => {
|
|
1084
1084
|
if (e < 0)
|
|
1085
1085
|
throw new Error("Invalid number of year");
|
|
1086
1086
|
return 10 + e;
|
|
1087
|
-
},
|
|
1087
|
+
}, Dn = (e) => {
|
|
1088
1088
|
if (e.length > 30)
|
|
1089
1089
|
return !1;
|
|
1090
1090
|
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
1091
1091
|
return !!e.match(t);
|
|
1092
|
-
},
|
|
1092
|
+
}, Pn = ([e, t, n, a, s]) => `${e}'/${t}'/${n}'/${a}${typeof s != "number" ? "" : `/${s}`}`;
|
|
1093
1093
|
class Ae extends Error {
|
|
1094
1094
|
constructor(t, n, a) {
|
|
1095
1095
|
const s = t.status || t.status === 0 ? t.status : "", r = t.statusText || "", o = `${s} ${r}`.trim(), p = o ? `status code ${o}` : "an unknown error";
|
|
@@ -1142,7 +1142,7 @@ const Q = (e) => e !== null && typeof e == "object", J = (...e) => {
|
|
|
1142
1142
|
Q(a.headers) && (n = Be(n, a.headers), t.headers = n);
|
|
1143
1143
|
}
|
|
1144
1144
|
return t;
|
|
1145
|
-
},
|
|
1145
|
+
}, Ct = (() => {
|
|
1146
1146
|
let e = !1, t = !1;
|
|
1147
1147
|
const n = typeof globalThis.ReadableStream == "function", a = typeof globalThis.Request == "function";
|
|
1148
1148
|
return n && a && (t = new globalThis.Request("https://empty.invalid", {
|
|
@@ -1153,13 +1153,13 @@ const Q = (e) => e !== null && typeof e == "object", J = (...e) => {
|
|
|
1153
1153
|
return e = !0, "half";
|
|
1154
1154
|
}
|
|
1155
1155
|
}).headers.has("Content-Type")), e && !t;
|
|
1156
|
-
})(),
|
|
1156
|
+
})(), Mt = typeof globalThis.AbortController == "function", Nt = typeof globalThis.ReadableStream == "function", xt = typeof globalThis.FormData == "function", Le = ["get", "post", "put", "patch", "head", "delete"], Dt = {
|
|
1157
1157
|
json: "application/json",
|
|
1158
1158
|
text: "text/*",
|
|
1159
1159
|
formData: "multipart/form-data",
|
|
1160
1160
|
arrayBuffer: "*/*",
|
|
1161
1161
|
blob: "*/*"
|
|
1162
|
-
}, re = 2147483647, Ve = Symbol("stop"),
|
|
1162
|
+
}, re = 2147483647, Ve = Symbol("stop"), Pt = {
|
|
1163
1163
|
json: !0,
|
|
1164
1164
|
parseJson: !0,
|
|
1165
1165
|
searchParams: !0,
|
|
@@ -1170,7 +1170,7 @@ const Q = (e) => e !== null && typeof e == "object", J = (...e) => {
|
|
|
1170
1170
|
throwHttpErrors: !0,
|
|
1171
1171
|
onDownloadProgress: !0,
|
|
1172
1172
|
fetch: !0
|
|
1173
|
-
},
|
|
1173
|
+
}, Bt = {
|
|
1174
1174
|
method: !0,
|
|
1175
1175
|
headers: !0,
|
|
1176
1176
|
body: !0,
|
|
@@ -1186,15 +1186,15 @@ const Q = (e) => e !== null && typeof e == "object", J = (...e) => {
|
|
|
1186
1186
|
window: !0,
|
|
1187
1187
|
dispatcher: !0,
|
|
1188
1188
|
duplex: !0
|
|
1189
|
-
},
|
|
1189
|
+
}, Lt = (e) => Le.includes(e) ? e.toUpperCase() : e, Vt = ["get", "put", "head", "delete", "options", "trace"], Ut = [408, 413, 429, 500, 502, 503, 504], Ue = [413, 429, 503], Ee = {
|
|
1190
1190
|
limit: 2,
|
|
1191
|
-
methods:
|
|
1192
|
-
statusCodes:
|
|
1191
|
+
methods: Vt,
|
|
1192
|
+
statusCodes: Ut,
|
|
1193
1193
|
afterStatusCodes: Ue,
|
|
1194
1194
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
1195
1195
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
1196
1196
|
delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
|
|
1197
|
-
},
|
|
1197
|
+
}, Ht = (e = {}) => {
|
|
1198
1198
|
if (typeof e == "number")
|
|
1199
1199
|
return {
|
|
1200
1200
|
...Ee,
|
|
@@ -1210,7 +1210,7 @@ const Q = (e) => e !== null && typeof e == "object", J = (...e) => {
|
|
|
1210
1210
|
afterStatusCodes: Ue
|
|
1211
1211
|
};
|
|
1212
1212
|
};
|
|
1213
|
-
async function
|
|
1213
|
+
async function $t(e, t, n, a) {
|
|
1214
1214
|
return new Promise((s, r) => {
|
|
1215
1215
|
const o = setTimeout(() => {
|
|
1216
1216
|
n && n.abort(), r(new Pe(e));
|
|
@@ -1220,7 +1220,7 @@ async function Ut(e, t, n, a) {
|
|
|
1220
1220
|
});
|
|
1221
1221
|
});
|
|
1222
1222
|
}
|
|
1223
|
-
async function
|
|
1223
|
+
async function kt(e, { signal: t }) {
|
|
1224
1224
|
return new Promise((n, a) => {
|
|
1225
1225
|
t && (t.throwIfAborted(), t.addEventListener("abort", s, { once: !0 }));
|
|
1226
1226
|
function s() {
|
|
@@ -1231,10 +1231,10 @@ async function Ht(e, { signal: t }) {
|
|
|
1231
1231
|
}, e);
|
|
1232
1232
|
});
|
|
1233
1233
|
}
|
|
1234
|
-
const
|
|
1234
|
+
const Ft = (e, t) => {
|
|
1235
1235
|
const n = {};
|
|
1236
1236
|
for (const a in t)
|
|
1237
|
-
!(a in
|
|
1237
|
+
!(a in Bt) && !(a in Pt) && !(a in e) && (n[a] = t[a]);
|
|
1238
1238
|
return n;
|
|
1239
1239
|
};
|
|
1240
1240
|
class Z {
|
|
@@ -1257,13 +1257,13 @@ class Z {
|
|
|
1257
1257
|
if (a._options.onDownloadProgress) {
|
|
1258
1258
|
if (typeof a._options.onDownloadProgress != "function")
|
|
1259
1259
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
1260
|
-
if (!
|
|
1260
|
+
if (!Nt)
|
|
1261
1261
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
1262
1262
|
return a._stream(o.clone(), a._options.onDownloadProgress);
|
|
1263
1263
|
}
|
|
1264
1264
|
return o;
|
|
1265
1265
|
}, r = a._options.retry.methods.includes(a.request.method.toLowerCase()) ? a._retry(s) : s();
|
|
1266
|
-
for (const [o, p] of Object.entries(
|
|
1266
|
+
for (const [o, p] of Object.entries(Dt))
|
|
1267
1267
|
r[o] = async () => {
|
|
1268
1268
|
a.request.headers.set("accept", a.request.headers.get("accept") || p);
|
|
1269
1269
|
const d = (await r).clone();
|
|
@@ -1315,10 +1315,10 @@ class Z {
|
|
|
1315
1315
|
beforeError: [],
|
|
1316
1316
|
afterResponse: []
|
|
1317
1317
|
}, n.hooks),
|
|
1318
|
-
method:
|
|
1318
|
+
method: Lt(n.method ?? this._input.method),
|
|
1319
1319
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
1320
1320
|
prefixUrl: String(n.prefixUrl || ""),
|
|
1321
|
-
retry:
|
|
1321
|
+
retry: Ht(n.retry),
|
|
1322
1322
|
throwHttpErrors: n.throwHttpErrors !== !1,
|
|
1323
1323
|
timeout: n.timeout ?? 1e4,
|
|
1324
1324
|
fetch: n.fetch ?? globalThis.fetch.bind(globalThis)
|
|
@@ -1329,7 +1329,7 @@ class Z {
|
|
|
1329
1329
|
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
1330
1330
|
this._options.prefixUrl.endsWith("/") || (this._options.prefixUrl += "/"), this._input = this._options.prefixUrl + this._input;
|
|
1331
1331
|
}
|
|
1332
|
-
if (
|
|
1332
|
+
if (Mt) {
|
|
1333
1333
|
if (this.abortController = new globalThis.AbortController(), this._options.signal) {
|
|
1334
1334
|
const a = this._options.signal;
|
|
1335
1335
|
this._options.signal.addEventListener("abort", () => {
|
|
@@ -1338,9 +1338,9 @@ class Z {
|
|
|
1338
1338
|
}
|
|
1339
1339
|
this._options.signal = this.abortController.signal;
|
|
1340
1340
|
}
|
|
1341
|
-
if (
|
|
1341
|
+
if (Ct && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
|
|
1342
1342
|
const a = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), s = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, a);
|
|
1343
|
-
(
|
|
1343
|
+
(xt && 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(s, { ...this.request }), this._options);
|
|
1344
1344
|
}
|
|
1345
1345
|
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 }));
|
|
1346
1346
|
}
|
|
@@ -1371,7 +1371,7 @@ class Z {
|
|
|
1371
1371
|
} catch (n) {
|
|
1372
1372
|
const a = Math.min(this._calculateRetryDelay(n), re);
|
|
1373
1373
|
if (a !== 0 && this._retryCount > 0) {
|
|
1374
|
-
await
|
|
1374
|
+
await kt(a, { signal: this._options.signal });
|
|
1375
1375
|
for (const s of this._options.hooks.beforeRetry)
|
|
1376
1376
|
if (await s({
|
|
1377
1377
|
request: this.request,
|
|
@@ -1395,8 +1395,8 @@ class Z {
|
|
|
1395
1395
|
if (a instanceof Response)
|
|
1396
1396
|
return a;
|
|
1397
1397
|
}
|
|
1398
|
-
const t =
|
|
1399
|
-
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) :
|
|
1398
|
+
const t = Ft(this.request, this._options);
|
|
1399
|
+
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : $t(this.request.clone(), t, this.abortController, this._options);
|
|
1400
1400
|
}
|
|
1401
1401
|
/* istanbul ignore next */
|
|
1402
1402
|
_stream(t, n) {
|
|
@@ -1438,10 +1438,10 @@ const pe = (e) => {
|
|
|
1438
1438
|
for (const n of Le)
|
|
1439
1439
|
t[n] = (a, s) => Z.create(a, J(e, s, { method: n }));
|
|
1440
1440
|
return t.create = (n) => pe(J(n)), t.extend = (n) => pe(J(e, n)), t.stop = Ve, t;
|
|
1441
|
-
},
|
|
1441
|
+
}, Gt = pe(), Wt = Gt, qt = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, Re = Wt.create({ headers: qt }), we = {
|
|
1442
1442
|
get: (e, t) => Re.get(e, t).json(),
|
|
1443
1443
|
post: (e, t) => Re.post(e, t).json()
|
|
1444
|
-
}, ge = Object.values(i),
|
|
1444
|
+
}, ge = Object.values(i), jt = (e = "") => {
|
|
1445
1445
|
const t = e.toUpperCase(), [n] = t.split(".");
|
|
1446
1446
|
if (ge.includes(n))
|
|
1447
1447
|
return !0;
|
|
@@ -1469,7 +1469,7 @@ function se({
|
|
|
1469
1469
|
);
|
|
1470
1470
|
}
|
|
1471
1471
|
var U, k, de, He, ue, Oe, ee, le, $, W, te, ye;
|
|
1472
|
-
const
|
|
1472
|
+
const Kt = class $e {
|
|
1473
1473
|
constructor(t) {
|
|
1474
1474
|
V(this, U), V(this, de), V(this, ue), V(this, ee), V(this, $), V(this, te), C(this, "decimalMultiplier", 10n ** 8n), C(this, "bigIntValue", 0n), C(this, "decimal");
|
|
1475
1475
|
const n = me(t);
|
|
@@ -1659,7 +1659,7 @@ U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
|
1659
1659
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1660
1660
|
return Math.max(n, j);
|
|
1661
1661
|
};
|
|
1662
|
-
let ce =
|
|
1662
|
+
let ce = Kt;
|
|
1663
1663
|
function me(e) {
|
|
1664
1664
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1665
1665
|
}
|
|
@@ -1670,8 +1670,8 @@ const Ie = (e) => {
|
|
|
1670
1670
|
throw new Error("Static assets not loaded, call await AssetValue.loadStaticAssets() first");
|
|
1671
1671
|
return Te.get(e.toUpperCase()) || { decimal: A.THOR, identifier: "" };
|
|
1672
1672
|
}, Se = async (e, t = 0) => {
|
|
1673
|
-
|
|
1674
|
-
const n = await
|
|
1673
|
+
jt(e);
|
|
1674
|
+
const n = await ft(he(e)), a = z(t, n);
|
|
1675
1675
|
return new N({ decimal: n, value: a, identifier: e });
|
|
1676
1676
|
};
|
|
1677
1677
|
class N extends ce {
|
|
@@ -1680,7 +1680,7 @@ class N extends ce {
|
|
|
1680
1680
|
t.value instanceof ce ? t.value : { decimal: t.decimal, value: t.value }
|
|
1681
1681
|
), C(this, "address"), C(this, "chain"), C(this, "isSynthetic", !1), C(this, "isGasAsset", !1), C(this, "symbol"), C(this, "ticker"), C(this, "type");
|
|
1682
1682
|
const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a = he(n);
|
|
1683
|
-
this.type =
|
|
1683
|
+
this.type = Et(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;
|
|
1684
1684
|
}
|
|
1685
1685
|
get assetValue() {
|
|
1686
1686
|
return `${this.getValue("string")} ${this.ticker}`;
|
|
@@ -1712,7 +1712,7 @@ class N extends ce {
|
|
|
1712
1712
|
return new N({ decimal: a, identifier: s, value: r });
|
|
1713
1713
|
}
|
|
1714
1714
|
static fromChainOrSignature(t, n = 0) {
|
|
1715
|
-
const { decimal: a, identifier: s } =
|
|
1715
|
+
const { decimal: a, identifier: s } = At(t), r = z(n, a);
|
|
1716
1716
|
return new N({ value: r, decimal: a, identifier: s });
|
|
1717
1717
|
}
|
|
1718
1718
|
static async loadStaticAssets() {
|
|
@@ -1767,12 +1767,12 @@ const oe = (e) => {
|
|
|
1767
1767
|
return {
|
|
1768
1768
|
address: d == null ? void 0 : d.toLowerCase(),
|
|
1769
1769
|
chain: r,
|
|
1770
|
-
isGasAsset:
|
|
1770
|
+
isGasAsset: wt({ chain: r, symbol: o }),
|
|
1771
1771
|
isSynthetic: t,
|
|
1772
1772
|
symbol: (t ? `${n}/` : "") + (d ? `${p}-${(d == null ? void 0 : d.toLowerCase()) ?? ""}` : o),
|
|
1773
1773
|
ticker: p
|
|
1774
1774
|
};
|
|
1775
|
-
},
|
|
1775
|
+
}, Yt = {
|
|
1776
1776
|
/**
|
|
1777
1777
|
* Core
|
|
1778
1778
|
*/
|
|
@@ -1831,7 +1831,7 @@ const oe = (e) => {
|
|
|
1831
1831
|
};
|
|
1832
1832
|
class m extends Error {
|
|
1833
1833
|
constructor(t, n) {
|
|
1834
|
-
console.error(n), super(t, { cause: { code:
|
|
1834
|
+
console.error(n), super(t, { cause: { code: Yt[t], message: t } }), Object.setPrototypeOf(this, m.prototype);
|
|
1835
1835
|
}
|
|
1836
1836
|
}
|
|
1837
1837
|
class D extends ce {
|
|
@@ -1845,7 +1845,7 @@ class D extends ce {
|
|
|
1845
1845
|
});
|
|
1846
1846
|
}
|
|
1847
1847
|
}
|
|
1848
|
-
const
|
|
1848
|
+
const Xt = [
|
|
1849
1849
|
{
|
|
1850
1850
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
1851
1851
|
stateMutability: "nonpayable",
|
|
@@ -1936,7 +1936,7 @@ const Kt = [
|
|
|
1936
1936
|
type: "function"
|
|
1937
1937
|
},
|
|
1938
1938
|
{ stateMutability: "payable", type: "receive" }
|
|
1939
|
-
],
|
|
1939
|
+
], Jt = [
|
|
1940
1940
|
{
|
|
1941
1941
|
inputs: [
|
|
1942
1942
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2080,7 +2080,7 @@ const Kt = [
|
|
|
2080
2080
|
type: "function"
|
|
2081
2081
|
},
|
|
2082
2082
|
{ stateMutability: "payable", type: "receive" }
|
|
2083
|
-
],
|
|
2083
|
+
], Qt = [
|
|
2084
2084
|
{
|
|
2085
2085
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2086
2086
|
stateMutability: "nonpayable",
|
|
@@ -2185,7 +2185,7 @@ const Kt = [
|
|
|
2185
2185
|
type: "function"
|
|
2186
2186
|
},
|
|
2187
2187
|
{ stateMutability: "payable", type: "receive" }
|
|
2188
|
-
],
|
|
2188
|
+
], zt = [
|
|
2189
2189
|
{
|
|
2190
2190
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2191
2191
|
stateMutability: "nonpayable",
|
|
@@ -2276,7 +2276,7 @@ const Kt = [
|
|
|
2276
2276
|
type: "function"
|
|
2277
2277
|
},
|
|
2278
2278
|
{ stateMutability: "payable", type: "receive" }
|
|
2279
|
-
],
|
|
2279
|
+
], Zt = [
|
|
2280
2280
|
{
|
|
2281
2281
|
inputs: [
|
|
2282
2282
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2420,7 +2420,7 @@ const Kt = [
|
|
|
2420
2420
|
type: "function"
|
|
2421
2421
|
},
|
|
2422
2422
|
{ stateMutability: "payable", type: "receive" }
|
|
2423
|
-
],
|
|
2423
|
+
], en = [
|
|
2424
2424
|
{
|
|
2425
2425
|
inputs: [
|
|
2426
2426
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2539,7 +2539,7 @@ const Kt = [
|
|
|
2539
2539
|
type: "function"
|
|
2540
2540
|
},
|
|
2541
2541
|
{ stateMutability: "payable", type: "receive" }
|
|
2542
|
-
],
|
|
2542
|
+
], tn = [
|
|
2543
2543
|
{
|
|
2544
2544
|
inputs: [
|
|
2545
2545
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2658,7 +2658,7 @@ const Kt = [
|
|
|
2658
2658
|
type: "function"
|
|
2659
2659
|
},
|
|
2660
2660
|
{ stateMutability: "payable", type: "receive" }
|
|
2661
|
-
],
|
|
2661
|
+
], nn = [
|
|
2662
2662
|
{
|
|
2663
2663
|
inputs: [
|
|
2664
2664
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2777,7 +2777,7 @@ const Kt = [
|
|
|
2777
2777
|
type: "function"
|
|
2778
2778
|
},
|
|
2779
2779
|
{ stateMutability: "payable", type: "receive" }
|
|
2780
|
-
],
|
|
2780
|
+
], an = [
|
|
2781
2781
|
{
|
|
2782
2782
|
inputs: [
|
|
2783
2783
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2896,7 +2896,7 @@ const Kt = [
|
|
|
2896
2896
|
type: "function"
|
|
2897
2897
|
},
|
|
2898
2898
|
{ stateMutability: "payable", type: "receive" }
|
|
2899
|
-
],
|
|
2899
|
+
], sn = [
|
|
2900
2900
|
{
|
|
2901
2901
|
inputs: [
|
|
2902
2902
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3023,7 +3023,7 @@ const Kt = [
|
|
|
3023
3023
|
type: "function"
|
|
3024
3024
|
},
|
|
3025
3025
|
{ stateMutability: "payable", type: "receive" }
|
|
3026
|
-
],
|
|
3026
|
+
], rn = [
|
|
3027
3027
|
{
|
|
3028
3028
|
inputs: [
|
|
3029
3029
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3150,7 +3150,7 @@ const Kt = [
|
|
|
3150
3150
|
type: "function"
|
|
3151
3151
|
},
|
|
3152
3152
|
{ stateMutability: "payable", type: "receive" }
|
|
3153
|
-
],
|
|
3153
|
+
], on = [
|
|
3154
3154
|
{
|
|
3155
3155
|
inputs: [
|
|
3156
3156
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3277,7 +3277,7 @@ const Kt = [
|
|
|
3277
3277
|
type: "function"
|
|
3278
3278
|
},
|
|
3279
3279
|
{ stateMutability: "payable", type: "receive" }
|
|
3280
|
-
],
|
|
3280
|
+
], pn = [
|
|
3281
3281
|
{
|
|
3282
3282
|
inputs: [
|
|
3283
3283
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3404,7 +3404,7 @@ const Kt = [
|
|
|
3404
3404
|
type: "function"
|
|
3405
3405
|
},
|
|
3406
3406
|
{ stateMutability: "payable", type: "receive" }
|
|
3407
|
-
],
|
|
3407
|
+
], dn = [
|
|
3408
3408
|
{
|
|
3409
3409
|
inputs: [
|
|
3410
3410
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3532,26 +3532,26 @@ const Kt = [
|
|
|
3532
3532
|
},
|
|
3533
3533
|
{ stateMutability: "payable", type: "receive" }
|
|
3534
3534
|
], ke = {
|
|
3535
|
-
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]:
|
|
3536
|
-
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]:
|
|
3537
|
-
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]:
|
|
3538
|
-
},
|
|
3535
|
+
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: Xt,
|
|
3536
|
+
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: Qt,
|
|
3537
|
+
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: zt
|
|
3538
|
+
}, un = {
|
|
3539
3539
|
...ke,
|
|
3540
3540
|
// AVAX
|
|
3541
|
-
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]:
|
|
3542
|
-
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]:
|
|
3543
|
-
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]:
|
|
3541
|
+
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: en,
|
|
3542
|
+
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: Jt,
|
|
3543
|
+
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: nn,
|
|
3544
3544
|
// BSC
|
|
3545
|
-
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]:
|
|
3545
|
+
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: Zt,
|
|
3546
3546
|
// ETH
|
|
3547
|
-
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]:
|
|
3548
|
-
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]:
|
|
3549
|
-
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]:
|
|
3550
|
-
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]:
|
|
3551
|
-
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]:
|
|
3552
|
-
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]:
|
|
3553
|
-
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]:
|
|
3554
|
-
},
|
|
3547
|
+
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: tn,
|
|
3548
|
+
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: an,
|
|
3549
|
+
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: sn,
|
|
3550
|
+
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: rn,
|
|
3551
|
+
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: on,
|
|
3552
|
+
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: pn,
|
|
3553
|
+
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: dn
|
|
3554
|
+
}, ln = ({
|
|
3555
3555
|
streamSwap: e,
|
|
3556
3556
|
contractAddress: t,
|
|
3557
3557
|
recipient: n,
|
|
@@ -3592,7 +3592,7 @@ const Kt = [
|
|
|
3592
3592
|
s
|
|
3593
3593
|
], Fe = O ? [a(y), o, p] : [r, p];
|
|
3594
3594
|
return [...P, ...Fe];
|
|
3595
|
-
},
|
|
3595
|
+
}, yn = ({ chain: e, txHash: t }) => {
|
|
3596
3596
|
const n = xe[e];
|
|
3597
3597
|
switch (e) {
|
|
3598
3598
|
case i.Binance:
|
|
@@ -3618,7 +3618,7 @@ const Kt = [
|
|
|
3618
3618
|
default:
|
|
3619
3619
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3620
3620
|
}
|
|
3621
|
-
},
|
|
3621
|
+
}, cn = ({ chain: e, address: t }) => {
|
|
3622
3622
|
const n = xe[e];
|
|
3623
3623
|
switch (e) {
|
|
3624
3624
|
case i.Arbitrum:
|
|
@@ -3642,10 +3642,10 @@ const Kt = [
|
|
|
3642
3642
|
default:
|
|
3643
3643
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3644
3644
|
}
|
|
3645
|
-
},
|
|
3645
|
+
}, mn = (e) => {
|
|
3646
3646
|
const t = e ? q.ThornodeStagenet : q.ThornodeMainnet;
|
|
3647
3647
|
return we.get(`${t}/thorchain/inbound_addresses`);
|
|
3648
|
-
},
|
|
3648
|
+
}, Tn = (e) => {
|
|
3649
3649
|
const t = e ? q.ThornodeStagenet : q.ThornodeMainnet;
|
|
3650
3650
|
return we.get(`${t}/thorchain/mimir`);
|
|
3651
3651
|
}, ve = () => Object.values(i).reduce(
|
|
@@ -3653,7 +3653,7 @@ const Kt = [
|
|
|
3653
3653
|
{}
|
|
3654
3654
|
);
|
|
3655
3655
|
var L, ne, K, M, Y, X;
|
|
3656
|
-
class
|
|
3656
|
+
class Bn {
|
|
3657
3657
|
constructor({ stagenet: t } = {}) {
|
|
3658
3658
|
T(this, "connectedChains", ve());
|
|
3659
3659
|
T(this, "connectedWallets", ve());
|
|
@@ -3662,9 +3662,9 @@ class Pn {
|
|
|
3662
3662
|
var n;
|
|
3663
3663
|
return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
|
|
3664
3664
|
});
|
|
3665
|
-
T(this, "getExplorerTxUrl", (t, n) =>
|
|
3665
|
+
T(this, "getExplorerTxUrl", (t, n) => yn({ chain: t, txHash: n }));
|
|
3666
3666
|
T(this, "getWallet", (t) => this.connectedWallets[t]);
|
|
3667
|
-
T(this, "getExplorerAddressUrl", (t, n) =>
|
|
3667
|
+
T(this, "getExplorerAddressUrl", (t, n) => cn({ chain: t, address: n }));
|
|
3668
3668
|
T(this, "getBalance", async (t, n) => {
|
|
3669
3669
|
const a = await this.getWalletByChain(t, n);
|
|
3670
3670
|
return (a == null ? void 0 : a.balance) || [];
|
|
@@ -3685,7 +3685,7 @@ class Pn {
|
|
|
3685
3685
|
data: c,
|
|
3686
3686
|
from: _,
|
|
3687
3687
|
to: b.toLowerCase(),
|
|
3688
|
-
chainId: BigInt(
|
|
3688
|
+
chainId: BigInt(ot[o]),
|
|
3689
3689
|
value: w ? BigInt(w) : 0n
|
|
3690
3690
|
};
|
|
3691
3691
|
return y.sendTransaction(E, s);
|
|
@@ -3716,11 +3716,11 @@ class Pn {
|
|
|
3716
3716
|
const c = this.connectedWallets[o], _ = this.getAddress(o);
|
|
3717
3717
|
if (!(c != null && c.sendTransaction) || !_)
|
|
3718
3718
|
throw new m("core_wallet_connection_not_found");
|
|
3719
|
-
const { getProvider: b, toChecksumAddress: w } = await import("@swapkit/toolbox-evm"), E = b(o), O =
|
|
3719
|
+
const { getProvider: b, toChecksumAddress: w } = await import("@swapkit/toolbox-evm"), E = b(o), O = un[u.toLowerCase()];
|
|
3720
3720
|
if (!O)
|
|
3721
3721
|
throw new m("core_swap_contract_not_supported", { contractAddress: u });
|
|
3722
3722
|
const S = await (await ((d = c.createContract) == null ? void 0 : d.call(c, u, O, E))).getFunction("swapIn").populateTransaction(
|
|
3723
|
-
...
|
|
3723
|
+
...ln({
|
|
3724
3724
|
streamSwap: t,
|
|
3725
3725
|
toChecksumAddress: w,
|
|
3726
3726
|
contractAddress: u,
|
|
@@ -4036,7 +4036,7 @@ class Pn {
|
|
|
4036
4036
|
halted: !1,
|
|
4037
4037
|
chain: i.THORChain
|
|
4038
4038
|
};
|
|
4039
|
-
const a = (await
|
|
4039
|
+
const a = (await mn(this.stagenet)).find((s) => s.chain === t);
|
|
4040
4040
|
if (!a)
|
|
4041
4041
|
throw new m("core_inbound_data_not_found");
|
|
4042
4042
|
if (a != null && a.halted)
|
|
@@ -4077,7 +4077,7 @@ class Pn {
|
|
|
4077
4077
|
gas_rate: s,
|
|
4078
4078
|
router: r,
|
|
4079
4079
|
address: o
|
|
4080
|
-
} = await f(this, L).call(this, t.chain), p = (parseInt(s) || 0) *
|
|
4080
|
+
} = await f(this, L).call(this, t.chain), p = (parseInt(s) || 0) * bt[a];
|
|
4081
4081
|
return this.deposit({
|
|
4082
4082
|
assetValue: t,
|
|
4083
4083
|
recipient: o,
|
|
@@ -4087,7 +4087,7 @@ class Pn {
|
|
|
4087
4087
|
});
|
|
4088
4088
|
});
|
|
4089
4089
|
B(this, Y, async ({ memo: t, assetValue: n }) => {
|
|
4090
|
-
const a = await
|
|
4090
|
+
const a = await Tn(this.stagenet);
|
|
4091
4091
|
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
4092
4092
|
throw new m("core_chain_halted");
|
|
4093
4093
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
@@ -4104,63 +4104,63 @@ class Pn {
|
|
|
4104
4104
|
L = new WeakMap(), ne = new WeakMap(), K = new WeakMap(), M = new WeakMap(), Y = new WeakMap(), X = new WeakMap();
|
|
4105
4105
|
export {
|
|
4106
4106
|
ze as AGG_SWAP,
|
|
4107
|
-
|
|
4107
|
+
fn as ApiError,
|
|
4108
4108
|
q as ApiUrl,
|
|
4109
4109
|
N as AssetValue,
|
|
4110
4110
|
A as BaseDecimal,
|
|
4111
4111
|
ce as BigIntArithmetics,
|
|
4112
4112
|
i as Chain,
|
|
4113
4113
|
_e as ChainId,
|
|
4114
|
-
|
|
4115
|
-
|
|
4114
|
+
gn as ChainIdToChain,
|
|
4115
|
+
ot as ChainToChainId,
|
|
4116
4116
|
xe as ChainToExplorerUrl,
|
|
4117
|
-
|
|
4118
|
-
|
|
4117
|
+
Rn as ChainToHexChainId,
|
|
4118
|
+
pt as ChainToRPC,
|
|
4119
4119
|
at as ContractAddress,
|
|
4120
|
-
|
|
4120
|
+
An as CosmosChainList,
|
|
4121
4121
|
st as DerivationPath,
|
|
4122
4122
|
l as ERROR_CODE,
|
|
4123
4123
|
tt as ERROR_MODULE,
|
|
4124
4124
|
Ce as ERROR_TYPE,
|
|
4125
|
-
|
|
4126
|
-
|
|
4125
|
+
it as EVMChainList,
|
|
4126
|
+
dt as ErrorCode,
|
|
4127
4127
|
F as FeeOption,
|
|
4128
4128
|
h as MemoType,
|
|
4129
|
-
|
|
4129
|
+
bn as NetworkDerivationPath,
|
|
4130
4130
|
Qe as QuoteMode,
|
|
4131
4131
|
Ne as RPCUrl,
|
|
4132
4132
|
we as RequestClient,
|
|
4133
4133
|
Ze as SWAP_IN,
|
|
4134
4134
|
et as SWAP_OUT,
|
|
4135
|
-
|
|
4135
|
+
Bn as SwapKitCore,
|
|
4136
4136
|
m as SwapKitError,
|
|
4137
4137
|
D as SwapKitNumber,
|
|
4138
4138
|
Xe as TCAvalancheDepositABI,
|
|
4139
4139
|
Je as TCBscDepositABI,
|
|
4140
4140
|
Ye as TCEthereumVaultAbi,
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4141
|
+
En as TCSupportedChainList,
|
|
4142
|
+
wn as UTXOChainList,
|
|
4143
|
+
ut as WalletOption,
|
|
4144
|
+
On as assetFromString,
|
|
4145
|
+
Pn as derivationPathToString,
|
|
4146
|
+
_n as erc20ABI,
|
|
4147
|
+
In as filterAssets,
|
|
4148
4148
|
se as formatBigIntToSafeValue,
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4149
|
+
bt as gasFeeMultiplier,
|
|
4150
|
+
Et as getAssetType,
|
|
4151
|
+
It as getAsymmetricAssetShare,
|
|
4152
|
+
vn as getAsymmetricAssetWithdrawAmount,
|
|
4153
|
+
Ot as getAsymmetricRuneShare,
|
|
4154
|
+
Sn as getAsymmetricRuneWithdrawAmount,
|
|
4155
|
+
At as getCommonAssetInfo,
|
|
4156
|
+
ft as getDecimal,
|
|
4157
|
+
Mn as getEstimatedPoolShare,
|
|
4158
|
+
Nn as getLiquiditySlippage,
|
|
4159
4159
|
x as getMemoFor,
|
|
4160
4160
|
oe as getMinAmountByChain,
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4161
|
+
St as getSymmetricPoolShare,
|
|
4162
|
+
Cn as getSymmetricWithdraw,
|
|
4163
|
+
xn as getTHORNameCost,
|
|
4164
|
+
wt as isGasAsset,
|
|
4165
|
+
Dn as validateTHORName
|
|
4166
4166
|
};
|