@swapkit/core 1.0.0-rc.110 → 1.0.0-rc.111
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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +589 -555
- package/dist/index.es.js.map +1 -1
- package/package.json +13 -13
- package/src/client/old.ts +38 -5
- package/src/helpers/mayanode.ts +31 -0
- package/src/helpers/thornode.ts +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var bt = Object.defineProperty;
|
|
2
|
+
var ft = (e, t, n) => t in e ? bt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var m = (e, t, n) => (ft(e, typeof t != "symbol" ? t + "" : t, n), n), ht = (e, t, n) => {
|
|
4
4
|
if (!t.has(e))
|
|
5
5
|
throw TypeError("Cannot " + n);
|
|
6
6
|
};
|
|
7
|
-
var
|
|
7
|
+
var A = (e, t, n) => (ht(e, t, "read from private field"), n ? n.call(e) : t.get(e)), V = (e, t, n) => {
|
|
8
8
|
if (t.has(e))
|
|
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
|
-
const
|
|
12
|
+
const Jn = [
|
|
13
13
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
14
14
|
{
|
|
15
15
|
anonymous: !1,
|
|
@@ -107,7 +107,7 @@ const Qn = [
|
|
|
107
107
|
stateMutability: "nonpayable",
|
|
108
108
|
type: "function"
|
|
109
109
|
}
|
|
110
|
-
],
|
|
110
|
+
], wt = [
|
|
111
111
|
{
|
|
112
112
|
inputs: [{ internalType: "address", name: "rune", type: "address" }],
|
|
113
113
|
stateMutability: "nonpayable",
|
|
@@ -282,7 +282,7 @@ const Qn = [
|
|
|
282
282
|
stateMutability: "view",
|
|
283
283
|
type: "function"
|
|
284
284
|
}
|
|
285
|
-
],
|
|
285
|
+
], At = [
|
|
286
286
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
287
287
|
{
|
|
288
288
|
anonymous: !1,
|
|
@@ -446,7 +446,7 @@ const Qn = [
|
|
|
446
446
|
stateMutability: "view",
|
|
447
447
|
type: "function"
|
|
448
448
|
}
|
|
449
|
-
],
|
|
449
|
+
], gt = [
|
|
450
450
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
451
451
|
{
|
|
452
452
|
anonymous: !1,
|
|
@@ -599,13 +599,13 @@ const Qn = [
|
|
|
599
599
|
type: "function"
|
|
600
600
|
}
|
|
601
601
|
];
|
|
602
|
-
var
|
|
603
|
-
const
|
|
602
|
+
var _t = /* @__PURE__ */ ((e) => (e.TC_SUPPORTED_TO_TC_SUPPORTED = "TC-TC", e.TC_SUPPORTED_TO_ETH = "TC-ERC20", e.TC_SUPPORTED_TO_AVAX = "TC-ARC20", e.TC_SUPPORTED_TO_BSC = "TC-BEP20", e.ETH_TO_TC_SUPPORTED = "ERC20-TC", e.ETH_TO_ETH = "ERC20-ERC20", e.ETH_TO_AVAX = "ERC20-ARC20", e.ETH_TO_BSC = "ERC20-BEP20", e.AVAX_TO_TC_SUPPORTED = "ARC20-TC", e.AVAX_TO_ETH = "ARC20-ERC20", e.AVAX_TO_AVAX = "ARC20-ARC20", e.AVAX_TO_BSC = "ARC20-BEP20", e.BSC_TO_TC_SUPPORTED = "BEP20-TC", e.BSC_TO_ETH = "BEP20-ERC20", e.BSC_TO_AVAX = "BEP20-ARC20", e.BSC_TO_BSC = "BEP20-BEP20", e))(_t || {});
|
|
603
|
+
const Mt = [
|
|
604
604
|
"ERC20-ERC20",
|
|
605
605
|
"ARC20-ARC20",
|
|
606
606
|
"BEP20-BEP20"
|
|
607
607
|
/* BSC_TO_BSC */
|
|
608
|
-
],
|
|
608
|
+
], vt = [
|
|
609
609
|
"ERC20-TC",
|
|
610
610
|
"ERC20-ARC20",
|
|
611
611
|
"ERC20-BEP20",
|
|
@@ -616,15 +616,15 @@ const _t = [
|
|
|
616
616
|
"BEP20-ERC20",
|
|
617
617
|
"BEP20-ARC20"
|
|
618
618
|
/* BSC_TO_AVAX */
|
|
619
|
-
],
|
|
619
|
+
], Et = [
|
|
620
620
|
"TC-TC",
|
|
621
621
|
"TC-ERC20",
|
|
622
622
|
"TC-ARC20",
|
|
623
623
|
"TC-BEP20"
|
|
624
624
|
/* TC_SUPPORTED_TO_BSC */
|
|
625
625
|
];
|
|
626
|
-
var r = /* @__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))(r || {}),
|
|
627
|
-
const
|
|
626
|
+
var r = /* @__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))(r || {}), Ct = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(Ct || {}), Ot = /* @__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.DASH = "m/44'/5'/0'/0", e.DOGE = "m/44'/3'/0'/0", e.DOT = "////", e.ETH = "m/44'/60'/0'/0", e.FLIP = "////", 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))(Ot || {});
|
|
627
|
+
const Zn = {
|
|
628
628
|
ARB: [44, 60, 0, 0, 0],
|
|
629
629
|
AVAX: [44, 60, 0, 0, 0],
|
|
630
630
|
BCH: [44, 145, 0, 0, 0],
|
|
@@ -645,8 +645,8 @@ const Yn = {
|
|
|
645
645
|
DOT: [0, 0, 0, 0, 0],
|
|
646
646
|
FLIP: [0, 0, 0, 0, 0]
|
|
647
647
|
};
|
|
648
|
-
var
|
|
649
|
-
const
|
|
648
|
+
var g = /* @__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.DOT = 10] = "DOT", e[e.ETH = 18] = "ETH", e[e.FLIP = 18] = "FLIP", 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[e.ZEC = 8] = "ZEC", e))(g || {});
|
|
649
|
+
const zn = [
|
|
650
650
|
"DOT",
|
|
651
651
|
"FLIP"
|
|
652
652
|
/* Chainflip */
|
|
@@ -658,19 +658,21 @@ const Jn = [
|
|
|
658
658
|
"OP",
|
|
659
659
|
"MATIC"
|
|
660
660
|
/* Polygon */
|
|
661
|
-
],
|
|
661
|
+
], ea = je, xt = [
|
|
662
662
|
"BTC",
|
|
663
663
|
"BCH",
|
|
664
664
|
"DASH",
|
|
665
665
|
"DOGE",
|
|
666
666
|
"LTC"
|
|
667
667
|
/* Litecoin */
|
|
668
|
-
],
|
|
668
|
+
], ta = xt, kt = [
|
|
669
669
|
"GAIA",
|
|
670
670
|
"THOR",
|
|
671
|
-
"BNB"
|
|
672
|
-
|
|
673
|
-
|
|
671
|
+
"BNB",
|
|
672
|
+
"MAYA",
|
|
673
|
+
"KUJI"
|
|
674
|
+
/* Kujira */
|
|
675
|
+
], na = kt, St = [
|
|
674
676
|
"AVAX",
|
|
675
677
|
"BNB",
|
|
676
678
|
"BSC",
|
|
@@ -682,27 +684,27 @@ const Jn = [
|
|
|
682
684
|
"LTC",
|
|
683
685
|
"THOR"
|
|
684
686
|
/* THORChain */
|
|
685
|
-
],
|
|
686
|
-
var
|
|
687
|
-
const
|
|
687
|
+
], aa = St;
|
|
688
|
+
var Re = /* @__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))(Re || {}), Ke = /* @__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))(Ke || {}), U = /* @__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))(U || {});
|
|
689
|
+
const ce = Object.values(r), Rt = Object.keys(r), Ie = ce.reduce(
|
|
688
690
|
(e, t) => {
|
|
689
|
-
const n =
|
|
691
|
+
const n = Rt.find((a) => r[a] === t);
|
|
690
692
|
return n && (e[t] = n), e;
|
|
691
693
|
},
|
|
692
694
|
{}
|
|
693
|
-
),
|
|
694
|
-
(e, t) => (e[t] =
|
|
695
|
+
), Qe = ce.reduce(
|
|
696
|
+
(e, t) => (e[t] = Re[Ie[t]], e),
|
|
695
697
|
{}
|
|
696
|
-
),
|
|
697
|
-
(e, t) => (e[t] =
|
|
698
|
+
), It = ce.reduce(
|
|
699
|
+
(e, t) => (e[t] = Ke[Ie[t]], e),
|
|
698
700
|
{}
|
|
699
|
-
),
|
|
701
|
+
), ia = ce.reduce(
|
|
700
702
|
(e, t) => {
|
|
701
|
-
const n = `${
|
|
702
|
-
return e[t] =
|
|
703
|
+
const n = `${Ie[t]}Hex`;
|
|
704
|
+
return e[t] = Re[n], e;
|
|
703
705
|
},
|
|
704
706
|
{}
|
|
705
|
-
),
|
|
707
|
+
), sa = {
|
|
706
708
|
"0xa4b1": "ARB",
|
|
707
709
|
42161: "ARB",
|
|
708
710
|
"0xa86a": "AVAX",
|
|
@@ -730,7 +732,7 @@ const Te = Object.values(r), St = Object.keys(r), Re = Te.reduce(
|
|
|
730
732
|
"thorchain-stagenet-v2": "THOR",
|
|
731
733
|
"thorchain-mainnet-v1": "THOR"
|
|
732
734
|
/* THORChain */
|
|
733
|
-
},
|
|
735
|
+
}, Ye = {
|
|
734
736
|
ARB: "https://arbiscan.io",
|
|
735
737
|
AVAX: "https://snowtrace.io",
|
|
736
738
|
BSC: "https://bscscan.com",
|
|
@@ -750,37 +752,37 @@ const Te = Object.values(r), St = Object.keys(r), Re = Te.reduce(
|
|
|
750
752
|
MATIC: "https://polygonscan.com",
|
|
751
753
|
THOR: "https://runescan.io"
|
|
752
754
|
};
|
|
753
|
-
var w = /* @__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))(w || {}),
|
|
755
|
+
var w = /* @__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))(w || {}), Y = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(Y || {}), Bt = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", e.KEEPKEY = "KEEPKEY", 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))(Bt || {}), Pt = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e[e.LockedDevice = 21781] = "LockedDevice", e[e.TC_NotFound = 65535] = "TC_NotFound", e))(Pt || {}), Ht = Object.defineProperty, Dt = (e, t, n) => t in e ? Ht(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, P = (e, t, n) => (Dt(e, typeof t != "symbol" ? t + "" : t, n), n), Ft = (e, t, n) => {
|
|
754
756
|
if (!t.has(e))
|
|
755
757
|
throw TypeError("Cannot " + n);
|
|
756
|
-
},
|
|
758
|
+
}, Z = (e, t, n) => {
|
|
757
759
|
if (t.has(e))
|
|
758
760
|
throw TypeError("Cannot add the same private member more than once");
|
|
759
761
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
760
|
-
}, C = (e, t, n) => (Ft(e, t, "access private method"), n),
|
|
761
|
-
const
|
|
762
|
+
}, C = (e, t, n) => (Ft(e, t, "access private method"), n), be = /* @__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))(be || {}), Be = /* @__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))(Be || {}), Je = /* @__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))(Je || {}), N = /* @__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))(N || {});
|
|
763
|
+
const fe = Object.values(be), Lt = Object.keys(be), Pe = fe.reduce(
|
|
762
764
|
(e, t) => {
|
|
763
|
-
const n =
|
|
765
|
+
const n = Lt.find((a) => be[a] === t);
|
|
764
766
|
return n && (e[t] = n), e;
|
|
765
767
|
},
|
|
766
768
|
{}
|
|
767
769
|
);
|
|
768
|
-
|
|
769
|
-
(e, t) => (e[t] = Be[
|
|
770
|
+
fe.reduce(
|
|
771
|
+
(e, t) => (e[t] = Be[Pe[t]], e),
|
|
770
772
|
{}
|
|
771
773
|
);
|
|
772
|
-
|
|
773
|
-
(e, t) => (e[t] =
|
|
774
|
+
fe.reduce(
|
|
775
|
+
(e, t) => (e[t] = Je[Pe[t]], e),
|
|
774
776
|
{}
|
|
775
777
|
);
|
|
776
|
-
|
|
778
|
+
fe.reduce(
|
|
777
779
|
(e, t) => {
|
|
778
|
-
const n = `${
|
|
780
|
+
const n = `${Pe[t]}Hex`;
|
|
779
781
|
return e[t] = Be[n], e;
|
|
780
782
|
},
|
|
781
783
|
{}
|
|
782
784
|
);
|
|
783
|
-
class
|
|
785
|
+
class Ve extends Error {
|
|
784
786
|
constructor(t, n, a) {
|
|
785
787
|
const i = t.status || t.status === 0 ? t.status : "", s = t.statusText || "", p = `${i} ${s}`.trim(), u = p ? `status code ${p}` : "an unknown error";
|
|
786
788
|
super(`Request failed with ${u}`), Object.defineProperty(this, "response", {
|
|
@@ -801,7 +803,7 @@ class Le extends Error {
|
|
|
801
803
|
}), this.name = "HTTPError", this.response = t, this.request = n, this.options = a;
|
|
802
804
|
}
|
|
803
805
|
}
|
|
804
|
-
class
|
|
806
|
+
class Ze extends Error {
|
|
805
807
|
constructor(t) {
|
|
806
808
|
super("Request timed out"), Object.defineProperty(this, "request", {
|
|
807
809
|
enumerable: !0,
|
|
@@ -815,24 +817,24 @@ const pe = (e) => e !== null && typeof e == "object", re = (...e) => {
|
|
|
815
817
|
for (const t of e)
|
|
816
818
|
if ((!pe(t) || Array.isArray(t)) && t !== void 0)
|
|
817
819
|
throw new TypeError("The `options` argument must be an object");
|
|
818
|
-
return
|
|
819
|
-
},
|
|
820
|
+
return He({}, ...e);
|
|
821
|
+
}, ze = (e = {}, t = {}) => {
|
|
820
822
|
const n = new globalThis.Headers(e), a = t instanceof globalThis.Headers, i = new globalThis.Headers(t);
|
|
821
823
|
for (const [s, p] of i.entries())
|
|
822
824
|
a && p === "undefined" || p === void 0 ? n.delete(s) : n.set(s, p);
|
|
823
825
|
return n;
|
|
824
|
-
},
|
|
826
|
+
}, He = (...e) => {
|
|
825
827
|
let t = {}, n = {};
|
|
826
828
|
for (const a of e)
|
|
827
829
|
if (Array.isArray(a))
|
|
828
830
|
Array.isArray(t) || (t = []), t = [...t, ...a];
|
|
829
831
|
else if (pe(a)) {
|
|
830
832
|
for (let [i, s] of Object.entries(a))
|
|
831
|
-
pe(s) && i in t && (s =
|
|
832
|
-
pe(a.headers) && (n =
|
|
833
|
+
pe(s) && i in t && (s = He(t[i], s)), t = { ...t, [i]: s };
|
|
834
|
+
pe(a.headers) && (n = ze(n, a.headers), t.headers = n);
|
|
833
835
|
}
|
|
834
836
|
return t;
|
|
835
|
-
},
|
|
837
|
+
}, Vt = (() => {
|
|
836
838
|
let e = !1, t = !1;
|
|
837
839
|
const n = typeof globalThis.ReadableStream == "function", a = typeof globalThis.Request == "function";
|
|
838
840
|
return n && a && (t = new globalThis.Request("https://empty.invalid", {
|
|
@@ -843,13 +845,13 @@ const pe = (e) => e !== null && typeof e == "object", re = (...e) => {
|
|
|
843
845
|
return e = !0, "half";
|
|
844
846
|
}
|
|
845
847
|
}).headers.has("Content-Type")), e && !t;
|
|
846
|
-
})(),
|
|
848
|
+
})(), Nt = typeof globalThis.AbortController == "function", qt = typeof globalThis.ReadableStream == "function", Wt = typeof globalThis.FormData == "function", et = ["get", "post", "put", "patch", "head", "delete"], $t = {
|
|
847
849
|
json: "application/json",
|
|
848
850
|
text: "text/*",
|
|
849
851
|
formData: "multipart/form-data",
|
|
850
852
|
arrayBuffer: "*/*",
|
|
851
853
|
blob: "*/*"
|
|
852
|
-
},
|
|
854
|
+
}, Ae = 2147483647, tt = Symbol("stop"), Ut = {
|
|
853
855
|
json: !0,
|
|
854
856
|
parseJson: !0,
|
|
855
857
|
searchParams: !0,
|
|
@@ -860,7 +862,7 @@ const pe = (e) => e !== null && typeof e == "object", re = (...e) => {
|
|
|
860
862
|
throwHttpErrors: !0,
|
|
861
863
|
onDownloadProgress: !0,
|
|
862
864
|
fetch: !0
|
|
863
|
-
},
|
|
865
|
+
}, Xt = {
|
|
864
866
|
method: !0,
|
|
865
867
|
headers: !0,
|
|
866
868
|
body: !0,
|
|
@@ -876,18 +878,18 @@ const pe = (e) => e !== null && typeof e == "object", re = (...e) => {
|
|
|
876
878
|
window: !0,
|
|
877
879
|
dispatcher: !0,
|
|
878
880
|
duplex: !0
|
|
879
|
-
},
|
|
881
|
+
}, Gt = (e) => et.includes(e) ? e.toUpperCase() : e, jt = ["get", "put", "head", "delete", "options", "trace"], Kt = [408, 413, 429, 500, 502, 503, 504], nt = [413, 429, 503], Ne = {
|
|
880
882
|
limit: 2,
|
|
881
883
|
methods: jt,
|
|
882
|
-
statusCodes:
|
|
883
|
-
afterStatusCodes:
|
|
884
|
+
statusCodes: Kt,
|
|
885
|
+
afterStatusCodes: nt,
|
|
884
886
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
885
887
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
886
888
|
delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
|
|
887
|
-
},
|
|
889
|
+
}, Qt = (e = {}) => {
|
|
888
890
|
if (typeof e == "number")
|
|
889
891
|
return {
|
|
890
|
-
...
|
|
892
|
+
...Ne,
|
|
891
893
|
limit: e
|
|
892
894
|
};
|
|
893
895
|
if (e.methods && !Array.isArray(e.methods))
|
|
@@ -895,22 +897,22 @@ const pe = (e) => e !== null && typeof e == "object", re = (...e) => {
|
|
|
895
897
|
if (e.statusCodes && !Array.isArray(e.statusCodes))
|
|
896
898
|
throw new Error("retry.statusCodes must be an array");
|
|
897
899
|
return {
|
|
898
|
-
...
|
|
900
|
+
...Ne,
|
|
899
901
|
...e,
|
|
900
|
-
afterStatusCodes:
|
|
902
|
+
afterStatusCodes: nt
|
|
901
903
|
};
|
|
902
904
|
};
|
|
903
|
-
async function
|
|
905
|
+
async function Yt(e, t, n, a) {
|
|
904
906
|
return new Promise((i, s) => {
|
|
905
907
|
const p = setTimeout(() => {
|
|
906
|
-
n && n.abort(), s(new
|
|
908
|
+
n && n.abort(), s(new Ze(e));
|
|
907
909
|
}, a.timeout);
|
|
908
910
|
a.fetch(e, t).then(i).catch(s).then(() => {
|
|
909
911
|
clearTimeout(p);
|
|
910
912
|
});
|
|
911
913
|
});
|
|
912
914
|
}
|
|
913
|
-
async function
|
|
915
|
+
async function Jt(e, { signal: t }) {
|
|
914
916
|
return new Promise((n, a) => {
|
|
915
917
|
t && (t.throwIfAborted(), t.addEventListener("abort", i, { once: !0 }));
|
|
916
918
|
function i() {
|
|
@@ -921,17 +923,17 @@ async function Yt(e, { signal: t }) {
|
|
|
921
923
|
}, e);
|
|
922
924
|
});
|
|
923
925
|
}
|
|
924
|
-
const
|
|
926
|
+
const Zt = (e, t) => {
|
|
925
927
|
const n = {};
|
|
926
928
|
for (const a in t)
|
|
927
|
-
!(a in
|
|
929
|
+
!(a in Xt) && !(a in Ut) && !(a in e) && (n[a] = t[a]);
|
|
928
930
|
return n;
|
|
929
931
|
};
|
|
930
932
|
class oe {
|
|
931
933
|
static create(t, n) {
|
|
932
934
|
const a = new oe(t, n), i = async () => {
|
|
933
|
-
if (typeof a._options.timeout == "number" && a._options.timeout >
|
|
934
|
-
throw new RangeError(`The \`timeout\` option cannot be greater than ${
|
|
935
|
+
if (typeof a._options.timeout == "number" && a._options.timeout > Ae)
|
|
936
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${Ae}`);
|
|
935
937
|
await Promise.resolve();
|
|
936
938
|
let p = await a._fetch();
|
|
937
939
|
for (const u of a._options.hooks.afterResponse) {
|
|
@@ -939,7 +941,7 @@ class oe {
|
|
|
939
941
|
y instanceof globalThis.Response && (p = y);
|
|
940
942
|
}
|
|
941
943
|
if (a._decorateResponse(p), !p.ok && a._options.throwHttpErrors) {
|
|
942
|
-
let u = new
|
|
944
|
+
let u = new Ve(p, a.request, a._options);
|
|
943
945
|
for (const y of a._options.hooks.beforeError)
|
|
944
946
|
u = await y(u);
|
|
945
947
|
throw u;
|
|
@@ -953,7 +955,7 @@ class oe {
|
|
|
953
955
|
}
|
|
954
956
|
return p;
|
|
955
957
|
}, s = a._options.retry.methods.includes(a.request.method.toLowerCase()) ? a._retry(i) : i();
|
|
956
|
-
for (const [p, u] of Object.entries(
|
|
958
|
+
for (const [p, u] of Object.entries($t))
|
|
957
959
|
s[p] = async () => {
|
|
958
960
|
a.request.headers.set("accept", a.request.headers.get("accept") || u);
|
|
959
961
|
const y = (await s).clone();
|
|
@@ -998,17 +1000,17 @@ class oe {
|
|
|
998
1000
|
// TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
|
|
999
1001
|
credentials: this._input.credentials || "same-origin",
|
|
1000
1002
|
...n,
|
|
1001
|
-
headers:
|
|
1002
|
-
hooks:
|
|
1003
|
+
headers: ze(this._input.headers, n.headers),
|
|
1004
|
+
hooks: He({
|
|
1003
1005
|
beforeRequest: [],
|
|
1004
1006
|
beforeRetry: [],
|
|
1005
1007
|
beforeError: [],
|
|
1006
1008
|
afterResponse: []
|
|
1007
1009
|
}, n.hooks),
|
|
1008
|
-
method:
|
|
1010
|
+
method: Gt(n.method ?? this._input.method),
|
|
1009
1011
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
1010
1012
|
prefixUrl: String(n.prefixUrl || ""),
|
|
1011
|
-
retry:
|
|
1013
|
+
retry: Qt(n.retry),
|
|
1012
1014
|
throwHttpErrors: n.throwHttpErrors !== !1,
|
|
1013
1015
|
timeout: n.timeout ?? 1e4,
|
|
1014
1016
|
fetch: n.fetch ?? globalThis.fetch.bind(globalThis)
|
|
@@ -1019,7 +1021,7 @@ class oe {
|
|
|
1019
1021
|
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
1020
1022
|
this._options.prefixUrl.endsWith("/") || (this._options.prefixUrl += "/"), this._input = this._options.prefixUrl + this._input;
|
|
1021
1023
|
}
|
|
1022
|
-
if (
|
|
1024
|
+
if (Nt) {
|
|
1023
1025
|
if (this.abortController = new globalThis.AbortController(), this._options.signal) {
|
|
1024
1026
|
const a = this._options.signal;
|
|
1025
1027
|
this._options.signal.addEventListener("abort", () => {
|
|
@@ -1028,15 +1030,15 @@ class oe {
|
|
|
1028
1030
|
}
|
|
1029
1031
|
this._options.signal = this.abortController.signal;
|
|
1030
1032
|
}
|
|
1031
|
-
if (
|
|
1033
|
+
if (Vt && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
|
|
1032
1034
|
const a = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), i = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, a);
|
|
1033
1035
|
(Wt && 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);
|
|
1034
1036
|
}
|
|
1035
1037
|
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 }));
|
|
1036
1038
|
}
|
|
1037
1039
|
_calculateRetryDelay(t) {
|
|
1038
|
-
if (this._retryCount++, this._retryCount <= this._options.retry.limit && !(t instanceof
|
|
1039
|
-
if (t instanceof
|
|
1040
|
+
if (this._retryCount++, this._retryCount <= this._options.retry.limit && !(t instanceof Ze)) {
|
|
1041
|
+
if (t instanceof Ve) {
|
|
1040
1042
|
if (!this._options.retry.statusCodes.includes(t.response.status))
|
|
1041
1043
|
return 0;
|
|
1042
1044
|
const a = t.response.headers.get("Retry-After");
|
|
@@ -1059,16 +1061,16 @@ class oe {
|
|
|
1059
1061
|
try {
|
|
1060
1062
|
return await t();
|
|
1061
1063
|
} catch (n) {
|
|
1062
|
-
const a = Math.min(this._calculateRetryDelay(n),
|
|
1064
|
+
const a = Math.min(this._calculateRetryDelay(n), Ae);
|
|
1063
1065
|
if (a !== 0 && this._retryCount > 0) {
|
|
1064
|
-
await
|
|
1066
|
+
await Jt(a, { signal: this._options.signal });
|
|
1065
1067
|
for (const i of this._options.hooks.beforeRetry)
|
|
1066
1068
|
if (await i({
|
|
1067
1069
|
request: this.request,
|
|
1068
1070
|
options: this._options,
|
|
1069
1071
|
error: n,
|
|
1070
1072
|
retryCount: this._retryCount
|
|
1071
|
-
}) ===
|
|
1073
|
+
}) === tt)
|
|
1072
1074
|
return;
|
|
1073
1075
|
return this._retry(t);
|
|
1074
1076
|
}
|
|
@@ -1085,8 +1087,8 @@ class oe {
|
|
|
1085
1087
|
if (a instanceof Response)
|
|
1086
1088
|
return a;
|
|
1087
1089
|
}
|
|
1088
|
-
const t =
|
|
1089
|
-
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) :
|
|
1090
|
+
const t = Zt(this.request, this._options);
|
|
1091
|
+
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Yt(this.request.clone(), t, this.abortController, this._options);
|
|
1090
1092
|
}
|
|
1091
1093
|
/* istanbul ignore next */
|
|
1092
1094
|
_stream(t, n) {
|
|
@@ -1123,54 +1125,54 @@ class oe {
|
|
|
1123
1125
|
}
|
|
1124
1126
|
}
|
|
1125
1127
|
/*! MIT License © Sindre Sorhus */
|
|
1126
|
-
const
|
|
1128
|
+
const Ee = (e) => {
|
|
1127
1129
|
const t = (n, a) => oe.create(n, re(e, a));
|
|
1128
|
-
for (const n of
|
|
1130
|
+
for (const n of et)
|
|
1129
1131
|
t[n] = (a, i) => oe.create(a, re(e, i, { method: n }));
|
|
1130
|
-
return t.create = (n) =>
|
|
1131
|
-
},
|
|
1132
|
+
return t.create = (n) => Ee(re(n)), t.extend = (n) => Ee(re(e, n)), t.stop = tt, t;
|
|
1133
|
+
}, at = Ee();
|
|
1132
1134
|
let ue;
|
|
1133
1135
|
const L = {
|
|
1134
|
-
CachedPrices: `${
|
|
1135
|
-
GasRates: `${
|
|
1136
|
-
Quote: `${
|
|
1137
|
-
Txn: `${
|
|
1138
|
-
TokenlistProviders: `${
|
|
1139
|
-
TokenList: `${
|
|
1140
|
-
Thorname: `${
|
|
1141
|
-
},
|
|
1142
|
-
ue =
|
|
1136
|
+
CachedPrices: `${N.ThorswapApi}/tokenlist/cached-price`,
|
|
1137
|
+
GasRates: `${N.ThorswapApi}/resource-worker/gasPrice/getAll`,
|
|
1138
|
+
Quote: `${N.ThorswapApi}/aggregator/tokens/quote`,
|
|
1139
|
+
Txn: `${N.ThorswapApi}/apiusage/v2/txn`,
|
|
1140
|
+
TokenlistProviders: `${N.ThorswapApi}/tokenlist/providers`,
|
|
1141
|
+
TokenList: `${N.ThorswapStatic}/token-list`,
|
|
1142
|
+
Thorname: `${N.ThorswapApi}/thorname`
|
|
1143
|
+
}, it = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, qe = () => ue || (ue = at.create({ headers: it }), ue), ra = ({ apiKey: e, ...t }) => {
|
|
1144
|
+
ue = at.create({
|
|
1143
1145
|
...t,
|
|
1144
|
-
headers: { ...
|
|
1146
|
+
headers: { ...it, ...t.headers, "x-api-key": e }
|
|
1145
1147
|
});
|
|
1146
|
-
},
|
|
1148
|
+
}, x = {
|
|
1147
1149
|
get: (e, t) => qe().get(e, t).json(),
|
|
1148
1150
|
post: (e, t) => qe().post(e, t).json()
|
|
1149
|
-
},
|
|
1151
|
+
}, zt = ({ tokens: e, ...t }) => {
|
|
1150
1152
|
const n = new URLSearchParams(), a = e.filter(
|
|
1151
1153
|
(i, s, p) => p.findIndex((u) => u === i) === s
|
|
1152
1154
|
);
|
|
1153
1155
|
for (const i of a)
|
|
1154
1156
|
n.append("tokens", JSON.stringify(i));
|
|
1155
|
-
return t.metadata && n.append("metadata", "true"), t.lookup && n.append("lookup", "true"), t.sparkline && n.append("sparkline", "true"),
|
|
1157
|
+
return t.metadata && n.append("metadata", "true"), t.lookup && n.append("lookup", "true"), t.sparkline && n.append("sparkline", "true"), x.post(L.CachedPrices, {
|
|
1156
1158
|
body: n.toString(),
|
|
1157
1159
|
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
1158
1160
|
});
|
|
1159
|
-
},
|
|
1160
|
-
getCachedPrices:
|
|
1161
|
-
getQuote: (e) =>
|
|
1162
|
-
getGasRates: () =>
|
|
1163
|
-
getTxnDetails: (e) =>
|
|
1164
|
-
getTokenlistProviders: () =>
|
|
1165
|
-
getTokenList: (e) =>
|
|
1166
|
-
getThornameAddresses: (e) =>
|
|
1167
|
-
getThornameRegisteredChains: (e) =>
|
|
1168
|
-
getThornameRlookup: (e, t) =>
|
|
1161
|
+
}, pa = {
|
|
1162
|
+
getCachedPrices: zt,
|
|
1163
|
+
getQuote: (e) => x.get(L.Quote, { searchParams: e }),
|
|
1164
|
+
getGasRates: () => x.get(L.GasRates),
|
|
1165
|
+
getTxnDetails: (e) => x.get(L.Txn, { searchParams: e }),
|
|
1166
|
+
getTokenlistProviders: () => x.get(L.TokenlistProviders),
|
|
1167
|
+
getTokenList: (e) => x.get(`${L.TokenList}/${e}.json`),
|
|
1168
|
+
getThornameAddresses: (e) => x.get(`${L.Thorname}/${e}`),
|
|
1169
|
+
getThornameRegisteredChains: (e) => x.get(`${L.Thorname}/chains/${e}`),
|
|
1170
|
+
getThornameRlookup: (e, t) => x.get(`${L.Thorname}/rlookup`, { searchParams: { address: e, chain: t } })
|
|
1169
1171
|
};
|
|
1170
|
-
var
|
|
1171
|
-
const
|
|
1172
|
+
var en = /* @__PURE__ */ ((e) => (e.SWAP_TC_TO_TC = "SWAP:TC-TC", e.SWAP_ETH_TO_TC = "SWAP:ERC20-TC", e.SWAP_TC_TO_ETH = "SWAP:TC-ERC20", e.SWAP_ETH_TO_ETH = "SWAP:ERC20-ERC20", e.SWAP_AVAX_TO_TC = "SWAP:AVAX-TC", e.SWAP_TC_TO_AVAX = "SWAP:TC-AVAX", e.SWAP_AVAX_TO_AVAX = "SWAP:AVAX-AVAX", e.SWAP_ETH_TO_AVAX = "SWAP:ETH-AVAX", e.SWAP_AVAX_TO_ETH = "SWAP:AVAX-ETH", e.SWAP_TC_TO_GAIA = "SWAP:TC-GAIA", e.SWAP_GAIA_TO_TC = "SWAP:GAIA-TC", e.SWAP_TC_TO_BNB = "SWAP:TC-BNB", e.SWAP_BNB_TO_TC = "SWAP:BNB-TC", e.SWAP_TC_TO_BTC = "SWAP:TC-BTC", e.SWAP_BTC_TO_TC = "SWAP:BTC-TC", e.SWAP_TC_TO_BCH = "SWAP:TC-BCH", e.SWAP_BCH_TO_TC = "SWAP:BCH-TC", e.SWAP_TC_TO_LTC = "SWAP:TC-LTC", e.SWAP_LTC_TO_TC = "SWAP:LTC-TC", e.SWAP_TC_TO_DOGE = "SWAP:TC-DOGE", e.SWAP_DOGE_TO_TC = "SWAP:DOGE-TC", e.TC_STATUS = "TC:STATUS", e.TC_TRANSFER = "TC:TRANSFER", e.TC_DEPOSIT = "TC:DEPOSIT", e.TC_SEND = "TC:SEND", e.TC_SWITCH = "TC:SWITCH", e.TC_LP_ADD = "TC:ADDLIQUIDITY", e.TC_LP_WITHDRAW = "TC:WITHDRAW", e.TC_TNS_CREATE = "TC:TNS-CREATE", e.TC_TNS_EXTEND = "TC:TNS-EXTEND", e.TC_TNS_UPDATE = "TC:TNS-UPDATE", e.TC_SAVINGS_ADD = "TC:ADDSAVINGS", e.TC_SAVINGS_WITHDRAW = "TC:WITHDRAWSAVINGS", e.TC_LENDING_OPEN = "TC:LENDINGOPEN", e.TC_LENDING_CLOSE = "TC:LENDINGCLOSE", e.ETH_APPROVAL = "ETH:APPROVAL", e.ETH_STATUS = "ETH:STATUS", e.ETH_TRANSFER_TO_TC = "ETH:TRANSFER:IN", e.ETH_TRANSFER_FROM_TC = "ETH:TRANSFER:OUT", e.AVAX_APPROVAL = "AVAX:APPROVAL", e.AVAX_STATUS = "AVAX:STATUS", e.AVAX_TRANSFER_TO_TC = "AVAX:TRANSFER:IN", e.AVAX_TRANSFER_FROM_TC = "AVAX:TRANSFER:OUT", e.BSC_APPROVAL = "BSC:APPROVAL", e.BSC_STATUS = "BSC:STATUS", e.BSC_TRANSFER_TO_TC = "BSC:TRANSFER:IN", e.BSC_TRANSFER_FROM_TC = "BSC:TRANSFER:OUT", e.APPROVAL = "APPROVAL", e.STATUS = "STATUS", e.TRANSFER_TO_TC = "TRANSFER:IN", e.TRANSFER_FROM_TC = "TRANSFER:OUT", e.UNSUPPORTED = "UNSUPPORTED", e.TC_LENDING = "TC:LENDING", e))(en || {}), tn = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.SUCCESS = "success", e.CANCELLED = "cancelled", e.REFUNDED = "refunded", e.REPLACED = "replaced", e.ERROR = "error", e.UNKNOWN = "unknown", e.NOT_STARTED = "not_started", e.NOT_FOUND = "not_found", e.RETRIES_EXCEEDED = "retries_exceeded", e.STREAMING = "streaming", e))(tn || {}), nn = /* @__PURE__ */ ((e) => (e[e.NOT_STARTED = 0] = "NOT_STARTED", e[e.SUCCESS = 1] = "SUCCESS", e[e.REFUNDED = 2] = "REFUNDED", e))(nn || {});
|
|
1173
|
+
const an = "0x313ce567", st = async ({ chain: e, to: t }) => {
|
|
1172
1174
|
try {
|
|
1173
|
-
const { result: n } = await
|
|
1175
|
+
const { result: n } = await x.post(It[e], {
|
|
1174
1176
|
headers: {
|
|
1175
1177
|
accept: "*/*",
|
|
1176
1178
|
"content-type": "application/json",
|
|
@@ -1180,37 +1182,37 @@ const nn = "0x313ce567", it = async ({ chain: e, to: t }) => {
|
|
|
1180
1182
|
id: 44,
|
|
1181
1183
|
jsonrpc: "2.0",
|
|
1182
1184
|
method: "eth_call",
|
|
1183
|
-
params: [{ to: t.toLowerCase(), data:
|
|
1185
|
+
params: [{ to: t.toLowerCase(), data: an }, "latest"]
|
|
1184
1186
|
})
|
|
1185
1187
|
});
|
|
1186
1188
|
return parseInt(BigInt(n).toString());
|
|
1187
1189
|
} catch (n) {
|
|
1188
|
-
return console.error(n),
|
|
1190
|
+
return console.error(n), g[e];
|
|
1189
1191
|
}
|
|
1190
|
-
},
|
|
1192
|
+
}, sn = (e) => {
|
|
1191
1193
|
if (e === r.Ethereum)
|
|
1192
|
-
return
|
|
1194
|
+
return g.ETH;
|
|
1193
1195
|
const [, t] = e.split("-");
|
|
1194
|
-
return t != null && t.startsWith("0x") ?
|
|
1195
|
-
},
|
|
1196
|
+
return t != null && t.startsWith("0x") ? st({ chain: r.Ethereum, to: t }) : g.ETH;
|
|
1197
|
+
}, rn = (e) => {
|
|
1196
1198
|
const [, t] = e.split("-");
|
|
1197
|
-
return t != null && t.startsWith("0x") ?
|
|
1198
|
-
},
|
|
1199
|
+
return t != null && t.startsWith("0x") ? st({ chain: r.Avalanche, to: t.toLowerCase() }) : g.AVAX;
|
|
1200
|
+
}, pn = (e) => (e === r.BinanceSmartChain, g.BSC), un = ({ chain: e, symbol: t }) => {
|
|
1199
1201
|
switch (e) {
|
|
1200
1202
|
case r.Ethereum:
|
|
1201
|
-
return an(t);
|
|
1202
|
-
case r.Avalanche:
|
|
1203
1203
|
return sn(t);
|
|
1204
|
-
case r.
|
|
1204
|
+
case r.Avalanche:
|
|
1205
1205
|
return rn(t);
|
|
1206
|
+
case r.BinanceSmartChain:
|
|
1207
|
+
return pn(t);
|
|
1206
1208
|
default:
|
|
1207
|
-
return
|
|
1209
|
+
return g[e];
|
|
1208
1210
|
}
|
|
1209
|
-
},
|
|
1210
|
-
[
|
|
1211
|
-
[
|
|
1212
|
-
[
|
|
1213
|
-
},
|
|
1211
|
+
}, yn = {
|
|
1212
|
+
[Y.Average]: 1.2,
|
|
1213
|
+
[Y.Fast]: 1.5,
|
|
1214
|
+
[Y.Fastest]: 2
|
|
1215
|
+
}, rt = ({ chain: e, symbol: t }) => {
|
|
1214
1216
|
switch (e) {
|
|
1215
1217
|
case r.Arbitrum:
|
|
1216
1218
|
case r.Optimism:
|
|
@@ -1230,28 +1232,28 @@ const nn = "0x313ce567", it = async ({ chain: e, to: t }) => {
|
|
|
1230
1232
|
default:
|
|
1231
1233
|
return t === e;
|
|
1232
1234
|
}
|
|
1233
|
-
},
|
|
1235
|
+
}, on = (e) => {
|
|
1234
1236
|
switch (e) {
|
|
1235
1237
|
case `${r.Ethereum}.THOR`:
|
|
1236
1238
|
return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
|
|
1237
1239
|
case `${r.Ethereum}.vTHOR`:
|
|
1238
1240
|
return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
|
|
1239
1241
|
case r.Cosmos:
|
|
1240
|
-
return { identifier: "GAIA.ATOM", decimal:
|
|
1242
|
+
return { identifier: "GAIA.ATOM", decimal: g[e] };
|
|
1241
1243
|
case r.THORChain:
|
|
1242
|
-
return { identifier: "THOR.RUNE", decimal:
|
|
1244
|
+
return { identifier: "THOR.RUNE", decimal: g[e] };
|
|
1243
1245
|
case r.BinanceSmartChain:
|
|
1244
|
-
return { identifier: "BSC.BNB", decimal:
|
|
1246
|
+
return { identifier: "BSC.BNB", decimal: g[e] };
|
|
1245
1247
|
case r.Maya:
|
|
1246
|
-
return { identifier: "MAYA.CACAO", decimal:
|
|
1248
|
+
return { identifier: "MAYA.CACAO", decimal: g.MAYA };
|
|
1247
1249
|
case `${r.Maya}.MAYA`:
|
|
1248
1250
|
return { identifier: "MAYA.MAYA", decimal: 4 };
|
|
1249
1251
|
case `${r.Kujira}.USK`:
|
|
1250
1252
|
return { identifier: `${r.Kujira}.USK`, decimal: 6 };
|
|
1251
1253
|
default:
|
|
1252
|
-
return { identifier: `${e}.${e}`, decimal:
|
|
1254
|
+
return { identifier: `${e}.${e}`, decimal: g[e] };
|
|
1253
1255
|
}
|
|
1254
|
-
},
|
|
1256
|
+
}, dn = ({ chain: e, symbol: t }) => {
|
|
1255
1257
|
if (t.includes("/"))
|
|
1256
1258
|
return "Synth";
|
|
1257
1259
|
switch (e) {
|
|
@@ -1276,70 +1278,70 @@ const nn = "0x313ce567", it = async ({ chain: e, to: t }) => {
|
|
|
1276
1278
|
default:
|
|
1277
1279
|
return "Native";
|
|
1278
1280
|
}
|
|
1279
|
-
},
|
|
1281
|
+
}, ua = (e) => {
|
|
1280
1282
|
var t;
|
|
1281
1283
|
const [n, ...a] = e.split("."), i = e.includes("/"), s = a.join("."), p = (t = s == null ? void 0 : s.split("-")) == null ? void 0 : t[0];
|
|
1282
1284
|
return { chain: n, symbol: s, ticker: p, synth: i };
|
|
1283
|
-
},
|
|
1285
|
+
}, ln = new RegExp(
|
|
1284
1286
|
/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
|
|
1285
1287
|
"gmi"
|
|
1286
|
-
),
|
|
1288
|
+
), mn = (e) => {
|
|
1287
1289
|
const [t, n] = e.split(".");
|
|
1288
1290
|
if (!je.includes(t))
|
|
1289
1291
|
return !0;
|
|
1290
1292
|
const [, a] = n.split("-");
|
|
1291
|
-
return
|
|
1292
|
-
},
|
|
1293
|
+
return rt({ chain: t, symbol: n }) || !!a;
|
|
1294
|
+
}, ya = (e) => e.filter(({ chain: t, value: n, symbol: a }) => {
|
|
1293
1295
|
const i = `${t}.${a}`;
|
|
1294
|
-
return !
|
|
1296
|
+
return !ln.test(i) && mn(i) && n !== "0";
|
|
1295
1297
|
});
|
|
1296
|
-
function
|
|
1298
|
+
function Tn({
|
|
1297
1299
|
liquidityUnits: e,
|
|
1298
1300
|
poolUnits: t,
|
|
1299
1301
|
runeDepth: n
|
|
1300
1302
|
}) {
|
|
1301
|
-
const a =
|
|
1303
|
+
const a = S(e), i = S(t), s = S(n), p = a.mul(s), u = i.mul(i).mul(2), y = i.mul(a).mul(2), o = a.mul(a), l = i.mul(i).mul(i);
|
|
1302
1304
|
return p.mul(u.sub(y).add(o)).div(l);
|
|
1303
1305
|
}
|
|
1304
|
-
function
|
|
1306
|
+
function cn({
|
|
1305
1307
|
liquidityUnits: e,
|
|
1306
1308
|
poolUnits: t,
|
|
1307
1309
|
assetDepth: n
|
|
1308
1310
|
}) {
|
|
1309
|
-
const a =
|
|
1311
|
+
const a = S(e), i = S(t), s = S(n), p = a.mul(s), u = i.mul(i).mul(2), y = i.mul(a).mul(2), o = a.mul(a), l = p.mul(u.sub(y).add(o)), b = i.mul(i).mul(i);
|
|
1310
1312
|
return l.div(b);
|
|
1311
1313
|
}
|
|
1312
|
-
function
|
|
1314
|
+
function oa({
|
|
1313
1315
|
percent: e,
|
|
1314
1316
|
runeDepth: t,
|
|
1315
1317
|
liquidityUnits: n,
|
|
1316
1318
|
poolUnits: a
|
|
1317
1319
|
}) {
|
|
1318
|
-
return
|
|
1320
|
+
return Tn({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
|
|
1319
1321
|
}
|
|
1320
|
-
function
|
|
1322
|
+
function da({
|
|
1321
1323
|
percent: e,
|
|
1322
1324
|
assetDepth: t,
|
|
1323
1325
|
liquidityUnits: n,
|
|
1324
1326
|
poolUnits: a
|
|
1325
1327
|
}) {
|
|
1326
|
-
return
|
|
1328
|
+
return cn({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
|
|
1327
1329
|
}
|
|
1328
|
-
function
|
|
1329
|
-
return
|
|
1330
|
+
function S(e) {
|
|
1331
|
+
return F.fromBigInt(BigInt(e), g.THOR);
|
|
1330
1332
|
}
|
|
1331
|
-
function
|
|
1333
|
+
function bn({
|
|
1332
1334
|
liquidityUnits: e,
|
|
1333
1335
|
poolUnits: t,
|
|
1334
1336
|
runeDepth: n,
|
|
1335
1337
|
assetDepth: a
|
|
1336
1338
|
}) {
|
|
1337
1339
|
return {
|
|
1338
|
-
assetAmount:
|
|
1339
|
-
runeAmount:
|
|
1340
|
+
assetAmount: S(a).mul(e).div(t),
|
|
1341
|
+
runeAmount: S(n).mul(e).div(t)
|
|
1340
1342
|
};
|
|
1341
1343
|
}
|
|
1342
|
-
function
|
|
1344
|
+
function la({
|
|
1343
1345
|
liquidityUnits: e,
|
|
1344
1346
|
poolUnits: t,
|
|
1345
1347
|
runeDepth: n,
|
|
@@ -1347,12 +1349,12 @@ function oa({
|
|
|
1347
1349
|
percent: i
|
|
1348
1350
|
}) {
|
|
1349
1351
|
return Object.fromEntries(
|
|
1350
|
-
Object.entries(
|
|
1352
|
+
Object.entries(bn({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
|
|
1351
1353
|
([s, p]) => [s, p.mul(i)]
|
|
1352
1354
|
)
|
|
1353
1355
|
);
|
|
1354
1356
|
}
|
|
1355
|
-
function
|
|
1357
|
+
function ma({
|
|
1356
1358
|
runeDepth: e,
|
|
1357
1359
|
poolUnits: t,
|
|
1358
1360
|
assetDepth: n,
|
|
@@ -1360,13 +1362,13 @@ function da({
|
|
|
1360
1362
|
runeAmount: i,
|
|
1361
1363
|
assetAmount: s
|
|
1362
1364
|
}) {
|
|
1363
|
-
const p = new
|
|
1365
|
+
const p = new F({ value: e, decimal: 8 }), u = new F({ value: n, decimal: 8 }), y = new F({ value: t, decimal: 8 }), o = new F({ value: i, decimal: 8 }), l = new F({ value: s, decimal: 8 }), b = o.mul(u), T = l.mul(p), f = o.mul(l), _ = p.mul(u), M = y.mul(b.add(T.add(f.mul(2)))), v = b.add(T.add(_.mul(2))), E = M.div(v), R = S(a).add(E);
|
|
1364
1366
|
if (E.getBaseValue("number") === 0)
|
|
1365
|
-
return
|
|
1366
|
-
const
|
|
1367
|
-
return
|
|
1367
|
+
return R.div(y).getBaseValue("number");
|
|
1368
|
+
const J = y.add(R);
|
|
1369
|
+
return R.div(J).getBaseValue("number");
|
|
1368
1370
|
}
|
|
1369
|
-
function
|
|
1371
|
+
function Ta({
|
|
1370
1372
|
runeAmount: e,
|
|
1371
1373
|
assetAmount: t,
|
|
1372
1374
|
runeDepth: n,
|
|
@@ -1374,10 +1376,10 @@ function la({
|
|
|
1374
1376
|
}) {
|
|
1375
1377
|
if (e === "0" || t === "0" || n === "0" || a === "0")
|
|
1376
1378
|
return 0;
|
|
1377
|
-
const i =
|
|
1379
|
+
const i = S(n), s = S(a), p = S(t), u = S(e), y = p.mul(i).sub(s.mul(u)), o = s.mul(u).add(i.mul(s));
|
|
1378
1380
|
return Math.abs(y.div(o).getBaseValue("number"));
|
|
1379
1381
|
}
|
|
1380
|
-
const
|
|
1382
|
+
const B = (e, t) => {
|
|
1381
1383
|
switch (e) {
|
|
1382
1384
|
case w.LEAVE:
|
|
1383
1385
|
case w.BOND: {
|
|
@@ -1420,22 +1422,33 @@ const F = (e, t) => {
|
|
|
1420
1422
|
return "";
|
|
1421
1423
|
}
|
|
1422
1424
|
};
|
|
1423
|
-
function
|
|
1425
|
+
function ca(e) {
|
|
1424
1426
|
if (e < 0)
|
|
1425
1427
|
throw new Error("Invalid number of year");
|
|
1426
1428
|
return 10 + e;
|
|
1427
1429
|
}
|
|
1428
|
-
function
|
|
1430
|
+
function ba(e) {
|
|
1431
|
+
if (e < 0)
|
|
1432
|
+
throw new Error("Invalid number of year");
|
|
1433
|
+
return Math.round((10 + e * 1.0512) * 1e10) / 1e10;
|
|
1434
|
+
}
|
|
1435
|
+
function fa(e) {
|
|
1429
1436
|
if (e.length > 30)
|
|
1430
1437
|
return !1;
|
|
1431
1438
|
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
1432
1439
|
return !!e.match(t);
|
|
1433
1440
|
}
|
|
1434
|
-
function
|
|
1441
|
+
function ha(e) {
|
|
1442
|
+
if (e.length > 30)
|
|
1443
|
+
return !1;
|
|
1444
|
+
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
1445
|
+
return !!e.match(t);
|
|
1446
|
+
}
|
|
1447
|
+
function wa([e, t, n, a, i]) {
|
|
1435
1448
|
return `${e}'/${t}'/${n}'/${a}${typeof i != "number" ? "" : `/${i}`}`;
|
|
1436
1449
|
}
|
|
1437
1450
|
const We = [...Object.values(r), "TERRA"];
|
|
1438
|
-
function
|
|
1451
|
+
function fn(e = "") {
|
|
1439
1452
|
const t = e.toUpperCase(), [n] = t.split(".");
|
|
1440
1453
|
if (We.includes(n))
|
|
1441
1454
|
return !0;
|
|
@@ -1446,8 +1459,8 @@ function bn(e = "") {
|
|
|
1446
1459
|
`Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
|
|
1447
1460
|
);
|
|
1448
1461
|
}
|
|
1449
|
-
const ne = 8,
|
|
1450
|
-
function
|
|
1462
|
+
const ne = 8, W = (e) => 10n ** BigInt(e), te = (e) => Math.log10(parseFloat(e.toString()));
|
|
1463
|
+
function he({
|
|
1451
1464
|
value: e,
|
|
1452
1465
|
bigIntDecimal: t = ne,
|
|
1453
1466
|
decimal: n = ne
|
|
@@ -1465,17 +1478,17 @@ function fe({
|
|
|
1465
1478
|
""
|
|
1466
1479
|
);
|
|
1467
1480
|
}
|
|
1468
|
-
var
|
|
1469
|
-
const
|
|
1481
|
+
var G, z, q, j, Ce, pt, ye, ge, de, Oe;
|
|
1482
|
+
const hn = class xe {
|
|
1470
1483
|
constructor(t) {
|
|
1471
|
-
|
|
1472
|
-
const n =
|
|
1473
|
-
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier :
|
|
1484
|
+
Z(this, G), Z(this, q), Z(this, Ce), Z(this, ye), Z(this, de), P(this, "decimalMultiplier", 10n ** 8n), P(this, "bigIntValue", 0n), P(this, "decimal");
|
|
1485
|
+
const n = Se(t), a = typeof t == "object";
|
|
1486
|
+
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier : W(Math.max(ut(le(n)), this.decimal || 0)), C(this, Ce, pt).call(this, n);
|
|
1474
1487
|
}
|
|
1475
1488
|
static fromBigInt(t, n) {
|
|
1476
|
-
return new
|
|
1489
|
+
return new xe({
|
|
1477
1490
|
decimal: n,
|
|
1478
|
-
value:
|
|
1491
|
+
value: he({ value: t, bigIntDecimal: n, decimal: n })
|
|
1479
1492
|
});
|
|
1480
1493
|
}
|
|
1481
1494
|
static shiftDecimals({
|
|
@@ -1483,8 +1496,8 @@ const fn = class Oe {
|
|
|
1483
1496
|
from: n,
|
|
1484
1497
|
to: a
|
|
1485
1498
|
}) {
|
|
1486
|
-
return
|
|
1487
|
-
t.getBaseValue("bigint") *
|
|
1499
|
+
return xe.fromBigInt(
|
|
1500
|
+
t.getBaseValue("bigint") * W(a) / W(n),
|
|
1488
1501
|
a
|
|
1489
1502
|
);
|
|
1490
1503
|
}
|
|
@@ -1492,37 +1505,37 @@ const fn = class Oe {
|
|
|
1492
1505
|
return new this.constructor({ decimal: this.decimal, value: t, identifier: this.toString() });
|
|
1493
1506
|
}
|
|
1494
1507
|
add(...t) {
|
|
1495
|
-
return C(this,
|
|
1508
|
+
return C(this, G, z).call(this, "add", ...t);
|
|
1496
1509
|
}
|
|
1497
1510
|
sub(...t) {
|
|
1498
|
-
return C(this,
|
|
1511
|
+
return C(this, G, z).call(this, "sub", ...t);
|
|
1499
1512
|
}
|
|
1500
1513
|
mul(...t) {
|
|
1501
|
-
return C(this,
|
|
1514
|
+
return C(this, G, z).call(this, "mul", ...t);
|
|
1502
1515
|
}
|
|
1503
1516
|
div(...t) {
|
|
1504
|
-
return C(this,
|
|
1517
|
+
return C(this, G, z).call(this, "div", ...t);
|
|
1505
1518
|
}
|
|
1506
1519
|
gt(t) {
|
|
1507
|
-
return C(this,
|
|
1520
|
+
return C(this, q, j).call(this, "gt", t);
|
|
1508
1521
|
}
|
|
1509
1522
|
gte(t) {
|
|
1510
|
-
return C(this,
|
|
1523
|
+
return C(this, q, j).call(this, "gte", t);
|
|
1511
1524
|
}
|
|
1512
1525
|
lt(t) {
|
|
1513
|
-
return C(this,
|
|
1526
|
+
return C(this, q, j).call(this, "lt", t);
|
|
1514
1527
|
}
|
|
1515
1528
|
lte(t) {
|
|
1516
|
-
return C(this,
|
|
1529
|
+
return C(this, q, j).call(this, "lte", t);
|
|
1517
1530
|
}
|
|
1518
1531
|
eqValue(t) {
|
|
1519
|
-
return C(this,
|
|
1532
|
+
return C(this, q, j).call(this, "eqValue", t);
|
|
1520
1533
|
}
|
|
1521
1534
|
// @ts-expect-error False positive
|
|
1522
1535
|
getValue(t) {
|
|
1523
1536
|
const n = this.formatBigIntToSafeValue(
|
|
1524
1537
|
this.bigIntValue,
|
|
1525
|
-
this.decimal ||
|
|
1538
|
+
this.decimal || te(this.decimalMultiplier)
|
|
1526
1539
|
);
|
|
1527
1540
|
switch (t) {
|
|
1528
1541
|
case "number":
|
|
@@ -1535,7 +1548,7 @@ const fn = class Oe {
|
|
|
1535
1548
|
}
|
|
1536
1549
|
// @ts-expect-error
|
|
1537
1550
|
getBaseValue(t) {
|
|
1538
|
-
const n = this.decimalMultiplier /
|
|
1551
|
+
const n = this.decimalMultiplier / W(this.decimal || g.THOR), a = this.bigIntValue / n;
|
|
1539
1552
|
switch (t) {
|
|
1540
1553
|
case "number":
|
|
1541
1554
|
return Number(a);
|
|
@@ -1548,8 +1561,8 @@ const fn = class Oe {
|
|
|
1548
1561
|
getBigIntValue(t, n) {
|
|
1549
1562
|
if (!n && typeof t == "object")
|
|
1550
1563
|
return t.bigIntValue;
|
|
1551
|
-
const a =
|
|
1552
|
-
return i === "0" || i === "undefined" ? 0n : C(this, de,
|
|
1564
|
+
const a = Se(t), i = le(a);
|
|
1565
|
+
return i === "0" || i === "undefined" ? 0n : C(this, de, Oe).call(this, i, n);
|
|
1553
1566
|
}
|
|
1554
1567
|
toSignificant(t = 6) {
|
|
1555
1568
|
const [n, a] = this.getValue("string").split("."), i = n || "", s = a || "";
|
|
@@ -1597,7 +1610,7 @@ const fn = class Oe {
|
|
|
1597
1610
|
formatBigIntToSafeValue(t, n) {
|
|
1598
1611
|
const a = n || this.decimal || ne, i = Math.max(
|
|
1599
1612
|
a,
|
|
1600
|
-
|
|
1613
|
+
te(this.decimalMultiplier)
|
|
1601
1614
|
), s = t < 0n, p = t.toString().substring(s ? 1 : 0), u = i - (p.length - 1), y = u > 0 ? "0".repeat(u) + p : p, o = y.length - i;
|
|
1602
1615
|
let l = y.slice(-i);
|
|
1603
1616
|
return parseInt(l[a]) >= 5 ? l = `${l.substring(0, a - 1)}${(parseInt(l[a - 1]) + 1).toString()}` : l = l.substring(0, a), `${s ? "-" : ""}${y.slice(
|
|
@@ -1606,8 +1619,8 @@ const fn = class Oe {
|
|
|
1606
1619
|
)}.${l}`.replace(/\.?0*$/, "");
|
|
1607
1620
|
}
|
|
1608
1621
|
};
|
|
1609
|
-
|
|
1610
|
-
const n = C(this, ye,
|
|
1622
|
+
G = /* @__PURE__ */ new WeakSet(), z = function(e, ...t) {
|
|
1623
|
+
const n = C(this, ye, ge).call(this, this, ...t), a = Math.max(n, te(this.decimalMultiplier)), i = W(a), s = t.reduce(
|
|
1611
1624
|
(u, y) => {
|
|
1612
1625
|
const o = this.getBigIntValue(y, a);
|
|
1613
1626
|
switch (e) {
|
|
@@ -1628,19 +1641,19 @@ X = /* @__PURE__ */ new WeakSet(), Z = function(e, ...t) {
|
|
|
1628
1641
|
},
|
|
1629
1642
|
//normalize is to precision multiplier base
|
|
1630
1643
|
this.bigIntValue * i / this.decimalMultiplier
|
|
1631
|
-
), p =
|
|
1644
|
+
), p = he({
|
|
1632
1645
|
bigIntDecimal: a,
|
|
1633
1646
|
decimal: a,
|
|
1634
1647
|
value: s
|
|
1635
1648
|
});
|
|
1636
1649
|
return new this.constructor({
|
|
1637
|
-
decimalMultiplier:
|
|
1650
|
+
decimalMultiplier: W(a),
|
|
1638
1651
|
decimal: this.decimal,
|
|
1639
1652
|
value: p,
|
|
1640
1653
|
identifier: this.toString()
|
|
1641
1654
|
});
|
|
1642
|
-
},
|
|
1643
|
-
const n = C(this, ye,
|
|
1655
|
+
}, q = /* @__PURE__ */ new WeakSet(), j = function(e, ...t) {
|
|
1656
|
+
const n = C(this, ye, ge).call(this, this, ...t), a = this.getBigIntValue(t[0], n), i = this.getBigIntValue(this, n);
|
|
1644
1657
|
switch (e) {
|
|
1645
1658
|
case "gt":
|
|
1646
1659
|
return i > a;
|
|
@@ -1653,46 +1666,46 @@ X = /* @__PURE__ */ new WeakSet(), Z = function(e, ...t) {
|
|
|
1653
1666
|
case "eqValue":
|
|
1654
1667
|
return i === a;
|
|
1655
1668
|
}
|
|
1656
|
-
},
|
|
1669
|
+
}, Ce = /* @__PURE__ */ new WeakSet(), pt = function(e) {
|
|
1657
1670
|
const t = le(e) || "0";
|
|
1658
|
-
this.bigIntValue = C(this, de,
|
|
1659
|
-
}, ye = /* @__PURE__ */ new WeakSet(),
|
|
1660
|
-
const t = e.map((n) => typeof n == "object" ? n.decimal ||
|
|
1671
|
+
this.bigIntValue = C(this, de, Oe).call(this, t);
|
|
1672
|
+
}, ye = /* @__PURE__ */ new WeakSet(), ge = function(...e) {
|
|
1673
|
+
const t = e.map((n) => typeof n == "object" ? n.decimal || te(n.decimalMultiplier) : ut(le(n))).filter(Boolean);
|
|
1661
1674
|
return Math.max(...t, ne);
|
|
1662
|
-
}, de = /* @__PURE__ */ new WeakSet(),
|
|
1663
|
-
const n = t ?
|
|
1675
|
+
}, de = /* @__PURE__ */ new WeakSet(), Oe = function(e, t) {
|
|
1676
|
+
const n = t ? W(t) : this.decimalMultiplier, a = te(n), [i = "", s = ""] = e.split(".");
|
|
1664
1677
|
return BigInt(`${i}${s.padEnd(a, "0")}`);
|
|
1665
1678
|
};
|
|
1666
|
-
let
|
|
1667
|
-
const
|
|
1679
|
+
let ke = hn;
|
|
1680
|
+
const wn = Intl.NumberFormat("fullwide", {
|
|
1668
1681
|
useGrouping: !1,
|
|
1669
1682
|
maximumFractionDigits: 20
|
|
1670
1683
|
});
|
|
1671
1684
|
function le(e) {
|
|
1672
|
-
const t = `${typeof e == "number" ?
|
|
1685
|
+
const t = `${typeof e == "number" ? wn.format(e) : Se(e)}`.replaceAll(",", ".").split(".");
|
|
1673
1686
|
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1674
1687
|
}
|
|
1675
|
-
function
|
|
1688
|
+
function ut(e) {
|
|
1676
1689
|
var t;
|
|
1677
1690
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1678
1691
|
return Math.max(n, ne);
|
|
1679
1692
|
}
|
|
1680
|
-
function
|
|
1693
|
+
function Se(e) {
|
|
1681
1694
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1682
1695
|
}
|
|
1683
|
-
class
|
|
1696
|
+
class F extends ke {
|
|
1684
1697
|
eq(t) {
|
|
1685
1698
|
return this.eqValue(t);
|
|
1686
1699
|
}
|
|
1687
1700
|
static fromBigInt(t, n) {
|
|
1688
|
-
return new
|
|
1701
|
+
return new F({
|
|
1689
1702
|
decimal: n,
|
|
1690
|
-
value:
|
|
1703
|
+
value: he({ value: t, bigIntDecimal: n, decimal: n })
|
|
1691
1704
|
});
|
|
1692
1705
|
}
|
|
1693
1706
|
}
|
|
1694
|
-
const
|
|
1695
|
-
class
|
|
1707
|
+
const K = /* @__PURE__ */ new Map();
|
|
1708
|
+
class k extends ke {
|
|
1696
1709
|
constructor({
|
|
1697
1710
|
value: t,
|
|
1698
1711
|
decimal: n,
|
|
@@ -1701,9 +1714,9 @@ class x extends xe {
|
|
|
1701
1714
|
symbol: s,
|
|
1702
1715
|
identifier: p
|
|
1703
1716
|
}) {
|
|
1704
|
-
super(typeof t == "object" ? t : { decimal: n, value: t }),
|
|
1705
|
-
const u =
|
|
1706
|
-
this.type =
|
|
1717
|
+
super(typeof t == "object" ? t : { decimal: n, value: t }), P(this, "address"), P(this, "chain"), P(this, "isGasAsset", !1), P(this, "isSynthetic", !1), P(this, "symbol"), P(this, "tax"), P(this, "ticker"), P(this, "type");
|
|
1718
|
+
const u = ee(p || `${i}.${s}`);
|
|
1719
|
+
this.type = dn(u), this.tax = a, this.chain = u.chain, this.ticker = u.ticker, this.symbol = u.symbol, this.address = u.address, this.isSynthetic = u.isSynthetic, this.isGasAsset = u.isGasAsset;
|
|
1707
1720
|
}
|
|
1708
1721
|
toString() {
|
|
1709
1722
|
return this.isSynthetic ? this.symbol : `${this.chain}.${this.symbol}`;
|
|
@@ -1715,7 +1728,7 @@ class x extends xe {
|
|
|
1715
1728
|
return this.chain === t && this.symbol === n;
|
|
1716
1729
|
}
|
|
1717
1730
|
chainId() {
|
|
1718
|
-
return
|
|
1731
|
+
return Qe[this.chain];
|
|
1719
1732
|
}
|
|
1720
1733
|
// THOR.RUNE
|
|
1721
1734
|
// THOR.ETH.ETH
|
|
@@ -1725,65 +1738,65 @@ class x extends xe {
|
|
|
1725
1738
|
if (!(a && i))
|
|
1726
1739
|
throw new Error("Invalid asset url");
|
|
1727
1740
|
const p = a === r.THORChain && s ? `${a}.${i}/${s}` : t;
|
|
1728
|
-
return
|
|
1741
|
+
return Me(p, n);
|
|
1729
1742
|
}
|
|
1730
1743
|
static fromString(t, n = 0) {
|
|
1731
|
-
return
|
|
1744
|
+
return Me(t, n);
|
|
1732
1745
|
}
|
|
1733
1746
|
static fromIdentifier(t, n = 0) {
|
|
1734
|
-
return
|
|
1747
|
+
return Me(t, n);
|
|
1735
1748
|
}
|
|
1736
1749
|
static fromStringSync(t, n = 0) {
|
|
1737
|
-
const { chain: a, isSynthetic: i } =
|
|
1750
|
+
const { chain: a, isSynthetic: i } = ee(t), s = K.get(t.toUpperCase());
|
|
1738
1751
|
if (i)
|
|
1739
|
-
return
|
|
1752
|
+
return ve(t, n);
|
|
1740
1753
|
const { tax: p, decimal: u, identifier: y } = s || {
|
|
1741
|
-
decimal:
|
|
1754
|
+
decimal: g[a],
|
|
1742
1755
|
identifier: t
|
|
1743
1756
|
};
|
|
1744
|
-
return new
|
|
1757
|
+
return new k({
|
|
1745
1758
|
tax: p,
|
|
1746
|
-
value:
|
|
1759
|
+
value: Q(n, u),
|
|
1747
1760
|
identifier: i ? t : y,
|
|
1748
1761
|
decimal: i ? 8 : u
|
|
1749
1762
|
});
|
|
1750
1763
|
}
|
|
1751
|
-
static async fromStringWithBase(t, n = 0, a =
|
|
1752
|
-
const i =
|
|
1753
|
-
value:
|
|
1764
|
+
static async fromStringWithBase(t, n = 0, a = g.THOR) {
|
|
1765
|
+
const i = ke.shiftDecimals({
|
|
1766
|
+
value: F.fromBigInt(BigInt(n)),
|
|
1754
1767
|
from: 0,
|
|
1755
1768
|
to: a
|
|
1756
1769
|
}).getBaseValue("string");
|
|
1757
|
-
return (await
|
|
1770
|
+
return (await k.fromString(t, n)).set(i);
|
|
1758
1771
|
}
|
|
1759
|
-
static fromStringWithBaseSync(t, n = 0, a =
|
|
1760
|
-
const { chain: i, isSynthetic: s } =
|
|
1772
|
+
static fromStringWithBaseSync(t, n = 0, a = g.THOR) {
|
|
1773
|
+
const { chain: i, isSynthetic: s } = ee(t), p = K.get(t.toUpperCase());
|
|
1761
1774
|
if (s)
|
|
1762
|
-
return
|
|
1775
|
+
return ve(t, n);
|
|
1763
1776
|
const { tax: u, decimal: y, identifier: o } = p || {
|
|
1764
|
-
decimal:
|
|
1777
|
+
decimal: g[i],
|
|
1765
1778
|
identifier: t
|
|
1766
1779
|
};
|
|
1767
|
-
return new
|
|
1780
|
+
return new k({
|
|
1768
1781
|
tax: u,
|
|
1769
|
-
value:
|
|
1782
|
+
value: Q(BigInt(n), a),
|
|
1770
1783
|
identifier: o,
|
|
1771
1784
|
decimal: y
|
|
1772
1785
|
});
|
|
1773
1786
|
}
|
|
1774
1787
|
static fromIdentifierSync(t, n = 0) {
|
|
1775
|
-
const { chain: a, isSynthetic: i } =
|
|
1788
|
+
const { chain: a, isSynthetic: i } = ee(t), s = K.get(t);
|
|
1776
1789
|
if (i)
|
|
1777
|
-
return
|
|
1790
|
+
return ve(t, n);
|
|
1778
1791
|
const { tax: p, decimal: u, identifier: y } = s || {
|
|
1779
|
-
decimal:
|
|
1792
|
+
decimal: g[a],
|
|
1780
1793
|
identifier: t
|
|
1781
1794
|
};
|
|
1782
|
-
return new
|
|
1795
|
+
return new k({ tax: p, decimal: u, identifier: y, value: Q(n, u) });
|
|
1783
1796
|
}
|
|
1784
1797
|
static fromChainOrSignature(t, n = 0) {
|
|
1785
|
-
const { decimal: a, identifier: i } =
|
|
1786
|
-
return new
|
|
1798
|
+
const { decimal: a, identifier: i } = on(t);
|
|
1799
|
+
return new k({ value: Q(n, a), decimal: a, identifier: i });
|
|
1787
1800
|
}
|
|
1788
1801
|
static loadStaticAssets() {
|
|
1789
1802
|
return new Promise(
|
|
@@ -1792,9 +1805,9 @@ class x extends xe {
|
|
|
1792
1805
|
import("@swapkit/tokens").then((a) => {
|
|
1793
1806
|
for (const i of Object.values(a))
|
|
1794
1807
|
for (const { identifier: s, chain: p, ...u } of i.tokens)
|
|
1795
|
-
|
|
1808
|
+
K.set(s.toUpperCase(), {
|
|
1796
1809
|
identifier: s,
|
|
1797
|
-
decimal: "decimals" in u ? u.decimals :
|
|
1810
|
+
decimal: "decimals" in u ? u.decimals : g[p]
|
|
1798
1811
|
});
|
|
1799
1812
|
t({ ok: !0 });
|
|
1800
1813
|
});
|
|
@@ -1809,8 +1822,8 @@ class x extends xe {
|
|
|
1809
1822
|
);
|
|
1810
1823
|
}
|
|
1811
1824
|
}
|
|
1812
|
-
function
|
|
1813
|
-
const t =
|
|
1825
|
+
function _e(e) {
|
|
1826
|
+
const t = k.fromChainOrSignature(e);
|
|
1814
1827
|
switch (e) {
|
|
1815
1828
|
case r.Bitcoin:
|
|
1816
1829
|
case r.Litecoin:
|
|
@@ -1830,25 +1843,25 @@ function ge(e) {
|
|
|
1830
1843
|
return t.set(1e-8);
|
|
1831
1844
|
}
|
|
1832
1845
|
}
|
|
1833
|
-
async function
|
|
1834
|
-
|
|
1835
|
-
const n =
|
|
1836
|
-
return n ||
|
|
1846
|
+
async function Me(e, t = 0) {
|
|
1847
|
+
fn(e);
|
|
1848
|
+
const n = K.get(e.toUpperCase()), a = (n == null ? void 0 : n.decimal) || await un(ee(e));
|
|
1849
|
+
return n || K.set(e.toUpperCase(), { identifier: e, decimal: a }), new k({ decimal: a, value: Q(t, a), identifier: e });
|
|
1837
1850
|
}
|
|
1838
|
-
function
|
|
1851
|
+
function ve(e, t = 0) {
|
|
1839
1852
|
const [n, a] = e.split(".")[0].toUpperCase() === r.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
|
|
1840
1853
|
if (!(n && a))
|
|
1841
1854
|
throw new Error("Invalid asset identifier");
|
|
1842
|
-
return new
|
|
1855
|
+
return new k({
|
|
1843
1856
|
decimal: 8,
|
|
1844
|
-
value:
|
|
1857
|
+
value: Q(t, 8),
|
|
1845
1858
|
identifier: `${r.THORChain}.${n}/${a}`
|
|
1846
1859
|
});
|
|
1847
1860
|
}
|
|
1848
|
-
function
|
|
1849
|
-
return typeof e == "bigint" ?
|
|
1861
|
+
function Q(e, t) {
|
|
1862
|
+
return typeof e == "bigint" ? he({ value: e, bigIntDecimal: t, decimal: t }) : e;
|
|
1850
1863
|
}
|
|
1851
|
-
function
|
|
1864
|
+
function ee(e) {
|
|
1852
1865
|
const t = e.slice(0, 14).includes("/"), [n, a] = e.split(".")[0].toUpperCase() === r.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
|
|
1853
1866
|
if (t && !(n && a))
|
|
1854
1867
|
throw new Error("Invalid asset identifier");
|
|
@@ -1856,13 +1869,13 @@ function z(e) {
|
|
|
1856
1869
|
return {
|
|
1857
1870
|
address: y == null ? void 0 : y.toLowerCase(),
|
|
1858
1871
|
chain: s,
|
|
1859
|
-
isGasAsset:
|
|
1872
|
+
isGasAsset: rt({ chain: s, symbol: o }),
|
|
1860
1873
|
isSynthetic: t,
|
|
1861
1874
|
symbol: (t ? `${n}/` : "") + (y ? `${u}-${(y == null ? void 0 : y.toLowerCase()) ?? ""}` : o),
|
|
1862
1875
|
ticker: u
|
|
1863
1876
|
};
|
|
1864
1877
|
}
|
|
1865
|
-
const
|
|
1878
|
+
const An = {
|
|
1866
1879
|
/**
|
|
1867
1880
|
* Core
|
|
1868
1881
|
*/
|
|
@@ -1941,12 +1954,12 @@ class d extends Error {
|
|
|
1941
1954
|
stack: n == null ? void 0 : n.stack,
|
|
1942
1955
|
message: n == null ? void 0 : n.message
|
|
1943
1956
|
}), super(t, {
|
|
1944
|
-
cause: { code:
|
|
1957
|
+
cause: { code: An[t], message: t }
|
|
1945
1958
|
}), Object.setPrototypeOf(this, d.prototype);
|
|
1946
1959
|
}
|
|
1947
1960
|
}
|
|
1948
|
-
const
|
|
1949
|
-
const n =
|
|
1961
|
+
const yt = ({ chain: e, txHash: t }) => {
|
|
1962
|
+
const n = Ye[e];
|
|
1950
1963
|
switch (e) {
|
|
1951
1964
|
case r.Binance:
|
|
1952
1965
|
case r.Maya:
|
|
@@ -1971,8 +1984,8 @@ const ut = ({ chain: e, txHash: t }) => {
|
|
|
1971
1984
|
default:
|
|
1972
1985
|
throw new Error(`Unsupported chain: ${e}`);
|
|
1973
1986
|
}
|
|
1974
|
-
},
|
|
1975
|
-
const n =
|
|
1987
|
+
}, ot = ({ chain: e, address: t }) => {
|
|
1988
|
+
const n = Ye[e];
|
|
1976
1989
|
switch (e) {
|
|
1977
1990
|
case r.Arbitrum:
|
|
1978
1991
|
case r.Avalanche:
|
|
@@ -1996,8 +2009,8 @@ const ut = ({ chain: e, txHash: t }) => {
|
|
|
1996
2009
|
throw new Error(`Unsupported chain: ${e}`);
|
|
1997
2010
|
}
|
|
1998
2011
|
};
|
|
1999
|
-
var
|
|
2000
|
-
function
|
|
2012
|
+
var gn = /* @__PURE__ */ ((e) => (e.Approve = "approve", e.CheckOnly = "checkOnly", e))(gn || {});
|
|
2013
|
+
function Aa({
|
|
2001
2014
|
stagenet: e,
|
|
2002
2015
|
wallets: t,
|
|
2003
2016
|
providers: n,
|
|
@@ -2006,18 +2019,18 @@ function ba({
|
|
|
2006
2019
|
rpcUrls: s
|
|
2007
2020
|
}) {
|
|
2008
2021
|
const p = {}, u = {};
|
|
2009
|
-
for (const
|
|
2010
|
-
const { name: h, methods:
|
|
2011
|
-
u[h] =
|
|
2022
|
+
for (const c of n) {
|
|
2023
|
+
const { name: h, methods: I } = c({ wallets: p, stagenet: e });
|
|
2024
|
+
u[h] = I;
|
|
2012
2025
|
}
|
|
2013
|
-
const y = t.reduce((
|
|
2026
|
+
const y = t.reduce((c, h) => (c[h.connectMethodName] = h.connect({
|
|
2014
2027
|
addChain: l,
|
|
2015
2028
|
config: a,
|
|
2016
2029
|
apis: i,
|
|
2017
2030
|
rpcUrls: s
|
|
2018
|
-
}),
|
|
2019
|
-
function o(
|
|
2020
|
-
const h = u[
|
|
2031
|
+
}), c), {});
|
|
2032
|
+
function o(c) {
|
|
2033
|
+
const h = u[c] || Object.values(u)[0];
|
|
2021
2034
|
if (!h)
|
|
2022
2035
|
throw new d(
|
|
2023
2036
|
"core_swap_provider_not_found",
|
|
@@ -2025,98 +2038,98 @@ function ba({
|
|
|
2025
2038
|
);
|
|
2026
2039
|
return h;
|
|
2027
2040
|
}
|
|
2028
|
-
function l(
|
|
2029
|
-
p[
|
|
2041
|
+
function l(c) {
|
|
2042
|
+
p[c.chain] = c;
|
|
2030
2043
|
}
|
|
2031
2044
|
function b({
|
|
2032
|
-
assetValue:
|
|
2045
|
+
assetValue: c,
|
|
2033
2046
|
type: h = "checkOnly",
|
|
2034
|
-
contractAddress:
|
|
2047
|
+
contractAddress: I
|
|
2035
2048
|
}) {
|
|
2036
|
-
const { address: O, chain:
|
|
2037
|
-
if (
|
|
2049
|
+
const { address: O, chain: D, isGasAsset: mt, isSynthetic: Tt } = c, De = [r.Ethereum, r.Avalanche, r.BinanceSmartChain].includes(D);
|
|
2050
|
+
if (De && mt || !De || Tt)
|
|
2038
2051
|
return Promise.resolve(h === "checkOnly" ? !0 : "approved");
|
|
2039
|
-
const
|
|
2052
|
+
const X = p[D], Fe = h === "checkOnly" ? X == null ? void 0 : X.isApproved : X == null ? void 0 : X.approve;
|
|
2040
2053
|
if (!Fe)
|
|
2041
2054
|
throw new d("core_wallet_connection_not_found");
|
|
2042
|
-
const
|
|
2043
|
-
if (!(O &&
|
|
2055
|
+
const Le = f(D);
|
|
2056
|
+
if (!(O && Le))
|
|
2044
2057
|
throw new d("core_approve_asset_address_or_from_not_found");
|
|
2045
|
-
const
|
|
2058
|
+
const ct = I;
|
|
2046
2059
|
return Fe({
|
|
2047
|
-
amount:
|
|
2060
|
+
amount: c.getBaseValue("bigint"),
|
|
2048
2061
|
assetAddress: O,
|
|
2049
|
-
from:
|
|
2050
|
-
spenderAddress:
|
|
2062
|
+
from: Le,
|
|
2063
|
+
spenderAddress: ct
|
|
2051
2064
|
});
|
|
2052
2065
|
}
|
|
2053
|
-
function c
|
|
2054
|
-
return p[
|
|
2066
|
+
function T(c) {
|
|
2067
|
+
return p[c];
|
|
2055
2068
|
}
|
|
2056
|
-
function f(
|
|
2069
|
+
function f(c) {
|
|
2057
2070
|
var h;
|
|
2058
|
-
return ((h = c
|
|
2071
|
+
return ((h = T(c)) == null ? void 0 : h.address) || "";
|
|
2059
2072
|
}
|
|
2060
|
-
function _(
|
|
2073
|
+
function _(c) {
|
|
2061
2074
|
var h;
|
|
2062
|
-
return ((h = c
|
|
2075
|
+
return ((h = T(c)) == null ? void 0 : h.balance) || [];
|
|
2063
2076
|
}
|
|
2064
|
-
function M(
|
|
2065
|
-
return
|
|
2077
|
+
function M(c, h) {
|
|
2078
|
+
return yt({ chain: c, txHash: h });
|
|
2066
2079
|
}
|
|
2067
|
-
function v(
|
|
2068
|
-
return
|
|
2080
|
+
function v(c, h) {
|
|
2081
|
+
return ot({ chain: c, address: h });
|
|
2069
2082
|
}
|
|
2070
|
-
function E({ address:
|
|
2071
|
-
var
|
|
2072
|
-
return (O = (
|
|
2083
|
+
function E({ address: c, chain: h }) {
|
|
2084
|
+
var I, O;
|
|
2085
|
+
return (O = (I = T(h)) == null ? void 0 : I.validateAddress) == null ? void 0 : O.call(I, c);
|
|
2073
2086
|
}
|
|
2074
|
-
async function
|
|
2075
|
-
const
|
|
2087
|
+
async function R(c, h) {
|
|
2088
|
+
const I = [k.fromChainOrSignature(c)], O = T(c);
|
|
2076
2089
|
try {
|
|
2077
2090
|
if (!O)
|
|
2078
2091
|
throw new d("core_wallet_connection_not_found");
|
|
2079
|
-
const
|
|
2080
|
-
return O.balance =
|
|
2081
|
-
} catch (
|
|
2082
|
-
throw new d("core_wallet_connection_not_found",
|
|
2092
|
+
const D = await (O == null ? void 0 : O.getBalance(O.address, h));
|
|
2093
|
+
return O.balance = D != null && D.length ? D : I, O;
|
|
2094
|
+
} catch (D) {
|
|
2095
|
+
throw new d("core_wallet_connection_not_found", D);
|
|
2083
2096
|
}
|
|
2084
2097
|
}
|
|
2085
|
-
function
|
|
2098
|
+
function J(c, h) {
|
|
2086
2099
|
return b({
|
|
2087
|
-
assetValue:
|
|
2100
|
+
assetValue: c,
|
|
2088
2101
|
contractAddress: h,
|
|
2089
2102
|
type: "approve"
|
|
2090
2103
|
/* Approve */
|
|
2091
2104
|
});
|
|
2092
2105
|
}
|
|
2093
|
-
function
|
|
2106
|
+
function we(c, h) {
|
|
2094
2107
|
return b({
|
|
2095
|
-
assetValue:
|
|
2108
|
+
assetValue: c,
|
|
2096
2109
|
contractAddress: h,
|
|
2097
2110
|
type: "checkOnly"
|
|
2098
2111
|
/* CheckOnly */
|
|
2099
2112
|
});
|
|
2100
2113
|
}
|
|
2101
|
-
function
|
|
2102
|
-
return o(
|
|
2114
|
+
function lt({ provider: c, ...h }) {
|
|
2115
|
+
return o(c == null ? void 0 : c.name).swap({ provider: c, ...h });
|
|
2103
2116
|
}
|
|
2104
2117
|
return {
|
|
2105
2118
|
...u,
|
|
2106
2119
|
...y,
|
|
2107
|
-
approveAssetValue:
|
|
2120
|
+
approveAssetValue: J,
|
|
2108
2121
|
getAddress: f,
|
|
2109
2122
|
getBalance: _,
|
|
2110
2123
|
getExplorerAddressUrl: v,
|
|
2111
2124
|
getExplorerTxUrl: M,
|
|
2112
|
-
getWallet:
|
|
2113
|
-
getWalletWithBalance:
|
|
2114
|
-
isAssetValueApproved:
|
|
2115
|
-
swap:
|
|
2125
|
+
getWallet: T,
|
|
2126
|
+
getWalletWithBalance: R,
|
|
2127
|
+
isAssetValueApproved: we,
|
|
2128
|
+
swap: lt,
|
|
2116
2129
|
validateAddress: E
|
|
2117
2130
|
};
|
|
2118
2131
|
}
|
|
2119
|
-
const
|
|
2132
|
+
const _n = [
|
|
2120
2133
|
{
|
|
2121
2134
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2122
2135
|
stateMutability: "nonpayable",
|
|
@@ -2207,7 +2220,7 @@ const gn = [
|
|
|
2207
2220
|
type: "function"
|
|
2208
2221
|
},
|
|
2209
2222
|
{ stateMutability: "payable", type: "receive" }
|
|
2210
|
-
],
|
|
2223
|
+
], Mn = [
|
|
2211
2224
|
{
|
|
2212
2225
|
inputs: [
|
|
2213
2226
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2351,7 +2364,7 @@ const gn = [
|
|
|
2351
2364
|
type: "function"
|
|
2352
2365
|
},
|
|
2353
2366
|
{ stateMutability: "payable", type: "receive" }
|
|
2354
|
-
],
|
|
2367
|
+
], vn = [
|
|
2355
2368
|
{
|
|
2356
2369
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2357
2370
|
stateMutability: "nonpayable",
|
|
@@ -2456,7 +2469,7 @@ const gn = [
|
|
|
2456
2469
|
type: "function"
|
|
2457
2470
|
},
|
|
2458
2471
|
{ stateMutability: "payable", type: "receive" }
|
|
2459
|
-
],
|
|
2472
|
+
], En = [
|
|
2460
2473
|
{
|
|
2461
2474
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2462
2475
|
stateMutability: "nonpayable",
|
|
@@ -2547,7 +2560,7 @@ const gn = [
|
|
|
2547
2560
|
type: "function"
|
|
2548
2561
|
},
|
|
2549
2562
|
{ stateMutability: "payable", type: "receive" }
|
|
2550
|
-
],
|
|
2563
|
+
], Cn = [
|
|
2551
2564
|
{
|
|
2552
2565
|
inputs: [
|
|
2553
2566
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2691,7 +2704,7 @@ const gn = [
|
|
|
2691
2704
|
type: "function"
|
|
2692
2705
|
},
|
|
2693
2706
|
{ stateMutability: "payable", type: "receive" }
|
|
2694
|
-
],
|
|
2707
|
+
], On = [
|
|
2695
2708
|
{
|
|
2696
2709
|
inputs: [
|
|
2697
2710
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2810,7 +2823,7 @@ const gn = [
|
|
|
2810
2823
|
type: "function"
|
|
2811
2824
|
},
|
|
2812
2825
|
{ stateMutability: "payable", type: "receive" }
|
|
2813
|
-
],
|
|
2826
|
+
], $e = [
|
|
2814
2827
|
{
|
|
2815
2828
|
inputs: [{ internalType: "address", name: "_WETH", type: "address" }],
|
|
2816
2829
|
stateMutability: "nonpayable",
|
|
@@ -3211,7 +3224,7 @@ const gn = [
|
|
|
3211
3224
|
type: "function"
|
|
3212
3225
|
},
|
|
3213
3226
|
{ stateMutability: "payable", type: "receive" }
|
|
3214
|
-
],
|
|
3227
|
+
], Ue = [
|
|
3215
3228
|
{
|
|
3216
3229
|
inputs: [
|
|
3217
3230
|
{
|
|
@@ -5398,7 +5411,7 @@ const gn = [
|
|
|
5398
5411
|
stateMutability: "payable",
|
|
5399
5412
|
type: "receive"
|
|
5400
5413
|
}
|
|
5401
|
-
],
|
|
5414
|
+
], Xe = [
|
|
5402
5415
|
{
|
|
5403
5416
|
inputs: [
|
|
5404
5417
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -5737,7 +5750,7 @@ const gn = [
|
|
|
5737
5750
|
type: "function"
|
|
5738
5751
|
},
|
|
5739
5752
|
{ stateMutability: "payable", type: "receive" }
|
|
5740
|
-
],
|
|
5753
|
+
], xn = [
|
|
5741
5754
|
{
|
|
5742
5755
|
inputs: [
|
|
5743
5756
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -6076,7 +6089,7 @@ const gn = [
|
|
|
6076
6089
|
type: "function"
|
|
6077
6090
|
},
|
|
6078
6091
|
{ stateMutability: "payable", type: "receive" }
|
|
6079
|
-
],
|
|
6092
|
+
], kn = [
|
|
6080
6093
|
{
|
|
6081
6094
|
inputs: [
|
|
6082
6095
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -6415,7 +6428,7 @@ const gn = [
|
|
|
6415
6428
|
type: "function"
|
|
6416
6429
|
},
|
|
6417
6430
|
{ stateMutability: "payable", type: "receive" }
|
|
6418
|
-
],
|
|
6431
|
+
], Sn = [
|
|
6419
6432
|
{
|
|
6420
6433
|
inputs: [
|
|
6421
6434
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -6754,7 +6767,7 @@ const gn = [
|
|
|
6754
6767
|
type: "function"
|
|
6755
6768
|
},
|
|
6756
6769
|
{ stateMutability: "payable", type: "receive" }
|
|
6757
|
-
],
|
|
6770
|
+
], Rn = [
|
|
6758
6771
|
{
|
|
6759
6772
|
inputs: [
|
|
6760
6773
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -7093,7 +7106,7 @@ const gn = [
|
|
|
7093
7106
|
type: "function"
|
|
7094
7107
|
},
|
|
7095
7108
|
{ stateMutability: "payable", type: "receive" }
|
|
7096
|
-
],
|
|
7109
|
+
], In = [
|
|
7097
7110
|
{
|
|
7098
7111
|
inputs: [
|
|
7099
7112
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -7516,23 +7529,23 @@ const gn = [
|
|
|
7516
7529
|
type: "function"
|
|
7517
7530
|
},
|
|
7518
7531
|
{ stateMutability: "payable", type: "receive" }
|
|
7519
|
-
],
|
|
7532
|
+
], Pn = {
|
|
7520
7533
|
// AVAX
|
|
7521
|
-
["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106".toLowerCase()]:
|
|
7534
|
+
["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106".toLowerCase()]: xn,
|
|
7522
7535
|
["0xC22FBb3133dF781E6C25ea6acebe2D2Bb8CeA2f9".toLowerCase()]: Bn,
|
|
7523
|
-
["0x60aE616a2155Ee3d9A68541Ba4544862310933d4".toLowerCase()]:
|
|
7524
|
-
["0x1111111254fb6c44bAC0beD2854e76F90643097d".toLowerCase()]:
|
|
7525
|
-
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]:
|
|
7536
|
+
["0x60aE616a2155Ee3d9A68541Ba4544862310933d4".toLowerCase()]: Sn,
|
|
7537
|
+
["0x1111111254fb6c44bAC0beD2854e76F90643097d".toLowerCase()]: Ue,
|
|
7538
|
+
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: $e,
|
|
7526
7539
|
// BSC
|
|
7527
|
-
["0x10ED43C718714eb63d5aA57B78B54704E256024E".toLowerCase()]:
|
|
7540
|
+
["0x10ED43C718714eb63d5aA57B78B54704E256024E".toLowerCase()]: Xe,
|
|
7528
7541
|
// ETH
|
|
7529
|
-
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]:
|
|
7530
|
-
["0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f".toLowerCase()]:
|
|
7531
|
-
["0xEfF92A263d31888d860bD50809A8D171709b7b1c".toLowerCase()]:
|
|
7532
|
-
["0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D".toLowerCase()]:
|
|
7533
|
-
["0xE592427A0AEce92De3Edee1F18E0157C05861564".toLowerCase()]:
|
|
7534
|
-
["0x1111111254fb6c44bac0bed2854e76f90643097d".toLowerCase()]:
|
|
7535
|
-
},
|
|
7542
|
+
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: $e,
|
|
7543
|
+
["0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f".toLowerCase()]: kn,
|
|
7544
|
+
["0xEfF92A263d31888d860bD50809A8D171709b7b1c".toLowerCase()]: Xe,
|
|
7545
|
+
["0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D".toLowerCase()]: Rn,
|
|
7546
|
+
["0xE592427A0AEce92De3Edee1F18E0157C05861564".toLowerCase()]: In,
|
|
7547
|
+
["0x1111111254fb6c44bac0bed2854e76f90643097d".toLowerCase()]: Ue
|
|
7548
|
+
}, Hn = [
|
|
7536
7549
|
{
|
|
7537
7550
|
inputs: [
|
|
7538
7551
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -7651,7 +7664,7 @@ const gn = [
|
|
|
7651
7664
|
type: "function"
|
|
7652
7665
|
},
|
|
7653
7666
|
{ stateMutability: "payable", type: "receive" }
|
|
7654
|
-
],
|
|
7667
|
+
], Dn = [
|
|
7655
7668
|
{
|
|
7656
7669
|
inputs: [
|
|
7657
7670
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -7889,7 +7902,7 @@ const gn = [
|
|
|
7889
7902
|
type: "function"
|
|
7890
7903
|
},
|
|
7891
7904
|
{ stateMutability: "payable", type: "receive" }
|
|
7892
|
-
],
|
|
7905
|
+
], Ln = [
|
|
7893
7906
|
{
|
|
7894
7907
|
inputs: [
|
|
7895
7908
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -8016,7 +8029,7 @@ const gn = [
|
|
|
8016
8029
|
type: "function"
|
|
8017
8030
|
},
|
|
8018
8031
|
{ stateMutability: "payable", type: "receive" }
|
|
8019
|
-
],
|
|
8032
|
+
], Vn = [
|
|
8020
8033
|
{
|
|
8021
8034
|
inputs: [
|
|
8022
8035
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -8143,7 +8156,7 @@ const gn = [
|
|
|
8143
8156
|
type: "function"
|
|
8144
8157
|
},
|
|
8145
8158
|
{ stateMutability: "payable", type: "receive" }
|
|
8146
|
-
],
|
|
8159
|
+
], Nn = [
|
|
8147
8160
|
{
|
|
8148
8161
|
inputs: [
|
|
8149
8162
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -8524,28 +8537,28 @@ const gn = [
|
|
|
8524
8537
|
type: "function"
|
|
8525
8538
|
},
|
|
8526
8539
|
{ stateMutability: "payable", type: "receive" }
|
|
8527
|
-
],
|
|
8528
|
-
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]:
|
|
8529
|
-
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]:
|
|
8530
|
-
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]:
|
|
8531
|
-
},
|
|
8532
|
-
...
|
|
8533
|
-
...
|
|
8540
|
+
], dt = {
|
|
8541
|
+
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: _n,
|
|
8542
|
+
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: vn,
|
|
8543
|
+
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: En
|
|
8544
|
+
}, $n = {
|
|
8545
|
+
...Pn,
|
|
8546
|
+
...dt,
|
|
8534
8547
|
// AVAX
|
|
8535
|
-
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]:
|
|
8536
|
-
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]:
|
|
8537
|
-
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]:
|
|
8548
|
+
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: On,
|
|
8549
|
+
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: Mn,
|
|
8550
|
+
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: Dn,
|
|
8538
8551
|
// BSC
|
|
8539
|
-
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]:
|
|
8552
|
+
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: Cn,
|
|
8540
8553
|
// ETH
|
|
8541
|
-
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]:
|
|
8554
|
+
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: Hn,
|
|
8542
8555
|
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: Fn,
|
|
8543
|
-
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]:
|
|
8544
|
-
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]:
|
|
8545
|
-
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]:
|
|
8556
|
+
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: Ln,
|
|
8557
|
+
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: Vn,
|
|
8558
|
+
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: Nn,
|
|
8546
8559
|
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: qn,
|
|
8547
8560
|
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: Wn
|
|
8548
|
-
},
|
|
8561
|
+
}, Un = ({
|
|
8549
8562
|
streamSwap: e,
|
|
8550
8563
|
contractAddress: t,
|
|
8551
8564
|
recipient: n,
|
|
@@ -8559,43 +8572,46 @@ const gn = [
|
|
|
8559
8572
|
router: o,
|
|
8560
8573
|
memoStreamingSwap: l,
|
|
8561
8574
|
tcMemo: b,
|
|
8562
|
-
tcRouter:
|
|
8575
|
+
tcRouter: T,
|
|
8563
8576
|
tcVault: f,
|
|
8564
8577
|
vault: _,
|
|
8565
8578
|
token: M
|
|
8566
8579
|
}
|
|
8567
8580
|
}) => {
|
|
8568
|
-
const v = !!
|
|
8581
|
+
const v = !!dt[t.toLowerCase()];
|
|
8569
8582
|
if (v && !o)
|
|
8570
8583
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
8571
|
-
const E = b || y,
|
|
8584
|
+
const E = b || y, R = e && l || E;
|
|
8572
8585
|
if (!(f || _))
|
|
8573
8586
|
throw new Error("TC Vault is required on calldata");
|
|
8574
|
-
if (!(
|
|
8587
|
+
if (!(T || o))
|
|
8575
8588
|
throw new Error("TC Router is required on calldata");
|
|
8576
|
-
if (!
|
|
8589
|
+
if (!R)
|
|
8577
8590
|
throw new Error("TC Memo is required on calldata");
|
|
8578
8591
|
if (!M)
|
|
8579
8592
|
throw new Error("Token is required on calldata");
|
|
8580
|
-
const
|
|
8593
|
+
const J = [
|
|
8581
8594
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
8582
|
-
a(
|
|
8595
|
+
a(T || o),
|
|
8583
8596
|
a(f || _),
|
|
8584
|
-
|
|
8597
|
+
R.replace("{recipientAddress}", n),
|
|
8585
8598
|
a(M),
|
|
8586
8599
|
i
|
|
8587
|
-
],
|
|
8588
|
-
return [...
|
|
8589
|
-
}, Un = (e) => {
|
|
8590
|
-
const t = e ? te.ThornodeStagenet : te.ThornodeMainnet;
|
|
8591
|
-
return R.get(`${t}/thorchain/inbound_addresses`);
|
|
8600
|
+
], we = v ? [a(o), p, u] : [s, u];
|
|
8601
|
+
return [...J, ...we];
|
|
8592
8602
|
}, Xn = (e) => {
|
|
8593
|
-
const t = e ?
|
|
8594
|
-
return
|
|
8595
|
-
},
|
|
8603
|
+
const t = e ? U.MayanodeStagenet : U.MayanodeMainnet;
|
|
8604
|
+
return x.get(`${t}/mayachain/mimir`);
|
|
8605
|
+
}, Gn = (e) => {
|
|
8606
|
+
const t = e ? U.ThornodeStagenet : U.ThornodeMainnet;
|
|
8607
|
+
return x.get(`${t}/thorchain/inbound_addresses`);
|
|
8608
|
+
}, jn = (e) => {
|
|
8609
|
+
const t = e ? U.ThornodeStagenet : U.ThornodeMainnet;
|
|
8610
|
+
return x.get(`${t}/thorchain/mimir`);
|
|
8611
|
+
}, Ge = () => Object.values(r).reduce(
|
|
8596
8612
|
(e, t) => (e[t] = null, e),
|
|
8597
8613
|
{}
|
|
8598
|
-
),
|
|
8614
|
+
), Kn = ({
|
|
8599
8615
|
chain: e,
|
|
8600
8616
|
address: t
|
|
8601
8617
|
}) => {
|
|
@@ -8608,28 +8624,28 @@ const gn = [
|
|
|
8608
8624
|
return !0;
|
|
8609
8625
|
}
|
|
8610
8626
|
};
|
|
8611
|
-
var $, me, ae,
|
|
8612
|
-
class
|
|
8627
|
+
var $, me, ae, H, ie, Te, se;
|
|
8628
|
+
class ga {
|
|
8613
8629
|
constructor({ stagenet: t } = {}) {
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8630
|
+
m(this, "connectedChains", Ge());
|
|
8631
|
+
m(this, "connectedWallets", Ge());
|
|
8632
|
+
m(this, "stagenet", !1);
|
|
8633
|
+
m(this, "getAddress", (t) => {
|
|
8618
8634
|
var n;
|
|
8619
8635
|
return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
|
|
8620
8636
|
});
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8637
|
+
m(this, "getExplorerTxUrl", (t, n) => yt({ chain: t, txHash: n }));
|
|
8638
|
+
m(this, "getWallet", (t) => this.connectedWallets[t]);
|
|
8639
|
+
m(this, "getExplorerAddressUrl", (t, n) => ot({ chain: t, address: n }));
|
|
8640
|
+
m(this, "getBalance", async (t, n) => {
|
|
8625
8641
|
const a = await this.getWalletByChain(t, n);
|
|
8626
8642
|
return (a == null ? void 0 : a.balance) || [];
|
|
8627
8643
|
});
|
|
8628
|
-
|
|
8644
|
+
m(this, "swap", async ({
|
|
8629
8645
|
streamSwap: t,
|
|
8630
8646
|
recipient: n,
|
|
8631
8647
|
route: a,
|
|
8632
|
-
feeOptionKey: i =
|
|
8648
|
+
feeOptionKey: i = Y.Average
|
|
8633
8649
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <explanation>
|
|
8634
8650
|
}) => {
|
|
8635
8651
|
var u, y;
|
|
@@ -8639,33 +8655,33 @@ class fa {
|
|
|
8639
8655
|
} = a, p = s.startsWith("ERC20-") ? r.Ethereum : s.startsWith("ARC20-") ? r.Avalanche : s.startsWith("BEP20-") ? r.BinanceSmartChain : void 0;
|
|
8640
8656
|
if (!a.complete)
|
|
8641
8657
|
throw new d("core_swap_route_not_complete");
|
|
8642
|
-
if (
|
|
8658
|
+
if (Mt.includes(s) && p) {
|
|
8643
8659
|
const o = this.connectedWallets[p];
|
|
8644
8660
|
if (!(o != null && o.sendTransaction))
|
|
8645
8661
|
throw new d("core_wallet_connection_not_found");
|
|
8646
8662
|
if (!(t ? (u = a == null ? void 0 : a.streamingSwap) == null ? void 0 : u.transaction : a == null ? void 0 : a.transaction))
|
|
8647
8663
|
throw new d("core_swap_route_transaction_not_found");
|
|
8648
|
-
const { data: b, from:
|
|
8664
|
+
const { data: b, from: T, to: f, value: _ } = a.transaction, M = {
|
|
8649
8665
|
data: b,
|
|
8650
|
-
from:
|
|
8666
|
+
from: T,
|
|
8651
8667
|
to: f.toLowerCase(),
|
|
8652
|
-
chainId: BigInt(
|
|
8668
|
+
chainId: BigInt(Qe[p]),
|
|
8653
8669
|
value: _ ? BigInt(_) : 0n
|
|
8654
8670
|
};
|
|
8655
8671
|
return o.sendTransaction(M, i);
|
|
8656
8672
|
}
|
|
8657
|
-
if (
|
|
8673
|
+
if (Et.includes(s)) {
|
|
8658
8674
|
if (!a.calldata.fromAsset)
|
|
8659
8675
|
throw new d("core_swap_asset_not_recognized");
|
|
8660
|
-
const o = await
|
|
8676
|
+
const o = await k.fromString(a.calldata.fromAsset);
|
|
8661
8677
|
if (!o)
|
|
8662
8678
|
throw new d("core_swap_asset_not_recognized");
|
|
8663
|
-
const { address: l } = await
|
|
8679
|
+
const { address: l } = await A(this, $).call(this, o.chain), {
|
|
8664
8680
|
contract: b,
|
|
8665
|
-
calldata: { expiration:
|
|
8666
|
-
} = a, v = o.add(
|
|
8681
|
+
calldata: { expiration: T, amountIn: f, memo: _, memoStreamingSwap: M }
|
|
8682
|
+
} = a, v = o.add(F.fromBigInt(BigInt(f), o.decimal)), E = t && M || _;
|
|
8667
8683
|
return this.deposit({
|
|
8668
|
-
expiration:
|
|
8684
|
+
expiration: T,
|
|
8669
8685
|
assetValue: v,
|
|
8670
8686
|
memo: E,
|
|
8671
8687
|
feeOptionKey: i,
|
|
@@ -8673,38 +8689,38 @@ class fa {
|
|
|
8673
8689
|
recipient: l
|
|
8674
8690
|
});
|
|
8675
8691
|
}
|
|
8676
|
-
if (
|
|
8692
|
+
if (vt.includes(s) && p) {
|
|
8677
8693
|
const { calldata: o, contract: l } = a;
|
|
8678
8694
|
if (!l)
|
|
8679
8695
|
throw new d("core_swap_contract_not_found");
|
|
8680
|
-
const b = this.connectedWallets[p],
|
|
8681
|
-
if (!(b != null && b.sendTransaction &&
|
|
8696
|
+
const b = this.connectedWallets[p], T = this.getAddress(p);
|
|
8697
|
+
if (!(b != null && b.sendTransaction && T))
|
|
8682
8698
|
throw new d("core_wallet_connection_not_found");
|
|
8683
|
-
const { getProvider: f, toChecksumAddress: _ } = await import("@swapkit/toolbox-evm"), M = f(p), v =
|
|
8699
|
+
const { getProvider: f, toChecksumAddress: _ } = await import("@swapkit/toolbox-evm"), M = f(p), v = $n[l.toLowerCase()];
|
|
8684
8700
|
if (!v)
|
|
8685
8701
|
throw new d("core_swap_contract_not_supported", {
|
|
8686
8702
|
contractAddress: l
|
|
8687
8703
|
});
|
|
8688
|
-
const
|
|
8689
|
-
|
|
8704
|
+
const R = await (await ((y = b.createContract) == null ? void 0 : y.call(b, l, v, M))).getFunction("swapIn").populateTransaction(
|
|
8705
|
+
...Un({
|
|
8690
8706
|
streamSwap: t,
|
|
8691
8707
|
toChecksumAddress: _,
|
|
8692
8708
|
contractAddress: l,
|
|
8693
8709
|
recipient: n,
|
|
8694
8710
|
calldata: o
|
|
8695
8711
|
}),
|
|
8696
|
-
{ from:
|
|
8712
|
+
{ from: T }
|
|
8697
8713
|
);
|
|
8698
|
-
return b.sendTransaction(
|
|
8714
|
+
return b.sendTransaction(R, i);
|
|
8699
8715
|
}
|
|
8700
8716
|
throw new d("core_swap_quote_mode_not_supported", { quoteMode: s });
|
|
8701
8717
|
});
|
|
8702
|
-
|
|
8718
|
+
m(this, "getWalletByChain", async (t, n) => {
|
|
8703
8719
|
var p, u;
|
|
8704
8720
|
const a = this.getAddress(t);
|
|
8705
8721
|
if (!a)
|
|
8706
8722
|
return null;
|
|
8707
|
-
const i = [
|
|
8723
|
+
const i = [k.fromChainOrSignature(t)], s = (p = this.connectedChains[t]) == null ? void 0 : p.walletType;
|
|
8708
8724
|
try {
|
|
8709
8725
|
const y = await ((u = this.getWallet(t)) == null ? void 0 : u.getBalance(a, n));
|
|
8710
8726
|
return this.connectedChains[t] = {
|
|
@@ -8716,37 +8732,37 @@ class fa {
|
|
|
8716
8732
|
return console.error(y), { address: a, balance: i, walletType: s };
|
|
8717
8733
|
}
|
|
8718
8734
|
});
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8735
|
+
m(this, "approveAssetValue", (t, n) => A(this, ae).call(this, { assetValue: t, type: "approve", contractAddress: n }));
|
|
8736
|
+
m(this, "isAssetValueApproved", (t, n) => A(this, ae).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
|
|
8737
|
+
m(this, "validateAddress", ({ address: t, chain: n }) => {
|
|
8722
8738
|
var a, i;
|
|
8723
8739
|
return (i = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : i.call(a, t);
|
|
8724
8740
|
});
|
|
8725
|
-
|
|
8741
|
+
m(this, "transfer", async (t) => {
|
|
8726
8742
|
const n = this.connectedWallets[t.assetValue.chain];
|
|
8727
8743
|
if (!n)
|
|
8728
8744
|
throw new d("core_wallet_connection_not_found");
|
|
8729
8745
|
try {
|
|
8730
|
-
return await n.transfer(
|
|
8746
|
+
return await n.transfer(A(this, se).call(this, t));
|
|
8731
8747
|
} catch (a) {
|
|
8732
8748
|
throw new d("core_swap_transaction_error", a);
|
|
8733
8749
|
}
|
|
8734
8750
|
});
|
|
8735
|
-
|
|
8751
|
+
m(this, "deposit", async ({
|
|
8736
8752
|
assetValue: t,
|
|
8737
8753
|
recipient: n,
|
|
8738
8754
|
router: a,
|
|
8739
8755
|
...i
|
|
8740
8756
|
}) => {
|
|
8741
8757
|
const { chain: s, symbol: p, ticker: u } = t, y = this.connectedWallets[s], o = this.connectedChains[s];
|
|
8742
|
-
if (!await
|
|
8758
|
+
if (!await Kn({
|
|
8743
8759
|
address: o == null ? void 0 : o.address,
|
|
8744
8760
|
chain: s
|
|
8745
8761
|
}))
|
|
8746
8762
|
throw new d("core_transaction_invalid_sender_address");
|
|
8747
8763
|
if (!y)
|
|
8748
8764
|
throw new d("core_wallet_connection_not_found");
|
|
8749
|
-
const b =
|
|
8765
|
+
const b = A(this, se).call(this, {
|
|
8750
8766
|
assetValue: t,
|
|
8751
8767
|
recipient: n,
|
|
8752
8768
|
router: a,
|
|
@@ -8756,20 +8772,20 @@ class fa {
|
|
|
8756
8772
|
switch (s) {
|
|
8757
8773
|
case r.THORChain:
|
|
8758
8774
|
case r.Maya: {
|
|
8759
|
-
const
|
|
8760
|
-
return await (n === "" ?
|
|
8775
|
+
const T = y;
|
|
8776
|
+
return await (n === "" ? T.deposit(b) : T.transfer(b));
|
|
8761
8777
|
}
|
|
8762
8778
|
case r.Ethereum:
|
|
8763
8779
|
case r.BinanceSmartChain:
|
|
8764
8780
|
case r.Avalanche: {
|
|
8765
|
-
const { getChecksumAddressFromAsset:
|
|
8781
|
+
const { getChecksumAddressFromAsset: T } = await import("@swapkit/toolbox-evm"), f = s === r.Avalanche ? At : s === r.BinanceSmartChain ? gt : wt;
|
|
8766
8782
|
return await y.call({
|
|
8767
8783
|
abi: f,
|
|
8768
|
-
contractAddress: a || (await
|
|
8784
|
+
contractAddress: a || (await A(this, $).call(this, s)).router,
|
|
8769
8785
|
funcName: "depositWithExpiry",
|
|
8770
8786
|
funcParams: [
|
|
8771
8787
|
n,
|
|
8772
|
-
|
|
8788
|
+
T({ chain: s, symbol: p, ticker: u }, s),
|
|
8773
8789
|
t.getBaseValue("string"),
|
|
8774
8790
|
b.memo,
|
|
8775
8791
|
i.expiration || parseInt(`${((/* @__PURE__ */ new Date()).getTime() + 15 * 60 * 1e3) / 1e3}`)
|
|
@@ -8783,15 +8799,15 @@ class fa {
|
|
|
8783
8799
|
default:
|
|
8784
8800
|
return await y.transfer(b);
|
|
8785
8801
|
}
|
|
8786
|
-
} catch (
|
|
8787
|
-
const f =
|
|
8788
|
-
throw new d(
|
|
8802
|
+
} catch (T) {
|
|
8803
|
+
const f = typeof T == "string" ? T.toLowerCase() : T == null ? void 0 : T.message.toLowerCase(), _ = f == null ? void 0 : f.includes("insufficient funds"), M = f == null ? void 0 : f.includes("gas"), v = f == null ? void 0 : f.includes("server"), E = f == null ? void 0 : f.includes("user rejected"), R = _ ? "core_transaction_deposit_insufficient_funds_error" : M ? "core_transaction_deposit_gas_error" : v ? "core_transaction_deposit_server_error" : E ? "core_transaction_user_rejected" : "core_transaction_deposit_error";
|
|
8804
|
+
throw new d(R, T);
|
|
8789
8805
|
}
|
|
8790
8806
|
});
|
|
8791
8807
|
/**
|
|
8792
8808
|
* TC related Methods
|
|
8793
8809
|
*/
|
|
8794
|
-
|
|
8810
|
+
m(this, "createLiquidity", async ({
|
|
8795
8811
|
runeAssetValue: t,
|
|
8796
8812
|
assetValue: n
|
|
8797
8813
|
}) => {
|
|
@@ -8799,9 +8815,9 @@ class fa {
|
|
|
8799
8815
|
throw new d("core_transaction_create_liquidity_invalid_params");
|
|
8800
8816
|
let a = "", i = "";
|
|
8801
8817
|
try {
|
|
8802
|
-
a = await
|
|
8818
|
+
a = await A(this, H).call(this, {
|
|
8803
8819
|
assetValue: t,
|
|
8804
|
-
memo:
|
|
8820
|
+
memo: B(w.DEPOSIT, {
|
|
8805
8821
|
...n,
|
|
8806
8822
|
address: this.getAddress(n.chain)
|
|
8807
8823
|
})
|
|
@@ -8810,9 +8826,9 @@ class fa {
|
|
|
8810
8826
|
throw new d("core_transaction_create_liquidity_rune_error", s);
|
|
8811
8827
|
}
|
|
8812
8828
|
try {
|
|
8813
|
-
i = await
|
|
8829
|
+
i = await A(this, H).call(this, {
|
|
8814
8830
|
assetValue: n,
|
|
8815
|
-
memo:
|
|
8831
|
+
memo: B(w.DEPOSIT, {
|
|
8816
8832
|
...n,
|
|
8817
8833
|
address: this.getAddress(r.THORChain)
|
|
8818
8834
|
})
|
|
@@ -8822,7 +8838,7 @@ class fa {
|
|
|
8822
8838
|
}
|
|
8823
8839
|
return { runeTx: a, assetTx: i };
|
|
8824
8840
|
});
|
|
8825
|
-
|
|
8841
|
+
m(this, "addLiquidity", async ({
|
|
8826
8842
|
runeAssetValue: t,
|
|
8827
8843
|
assetValue: n,
|
|
8828
8844
|
runeAddr: a,
|
|
@@ -8830,17 +8846,17 @@ class fa {
|
|
|
8830
8846
|
isPendingSymmAsset: s,
|
|
8831
8847
|
mode: p = "sym"
|
|
8832
8848
|
}) => {
|
|
8833
|
-
const { chain: u, symbol: y } = n, o = p === "sym", l = (t == null ? void 0 : t.gt(0)) && (o || p === "rune"), b = (n == null ? void 0 : n.gt(0)) && (o || p === "asset"),
|
|
8849
|
+
const { chain: u, symbol: y } = n, o = p === "sym", l = (t == null ? void 0 : t.gt(0)) && (o || p === "rune"), b = (n == null ? void 0 : n.gt(0)) && (o || p === "asset"), T = s || l, f = T ? a || this.getAddress(r.THORChain) : "", _ = o || p === "asset" ? i || this.getAddress(u) : "";
|
|
8834
8850
|
if (!(l || b))
|
|
8835
8851
|
throw new d("core_transaction_add_liquidity_invalid_params");
|
|
8836
|
-
if (
|
|
8852
|
+
if (T && !f)
|
|
8837
8853
|
throw new d("core_transaction_add_liquidity_no_rune_address");
|
|
8838
8854
|
let M, v;
|
|
8839
8855
|
if (l && t)
|
|
8840
8856
|
try {
|
|
8841
|
-
M = await
|
|
8857
|
+
M = await A(this, H).call(this, {
|
|
8842
8858
|
assetValue: t,
|
|
8843
|
-
memo:
|
|
8859
|
+
memo: B(w.DEPOSIT, {
|
|
8844
8860
|
chain: u,
|
|
8845
8861
|
symbol: y,
|
|
8846
8862
|
address: _
|
|
@@ -8851,9 +8867,9 @@ class fa {
|
|
|
8851
8867
|
}
|
|
8852
8868
|
if (b && n)
|
|
8853
8869
|
try {
|
|
8854
|
-
v = await
|
|
8870
|
+
v = await A(this, H).call(this, {
|
|
8855
8871
|
assetValue: n,
|
|
8856
|
-
memo:
|
|
8872
|
+
memo: B(w.DEPOSIT, {
|
|
8857
8873
|
chain: u,
|
|
8858
8874
|
symbol: y,
|
|
8859
8875
|
address: f
|
|
@@ -8864,7 +8880,7 @@ class fa {
|
|
|
8864
8880
|
}
|
|
8865
8881
|
return { runeTx: M, assetTx: v };
|
|
8866
8882
|
});
|
|
8867
|
-
|
|
8883
|
+
m(this, "addLiquidityPart", ({
|
|
8868
8884
|
assetValue: t,
|
|
8869
8885
|
poolAddress: n,
|
|
8870
8886
|
address: a,
|
|
@@ -8872,21 +8888,21 @@ class fa {
|
|
|
8872
8888
|
}) => {
|
|
8873
8889
|
if (i && !a)
|
|
8874
8890
|
throw new d("core_transaction_add_liquidity_invalid_params");
|
|
8875
|
-
const s =
|
|
8891
|
+
const s = B(w.DEPOSIT, {
|
|
8876
8892
|
chain: n.split(".")[0],
|
|
8877
8893
|
symbol: n.split(".")[1],
|
|
8878
8894
|
address: i ? a : ""
|
|
8879
8895
|
});
|
|
8880
|
-
return
|
|
8896
|
+
return A(this, H).call(this, { assetValue: t, memo: s });
|
|
8881
8897
|
});
|
|
8882
|
-
|
|
8898
|
+
m(this, "withdraw", ({
|
|
8883
8899
|
memo: t,
|
|
8884
8900
|
assetValue: n,
|
|
8885
8901
|
percent: a,
|
|
8886
8902
|
from: i,
|
|
8887
8903
|
to: s
|
|
8888
8904
|
}) => {
|
|
8889
|
-
const p = s === "rune" && i !== "rune" ?
|
|
8905
|
+
const p = s === "rune" && i !== "rune" ? k.fromChainOrSignature(r.THORChain) : i === "sym" && s === "sym" || i === "rune" || i === "asset" ? void 0 : n, u = _e(i === "asset" ? n.chain : r.THORChain), y = t || B(w.WITHDRAW, {
|
|
8890
8906
|
symbol: n.symbol,
|
|
8891
8907
|
chain: n.chain,
|
|
8892
8908
|
ticker: n.ticker,
|
|
@@ -8894,62 +8910,69 @@ class fa {
|
|
|
8894
8910
|
targetAssetString: p == null ? void 0 : p.toString(),
|
|
8895
8911
|
singleSide: !1
|
|
8896
8912
|
});
|
|
8897
|
-
return
|
|
8913
|
+
return A(this, H).call(this, { assetValue: u, memo: y });
|
|
8898
8914
|
});
|
|
8899
|
-
|
|
8915
|
+
m(this, "savings", ({
|
|
8900
8916
|
assetValue: t,
|
|
8901
8917
|
memo: n,
|
|
8902
8918
|
percent: a,
|
|
8903
8919
|
type: i
|
|
8904
8920
|
}) => {
|
|
8905
|
-
const s = i === "add" ? w.DEPOSIT : w.WITHDRAW, p = n ||
|
|
8921
|
+
const s = i === "add" ? w.DEPOSIT : w.WITHDRAW, p = n || B(s, {
|
|
8906
8922
|
ticker: t.ticker,
|
|
8907
8923
|
symbol: t.symbol,
|
|
8908
8924
|
chain: t.chain,
|
|
8909
8925
|
singleSide: !0,
|
|
8910
8926
|
basisPoints: a ? Math.min(1e4, Math.round(a * 100)) : void 0
|
|
8911
|
-
}), u = s === w.DEPOSIT ? t :
|
|
8912
|
-
return
|
|
8927
|
+
}), u = s === w.DEPOSIT ? t : _e(t.chain);
|
|
8928
|
+
return A(this, H).call(this, { memo: p, assetValue: u });
|
|
8913
8929
|
});
|
|
8914
|
-
|
|
8930
|
+
m(this, "loan", ({
|
|
8915
8931
|
assetValue: t,
|
|
8916
8932
|
memo: n,
|
|
8917
8933
|
minAmount: a,
|
|
8918
8934
|
type: i
|
|
8919
|
-
}) =>
|
|
8935
|
+
}) => A(this, H).call(this, {
|
|
8920
8936
|
assetValue: t,
|
|
8921
|
-
memo: n ||
|
|
8937
|
+
memo: n || B(i === "open" ? w.OPEN_LOAN : w.CLOSE_LOAN, {
|
|
8922
8938
|
asset: t.toString(),
|
|
8923
8939
|
minAmount: a.toString(),
|
|
8924
8940
|
address: this.getAddress(t.chain)
|
|
8925
8941
|
})
|
|
8926
8942
|
}));
|
|
8927
|
-
|
|
8943
|
+
m(this, "nodeAction", ({
|
|
8928
8944
|
type: t,
|
|
8929
8945
|
assetValue: n,
|
|
8930
8946
|
address: a
|
|
8931
8947
|
}) => {
|
|
8932
|
-
const i = t === "bond" ? w.BOND : t === "unbond" ? w.UNBOND : w.LEAVE, s =
|
|
8948
|
+
const i = t === "bond" ? w.BOND : t === "unbond" ? w.UNBOND : w.LEAVE, s = B(i, {
|
|
8933
8949
|
address: a,
|
|
8934
8950
|
unbondAmount: t === "unbond" ? n.getBaseValue("number") : void 0
|
|
8935
8951
|
});
|
|
8936
|
-
return
|
|
8952
|
+
return A(this, ie).call(this, {
|
|
8937
8953
|
memo: s,
|
|
8938
|
-
assetValue: t === "bond" ? n :
|
|
8954
|
+
assetValue: t === "bond" ? n : _e(r.THORChain)
|
|
8939
8955
|
});
|
|
8940
8956
|
});
|
|
8941
|
-
|
|
8957
|
+
m(this, "registerThorname", ({
|
|
8942
8958
|
assetValue: t,
|
|
8943
8959
|
...n
|
|
8944
|
-
}) =>
|
|
8960
|
+
}) => A(this, ie).call(this, {
|
|
8945
8961
|
assetValue: t,
|
|
8946
|
-
memo:
|
|
8962
|
+
memo: B(w.THORNAME_REGISTER, n)
|
|
8947
8963
|
}));
|
|
8948
|
-
|
|
8964
|
+
m(this, "registerMayaname", ({
|
|
8965
|
+
assetValue: t,
|
|
8966
|
+
...n
|
|
8967
|
+
}) => A(this, Te).call(this, {
|
|
8968
|
+
assetValue: t,
|
|
8969
|
+
memo: B(w.THORNAME_REGISTER, n)
|
|
8970
|
+
}));
|
|
8971
|
+
m(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: i = {} }) => {
|
|
8949
8972
|
try {
|
|
8950
8973
|
for (const s of t)
|
|
8951
8974
|
this[s.connectMethodName] = s.connect({
|
|
8952
|
-
addChain:
|
|
8975
|
+
addChain: A(this, me),
|
|
8953
8976
|
config: n || {},
|
|
8954
8977
|
apis: a,
|
|
8955
8978
|
rpcUrls: i
|
|
@@ -8958,7 +8981,7 @@ class fa {
|
|
|
8958
8981
|
throw new d("core_extend_error", s);
|
|
8959
8982
|
}
|
|
8960
8983
|
});
|
|
8961
|
-
|
|
8984
|
+
m(this, "estimateMaxSendableAmount", async ({
|
|
8962
8985
|
chain: t,
|
|
8963
8986
|
params: n
|
|
8964
8987
|
}) => {
|
|
@@ -8998,51 +9021,51 @@ class fa {
|
|
|
8998
9021
|
* Wallet connection methods
|
|
8999
9022
|
*/
|
|
9000
9023
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9001
|
-
|
|
9024
|
+
m(this, "connectXDEFI", async (t) => {
|
|
9002
9025
|
throw new d("core_wallet_xdefi_not_installed");
|
|
9003
9026
|
});
|
|
9004
9027
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9005
|
-
|
|
9028
|
+
m(this, "connectEVMWallet", async (t, n) => {
|
|
9006
9029
|
throw new d("core_wallet_evmwallet_not_installed");
|
|
9007
9030
|
});
|
|
9008
9031
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9009
|
-
|
|
9032
|
+
m(this, "connectWalletconnect", async (t, n) => {
|
|
9010
9033
|
throw new d("core_wallet_walletconnect_not_installed");
|
|
9011
9034
|
});
|
|
9012
9035
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9013
|
-
|
|
9036
|
+
m(this, "connectKeepkey", async (t, n) => {
|
|
9014
9037
|
throw new d("core_wallet_keepkey_not_installed");
|
|
9015
9038
|
});
|
|
9016
9039
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9017
|
-
|
|
9040
|
+
m(this, "connectKeystore", async (t, n) => {
|
|
9018
9041
|
throw new d("core_wallet_keystore_not_installed");
|
|
9019
9042
|
});
|
|
9020
9043
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9021
|
-
|
|
9044
|
+
m(this, "connectLedger", async (t, n) => {
|
|
9022
9045
|
throw new d("core_wallet_ledger_not_installed");
|
|
9023
9046
|
});
|
|
9024
9047
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9025
|
-
|
|
9048
|
+
m(this, "connectTrezor", async (t, n) => {
|
|
9026
9049
|
throw new d("core_wallet_trezor_not_installed");
|
|
9027
9050
|
});
|
|
9028
9051
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9029
|
-
|
|
9052
|
+
m(this, "connectKeplr", async (t) => {
|
|
9030
9053
|
throw new d("core_wallet_keplr_not_installed");
|
|
9031
9054
|
});
|
|
9032
9055
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9033
|
-
|
|
9056
|
+
m(this, "connectOkx", async (t) => {
|
|
9034
9057
|
throw new d("core_wallet_okx_not_installed");
|
|
9035
9058
|
});
|
|
9036
|
-
|
|
9059
|
+
m(this, "disconnectChain", (t) => {
|
|
9037
9060
|
this.connectedChains[t] = null, this.connectedWallets[t] = null;
|
|
9038
9061
|
});
|
|
9039
|
-
|
|
9062
|
+
V(this, $, async (t) => {
|
|
9040
9063
|
switch (t) {
|
|
9041
9064
|
case r.Maya:
|
|
9042
9065
|
case r.THORChain:
|
|
9043
9066
|
return { gas_rate: "0", router: "", address: "", halted: !1, chain: t };
|
|
9044
9067
|
default: {
|
|
9045
|
-
const a = (await
|
|
9068
|
+
const a = (await Gn(this.stagenet)).find((i) => i.chain === t);
|
|
9046
9069
|
if (!a)
|
|
9047
9070
|
throw new d("core_inbound_data_not_found");
|
|
9048
9071
|
if (a != null && a.halted)
|
|
@@ -9051,7 +9074,7 @@ class fa {
|
|
|
9051
9074
|
}
|
|
9052
9075
|
}
|
|
9053
9076
|
});
|
|
9054
|
-
|
|
9077
|
+
V(this, me, ({
|
|
9055
9078
|
chain: t,
|
|
9056
9079
|
address: n,
|
|
9057
9080
|
balance: a,
|
|
@@ -9064,7 +9087,7 @@ class fa {
|
|
|
9064
9087
|
walletType: i || "unknown"
|
|
9065
9088
|
}, this.connectedWallets[t] = { ...s };
|
|
9066
9089
|
});
|
|
9067
|
-
|
|
9090
|
+
V(this, ae, async ({
|
|
9068
9091
|
assetValue: t,
|
|
9069
9092
|
type: n = "checkOnly",
|
|
9070
9093
|
contractAddress: a
|
|
@@ -9075,27 +9098,27 @@ class fa {
|
|
|
9075
9098
|
const l = this.connectedWallets[s], b = n === "checkOnly" ? l == null ? void 0 : l.isApproved : l == null ? void 0 : l.approve;
|
|
9076
9099
|
if (!b)
|
|
9077
9100
|
throw new d("core_wallet_connection_not_found");
|
|
9078
|
-
const
|
|
9079
|
-
if (!(i &&
|
|
9101
|
+
const T = this.getAddress(s);
|
|
9102
|
+
if (!(i && T))
|
|
9080
9103
|
throw new d("core_approve_asset_address_or_from_not_found");
|
|
9081
|
-
const f = a || (await
|
|
9104
|
+
const f = a || (await A(this, $).call(this, s)).router;
|
|
9082
9105
|
return b({
|
|
9083
9106
|
amount: t.getBaseValue("bigint"),
|
|
9084
9107
|
assetAddress: i,
|
|
9085
|
-
from:
|
|
9108
|
+
from: T,
|
|
9086
9109
|
spenderAddress: f
|
|
9087
9110
|
});
|
|
9088
9111
|
});
|
|
9089
|
-
|
|
9112
|
+
V(this, H, async ({
|
|
9090
9113
|
assetValue: t,
|
|
9091
9114
|
memo: n,
|
|
9092
|
-
feeOptionKey: a =
|
|
9115
|
+
feeOptionKey: a = Y.Fast
|
|
9093
9116
|
}) => {
|
|
9094
9117
|
const {
|
|
9095
9118
|
gas_rate: i,
|
|
9096
9119
|
router: s,
|
|
9097
9120
|
address: p
|
|
9098
|
-
} = await
|
|
9121
|
+
} = await A(this, $).call(this, t.chain), u = (parseInt(i) || 0) * yn[a];
|
|
9099
9122
|
return this.deposit({
|
|
9100
9123
|
assetValue: t,
|
|
9101
9124
|
recipient: p,
|
|
@@ -9104,7 +9127,16 @@ class fa {
|
|
|
9104
9127
|
feeRate: u
|
|
9105
9128
|
});
|
|
9106
9129
|
});
|
|
9107
|
-
|
|
9130
|
+
V(this, ie, async ({
|
|
9131
|
+
memo: t,
|
|
9132
|
+
assetValue: n
|
|
9133
|
+
}) => {
|
|
9134
|
+
const a = await jn(this.stagenet);
|
|
9135
|
+
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
9136
|
+
throw new d("core_chain_halted");
|
|
9137
|
+
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
9138
|
+
});
|
|
9139
|
+
V(this, Te, async ({
|
|
9108
9140
|
memo: t,
|
|
9109
9141
|
assetValue: n
|
|
9110
9142
|
}) => {
|
|
@@ -9113,7 +9145,7 @@ class fa {
|
|
|
9113
9145
|
throw new d("core_chain_halted");
|
|
9114
9146
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
9115
9147
|
});
|
|
9116
|
-
|
|
9148
|
+
V(this, se, ({ assetValue: t, ...n }) => ({
|
|
9117
9149
|
...n,
|
|
9118
9150
|
memo: n.memo || "",
|
|
9119
9151
|
from: this.getAddress(t.chain),
|
|
@@ -9122,77 +9154,79 @@ class fa {
|
|
|
9122
9154
|
this.stagenet = !!t;
|
|
9123
9155
|
}
|
|
9124
9156
|
}
|
|
9125
|
-
$ = new WeakMap(), me = new WeakMap(), ae = new WeakMap(),
|
|
9157
|
+
$ = new WeakMap(), me = new WeakMap(), ae = new WeakMap(), H = new WeakMap(), ie = new WeakMap(), Te = new WeakMap(), se = new WeakMap();
|
|
9126
9158
|
export {
|
|
9127
|
-
|
|
9159
|
+
Mt as AGG_SWAP,
|
|
9128
9160
|
L as ApiEndpoints,
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9161
|
+
U as ApiUrl,
|
|
9162
|
+
gn as ApproveMode,
|
|
9163
|
+
k as AssetValue,
|
|
9164
|
+
g as BaseDecimal,
|
|
9165
|
+
ke as BigIntArithmetics,
|
|
9134
9166
|
r as Chain,
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9167
|
+
Re as ChainId,
|
|
9168
|
+
sa as ChainIdToChain,
|
|
9169
|
+
Qe as ChainToChainId,
|
|
9170
|
+
Ye as ChainToExplorerUrl,
|
|
9171
|
+
ia as ChainToHexChainId,
|
|
9172
|
+
It as ChainToRPC,
|
|
9173
|
+
Ct as ContractAddress,
|
|
9174
|
+
na as CosmosChainList,
|
|
9175
|
+
kt as CosmosChains,
|
|
9176
|
+
Ot as DerivationPath,
|
|
9177
|
+
ea as EVMChainList,
|
|
9146
9178
|
je as EVMChains,
|
|
9147
|
-
|
|
9148
|
-
|
|
9179
|
+
Y as FeeOption,
|
|
9180
|
+
Pt as LedgerErrorCode,
|
|
9149
9181
|
w as MemoType,
|
|
9150
|
-
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
|
|
9182
|
+
Zn as NetworkDerivationPath,
|
|
9183
|
+
_t as QuoteMode,
|
|
9184
|
+
Ke as RPCUrl,
|
|
9185
|
+
x as RequestClient,
|
|
9186
|
+
vt as SWAP_IN,
|
|
9187
|
+
Et as SWAP_OUT,
|
|
9188
|
+
nn as StreamingSwapProgressStatus,
|
|
9189
|
+
zn as SubstrateChains,
|
|
9190
|
+
Aa as SwapKit,
|
|
9191
|
+
pa as SwapKitApi,
|
|
9192
|
+
ga as SwapKitCore,
|
|
9161
9193
|
d as SwapKitError,
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9194
|
+
F as SwapKitNumber,
|
|
9195
|
+
At as TCAvalancheDepositABI,
|
|
9196
|
+
gt as TCBscDepositABI,
|
|
9197
|
+
wt as TCEthereumVaultAbi,
|
|
9198
|
+
aa as TCSupportedChainList,
|
|
9199
|
+
St as TCSupportedChains,
|
|
9200
|
+
en as TransactionType,
|
|
9201
|
+
tn as TxStatus,
|
|
9202
|
+
ta as UTXOChainList,
|
|
9203
|
+
xt as UTXOChains,
|
|
9172
9204
|
Bt as WalletOption,
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9205
|
+
ua as assetFromString,
|
|
9206
|
+
it as defaultRequestHeaders,
|
|
9207
|
+
wa as derivationPathToString,
|
|
9208
|
+
Jn as erc20ABI,
|
|
9209
|
+
ya as filterAssets,
|
|
9210
|
+
he as formatBigIntToSafeValue,
|
|
9211
|
+
yn as gasFeeMultiplier,
|
|
9212
|
+
dn as getAssetType,
|
|
9213
|
+
cn as getAsymmetricAssetShare,
|
|
9214
|
+
da as getAsymmetricAssetWithdrawAmount,
|
|
9215
|
+
Tn as getAsymmetricRuneShare,
|
|
9216
|
+
oa as getAsymmetricRuneWithdrawAmount,
|
|
9217
|
+
on as getCommonAssetInfo,
|
|
9218
|
+
un as getDecimal,
|
|
9219
|
+
ma as getEstimatedPoolShare,
|
|
9220
|
+
Ta as getLiquiditySlippage,
|
|
9221
|
+
ba as getMAYANameCost,
|
|
9222
|
+
B as getMemoFor,
|
|
9223
|
+
_e as getMinAmountByChain,
|
|
9224
|
+
bn as getSymmetricPoolShare,
|
|
9225
|
+
la as getSymmetricWithdraw,
|
|
9226
|
+
ca as getTHORNameCost,
|
|
9227
|
+
rt as isGasAsset,
|
|
9228
|
+
ra as setRequestClientConfig,
|
|
9229
|
+
ha as validateMAYAName,
|
|
9230
|
+
fa as validateTHORName
|
|
9197
9231
|
};
|
|
9198
9232
|
//# sourceMappingURL=index.es.js.map
|