@swapkit/core 1.0.0-rc.100 → 1.0.0-rc.103
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 +18 -16
- package/dist/index.es.js +488 -474
- package/dist/index.es.js.map +1 -1
- package/package.json +13 -13
- package/src/__tests__/helpers.test.ts +63 -58
- package/src/client/index.ts +24 -21
- package/src/helpers/explorerUrls.ts +2 -0
package/dist/index.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var ct = Object.defineProperty;
|
|
2
|
+
var bt = (e, t, n) => t in e ? ct(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var T = (e, t, n) => (bt(e, typeof t != "symbol" ? t + "" : t, n), n), ft = (e, t, n) => {
|
|
4
4
|
if (!t.has(e))
|
|
5
5
|
throw TypeError("Cannot " + n);
|
|
6
6
|
};
|
|
7
|
-
var g = (e, t, n) => (
|
|
7
|
+
var g = (e, t, n) => (ft(e, t, "read from private field"), n ? n.call(e) : t.get(e)), q = (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 Qn = [
|
|
13
13
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
14
14
|
{
|
|
15
15
|
anonymous: !1,
|
|
@@ -107,7 +107,7 @@ const jn = [
|
|
|
107
107
|
stateMutability: "nonpayable",
|
|
108
108
|
type: "function"
|
|
109
109
|
}
|
|
110
|
-
],
|
|
110
|
+
], ht = [
|
|
111
111
|
{
|
|
112
112
|
inputs: [{ internalType: "address", name: "rune", type: "address" }],
|
|
113
113
|
stateMutability: "nonpayable",
|
|
@@ -282,7 +282,7 @@ const jn = [
|
|
|
282
282
|
stateMutability: "view",
|
|
283
283
|
type: "function"
|
|
284
284
|
}
|
|
285
|
-
],
|
|
285
|
+
], wt = [
|
|
286
286
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
287
287
|
{
|
|
288
288
|
anonymous: !1,
|
|
@@ -446,7 +446,7 @@ const jn = [
|
|
|
446
446
|
stateMutability: "view",
|
|
447
447
|
type: "function"
|
|
448
448
|
}
|
|
449
|
-
],
|
|
449
|
+
], At = [
|
|
450
450
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
451
451
|
{
|
|
452
452
|
anonymous: !1,
|
|
@@ -599,13 +599,13 @@ const jn = [
|
|
|
599
599
|
type: "function"
|
|
600
600
|
}
|
|
601
601
|
];
|
|
602
|
-
var
|
|
603
|
-
const
|
|
602
|
+
var gt = /* @__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))(gt || {});
|
|
603
|
+
const _t = [
|
|
604
604
|
"ERC20-ERC20",
|
|
605
605
|
"ARC20-ARC20",
|
|
606
606
|
"BEP20-BEP20"
|
|
607
607
|
/* BSC_TO_BSC */
|
|
608
|
-
],
|
|
608
|
+
], Mt = [
|
|
609
609
|
"ERC20-TC",
|
|
610
610
|
"ERC20-ARC20",
|
|
611
611
|
"ERC20-BEP20",
|
|
@@ -616,15 +616,15 @@ const ht = [
|
|
|
616
616
|
"BEP20-ERC20",
|
|
617
617
|
"BEP20-ARC20"
|
|
618
618
|
/* BSC_TO_AVAX */
|
|
619
|
-
],
|
|
619
|
+
], vt = [
|
|
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 || {}), Et = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(Et || {}), Ct = /* @__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))(Ct || {});
|
|
627
|
+
const Yn = {
|
|
628
628
|
ARB: [44, 60, 0, 0, 0],
|
|
629
629
|
AVAX: [44, 60, 0, 0, 0],
|
|
630
630
|
BCH: [44, 145, 0, 0, 0],
|
|
@@ -646,11 +646,11 @@ const Gn = {
|
|
|
646
646
|
FLIP: [0, 0, 0, 0, 0]
|
|
647
647
|
};
|
|
648
648
|
var A = /* @__PURE__ */ ((e) => (e[e.ARB = 18] = "ARB", e[e.AVAX = 18] = "AVAX", e[e.BCH = 8] = "BCH", e[e.BNB = 8] = "BNB", e[e.BSC = 18] = "BSC", e[e.BTC = 8] = "BTC", e[e.DASH = 8] = "DASH", e[e.DOGE = 8] = "DOGE", e[e.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))(A || {});
|
|
649
|
-
const
|
|
649
|
+
const Jn = [
|
|
650
650
|
"DOT",
|
|
651
651
|
"FLIP"
|
|
652
652
|
/* Chainflip */
|
|
653
|
-
],
|
|
653
|
+
], je = [
|
|
654
654
|
"ETH",
|
|
655
655
|
"AVAX",
|
|
656
656
|
"BSC",
|
|
@@ -658,19 +658,19 @@ const Kn = [
|
|
|
658
658
|
"OP",
|
|
659
659
|
"MATIC"
|
|
660
660
|
/* Polygon */
|
|
661
|
-
],
|
|
661
|
+
], Zn = je, Ot = [
|
|
662
662
|
"BTC",
|
|
663
663
|
"BCH",
|
|
664
664
|
"DASH",
|
|
665
665
|
"DOGE",
|
|
666
666
|
"LTC"
|
|
667
667
|
/* Litecoin */
|
|
668
|
-
],
|
|
668
|
+
], zn = Ot, xt = [
|
|
669
669
|
"GAIA",
|
|
670
670
|
"THOR",
|
|
671
671
|
"BNB"
|
|
672
672
|
/* Binance */
|
|
673
|
-
],
|
|
673
|
+
], ea = xt, kt = [
|
|
674
674
|
"AVAX",
|
|
675
675
|
"BNB",
|
|
676
676
|
"BSC",
|
|
@@ -682,27 +682,27 @@ const Kn = [
|
|
|
682
682
|
"LTC",
|
|
683
683
|
"THOR"
|
|
684
684
|
/* THORChain */
|
|
685
|
-
],
|
|
686
|
-
var
|
|
687
|
-
const Te = Object.values(r),
|
|
685
|
+
], ta = kt;
|
|
686
|
+
var Se = /* @__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))(Se || {}), Ge = /* @__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))(Ge || {}), te = /* @__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))(te || {});
|
|
687
|
+
const Te = Object.values(r), St = Object.keys(r), Re = Te.reduce(
|
|
688
688
|
(e, t) => {
|
|
689
|
-
const n =
|
|
689
|
+
const n = St.find((a) => r[a] === t);
|
|
690
690
|
return n && (e[t] = n), e;
|
|
691
691
|
},
|
|
692
692
|
{}
|
|
693
|
-
),
|
|
694
|
-
(e, t) => (e[t] =
|
|
693
|
+
), Ke = Te.reduce(
|
|
694
|
+
(e, t) => (e[t] = Se[Re[t]], e),
|
|
695
695
|
{}
|
|
696
|
-
),
|
|
697
|
-
(e, t) => (e[t] =
|
|
696
|
+
), Rt = Te.reduce(
|
|
697
|
+
(e, t) => (e[t] = Ge[Re[t]], e),
|
|
698
698
|
{}
|
|
699
|
-
),
|
|
699
|
+
), na = Te.reduce(
|
|
700
700
|
(e, t) => {
|
|
701
|
-
const n = `${
|
|
702
|
-
return e[t] =
|
|
701
|
+
const n = `${Re[t]}Hex`;
|
|
702
|
+
return e[t] = Se[n], e;
|
|
703
703
|
},
|
|
704
704
|
{}
|
|
705
|
-
),
|
|
705
|
+
), aa = {
|
|
706
706
|
"0xa4b1": "ARB",
|
|
707
707
|
42161: "ARB",
|
|
708
708
|
"0xa86a": "AVAX",
|
|
@@ -730,7 +730,7 @@ const Te = Object.values(r), Ct = Object.keys(r), Se = Te.reduce(
|
|
|
730
730
|
"thorchain-stagenet-v2": "THOR",
|
|
731
731
|
"thorchain-mainnet-v1": "THOR"
|
|
732
732
|
/* THORChain */
|
|
733
|
-
},
|
|
733
|
+
}, Qe = {
|
|
734
734
|
ARB: "https://arbiscan.io",
|
|
735
735
|
AVAX: "https://snowtrace.io",
|
|
736
736
|
BSC: "https://bscscan.com",
|
|
@@ -746,41 +746,41 @@ const Te = Object.values(r), Ct = Object.keys(r), Se = Te.reduce(
|
|
|
746
746
|
LTC: "https://blockchair.com/litecoin",
|
|
747
747
|
MAYA: "https://www.mayascan.org",
|
|
748
748
|
OP: "https://optimistic.etherscan.io",
|
|
749
|
-
DOT: "https://
|
|
749
|
+
DOT: "https://polkadot.subscan.io/",
|
|
750
750
|
MATIC: "https://polygonscan.com",
|
|
751
751
|
THOR: "https://runescan.io"
|
|
752
752
|
};
|
|
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 || {}), Q = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(Q || {}),
|
|
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 || {}), Q = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(Q || {}), 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 || {}), It = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e[e.LockedDevice = 21781] = "LockedDevice", e[e.TC_NotFound = 65535] = "TC_NotFound", e))(It || {}), Pt = Object.defineProperty, Ht = (e, t, n) => t in e ? Pt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, I = (e, t, n) => (Ht(e, typeof t != "symbol" ? t + "" : t, n), n), Ft = (e, t, n) => {
|
|
754
754
|
if (!t.has(e))
|
|
755
755
|
throw TypeError("Cannot " + n);
|
|
756
756
|
}, J = (e, t, n) => {
|
|
757
757
|
if (t.has(e))
|
|
758
758
|
throw TypeError("Cannot add the same private member more than once");
|
|
759
759
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
760
|
-
}, C = (e, t, n) => (
|
|
761
|
-
const be = Object.values(ce),
|
|
760
|
+
}, C = (e, t, n) => (Ft(e, t, "access private method"), n), ce = /* @__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))(ce || {}), 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 || {}), Ye = /* @__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))(Ye || {}), V = /* @__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))(V || {});
|
|
761
|
+
const be = Object.values(ce), Dt = Object.keys(ce), Ie = be.reduce(
|
|
762
762
|
(e, t) => {
|
|
763
|
-
const n =
|
|
763
|
+
const n = Dt.find((a) => ce[a] === t);
|
|
764
764
|
return n && (e[t] = n), e;
|
|
765
765
|
},
|
|
766
766
|
{}
|
|
767
767
|
);
|
|
768
768
|
be.reduce(
|
|
769
|
-
(e, t) => (e[t] =
|
|
769
|
+
(e, t) => (e[t] = Be[Ie[t]], e),
|
|
770
770
|
{}
|
|
771
771
|
);
|
|
772
772
|
be.reduce(
|
|
773
|
-
(e, t) => (e[t] =
|
|
773
|
+
(e, t) => (e[t] = Ye[Ie[t]], e),
|
|
774
774
|
{}
|
|
775
775
|
);
|
|
776
776
|
be.reduce(
|
|
777
777
|
(e, t) => {
|
|
778
|
-
const n = `${
|
|
779
|
-
return e[t] =
|
|
778
|
+
const n = `${Ie[t]}Hex`;
|
|
779
|
+
return e[t] = Be[n], e;
|
|
780
780
|
},
|
|
781
781
|
{}
|
|
782
782
|
);
|
|
783
|
-
class
|
|
783
|
+
class Le extends Error {
|
|
784
784
|
constructor(t, n, a) {
|
|
785
785
|
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
786
|
super(`Request failed with ${u}`), Object.defineProperty(this, "response", {
|
|
@@ -801,7 +801,7 @@ class De extends Error {
|
|
|
801
801
|
}), this.name = "HTTPError", this.response = t, this.request = n, this.options = a;
|
|
802
802
|
}
|
|
803
803
|
}
|
|
804
|
-
class
|
|
804
|
+
class Je extends Error {
|
|
805
805
|
constructor(t) {
|
|
806
806
|
super("Request timed out"), Object.defineProperty(this, "request", {
|
|
807
807
|
enumerable: !0,
|
|
@@ -815,24 +815,24 @@ const pe = (e) => e !== null && typeof e == "object", re = (...e) => {
|
|
|
815
815
|
for (const t of e)
|
|
816
816
|
if ((!pe(t) || Array.isArray(t)) && t !== void 0)
|
|
817
817
|
throw new TypeError("The `options` argument must be an object");
|
|
818
|
-
return
|
|
819
|
-
},
|
|
818
|
+
return Pe({}, ...e);
|
|
819
|
+
}, Ze = (e = {}, t = {}) => {
|
|
820
820
|
const n = new globalThis.Headers(e), a = t instanceof globalThis.Headers, i = new globalThis.Headers(t);
|
|
821
821
|
for (const [s, p] of i.entries())
|
|
822
822
|
a && p === "undefined" || p === void 0 ? n.delete(s) : n.set(s, p);
|
|
823
823
|
return n;
|
|
824
|
-
},
|
|
824
|
+
}, Pe = (...e) => {
|
|
825
825
|
let t = {}, n = {};
|
|
826
826
|
for (const a of e)
|
|
827
827
|
if (Array.isArray(a))
|
|
828
828
|
Array.isArray(t) || (t = []), t = [...t, ...a];
|
|
829
829
|
else if (pe(a)) {
|
|
830
830
|
for (let [i, s] of Object.entries(a))
|
|
831
|
-
pe(s) && i in t && (s =
|
|
832
|
-
pe(a.headers) && (n =
|
|
831
|
+
pe(s) && i in t && (s = Pe(t[i], s)), t = { ...t, [i]: s };
|
|
832
|
+
pe(a.headers) && (n = Ze(n, a.headers), t.headers = n);
|
|
833
833
|
}
|
|
834
834
|
return t;
|
|
835
|
-
},
|
|
835
|
+
}, Lt = (() => {
|
|
836
836
|
let e = !1, t = !1;
|
|
837
837
|
const n = typeof globalThis.ReadableStream == "function", a = typeof globalThis.Request == "function";
|
|
838
838
|
return n && a && (t = new globalThis.Request("https://empty.invalid", {
|
|
@@ -843,13 +843,13 @@ const pe = (e) => e !== null && typeof e == "object", re = (...e) => {
|
|
|
843
843
|
return e = !0, "half";
|
|
844
844
|
}
|
|
845
845
|
}).headers.has("Content-Type")), e && !t;
|
|
846
|
-
})(),
|
|
846
|
+
})(), Vt = typeof globalThis.AbortController == "function", qt = typeof globalThis.ReadableStream == "function", Wt = typeof globalThis.FormData == "function", ze = ["get", "post", "put", "patch", "head", "delete"], Nt = {
|
|
847
847
|
json: "application/json",
|
|
848
848
|
text: "text/*",
|
|
849
849
|
formData: "multipart/form-data",
|
|
850
850
|
arrayBuffer: "*/*",
|
|
851
851
|
blob: "*/*"
|
|
852
|
-
},
|
|
852
|
+
}, we = 2147483647, et = Symbol("stop"), $t = {
|
|
853
853
|
json: !0,
|
|
854
854
|
parseJson: !0,
|
|
855
855
|
searchParams: !0,
|
|
@@ -860,7 +860,7 @@ const pe = (e) => e !== null && typeof e == "object", re = (...e) => {
|
|
|
860
860
|
throwHttpErrors: !0,
|
|
861
861
|
onDownloadProgress: !0,
|
|
862
862
|
fetch: !0
|
|
863
|
-
},
|
|
863
|
+
}, Ut = {
|
|
864
864
|
method: !0,
|
|
865
865
|
headers: !0,
|
|
866
866
|
body: !0,
|
|
@@ -876,18 +876,18 @@ const pe = (e) => e !== null && typeof e == "object", re = (...e) => {
|
|
|
876
876
|
window: !0,
|
|
877
877
|
dispatcher: !0,
|
|
878
878
|
duplex: !0
|
|
879
|
-
},
|
|
879
|
+
}, Xt = (e) => ze.includes(e) ? e.toUpperCase() : e, jt = ["get", "put", "head", "delete", "options", "trace"], Gt = [408, 413, 429, 500, 502, 503, 504], tt = [413, 429, 503], Ve = {
|
|
880
880
|
limit: 2,
|
|
881
|
-
methods:
|
|
882
|
-
statusCodes:
|
|
883
|
-
afterStatusCodes:
|
|
881
|
+
methods: jt,
|
|
882
|
+
statusCodes: Gt,
|
|
883
|
+
afterStatusCodes: tt,
|
|
884
884
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
885
885
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
886
886
|
delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
|
|
887
|
-
},
|
|
887
|
+
}, Kt = (e = {}) => {
|
|
888
888
|
if (typeof e == "number")
|
|
889
889
|
return {
|
|
890
|
-
...
|
|
890
|
+
...Ve,
|
|
891
891
|
limit: e
|
|
892
892
|
};
|
|
893
893
|
if (e.methods && !Array.isArray(e.methods))
|
|
@@ -895,22 +895,22 @@ const pe = (e) => e !== null && typeof e == "object", re = (...e) => {
|
|
|
895
895
|
if (e.statusCodes && !Array.isArray(e.statusCodes))
|
|
896
896
|
throw new Error("retry.statusCodes must be an array");
|
|
897
897
|
return {
|
|
898
|
-
...
|
|
898
|
+
...Ve,
|
|
899
899
|
...e,
|
|
900
|
-
afterStatusCodes:
|
|
900
|
+
afterStatusCodes: tt
|
|
901
901
|
};
|
|
902
902
|
};
|
|
903
|
-
async function
|
|
903
|
+
async function Qt(e, t, n, a) {
|
|
904
904
|
return new Promise((i, s) => {
|
|
905
905
|
const p = setTimeout(() => {
|
|
906
|
-
n && n.abort(), s(new
|
|
906
|
+
n && n.abort(), s(new Je(e));
|
|
907
907
|
}, a.timeout);
|
|
908
908
|
a.fetch(e, t).then(i).catch(s).then(() => {
|
|
909
909
|
clearTimeout(p);
|
|
910
910
|
});
|
|
911
911
|
});
|
|
912
912
|
}
|
|
913
|
-
async function
|
|
913
|
+
async function Yt(e, { signal: t }) {
|
|
914
914
|
return new Promise((n, a) => {
|
|
915
915
|
t && (t.throwIfAborted(), t.addEventListener("abort", i, { once: !0 }));
|
|
916
916
|
function i() {
|
|
@@ -921,17 +921,17 @@ async function jt(e, { signal: t }) {
|
|
|
921
921
|
}, e);
|
|
922
922
|
});
|
|
923
923
|
}
|
|
924
|
-
const
|
|
924
|
+
const Jt = (e, t) => {
|
|
925
925
|
const n = {};
|
|
926
926
|
for (const a in t)
|
|
927
|
-
!(a in
|
|
927
|
+
!(a in Ut) && !(a in $t) && !(a in e) && (n[a] = t[a]);
|
|
928
928
|
return n;
|
|
929
929
|
};
|
|
930
930
|
class oe {
|
|
931
931
|
static create(t, n) {
|
|
932
932
|
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 ${
|
|
933
|
+
if (typeof a._options.timeout == "number" && a._options.timeout > we)
|
|
934
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${we}`);
|
|
935
935
|
await Promise.resolve();
|
|
936
936
|
let p = await a._fetch();
|
|
937
937
|
for (const u of a._options.hooks.afterResponse) {
|
|
@@ -939,7 +939,7 @@ class oe {
|
|
|
939
939
|
y instanceof globalThis.Response && (p = y);
|
|
940
940
|
}
|
|
941
941
|
if (a._decorateResponse(p), !p.ok && a._options.throwHttpErrors) {
|
|
942
|
-
let u = new
|
|
942
|
+
let u = new Le(p, a.request, a._options);
|
|
943
943
|
for (const y of a._options.hooks.beforeError)
|
|
944
944
|
u = await y(u);
|
|
945
945
|
throw u;
|
|
@@ -947,13 +947,13 @@ class oe {
|
|
|
947
947
|
if (a._options.onDownloadProgress) {
|
|
948
948
|
if (typeof a._options.onDownloadProgress != "function")
|
|
949
949
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
950
|
-
if (!
|
|
950
|
+
if (!qt)
|
|
951
951
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
952
952
|
return a._stream(p.clone(), a._options.onDownloadProgress);
|
|
953
953
|
}
|
|
954
954
|
return p;
|
|
955
955
|
}, s = a._options.retry.methods.includes(a.request.method.toLowerCase()) ? a._retry(i) : i();
|
|
956
|
-
for (const [p, u] of Object.entries(
|
|
956
|
+
for (const [p, u] of Object.entries(Nt))
|
|
957
957
|
s[p] = async () => {
|
|
958
958
|
a.request.headers.set("accept", a.request.headers.get("accept") || u);
|
|
959
959
|
const y = (await s).clone();
|
|
@@ -998,17 +998,17 @@ class oe {
|
|
|
998
998
|
// TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
|
|
999
999
|
credentials: this._input.credentials || "same-origin",
|
|
1000
1000
|
...n,
|
|
1001
|
-
headers:
|
|
1002
|
-
hooks:
|
|
1001
|
+
headers: Ze(this._input.headers, n.headers),
|
|
1002
|
+
hooks: Pe({
|
|
1003
1003
|
beforeRequest: [],
|
|
1004
1004
|
beforeRetry: [],
|
|
1005
1005
|
beforeError: [],
|
|
1006
1006
|
afterResponse: []
|
|
1007
1007
|
}, n.hooks),
|
|
1008
|
-
method:
|
|
1008
|
+
method: Xt(n.method ?? this._input.method),
|
|
1009
1009
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
1010
1010
|
prefixUrl: String(n.prefixUrl || ""),
|
|
1011
|
-
retry:
|
|
1011
|
+
retry: Kt(n.retry),
|
|
1012
1012
|
throwHttpErrors: n.throwHttpErrors !== !1,
|
|
1013
1013
|
timeout: n.timeout ?? 1e4,
|
|
1014
1014
|
fetch: n.fetch ?? globalThis.fetch.bind(globalThis)
|
|
@@ -1019,7 +1019,7 @@ class oe {
|
|
|
1019
1019
|
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
1020
1020
|
this._options.prefixUrl.endsWith("/") || (this._options.prefixUrl += "/"), this._input = this._options.prefixUrl + this._input;
|
|
1021
1021
|
}
|
|
1022
|
-
if (
|
|
1022
|
+
if (Vt) {
|
|
1023
1023
|
if (this.abortController = new globalThis.AbortController(), this._options.signal) {
|
|
1024
1024
|
const a = this._options.signal;
|
|
1025
1025
|
this._options.signal.addEventListener("abort", () => {
|
|
@@ -1028,15 +1028,15 @@ class oe {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
this._options.signal = this.abortController.signal;
|
|
1030
1030
|
}
|
|
1031
|
-
if (
|
|
1031
|
+
if (Lt && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
|
|
1032
1032
|
const a = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), i = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, a);
|
|
1033
|
-
(
|
|
1033
|
+
(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
1034
|
}
|
|
1035
1035
|
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
1036
|
}
|
|
1037
1037
|
_calculateRetryDelay(t) {
|
|
1038
|
-
if (this._retryCount++, this._retryCount <= this._options.retry.limit && !(t instanceof
|
|
1039
|
-
if (t instanceof
|
|
1038
|
+
if (this._retryCount++, this._retryCount <= this._options.retry.limit && !(t instanceof Je)) {
|
|
1039
|
+
if (t instanceof Le) {
|
|
1040
1040
|
if (!this._options.retry.statusCodes.includes(t.response.status))
|
|
1041
1041
|
return 0;
|
|
1042
1042
|
const a = t.response.headers.get("Retry-After");
|
|
@@ -1059,16 +1059,16 @@ class oe {
|
|
|
1059
1059
|
try {
|
|
1060
1060
|
return await t();
|
|
1061
1061
|
} catch (n) {
|
|
1062
|
-
const a = Math.min(this._calculateRetryDelay(n),
|
|
1062
|
+
const a = Math.min(this._calculateRetryDelay(n), we);
|
|
1063
1063
|
if (a !== 0 && this._retryCount > 0) {
|
|
1064
|
-
await
|
|
1064
|
+
await Yt(a, { signal: this._options.signal });
|
|
1065
1065
|
for (const i of this._options.hooks.beforeRetry)
|
|
1066
1066
|
if (await i({
|
|
1067
1067
|
request: this.request,
|
|
1068
1068
|
options: this._options,
|
|
1069
1069
|
error: n,
|
|
1070
1070
|
retryCount: this._retryCount
|
|
1071
|
-
}) ===
|
|
1071
|
+
}) === et)
|
|
1072
1072
|
return;
|
|
1073
1073
|
return this._retry(t);
|
|
1074
1074
|
}
|
|
@@ -1085,8 +1085,8 @@ class oe {
|
|
|
1085
1085
|
if (a instanceof Response)
|
|
1086
1086
|
return a;
|
|
1087
1087
|
}
|
|
1088
|
-
const t =
|
|
1089
|
-
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) :
|
|
1088
|
+
const t = Jt(this.request, this._options);
|
|
1089
|
+
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Qt(this.request.clone(), t, this.abortController, this._options);
|
|
1090
1090
|
}
|
|
1091
1091
|
/* istanbul ignore next */
|
|
1092
1092
|
_stream(t, n) {
|
|
@@ -1123,12 +1123,12 @@ class oe {
|
|
|
1123
1123
|
}
|
|
1124
1124
|
}
|
|
1125
1125
|
/*! MIT License © Sindre Sorhus */
|
|
1126
|
-
const
|
|
1126
|
+
const ve = (e) => {
|
|
1127
1127
|
const t = (n, a) => oe.create(n, re(e, a));
|
|
1128
|
-
for (const n of
|
|
1128
|
+
for (const n of ze)
|
|
1129
1129
|
t[n] = (a, i) => oe.create(a, re(e, i, { method: n }));
|
|
1130
|
-
return t.create = (n) =>
|
|
1131
|
-
},
|
|
1130
|
+
return t.create = (n) => ve(re(n)), t.extend = (n) => ve(re(e, n)), t.stop = et, t;
|
|
1131
|
+
}, nt = ve();
|
|
1132
1132
|
let ue;
|
|
1133
1133
|
const L = {
|
|
1134
1134
|
CachedPrices: `${V.ThorswapApi}/tokenlist/cached-price`,
|
|
@@ -1138,15 +1138,15 @@ const L = {
|
|
|
1138
1138
|
TokenlistProviders: `${V.ThorswapApi}/tokenlist/providers`,
|
|
1139
1139
|
TokenList: `${V.ThorswapStatic}/token-list`,
|
|
1140
1140
|
Thorname: `${V.ThorswapApi}/thorname`
|
|
1141
|
-
},
|
|
1142
|
-
ue =
|
|
1141
|
+
}, at = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, qe = () => ue || (ue = nt.create({ headers: at }), ue), ia = ({ apiKey: e, ...t }) => {
|
|
1142
|
+
ue = nt.create({
|
|
1143
1143
|
...t,
|
|
1144
|
-
headers: { ...
|
|
1144
|
+
headers: { ...at, ...t.headers, "x-api-key": e }
|
|
1145
1145
|
});
|
|
1146
1146
|
}, R = {
|
|
1147
|
-
get: (e, t) =>
|
|
1148
|
-
post: (e, t) =>
|
|
1149
|
-
},
|
|
1147
|
+
get: (e, t) => qe().get(e, t).json(),
|
|
1148
|
+
post: (e, t) => qe().post(e, t).json()
|
|
1149
|
+
}, Zt = ({ tokens: e, ...t }) => {
|
|
1150
1150
|
const n = new URLSearchParams(), a = e.filter(
|
|
1151
1151
|
(i, s, p) => p.findIndex((u) => u === i) === s
|
|
1152
1152
|
);
|
|
@@ -1156,8 +1156,8 @@ const L = {
|
|
|
1156
1156
|
body: n.toString(),
|
|
1157
1157
|
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
1158
1158
|
});
|
|
1159
|
-
},
|
|
1160
|
-
getCachedPrices:
|
|
1159
|
+
}, sa = {
|
|
1160
|
+
getCachedPrices: Zt,
|
|
1161
1161
|
getQuote: (e) => R.get(L.Quote, { searchParams: e }),
|
|
1162
1162
|
getGasRates: () => R.get(L.GasRates),
|
|
1163
1163
|
getTxnDetails: (e) => R.get(L.Txn, { searchParams: e }),
|
|
@@ -1167,10 +1167,10 @@ const L = {
|
|
|
1167
1167
|
getThornameRegisteredChains: (e) => R.get(`${L.Thorname}/chains/${e}`),
|
|
1168
1168
|
getThornameRlookup: (e, t) => R.get(`${L.Thorname}/rlookup`, { searchParams: { address: e, chain: t } })
|
|
1169
1169
|
};
|
|
1170
|
-
var
|
|
1171
|
-
const
|
|
1170
|
+
var zt = /* @__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))(zt || {}), en = /* @__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))(en || {}), tn = /* @__PURE__ */ ((e) => (e[e.NOT_STARTED = 0] = "NOT_STARTED", e[e.SUCCESS = 1] = "SUCCESS", e[e.REFUNDED = 2] = "REFUNDED", e))(tn || {});
|
|
1171
|
+
const nn = "0x313ce567", it = async ({ chain: e, to: t }) => {
|
|
1172
1172
|
try {
|
|
1173
|
-
const { result: n } = await R.post(
|
|
1173
|
+
const { result: n } = await R.post(Rt[e], {
|
|
1174
1174
|
headers: {
|
|
1175
1175
|
accept: "*/*",
|
|
1176
1176
|
"content-type": "application/json",
|
|
@@ -1180,37 +1180,37 @@ const Zt = "0x313ce567", at = async ({ chain: e, to: t }) => {
|
|
|
1180
1180
|
id: 44,
|
|
1181
1181
|
jsonrpc: "2.0",
|
|
1182
1182
|
method: "eth_call",
|
|
1183
|
-
params: [{ to: t.toLowerCase(), data:
|
|
1183
|
+
params: [{ to: t.toLowerCase(), data: nn }, "latest"]
|
|
1184
1184
|
})
|
|
1185
1185
|
});
|
|
1186
1186
|
return parseInt(BigInt(n).toString());
|
|
1187
1187
|
} catch (n) {
|
|
1188
1188
|
return console.error(n), A[e];
|
|
1189
1189
|
}
|
|
1190
|
-
},
|
|
1190
|
+
}, an = (e) => {
|
|
1191
1191
|
if (e === r.Ethereum)
|
|
1192
1192
|
return A.ETH;
|
|
1193
1193
|
const [, t] = e.split("-");
|
|
1194
|
-
return t != null && t.startsWith("0x") ?
|
|
1195
|
-
},
|
|
1194
|
+
return t != null && t.startsWith("0x") ? it({ chain: r.Ethereum, to: t }) : A.ETH;
|
|
1195
|
+
}, sn = (e) => {
|
|
1196
1196
|
const [, t] = e.split("-");
|
|
1197
|
-
return t != null && t.startsWith("0x") ?
|
|
1198
|
-
},
|
|
1197
|
+
return t != null && t.startsWith("0x") ? it({ chain: r.Avalanche, to: t.toLowerCase() }) : A.AVAX;
|
|
1198
|
+
}, rn = (e) => (e === r.BinanceSmartChain, A.BSC), pn = ({ chain: e, symbol: t }) => {
|
|
1199
1199
|
switch (e) {
|
|
1200
1200
|
case r.Ethereum:
|
|
1201
|
-
return
|
|
1201
|
+
return an(t);
|
|
1202
1202
|
case r.Avalanche:
|
|
1203
|
-
return
|
|
1203
|
+
return sn(t);
|
|
1204
1204
|
case r.BinanceSmartChain:
|
|
1205
|
-
return
|
|
1205
|
+
return rn(t);
|
|
1206
1206
|
default:
|
|
1207
1207
|
return A[e];
|
|
1208
1208
|
}
|
|
1209
|
-
},
|
|
1209
|
+
}, un = {
|
|
1210
1210
|
[Q.Average]: 1.2,
|
|
1211
1211
|
[Q.Fast]: 1.5,
|
|
1212
1212
|
[Q.Fastest]: 2
|
|
1213
|
-
},
|
|
1213
|
+
}, st = ({ chain: e, symbol: t }) => {
|
|
1214
1214
|
switch (e) {
|
|
1215
1215
|
case r.Arbitrum:
|
|
1216
1216
|
case r.Optimism:
|
|
@@ -1230,7 +1230,7 @@ const Zt = "0x313ce567", at = async ({ chain: e, to: t }) => {
|
|
|
1230
1230
|
default:
|
|
1231
1231
|
return t === e;
|
|
1232
1232
|
}
|
|
1233
|
-
},
|
|
1233
|
+
}, yn = (e) => {
|
|
1234
1234
|
switch (e) {
|
|
1235
1235
|
case `${r.Ethereum}.THOR`:
|
|
1236
1236
|
return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
|
|
@@ -1251,7 +1251,7 @@ const Zt = "0x313ce567", at = async ({ chain: e, to: t }) => {
|
|
|
1251
1251
|
default:
|
|
1252
1252
|
return { identifier: `${e}.${e}`, decimal: A[e] };
|
|
1253
1253
|
}
|
|
1254
|
-
},
|
|
1254
|
+
}, on = ({ chain: e, symbol: t }) => {
|
|
1255
1255
|
if (t.includes("/"))
|
|
1256
1256
|
return "Synth";
|
|
1257
1257
|
switch (e) {
|
|
@@ -1276,70 +1276,70 @@ const Zt = "0x313ce567", at = async ({ chain: e, to: t }) => {
|
|
|
1276
1276
|
default:
|
|
1277
1277
|
return "Native";
|
|
1278
1278
|
}
|
|
1279
|
-
},
|
|
1279
|
+
}, ra = (e) => {
|
|
1280
1280
|
var t;
|
|
1281
1281
|
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
1282
|
return { chain: n, symbol: s, ticker: p, synth: i };
|
|
1283
|
-
},
|
|
1283
|
+
}, dn = new RegExp(
|
|
1284
1284
|
/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
|
|
1285
1285
|
"gmi"
|
|
1286
|
-
),
|
|
1286
|
+
), ln = (e) => {
|
|
1287
1287
|
const [t, n] = e.split(".");
|
|
1288
|
-
if (!
|
|
1288
|
+
if (!je.includes(t))
|
|
1289
1289
|
return !0;
|
|
1290
1290
|
const [, a] = n.split("-");
|
|
1291
|
-
return
|
|
1292
|
-
},
|
|
1291
|
+
return st({ chain: t, symbol: n }) || !!a;
|
|
1292
|
+
}, pa = (e) => e.filter(({ chain: t, value: n, symbol: a }) => {
|
|
1293
1293
|
const i = `${t}.${a}`;
|
|
1294
|
-
return !
|
|
1294
|
+
return !dn.test(i) && ln(i) && n !== "0";
|
|
1295
1295
|
});
|
|
1296
|
-
function
|
|
1296
|
+
function mn({
|
|
1297
1297
|
liquidityUnits: e,
|
|
1298
1298
|
poolUnits: t,
|
|
1299
1299
|
runeDepth: n
|
|
1300
1300
|
}) {
|
|
1301
|
-
const a =
|
|
1301
|
+
const a = k(e), i = k(t), s = k(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
1302
|
return p.mul(u.sub(y).add(o)).div(l);
|
|
1303
1303
|
}
|
|
1304
|
-
function
|
|
1304
|
+
function Tn({
|
|
1305
1305
|
liquidityUnits: e,
|
|
1306
1306
|
poolUnits: t,
|
|
1307
1307
|
assetDepth: n
|
|
1308
1308
|
}) {
|
|
1309
|
-
const a =
|
|
1309
|
+
const a = k(e), i = k(t), s = k(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
1310
|
return l.div(b);
|
|
1311
1311
|
}
|
|
1312
|
-
function
|
|
1312
|
+
function ua({
|
|
1313
1313
|
percent: e,
|
|
1314
1314
|
runeDepth: t,
|
|
1315
1315
|
liquidityUnits: n,
|
|
1316
1316
|
poolUnits: a
|
|
1317
1317
|
}) {
|
|
1318
|
-
return
|
|
1318
|
+
return mn({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
|
|
1319
1319
|
}
|
|
1320
|
-
function
|
|
1320
|
+
function ya({
|
|
1321
1321
|
percent: e,
|
|
1322
1322
|
assetDepth: t,
|
|
1323
1323
|
liquidityUnits: n,
|
|
1324
1324
|
poolUnits: a
|
|
1325
1325
|
}) {
|
|
1326
|
-
return
|
|
1326
|
+
return Tn({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
|
|
1327
1327
|
}
|
|
1328
|
-
function
|
|
1328
|
+
function k(e) {
|
|
1329
1329
|
return D.fromBigInt(BigInt(e), A.THOR);
|
|
1330
1330
|
}
|
|
1331
|
-
function
|
|
1331
|
+
function cn({
|
|
1332
1332
|
liquidityUnits: e,
|
|
1333
1333
|
poolUnits: t,
|
|
1334
1334
|
runeDepth: n,
|
|
1335
1335
|
assetDepth: a
|
|
1336
1336
|
}) {
|
|
1337
1337
|
return {
|
|
1338
|
-
assetAmount:
|
|
1339
|
-
runeAmount:
|
|
1338
|
+
assetAmount: k(a).mul(e).div(t),
|
|
1339
|
+
runeAmount: k(n).mul(e).div(t)
|
|
1340
1340
|
};
|
|
1341
1341
|
}
|
|
1342
|
-
function
|
|
1342
|
+
function oa({
|
|
1343
1343
|
liquidityUnits: e,
|
|
1344
1344
|
poolUnits: t,
|
|
1345
1345
|
runeDepth: n,
|
|
@@ -1347,12 +1347,12 @@ function pa({
|
|
|
1347
1347
|
percent: i
|
|
1348
1348
|
}) {
|
|
1349
1349
|
return Object.fromEntries(
|
|
1350
|
-
Object.entries(
|
|
1350
|
+
Object.entries(cn({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
|
|
1351
1351
|
([s, p]) => [s, p.mul(i)]
|
|
1352
1352
|
)
|
|
1353
1353
|
);
|
|
1354
1354
|
}
|
|
1355
|
-
function
|
|
1355
|
+
function da({
|
|
1356
1356
|
runeDepth: e,
|
|
1357
1357
|
poolUnits: t,
|
|
1358
1358
|
assetDepth: n,
|
|
@@ -1360,13 +1360,13 @@ function ua({
|
|
|
1360
1360
|
runeAmount: i,
|
|
1361
1361
|
assetAmount: s
|
|
1362
1362
|
}) {
|
|
1363
|
-
const p = new D({ value: e, decimal: 8 }), u = new D({ value: n, decimal: 8 }), y = new D({ value: t, decimal: 8 }), o = new D({ value: i, decimal: 8 }), l = new D({ value: s, decimal: 8 }), b = o.mul(u),
|
|
1363
|
+
const p = new D({ value: e, decimal: 8 }), u = new D({ value: n, decimal: 8 }), y = new D({ value: t, decimal: 8 }), o = new D({ value: i, decimal: 8 }), l = new D({ value: s, decimal: 8 }), b = o.mul(u), c = l.mul(p), f = o.mul(l), _ = p.mul(u), M = y.mul(b.add(c.add(f.mul(2)))), v = b.add(c.add(_.mul(2))), E = M.div(v), S = k(a).add(E);
|
|
1364
1364
|
if (E.getBaseValue("number") === 0)
|
|
1365
1365
|
return S.div(y).getBaseValue("number");
|
|
1366
1366
|
const Y = y.add(S);
|
|
1367
1367
|
return S.div(Y).getBaseValue("number");
|
|
1368
1368
|
}
|
|
1369
|
-
function
|
|
1369
|
+
function la({
|
|
1370
1370
|
runeAmount: e,
|
|
1371
1371
|
assetAmount: t,
|
|
1372
1372
|
runeDepth: n,
|
|
@@ -1374,7 +1374,7 @@ function ya({
|
|
|
1374
1374
|
}) {
|
|
1375
1375
|
if (e === "0" || t === "0" || n === "0" || a === "0")
|
|
1376
1376
|
return 0;
|
|
1377
|
-
const i =
|
|
1377
|
+
const i = k(n), s = k(a), p = k(t), u = k(e), y = p.mul(i).sub(s.mul(u)), o = s.mul(u).add(i.mul(s));
|
|
1378
1378
|
return Math.abs(y.div(o).getBaseValue("number"));
|
|
1379
1379
|
}
|
|
1380
1380
|
const F = (e, t) => {
|
|
@@ -1420,27 +1420,27 @@ const F = (e, t) => {
|
|
|
1420
1420
|
return "";
|
|
1421
1421
|
}
|
|
1422
1422
|
};
|
|
1423
|
-
function
|
|
1423
|
+
function ma(e) {
|
|
1424
1424
|
if (e < 0)
|
|
1425
1425
|
throw new Error("Invalid number of year");
|
|
1426
1426
|
return 10 + e;
|
|
1427
1427
|
}
|
|
1428
|
-
function
|
|
1428
|
+
function Ta(e) {
|
|
1429
1429
|
if (e.length > 30)
|
|
1430
1430
|
return !1;
|
|
1431
1431
|
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
1432
1432
|
return !!e.match(t);
|
|
1433
1433
|
}
|
|
1434
|
-
function
|
|
1434
|
+
function ca([e, t, n, a, i]) {
|
|
1435
1435
|
return `${e}'/${t}'/${n}'/${a}${typeof i != "number" ? "" : `/${i}`}`;
|
|
1436
1436
|
}
|
|
1437
|
-
const
|
|
1438
|
-
function
|
|
1437
|
+
const We = [...Object.values(r), "TERRA"];
|
|
1438
|
+
function bn(e = "") {
|
|
1439
1439
|
const t = e.toUpperCase(), [n] = t.split(".");
|
|
1440
|
-
if (
|
|
1440
|
+
if (We.includes(n))
|
|
1441
1441
|
return !0;
|
|
1442
1442
|
const [a] = t.split("/");
|
|
1443
|
-
if (
|
|
1443
|
+
if (We.includes(a))
|
|
1444
1444
|
return !0;
|
|
1445
1445
|
throw new Error(
|
|
1446
1446
|
`Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
|
|
@@ -1465,15 +1465,15 @@ function fe({
|
|
|
1465
1465
|
""
|
|
1466
1466
|
);
|
|
1467
1467
|
}
|
|
1468
|
-
var X, Z, W, j,
|
|
1469
|
-
const
|
|
1468
|
+
var X, Z, W, j, Ee, rt, ye, Ae, de, Ce;
|
|
1469
|
+
const fn = class Oe {
|
|
1470
1470
|
constructor(t) {
|
|
1471
|
-
J(this, X), J(this, W), J(this,
|
|
1471
|
+
J(this, X), J(this, W), J(this, Ee), J(this, ye), J(this, de), I(this, "decimalMultiplier", 10n ** 8n), I(this, "bigIntValue", 0n), I(this, "decimal");
|
|
1472
1472
|
const n = ke(t), a = typeof t == "object";
|
|
1473
|
-
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier : N(Math.max(
|
|
1473
|
+
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier : N(Math.max(pt(le(n)), this.decimal || 0)), C(this, Ee, rt).call(this, n);
|
|
1474
1474
|
}
|
|
1475
1475
|
static fromBigInt(t, n) {
|
|
1476
|
-
return new
|
|
1476
|
+
return new Oe({
|
|
1477
1477
|
decimal: n,
|
|
1478
1478
|
value: fe({ value: t, bigIntDecimal: n, decimal: n })
|
|
1479
1479
|
});
|
|
@@ -1483,7 +1483,7 @@ const mn = class Ce {
|
|
|
1483
1483
|
from: n,
|
|
1484
1484
|
to: a
|
|
1485
1485
|
}) {
|
|
1486
|
-
return
|
|
1486
|
+
return Oe.fromBigInt(
|
|
1487
1487
|
t.getBaseValue("bigint") * N(a) / N(n),
|
|
1488
1488
|
a
|
|
1489
1489
|
);
|
|
@@ -1549,7 +1549,7 @@ const mn = class Ce {
|
|
|
1549
1549
|
if (!n && typeof t == "object")
|
|
1550
1550
|
return t.bigIntValue;
|
|
1551
1551
|
const a = ke(t), i = le(a);
|
|
1552
|
-
return i === "0" || i === "undefined" ? 0n : C(this, de,
|
|
1552
|
+
return i === "0" || i === "undefined" ? 0n : C(this, de, Ce).call(this, i, n);
|
|
1553
1553
|
}
|
|
1554
1554
|
toSignificant(t = 6) {
|
|
1555
1555
|
const [n, a] = this.getValue("string").split("."), i = n || "", s = a || "";
|
|
@@ -1607,7 +1607,7 @@ const mn = class Ce {
|
|
|
1607
1607
|
}
|
|
1608
1608
|
};
|
|
1609
1609
|
X = /* @__PURE__ */ new WeakSet(), Z = function(e, ...t) {
|
|
1610
|
-
const n = C(this, ye,
|
|
1610
|
+
const n = C(this, ye, Ae).call(this, this, ...t), a = Math.max(n, ee(this.decimalMultiplier)), i = N(a), s = t.reduce(
|
|
1611
1611
|
(u, y) => {
|
|
1612
1612
|
const o = this.getBigIntValue(y, a);
|
|
1613
1613
|
switch (e) {
|
|
@@ -1640,7 +1640,7 @@ X = /* @__PURE__ */ new WeakSet(), Z = function(e, ...t) {
|
|
|
1640
1640
|
identifier: this.toString()
|
|
1641
1641
|
});
|
|
1642
1642
|
}, W = /* @__PURE__ */ new WeakSet(), j = function(e, ...t) {
|
|
1643
|
-
const n = C(this, ye,
|
|
1643
|
+
const n = C(this, ye, Ae).call(this, this, ...t), a = this.getBigIntValue(t[0], n), i = this.getBigIntValue(this, n);
|
|
1644
1644
|
switch (e) {
|
|
1645
1645
|
case "gt":
|
|
1646
1646
|
return i > a;
|
|
@@ -1653,26 +1653,26 @@ X = /* @__PURE__ */ new WeakSet(), Z = function(e, ...t) {
|
|
|
1653
1653
|
case "eqValue":
|
|
1654
1654
|
return i === a;
|
|
1655
1655
|
}
|
|
1656
|
-
},
|
|
1656
|
+
}, Ee = /* @__PURE__ */ new WeakSet(), rt = function(e) {
|
|
1657
1657
|
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 || ee(n.decimalMultiplier) :
|
|
1658
|
+
this.bigIntValue = C(this, de, Ce).call(this, t);
|
|
1659
|
+
}, ye = /* @__PURE__ */ new WeakSet(), Ae = function(...e) {
|
|
1660
|
+
const t = e.map((n) => typeof n == "object" ? n.decimal || ee(n.decimalMultiplier) : pt(le(n))).filter(Boolean);
|
|
1661
1661
|
return Math.max(...t, ne);
|
|
1662
|
-
}, de = /* @__PURE__ */ new WeakSet(),
|
|
1662
|
+
}, de = /* @__PURE__ */ new WeakSet(), Ce = function(e, t) {
|
|
1663
1663
|
const n = t ? N(t) : this.decimalMultiplier, a = ee(n), [i = "", s = ""] = e.split(".");
|
|
1664
1664
|
return BigInt(`${i}${s.padEnd(a, "0")}`);
|
|
1665
1665
|
};
|
|
1666
|
-
let
|
|
1667
|
-
const
|
|
1666
|
+
let xe = fn;
|
|
1667
|
+
const hn = Intl.NumberFormat("fullwide", {
|
|
1668
1668
|
useGrouping: !1,
|
|
1669
1669
|
maximumFractionDigits: 20
|
|
1670
1670
|
});
|
|
1671
1671
|
function le(e) {
|
|
1672
|
-
const t = `${typeof e == "number" ?
|
|
1672
|
+
const t = `${typeof e == "number" ? hn.format(e) : ke(e)}`.replaceAll(",", ".").split(".");
|
|
1673
1673
|
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1674
1674
|
}
|
|
1675
|
-
function
|
|
1675
|
+
function pt(e) {
|
|
1676
1676
|
var t;
|
|
1677
1677
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1678
1678
|
return Math.max(n, ne);
|
|
@@ -1680,7 +1680,7 @@ function rt(e) {
|
|
|
1680
1680
|
function ke(e) {
|
|
1681
1681
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1682
1682
|
}
|
|
1683
|
-
class D extends
|
|
1683
|
+
class D extends xe {
|
|
1684
1684
|
eq(t) {
|
|
1685
1685
|
return this.eqValue(t);
|
|
1686
1686
|
}
|
|
@@ -1692,7 +1692,7 @@ class D extends Oe {
|
|
|
1692
1692
|
}
|
|
1693
1693
|
}
|
|
1694
1694
|
const G = /* @__PURE__ */ new Map();
|
|
1695
|
-
class
|
|
1695
|
+
class x extends xe {
|
|
1696
1696
|
constructor({
|
|
1697
1697
|
value: t,
|
|
1698
1698
|
decimal: n,
|
|
@@ -1703,7 +1703,7 @@ class k extends Oe {
|
|
|
1703
1703
|
}) {
|
|
1704
1704
|
super(typeof t == "object" ? t : { decimal: n, value: t }), I(this, "address"), I(this, "chain"), I(this, "isGasAsset", !1), I(this, "isSynthetic", !1), I(this, "symbol"), I(this, "tax"), I(this, "ticker"), I(this, "type");
|
|
1705
1705
|
const u = z(p || `${i}.${s}`);
|
|
1706
|
-
this.type =
|
|
1706
|
+
this.type = on(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
1707
|
}
|
|
1708
1708
|
toString() {
|
|
1709
1709
|
return this.isSynthetic ? this.symbol : `${this.chain}.${this.symbol}`;
|
|
@@ -1715,7 +1715,7 @@ class k extends Oe {
|
|
|
1715
1715
|
return this.chain === t && this.symbol === n;
|
|
1716
1716
|
}
|
|
1717
1717
|
chainId() {
|
|
1718
|
-
return
|
|
1718
|
+
return Ke[this.chain];
|
|
1719
1719
|
}
|
|
1720
1720
|
// THOR.RUNE
|
|
1721
1721
|
// THOR.ETH.ETH
|
|
@@ -1725,23 +1725,23 @@ class k extends Oe {
|
|
|
1725
1725
|
if (!(a && i))
|
|
1726
1726
|
throw new Error("Invalid asset url");
|
|
1727
1727
|
const p = a === r.THORChain && s ? `${a}.${i}/${s}` : t;
|
|
1728
|
-
return
|
|
1728
|
+
return _e(p, n);
|
|
1729
1729
|
}
|
|
1730
1730
|
static fromString(t, n = 0) {
|
|
1731
|
-
return
|
|
1731
|
+
return _e(t, n);
|
|
1732
1732
|
}
|
|
1733
1733
|
static fromIdentifier(t, n = 0) {
|
|
1734
|
-
return
|
|
1734
|
+
return _e(t, n);
|
|
1735
1735
|
}
|
|
1736
1736
|
static fromStringSync(t, n = 0) {
|
|
1737
1737
|
const { chain: a, isSynthetic: i } = z(t), s = G.get(t.toUpperCase());
|
|
1738
1738
|
if (i)
|
|
1739
|
-
return
|
|
1739
|
+
return Me(t, n);
|
|
1740
1740
|
const { tax: p, decimal: u, identifier: y } = s || {
|
|
1741
1741
|
decimal: A[a],
|
|
1742
1742
|
identifier: t
|
|
1743
1743
|
};
|
|
1744
|
-
return new
|
|
1744
|
+
return new x({
|
|
1745
1745
|
tax: p,
|
|
1746
1746
|
value: K(n, u),
|
|
1747
1747
|
identifier: i ? t : y,
|
|
@@ -1749,22 +1749,22 @@ class k extends Oe {
|
|
|
1749
1749
|
});
|
|
1750
1750
|
}
|
|
1751
1751
|
static async fromStringWithBase(t, n = 0, a = A.THOR) {
|
|
1752
|
-
const i =
|
|
1752
|
+
const i = xe.shiftDecimals({
|
|
1753
1753
|
value: D.fromBigInt(BigInt(n)),
|
|
1754
1754
|
from: 0,
|
|
1755
1755
|
to: a
|
|
1756
1756
|
}).getBaseValue("string");
|
|
1757
|
-
return (await
|
|
1757
|
+
return (await x.fromString(t, n)).set(i);
|
|
1758
1758
|
}
|
|
1759
1759
|
static fromStringWithBaseSync(t, n = 0, a = A.THOR) {
|
|
1760
1760
|
const { chain: i, isSynthetic: s } = z(t), p = G.get(t.toUpperCase());
|
|
1761
1761
|
if (s)
|
|
1762
|
-
return
|
|
1762
|
+
return Me(t, n);
|
|
1763
1763
|
const { tax: u, decimal: y, identifier: o } = p || {
|
|
1764
1764
|
decimal: A[i],
|
|
1765
1765
|
identifier: t
|
|
1766
1766
|
};
|
|
1767
|
-
return new
|
|
1767
|
+
return new x({
|
|
1768
1768
|
tax: u,
|
|
1769
1769
|
value: K(BigInt(n), a),
|
|
1770
1770
|
identifier: o,
|
|
@@ -1774,16 +1774,16 @@ class k extends Oe {
|
|
|
1774
1774
|
static fromIdentifierSync(t, n = 0) {
|
|
1775
1775
|
const { chain: a, isSynthetic: i } = z(t), s = G.get(t);
|
|
1776
1776
|
if (i)
|
|
1777
|
-
return
|
|
1777
|
+
return Me(t, n);
|
|
1778
1778
|
const { tax: p, decimal: u, identifier: y } = s || {
|
|
1779
1779
|
decimal: A[a],
|
|
1780
1780
|
identifier: t
|
|
1781
1781
|
};
|
|
1782
|
-
return new
|
|
1782
|
+
return new x({ tax: p, decimal: u, identifier: y, value: K(n, u) });
|
|
1783
1783
|
}
|
|
1784
1784
|
static fromChainOrSignature(t, n = 0) {
|
|
1785
|
-
const { decimal: a, identifier: i } =
|
|
1786
|
-
return new
|
|
1785
|
+
const { decimal: a, identifier: i } = yn(t);
|
|
1786
|
+
return new x({ value: K(n, a), decimal: a, identifier: i });
|
|
1787
1787
|
}
|
|
1788
1788
|
static loadStaticAssets() {
|
|
1789
1789
|
return new Promise(
|
|
@@ -1809,8 +1809,8 @@ class k extends Oe {
|
|
|
1809
1809
|
);
|
|
1810
1810
|
}
|
|
1811
1811
|
}
|
|
1812
|
-
function
|
|
1813
|
-
const t =
|
|
1812
|
+
function ge(e) {
|
|
1813
|
+
const t = x.fromChainOrSignature(e);
|
|
1814
1814
|
switch (e) {
|
|
1815
1815
|
case r.Bitcoin:
|
|
1816
1816
|
case r.Litecoin:
|
|
@@ -1830,16 +1830,16 @@ function Ae(e) {
|
|
|
1830
1830
|
return t.set(1e-8);
|
|
1831
1831
|
}
|
|
1832
1832
|
}
|
|
1833
|
-
async function
|
|
1834
|
-
|
|
1835
|
-
const n = G.get(e.toUpperCase()), a = (n == null ? void 0 : n.decimal) || await
|
|
1836
|
-
return n || G.set(e.toUpperCase(), { identifier: e, decimal: a }), new
|
|
1833
|
+
async function _e(e, t = 0) {
|
|
1834
|
+
bn(e);
|
|
1835
|
+
const n = G.get(e.toUpperCase()), a = (n == null ? void 0 : n.decimal) || await pn(z(e));
|
|
1836
|
+
return n || G.set(e.toUpperCase(), { identifier: e, decimal: a }), new x({ decimal: a, value: K(t, a), identifier: e });
|
|
1837
1837
|
}
|
|
1838
|
-
function
|
|
1838
|
+
function Me(e, t = 0) {
|
|
1839
1839
|
const [n, a] = e.split(".")[0].toUpperCase() === r.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
|
|
1840
1840
|
if (!(n && a))
|
|
1841
1841
|
throw new Error("Invalid asset identifier");
|
|
1842
|
-
return new
|
|
1842
|
+
return new x({
|
|
1843
1843
|
decimal: 8,
|
|
1844
1844
|
value: K(t, 8),
|
|
1845
1845
|
identifier: `${r.THORChain}.${n}/${a}`
|
|
@@ -1856,13 +1856,13 @@ function z(e) {
|
|
|
1856
1856
|
return {
|
|
1857
1857
|
address: y == null ? void 0 : y.toLowerCase(),
|
|
1858
1858
|
chain: s,
|
|
1859
|
-
isGasAsset:
|
|
1859
|
+
isGasAsset: st({ chain: s, symbol: o }),
|
|
1860
1860
|
isSynthetic: t,
|
|
1861
1861
|
symbol: (t ? `${n}/` : "") + (y ? `${u}-${(y == null ? void 0 : y.toLowerCase()) ?? ""}` : o),
|
|
1862
1862
|
ticker: u
|
|
1863
1863
|
};
|
|
1864
1864
|
}
|
|
1865
|
-
const
|
|
1865
|
+
const wn = {
|
|
1866
1866
|
/**
|
|
1867
1867
|
* Core
|
|
1868
1868
|
*/
|
|
@@ -1926,6 +1926,7 @@ const cn = {
|
|
|
1926
1926
|
* Chainflip
|
|
1927
1927
|
*/
|
|
1928
1928
|
chainflip_channel_error: 30001,
|
|
1929
|
+
chainflip_broker_recipient_error: 30002,
|
|
1929
1930
|
/**
|
|
1930
1931
|
* THORChain
|
|
1931
1932
|
*/
|
|
@@ -1940,11 +1941,63 @@ class d extends Error {
|
|
|
1940
1941
|
stack: n == null ? void 0 : n.stack,
|
|
1941
1942
|
message: n == null ? void 0 : n.message
|
|
1942
1943
|
}), super(t, {
|
|
1943
|
-
cause: { code:
|
|
1944
|
+
cause: { code: wn[t], message: t }
|
|
1944
1945
|
}), Object.setPrototypeOf(this, d.prototype);
|
|
1945
1946
|
}
|
|
1946
1947
|
}
|
|
1947
|
-
|
|
1948
|
+
const ut = ({ chain: e, txHash: t }) => {
|
|
1949
|
+
const n = Qe[e];
|
|
1950
|
+
switch (e) {
|
|
1951
|
+
case r.Binance:
|
|
1952
|
+
case r.Maya:
|
|
1953
|
+
case r.Kujira:
|
|
1954
|
+
case r.THORChain:
|
|
1955
|
+
return `${n}/tx/${t.startsWith("0x") ? t.slice(2) : t}`;
|
|
1956
|
+
case r.Arbitrum:
|
|
1957
|
+
case r.Avalanche:
|
|
1958
|
+
case r.BinanceSmartChain:
|
|
1959
|
+
case r.Ethereum:
|
|
1960
|
+
case r.Optimism:
|
|
1961
|
+
case r.Polkadot:
|
|
1962
|
+
case r.Polygon:
|
|
1963
|
+
return `${n}/tx/${t.startsWith("0x") ? t : `0x${t}`}`;
|
|
1964
|
+
case r.Cosmos:
|
|
1965
|
+
return `${n}/transactions/${t}`;
|
|
1966
|
+
case r.Litecoin:
|
|
1967
|
+
case r.Bitcoin:
|
|
1968
|
+
case r.BitcoinCash:
|
|
1969
|
+
case r.Dogecoin:
|
|
1970
|
+
return `${n}/transaction/${t.toLowerCase()}`;
|
|
1971
|
+
default:
|
|
1972
|
+
throw new Error(`Unsupported chain: ${e}`);
|
|
1973
|
+
}
|
|
1974
|
+
}, yt = ({ chain: e, address: t }) => {
|
|
1975
|
+
const n = Qe[e];
|
|
1976
|
+
switch (e) {
|
|
1977
|
+
case r.Arbitrum:
|
|
1978
|
+
case r.Avalanche:
|
|
1979
|
+
case r.Binance:
|
|
1980
|
+
case r.BinanceSmartChain:
|
|
1981
|
+
case r.Bitcoin:
|
|
1982
|
+
case r.BitcoinCash:
|
|
1983
|
+
case r.Dogecoin:
|
|
1984
|
+
case r.Ethereum:
|
|
1985
|
+
case r.Kujira:
|
|
1986
|
+
case r.Litecoin:
|
|
1987
|
+
case r.Maya:
|
|
1988
|
+
case r.Optimism:
|
|
1989
|
+
case r.Polkadot:
|
|
1990
|
+
case r.Polygon:
|
|
1991
|
+
case r.THORChain:
|
|
1992
|
+
return `${n}/address/${t}`;
|
|
1993
|
+
case r.Cosmos:
|
|
1994
|
+
return `${n}/account/${t}`;
|
|
1995
|
+
default:
|
|
1996
|
+
throw new Error(`Unsupported chain: ${e}`);
|
|
1997
|
+
}
|
|
1998
|
+
};
|
|
1999
|
+
var An = /* @__PURE__ */ ((e) => (e.Approve = "approve", e.CheckOnly = "checkOnly", e))(An || {});
|
|
2000
|
+
function ba({
|
|
1948
2001
|
stagenet: e,
|
|
1949
2002
|
wallets: t,
|
|
1950
2003
|
providers: n,
|
|
@@ -1953,18 +2006,18 @@ function ma({
|
|
|
1953
2006
|
rpcUrls: s
|
|
1954
2007
|
}) {
|
|
1955
2008
|
const p = {}, u = {};
|
|
1956
|
-
for (const
|
|
1957
|
-
const { name: h, methods: B } =
|
|
2009
|
+
for (const m of n) {
|
|
2010
|
+
const { name: h, methods: B } = m({ wallets: p, stagenet: e });
|
|
1958
2011
|
u[h] = B;
|
|
1959
2012
|
}
|
|
1960
|
-
const y = t.reduce((
|
|
2013
|
+
const y = t.reduce((m, h) => (m[h.connectMethodName] = h.connect({
|
|
1961
2014
|
addChain: l,
|
|
1962
2015
|
config: a,
|
|
1963
2016
|
apis: i,
|
|
1964
2017
|
rpcUrls: s
|
|
1965
|
-
}),
|
|
1966
|
-
function o(
|
|
1967
|
-
const h = u[
|
|
2018
|
+
}), m), {});
|
|
2019
|
+
function o(m) {
|
|
2020
|
+
const h = u[m] || Object.values(u)[0];
|
|
1968
2021
|
if (!h)
|
|
1969
2022
|
throw new d(
|
|
1970
2023
|
"core_swap_provider_not_found",
|
|
@@ -1972,48 +2025,54 @@ function ma({
|
|
|
1972
2025
|
);
|
|
1973
2026
|
return h;
|
|
1974
2027
|
}
|
|
1975
|
-
function l(
|
|
1976
|
-
p[
|
|
2028
|
+
function l(m) {
|
|
2029
|
+
p[m.chain] = m;
|
|
1977
2030
|
}
|
|
1978
2031
|
function b({
|
|
1979
|
-
assetValue:
|
|
2032
|
+
assetValue: m,
|
|
1980
2033
|
type: h = "checkOnly",
|
|
1981
2034
|
contractAddress: B
|
|
1982
2035
|
}) {
|
|
1983
|
-
const { address: O, chain: H, isGasAsset:
|
|
1984
|
-
if (
|
|
2036
|
+
const { address: O, chain: H, isGasAsset: lt, isSynthetic: mt } = m, He = [r.Ethereum, r.Avalanche, r.BinanceSmartChain].includes(H);
|
|
2037
|
+
if (He && lt || !He || mt)
|
|
1985
2038
|
return Promise.resolve(h === "checkOnly" ? !0 : "approved");
|
|
1986
|
-
const U = p[H],
|
|
1987
|
-
if (!
|
|
2039
|
+
const U = p[H], Fe = h === "checkOnly" ? U == null ? void 0 : U.isApproved : U == null ? void 0 : U.approve;
|
|
2040
|
+
if (!Fe)
|
|
1988
2041
|
throw new d("core_wallet_connection_not_found");
|
|
1989
|
-
const
|
|
1990
|
-
if (!(O &&
|
|
2042
|
+
const De = f(H);
|
|
2043
|
+
if (!(O && De))
|
|
1991
2044
|
throw new d("core_approve_asset_address_or_from_not_found");
|
|
1992
|
-
const
|
|
1993
|
-
return
|
|
1994
|
-
amount:
|
|
2045
|
+
const Tt = B;
|
|
2046
|
+
return Fe({
|
|
2047
|
+
amount: m.getBaseValue("bigint"),
|
|
1995
2048
|
assetAddress: O,
|
|
1996
|
-
from:
|
|
1997
|
-
spenderAddress:
|
|
2049
|
+
from: De,
|
|
2050
|
+
spenderAddress: Tt
|
|
1998
2051
|
});
|
|
1999
2052
|
}
|
|
2000
|
-
function
|
|
2001
|
-
return p[
|
|
2053
|
+
function c(m) {
|
|
2054
|
+
return p[m];
|
|
2002
2055
|
}
|
|
2003
|
-
function f(
|
|
2056
|
+
function f(m) {
|
|
2004
2057
|
var h;
|
|
2005
|
-
return ((h =
|
|
2058
|
+
return ((h = c(m)) == null ? void 0 : h.address) || "";
|
|
2006
2059
|
}
|
|
2007
|
-
function _(
|
|
2060
|
+
function _(m) {
|
|
2008
2061
|
var h;
|
|
2009
|
-
return ((h =
|
|
2062
|
+
return ((h = c(m)) == null ? void 0 : h.balance) || [];
|
|
2063
|
+
}
|
|
2064
|
+
function M(m, h) {
|
|
2065
|
+
return ut({ chain: m, txHash: h });
|
|
2010
2066
|
}
|
|
2011
|
-
function
|
|
2067
|
+
function v(m, h) {
|
|
2068
|
+
return yt({ chain: m, address: h });
|
|
2069
|
+
}
|
|
2070
|
+
function E({ address: m, chain: h }) {
|
|
2012
2071
|
var B, O;
|
|
2013
|
-
return (O = (B =
|
|
2072
|
+
return (O = (B = c(h)) == null ? void 0 : B.validateAddress) == null ? void 0 : O.call(B, m);
|
|
2014
2073
|
}
|
|
2015
|
-
async function
|
|
2016
|
-
const B = [
|
|
2074
|
+
async function S(m, h) {
|
|
2075
|
+
const B = [x.fromChainOrSignature(m)], O = c(m);
|
|
2017
2076
|
try {
|
|
2018
2077
|
if (!O)
|
|
2019
2078
|
throw new d("core_wallet_connection_not_found");
|
|
@@ -2023,39 +2082,41 @@ function ma({
|
|
|
2023
2082
|
throw new d("core_wallet_connection_not_found", H);
|
|
2024
2083
|
}
|
|
2025
2084
|
}
|
|
2026
|
-
function
|
|
2085
|
+
function Y(m, h) {
|
|
2027
2086
|
return b({
|
|
2028
|
-
assetValue:
|
|
2087
|
+
assetValue: m,
|
|
2029
2088
|
contractAddress: h,
|
|
2030
2089
|
type: "approve"
|
|
2031
2090
|
/* Approve */
|
|
2032
2091
|
});
|
|
2033
2092
|
}
|
|
2034
|
-
function
|
|
2093
|
+
function he(m, h) {
|
|
2035
2094
|
return b({
|
|
2036
|
-
assetValue:
|
|
2095
|
+
assetValue: m,
|
|
2037
2096
|
contractAddress: h,
|
|
2038
2097
|
type: "checkOnly"
|
|
2039
2098
|
/* CheckOnly */
|
|
2040
2099
|
});
|
|
2041
2100
|
}
|
|
2042
|
-
function
|
|
2043
|
-
return o(
|
|
2101
|
+
function dt({ provider: m, ...h }) {
|
|
2102
|
+
return o(m == null ? void 0 : m.name).swap({ provider: m, ...h });
|
|
2044
2103
|
}
|
|
2045
2104
|
return {
|
|
2046
2105
|
...u,
|
|
2047
2106
|
...y,
|
|
2048
|
-
approveAssetValue:
|
|
2107
|
+
approveAssetValue: Y,
|
|
2049
2108
|
getAddress: f,
|
|
2050
2109
|
getBalance: _,
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2110
|
+
getExplorerAddressUrl: v,
|
|
2111
|
+
getExplorerTxUrl: M,
|
|
2112
|
+
getWallet: c,
|
|
2113
|
+
getWalletWithBalance: S,
|
|
2114
|
+
isAssetValueApproved: he,
|
|
2115
|
+
swap: dt,
|
|
2116
|
+
validateAddress: E
|
|
2056
2117
|
};
|
|
2057
2118
|
}
|
|
2058
|
-
const
|
|
2119
|
+
const gn = [
|
|
2059
2120
|
{
|
|
2060
2121
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2061
2122
|
stateMutability: "nonpayable",
|
|
@@ -2146,7 +2207,7 @@ const bn = [
|
|
|
2146
2207
|
type: "function"
|
|
2147
2208
|
},
|
|
2148
2209
|
{ stateMutability: "payable", type: "receive" }
|
|
2149
|
-
],
|
|
2210
|
+
], _n = [
|
|
2150
2211
|
{
|
|
2151
2212
|
inputs: [
|
|
2152
2213
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2290,7 +2351,7 @@ const bn = [
|
|
|
2290
2351
|
type: "function"
|
|
2291
2352
|
},
|
|
2292
2353
|
{ stateMutability: "payable", type: "receive" }
|
|
2293
|
-
],
|
|
2354
|
+
], Mn = [
|
|
2294
2355
|
{
|
|
2295
2356
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2296
2357
|
stateMutability: "nonpayable",
|
|
@@ -2395,7 +2456,7 @@ const bn = [
|
|
|
2395
2456
|
type: "function"
|
|
2396
2457
|
},
|
|
2397
2458
|
{ stateMutability: "payable", type: "receive" }
|
|
2398
|
-
],
|
|
2459
|
+
], vn = [
|
|
2399
2460
|
{
|
|
2400
2461
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2401
2462
|
stateMutability: "nonpayable",
|
|
@@ -2486,7 +2547,7 @@ const bn = [
|
|
|
2486
2547
|
type: "function"
|
|
2487
2548
|
},
|
|
2488
2549
|
{ stateMutability: "payable", type: "receive" }
|
|
2489
|
-
],
|
|
2550
|
+
], En = [
|
|
2490
2551
|
{
|
|
2491
2552
|
inputs: [
|
|
2492
2553
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2630,7 +2691,7 @@ const bn = [
|
|
|
2630
2691
|
type: "function"
|
|
2631
2692
|
},
|
|
2632
2693
|
{ stateMutability: "payable", type: "receive" }
|
|
2633
|
-
],
|
|
2694
|
+
], Cn = [
|
|
2634
2695
|
{
|
|
2635
2696
|
inputs: [
|
|
2636
2697
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2749,7 +2810,7 @@ const bn = [
|
|
|
2749
2810
|
type: "function"
|
|
2750
2811
|
},
|
|
2751
2812
|
{ stateMutability: "payable", type: "receive" }
|
|
2752
|
-
],
|
|
2813
|
+
], Ne = [
|
|
2753
2814
|
{
|
|
2754
2815
|
inputs: [{ internalType: "address", name: "_WETH", type: "address" }],
|
|
2755
2816
|
stateMutability: "nonpayable",
|
|
@@ -3150,7 +3211,7 @@ const bn = [
|
|
|
3150
3211
|
type: "function"
|
|
3151
3212
|
},
|
|
3152
3213
|
{ stateMutability: "payable", type: "receive" }
|
|
3153
|
-
],
|
|
3214
|
+
], $e = [
|
|
3154
3215
|
{
|
|
3155
3216
|
inputs: [
|
|
3156
3217
|
{
|
|
@@ -5337,7 +5398,7 @@ const bn = [
|
|
|
5337
5398
|
stateMutability: "payable",
|
|
5338
5399
|
type: "receive"
|
|
5339
5400
|
}
|
|
5340
|
-
],
|
|
5401
|
+
], Ue = [
|
|
5341
5402
|
{
|
|
5342
5403
|
inputs: [
|
|
5343
5404
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -5676,7 +5737,7 @@ const bn = [
|
|
|
5676
5737
|
type: "function"
|
|
5677
5738
|
},
|
|
5678
5739
|
{ stateMutability: "payable", type: "receive" }
|
|
5679
|
-
],
|
|
5740
|
+
], On = [
|
|
5680
5741
|
{
|
|
5681
5742
|
inputs: [
|
|
5682
5743
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -6015,7 +6076,7 @@ const bn = [
|
|
|
6015
6076
|
type: "function"
|
|
6016
6077
|
},
|
|
6017
6078
|
{ stateMutability: "payable", type: "receive" }
|
|
6018
|
-
],
|
|
6079
|
+
], xn = [
|
|
6019
6080
|
{
|
|
6020
6081
|
inputs: [
|
|
6021
6082
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -6354,7 +6415,7 @@ const bn = [
|
|
|
6354
6415
|
type: "function"
|
|
6355
6416
|
},
|
|
6356
6417
|
{ stateMutability: "payable", type: "receive" }
|
|
6357
|
-
],
|
|
6418
|
+
], kn = [
|
|
6358
6419
|
{
|
|
6359
6420
|
inputs: [
|
|
6360
6421
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -6693,7 +6754,7 @@ const bn = [
|
|
|
6693
6754
|
type: "function"
|
|
6694
6755
|
},
|
|
6695
6756
|
{ stateMutability: "payable", type: "receive" }
|
|
6696
|
-
],
|
|
6757
|
+
], Sn = [
|
|
6697
6758
|
{
|
|
6698
6759
|
inputs: [
|
|
6699
6760
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -7032,7 +7093,7 @@ const bn = [
|
|
|
7032
7093
|
type: "function"
|
|
7033
7094
|
},
|
|
7034
7095
|
{ stateMutability: "payable", type: "receive" }
|
|
7035
|
-
],
|
|
7096
|
+
], Rn = [
|
|
7036
7097
|
{
|
|
7037
7098
|
inputs: [
|
|
7038
7099
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -7285,7 +7346,7 @@ const bn = [
|
|
|
7285
7346
|
type: "function"
|
|
7286
7347
|
},
|
|
7287
7348
|
{ stateMutability: "payable", type: "receive" }
|
|
7288
|
-
],
|
|
7349
|
+
], Bn = [
|
|
7289
7350
|
{
|
|
7290
7351
|
inputs: [
|
|
7291
7352
|
{ internalType: "address", name: "_weth", type: "address" },
|
|
@@ -7455,23 +7516,23 @@ const bn = [
|
|
|
7455
7516
|
type: "function"
|
|
7456
7517
|
},
|
|
7457
7518
|
{ stateMutability: "payable", type: "receive" }
|
|
7458
|
-
],
|
|
7519
|
+
], In = {
|
|
7459
7520
|
// AVAX
|
|
7460
|
-
["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106".toLowerCase()]:
|
|
7461
|
-
["0xC22FBb3133dF781E6C25ea6acebe2D2Bb8CeA2f9".toLowerCase()]:
|
|
7462
|
-
["0x60aE616a2155Ee3d9A68541Ba4544862310933d4".toLowerCase()]:
|
|
7463
|
-
["0x1111111254fb6c44bAC0beD2854e76F90643097d".toLowerCase()]:
|
|
7464
|
-
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]:
|
|
7521
|
+
["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106".toLowerCase()]: On,
|
|
7522
|
+
["0xC22FBb3133dF781E6C25ea6acebe2D2Bb8CeA2f9".toLowerCase()]: Bn,
|
|
7523
|
+
["0x60aE616a2155Ee3d9A68541Ba4544862310933d4".toLowerCase()]: kn,
|
|
7524
|
+
["0x1111111254fb6c44bAC0beD2854e76F90643097d".toLowerCase()]: $e,
|
|
7525
|
+
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: Ne,
|
|
7465
7526
|
// BSC
|
|
7466
|
-
["0x10ED43C718714eb63d5aA57B78B54704E256024E".toLowerCase()]:
|
|
7527
|
+
["0x10ED43C718714eb63d5aA57B78B54704E256024E".toLowerCase()]: Ue,
|
|
7467
7528
|
// ETH
|
|
7468
|
-
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]:
|
|
7469
|
-
["0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f".toLowerCase()]:
|
|
7470
|
-
["0xEfF92A263d31888d860bD50809A8D171709b7b1c".toLowerCase()]:
|
|
7471
|
-
["0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D".toLowerCase()]:
|
|
7472
|
-
["0xE592427A0AEce92De3Edee1F18E0157C05861564".toLowerCase()]:
|
|
7473
|
-
["0x1111111254fb6c44bac0bed2854e76f90643097d".toLowerCase()]:
|
|
7474
|
-
},
|
|
7529
|
+
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: Ne,
|
|
7530
|
+
["0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f".toLowerCase()]: xn,
|
|
7531
|
+
["0xEfF92A263d31888d860bD50809A8D171709b7b1c".toLowerCase()]: Ue,
|
|
7532
|
+
["0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D".toLowerCase()]: Sn,
|
|
7533
|
+
["0xE592427A0AEce92De3Edee1F18E0157C05861564".toLowerCase()]: Rn,
|
|
7534
|
+
["0x1111111254fb6c44bac0bed2854e76f90643097d".toLowerCase()]: $e
|
|
7535
|
+
}, Pn = [
|
|
7475
7536
|
{
|
|
7476
7537
|
inputs: [
|
|
7477
7538
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -7590,7 +7651,7 @@ const bn = [
|
|
|
7590
7651
|
type: "function"
|
|
7591
7652
|
},
|
|
7592
7653
|
{ stateMutability: "payable", type: "receive" }
|
|
7593
|
-
],
|
|
7654
|
+
], Hn = [
|
|
7594
7655
|
{
|
|
7595
7656
|
inputs: [
|
|
7596
7657
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -7709,7 +7770,7 @@ const bn = [
|
|
|
7709
7770
|
type: "function"
|
|
7710
7771
|
},
|
|
7711
7772
|
{ stateMutability: "payable", type: "receive" }
|
|
7712
|
-
],
|
|
7773
|
+
], Fn = [
|
|
7713
7774
|
{
|
|
7714
7775
|
inputs: [
|
|
7715
7776
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -7828,7 +7889,7 @@ const bn = [
|
|
|
7828
7889
|
type: "function"
|
|
7829
7890
|
},
|
|
7830
7891
|
{ stateMutability: "payable", type: "receive" }
|
|
7831
|
-
],
|
|
7892
|
+
], Dn = [
|
|
7832
7893
|
{
|
|
7833
7894
|
inputs: [
|
|
7834
7895
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -7955,7 +8016,7 @@ const bn = [
|
|
|
7955
8016
|
type: "function"
|
|
7956
8017
|
},
|
|
7957
8018
|
{ stateMutability: "payable", type: "receive" }
|
|
7958
|
-
],
|
|
8019
|
+
], Ln = [
|
|
7959
8020
|
{
|
|
7960
8021
|
inputs: [
|
|
7961
8022
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -8082,7 +8143,7 @@ const bn = [
|
|
|
8082
8143
|
type: "function"
|
|
8083
8144
|
},
|
|
8084
8145
|
{ stateMutability: "payable", type: "receive" }
|
|
8085
|
-
],
|
|
8146
|
+
], Vn = [
|
|
8086
8147
|
{
|
|
8087
8148
|
inputs: [
|
|
8088
8149
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -8209,7 +8270,7 @@ const bn = [
|
|
|
8209
8270
|
type: "function"
|
|
8210
8271
|
},
|
|
8211
8272
|
{ stateMutability: "payable", type: "receive" }
|
|
8212
|
-
],
|
|
8273
|
+
], qn = [
|
|
8213
8274
|
{
|
|
8214
8275
|
inputs: [
|
|
8215
8276
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -8336,7 +8397,7 @@ const bn = [
|
|
|
8336
8397
|
type: "function"
|
|
8337
8398
|
},
|
|
8338
8399
|
{ stateMutability: "payable", type: "receive" }
|
|
8339
|
-
],
|
|
8400
|
+
], Wn = [
|
|
8340
8401
|
{
|
|
8341
8402
|
inputs: [
|
|
8342
8403
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -8463,28 +8524,28 @@ const bn = [
|
|
|
8463
8524
|
type: "function"
|
|
8464
8525
|
},
|
|
8465
8526
|
{ stateMutability: "payable", type: "receive" }
|
|
8466
|
-
],
|
|
8467
|
-
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]:
|
|
8468
|
-
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]:
|
|
8469
|
-
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]:
|
|
8470
|
-
},
|
|
8471
|
-
...
|
|
8472
|
-
...
|
|
8527
|
+
], ot = {
|
|
8528
|
+
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: gn,
|
|
8529
|
+
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: Mn,
|
|
8530
|
+
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: vn
|
|
8531
|
+
}, Nn = {
|
|
8532
|
+
...In,
|
|
8533
|
+
...ot,
|
|
8473
8534
|
// AVAX
|
|
8474
|
-
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]:
|
|
8475
|
-
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]:
|
|
8476
|
-
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]:
|
|
8535
|
+
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: Cn,
|
|
8536
|
+
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: _n,
|
|
8537
|
+
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: Hn,
|
|
8477
8538
|
// BSC
|
|
8478
|
-
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]:
|
|
8539
|
+
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: En,
|
|
8479
8540
|
// ETH
|
|
8480
|
-
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]:
|
|
8481
|
-
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]:
|
|
8482
|
-
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]:
|
|
8483
|
-
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]:
|
|
8484
|
-
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]:
|
|
8485
|
-
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]:
|
|
8486
|
-
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]:
|
|
8487
|
-
},
|
|
8541
|
+
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: Pn,
|
|
8542
|
+
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: Fn,
|
|
8543
|
+
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: Dn,
|
|
8544
|
+
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: Ln,
|
|
8545
|
+
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: Vn,
|
|
8546
|
+
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: qn,
|
|
8547
|
+
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: Wn
|
|
8548
|
+
}, $n = ({
|
|
8488
8549
|
streamSwap: e,
|
|
8489
8550
|
contractAddress: t,
|
|
8490
8551
|
recipient: n,
|
|
@@ -8498,19 +8559,19 @@ const bn = [
|
|
|
8498
8559
|
router: o,
|
|
8499
8560
|
memoStreamingSwap: l,
|
|
8500
8561
|
tcMemo: b,
|
|
8501
|
-
tcRouter:
|
|
8562
|
+
tcRouter: c,
|
|
8502
8563
|
tcVault: f,
|
|
8503
8564
|
vault: _,
|
|
8504
8565
|
token: M
|
|
8505
8566
|
}
|
|
8506
8567
|
}) => {
|
|
8507
|
-
const v = !!
|
|
8568
|
+
const v = !!ot[t.toLowerCase()];
|
|
8508
8569
|
if (v && !o)
|
|
8509
8570
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
8510
8571
|
const E = b || y, S = e && l || E;
|
|
8511
8572
|
if (!(f || _))
|
|
8512
8573
|
throw new Error("TC Vault is required on calldata");
|
|
8513
|
-
if (!(
|
|
8574
|
+
if (!(c || o))
|
|
8514
8575
|
throw new Error("TC Router is required on calldata");
|
|
8515
8576
|
if (!S)
|
|
8516
8577
|
throw new Error("TC Memo is required on calldata");
|
|
@@ -8518,71 +8579,23 @@ const bn = [
|
|
|
8518
8579
|
throw new Error("Token is required on calldata");
|
|
8519
8580
|
const Y = [
|
|
8520
8581
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
8521
|
-
a(
|
|
8582
|
+
a(c || o),
|
|
8522
8583
|
a(f || _),
|
|
8523
8584
|
S.replace("{recipientAddress}", n),
|
|
8524
8585
|
a(M),
|
|
8525
8586
|
i
|
|
8526
|
-
],
|
|
8527
|
-
return [...Y, ...
|
|
8528
|
-
},
|
|
8529
|
-
const n = Ke[e];
|
|
8530
|
-
switch (e) {
|
|
8531
|
-
case r.Binance:
|
|
8532
|
-
case r.Maya:
|
|
8533
|
-
case r.Kujira:
|
|
8534
|
-
case r.THORChain:
|
|
8535
|
-
return `${n}/tx/${t.startsWith("0x") ? t.slice(2) : t}`;
|
|
8536
|
-
case r.Arbitrum:
|
|
8537
|
-
case r.Avalanche:
|
|
8538
|
-
case r.BinanceSmartChain:
|
|
8539
|
-
case r.Ethereum:
|
|
8540
|
-
case r.Optimism:
|
|
8541
|
-
case r.Polygon:
|
|
8542
|
-
return `${n}/tx/${t.startsWith("0x") ? t : `0x${t}`}`;
|
|
8543
|
-
case r.Cosmos:
|
|
8544
|
-
return `${n}/transactions/${t}`;
|
|
8545
|
-
case r.Litecoin:
|
|
8546
|
-
case r.Bitcoin:
|
|
8547
|
-
case r.BitcoinCash:
|
|
8548
|
-
case r.Dogecoin:
|
|
8549
|
-
return `${n}/transaction/${t.toLowerCase()}`;
|
|
8550
|
-
default:
|
|
8551
|
-
throw new Error(`Unsupported chain: ${e}`);
|
|
8552
|
-
}
|
|
8553
|
-
}, qn = ({ chain: e, address: t }) => {
|
|
8554
|
-
const n = Ke[e];
|
|
8555
|
-
switch (e) {
|
|
8556
|
-
case r.Arbitrum:
|
|
8557
|
-
case r.Avalanche:
|
|
8558
|
-
case r.Binance:
|
|
8559
|
-
case r.BinanceSmartChain:
|
|
8560
|
-
case r.Bitcoin:
|
|
8561
|
-
case r.BitcoinCash:
|
|
8562
|
-
case r.Dogecoin:
|
|
8563
|
-
case r.Ethereum:
|
|
8564
|
-
case r.Kujira:
|
|
8565
|
-
case r.Litecoin:
|
|
8566
|
-
case r.Maya:
|
|
8567
|
-
case r.Optimism:
|
|
8568
|
-
case r.Polygon:
|
|
8569
|
-
case r.THORChain:
|
|
8570
|
-
return `${n}/address/${t}`;
|
|
8571
|
-
case r.Cosmos:
|
|
8572
|
-
return `${n}/account/${t}`;
|
|
8573
|
-
default:
|
|
8574
|
-
throw new Error(`Unsupported chain: ${e}`);
|
|
8575
|
-
}
|
|
8576
|
-
}, Wn = (e) => {
|
|
8587
|
+
], he = v ? [a(o), p, u] : [s, u];
|
|
8588
|
+
return [...Y, ...he];
|
|
8589
|
+
}, Un = (e) => {
|
|
8577
8590
|
const t = e ? te.ThornodeStagenet : te.ThornodeMainnet;
|
|
8578
8591
|
return R.get(`${t}/thorchain/inbound_addresses`);
|
|
8579
|
-
},
|
|
8592
|
+
}, Xn = (e) => {
|
|
8580
8593
|
const t = e ? te.ThornodeStagenet : te.ThornodeMainnet;
|
|
8581
8594
|
return R.get(`${t}/thorchain/mimir`);
|
|
8582
|
-
},
|
|
8595
|
+
}, Xe = () => Object.values(r).reduce(
|
|
8583
8596
|
(e, t) => (e[t] = null, e),
|
|
8584
8597
|
{}
|
|
8585
|
-
),
|
|
8598
|
+
), jn = ({
|
|
8586
8599
|
chain: e,
|
|
8587
8600
|
address: t
|
|
8588
8601
|
}) => {
|
|
@@ -8596,23 +8609,23 @@ const bn = [
|
|
|
8596
8609
|
}
|
|
8597
8610
|
};
|
|
8598
8611
|
var $, me, ae, P, ie, se;
|
|
8599
|
-
class
|
|
8612
|
+
class fa {
|
|
8600
8613
|
constructor({ stagenet: t } = {}) {
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8614
|
+
T(this, "connectedChains", Xe());
|
|
8615
|
+
T(this, "connectedWallets", Xe());
|
|
8616
|
+
T(this, "stagenet", !1);
|
|
8617
|
+
T(this, "getAddress", (t) => {
|
|
8605
8618
|
var n;
|
|
8606
8619
|
return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
|
|
8607
8620
|
});
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8621
|
+
T(this, "getExplorerTxUrl", (t, n) => ut({ chain: t, txHash: n }));
|
|
8622
|
+
T(this, "getWallet", (t) => this.connectedWallets[t]);
|
|
8623
|
+
T(this, "getExplorerAddressUrl", (t, n) => yt({ chain: t, address: n }));
|
|
8624
|
+
T(this, "getBalance", async (t, n) => {
|
|
8612
8625
|
const a = await this.getWalletByChain(t, n);
|
|
8613
8626
|
return (a == null ? void 0 : a.balance) || [];
|
|
8614
8627
|
});
|
|
8615
|
-
|
|
8628
|
+
T(this, "swap", async ({
|
|
8616
8629
|
streamSwap: t,
|
|
8617
8630
|
recipient: n,
|
|
8618
8631
|
route: a,
|
|
@@ -8626,33 +8639,33 @@ class Ta {
|
|
|
8626
8639
|
} = a, p = s.startsWith("ERC20-") ? r.Ethereum : s.startsWith("ARC20-") ? r.Avalanche : s.startsWith("BEP20-") ? r.BinanceSmartChain : void 0;
|
|
8627
8640
|
if (!a.complete)
|
|
8628
8641
|
throw new d("core_swap_route_not_complete");
|
|
8629
|
-
if (
|
|
8642
|
+
if (_t.includes(s) && p) {
|
|
8630
8643
|
const o = this.connectedWallets[p];
|
|
8631
8644
|
if (!(o != null && o.sendTransaction))
|
|
8632
8645
|
throw new d("core_wallet_connection_not_found");
|
|
8633
8646
|
if (!(t ? (u = a == null ? void 0 : a.streamingSwap) == null ? void 0 : u.transaction : a == null ? void 0 : a.transaction))
|
|
8634
8647
|
throw new d("core_swap_route_transaction_not_found");
|
|
8635
|
-
const { data: b, from:
|
|
8648
|
+
const { data: b, from: c, to: f, value: _ } = a.transaction, M = {
|
|
8636
8649
|
data: b,
|
|
8637
|
-
from:
|
|
8650
|
+
from: c,
|
|
8638
8651
|
to: f.toLowerCase(),
|
|
8639
|
-
chainId: BigInt(
|
|
8652
|
+
chainId: BigInt(Ke[p]),
|
|
8640
8653
|
value: _ ? BigInt(_) : 0n
|
|
8641
8654
|
};
|
|
8642
8655
|
return o.sendTransaction(M, i);
|
|
8643
8656
|
}
|
|
8644
|
-
if (
|
|
8657
|
+
if (vt.includes(s)) {
|
|
8645
8658
|
if (!a.calldata.fromAsset)
|
|
8646
8659
|
throw new d("core_swap_asset_not_recognized");
|
|
8647
|
-
const o = await
|
|
8660
|
+
const o = await x.fromString(a.calldata.fromAsset);
|
|
8648
8661
|
if (!o)
|
|
8649
8662
|
throw new d("core_swap_asset_not_recognized");
|
|
8650
8663
|
const { address: l } = await g(this, $).call(this, o.chain), {
|
|
8651
8664
|
contract: b,
|
|
8652
|
-
calldata: { expiration:
|
|
8665
|
+
calldata: { expiration: c, amountIn: f, memo: _, memoStreamingSwap: M }
|
|
8653
8666
|
} = a, v = o.add(D.fromBigInt(BigInt(f), o.decimal)), E = t && M || _;
|
|
8654
8667
|
return this.deposit({
|
|
8655
|
-
expiration:
|
|
8668
|
+
expiration: c,
|
|
8656
8669
|
assetValue: v,
|
|
8657
8670
|
memo: E,
|
|
8658
8671
|
feeOptionKey: i,
|
|
@@ -8660,38 +8673,38 @@ class Ta {
|
|
|
8660
8673
|
recipient: l
|
|
8661
8674
|
});
|
|
8662
8675
|
}
|
|
8663
|
-
if (
|
|
8676
|
+
if (Mt.includes(s) && p) {
|
|
8664
8677
|
const { calldata: o, contract: l } = a;
|
|
8665
8678
|
if (!l)
|
|
8666
8679
|
throw new d("core_swap_contract_not_found");
|
|
8667
|
-
const b = this.connectedWallets[p],
|
|
8668
|
-
if (!(b != null && b.sendTransaction &&
|
|
8680
|
+
const b = this.connectedWallets[p], c = this.getAddress(p);
|
|
8681
|
+
if (!(b != null && b.sendTransaction && c))
|
|
8669
8682
|
throw new d("core_wallet_connection_not_found");
|
|
8670
|
-
const { getProvider: f, toChecksumAddress: _ } = await import("@swapkit/toolbox-evm"), M = f(p), v =
|
|
8683
|
+
const { getProvider: f, toChecksumAddress: _ } = await import("@swapkit/toolbox-evm"), M = f(p), v = Nn[l.toLowerCase()];
|
|
8671
8684
|
if (!v)
|
|
8672
8685
|
throw new d("core_swap_contract_not_supported", {
|
|
8673
8686
|
contractAddress: l
|
|
8674
8687
|
});
|
|
8675
8688
|
const S = await (await ((y = b.createContract) == null ? void 0 : y.call(b, l, v, M))).getFunction("swapIn").populateTransaction(
|
|
8676
|
-
|
|
8689
|
+
...$n({
|
|
8677
8690
|
streamSwap: t,
|
|
8678
8691
|
toChecksumAddress: _,
|
|
8679
8692
|
contractAddress: l,
|
|
8680
8693
|
recipient: n,
|
|
8681
8694
|
calldata: o
|
|
8682
8695
|
}),
|
|
8683
|
-
{ from:
|
|
8696
|
+
{ from: c }
|
|
8684
8697
|
);
|
|
8685
8698
|
return b.sendTransaction(S, i);
|
|
8686
8699
|
}
|
|
8687
8700
|
throw new d("core_swap_quote_mode_not_supported", { quoteMode: s });
|
|
8688
8701
|
});
|
|
8689
|
-
|
|
8702
|
+
T(this, "getWalletByChain", async (t, n) => {
|
|
8690
8703
|
var p, u;
|
|
8691
8704
|
const a = this.getAddress(t);
|
|
8692
8705
|
if (!a)
|
|
8693
8706
|
return null;
|
|
8694
|
-
const i = [
|
|
8707
|
+
const i = [x.fromChainOrSignature(t)], s = (p = this.connectedChains[t]) == null ? void 0 : p.walletType;
|
|
8695
8708
|
try {
|
|
8696
8709
|
const y = await ((u = this.getWallet(t)) == null ? void 0 : u.getBalance(a, n));
|
|
8697
8710
|
return this.connectedChains[t] = {
|
|
@@ -8703,13 +8716,13 @@ class Ta {
|
|
|
8703
8716
|
return console.error(y), { address: a, balance: i, walletType: s };
|
|
8704
8717
|
}
|
|
8705
8718
|
});
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8719
|
+
T(this, "approveAssetValue", (t, n) => g(this, ae).call(this, { assetValue: t, type: "approve", contractAddress: n }));
|
|
8720
|
+
T(this, "isAssetValueApproved", (t, n) => g(this, ae).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
|
|
8721
|
+
T(this, "validateAddress", ({ address: t, chain: n }) => {
|
|
8709
8722
|
var a, i;
|
|
8710
8723
|
return (i = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : i.call(a, t);
|
|
8711
8724
|
});
|
|
8712
|
-
|
|
8725
|
+
T(this, "transfer", async (t) => {
|
|
8713
8726
|
const n = this.connectedWallets[t.assetValue.chain];
|
|
8714
8727
|
if (!n)
|
|
8715
8728
|
throw new d("core_wallet_connection_not_found");
|
|
@@ -8719,14 +8732,14 @@ class Ta {
|
|
|
8719
8732
|
throw new d("core_swap_transaction_error", a);
|
|
8720
8733
|
}
|
|
8721
8734
|
});
|
|
8722
|
-
|
|
8735
|
+
T(this, "deposit", async ({
|
|
8723
8736
|
assetValue: t,
|
|
8724
8737
|
recipient: n,
|
|
8725
8738
|
router: a,
|
|
8726
8739
|
...i
|
|
8727
8740
|
}) => {
|
|
8728
8741
|
const { chain: s, symbol: p, ticker: u } = t, y = this.connectedWallets[s], o = this.connectedChains[s];
|
|
8729
|
-
if (!await
|
|
8742
|
+
if (!await jn({
|
|
8730
8743
|
address: o == null ? void 0 : o.address,
|
|
8731
8744
|
chain: s
|
|
8732
8745
|
}))
|
|
@@ -8743,20 +8756,20 @@ class Ta {
|
|
|
8743
8756
|
switch (s) {
|
|
8744
8757
|
case r.THORChain:
|
|
8745
8758
|
case r.Maya: {
|
|
8746
|
-
const
|
|
8747
|
-
return await (n === "" ?
|
|
8759
|
+
const c = y;
|
|
8760
|
+
return await (n === "" ? c.deposit(b) : c.transfer(b));
|
|
8748
8761
|
}
|
|
8749
8762
|
case r.Ethereum:
|
|
8750
8763
|
case r.BinanceSmartChain:
|
|
8751
8764
|
case r.Avalanche: {
|
|
8752
|
-
const { getChecksumAddressFromAsset:
|
|
8765
|
+
const { getChecksumAddressFromAsset: c } = await import("@swapkit/toolbox-evm"), f = s === r.Avalanche ? wt : s === r.BinanceSmartChain ? At : ht;
|
|
8753
8766
|
return await y.call({
|
|
8754
8767
|
abi: f,
|
|
8755
8768
|
contractAddress: a || (await g(this, $).call(this, s)).router,
|
|
8756
8769
|
funcName: "depositWithExpiry",
|
|
8757
8770
|
funcParams: [
|
|
8758
8771
|
n,
|
|
8759
|
-
|
|
8772
|
+
c({ chain: s, symbol: p, ticker: u }, s),
|
|
8760
8773
|
t.getBaseValue("string"),
|
|
8761
8774
|
b.memo,
|
|
8762
8775
|
i.expiration || parseInt(`${((/* @__PURE__ */ new Date()).getTime() + 15 * 60 * 1e3) / 1e3}`)
|
|
@@ -8770,15 +8783,15 @@ class Ta {
|
|
|
8770
8783
|
default:
|
|
8771
8784
|
return await y.transfer(b);
|
|
8772
8785
|
}
|
|
8773
|
-
} catch (
|
|
8774
|
-
const f =
|
|
8775
|
-
throw new d(S,
|
|
8786
|
+
} catch (c) {
|
|
8787
|
+
const f = c == null ? void 0 : c.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"), S = _ ? "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";
|
|
8788
|
+
throw new d(S, c);
|
|
8776
8789
|
}
|
|
8777
8790
|
});
|
|
8778
8791
|
/**
|
|
8779
8792
|
* TC related Methods
|
|
8780
8793
|
*/
|
|
8781
|
-
|
|
8794
|
+
T(this, "createLiquidity", async ({
|
|
8782
8795
|
runeAssetValue: t,
|
|
8783
8796
|
assetValue: n
|
|
8784
8797
|
}) => {
|
|
@@ -8809,7 +8822,7 @@ class Ta {
|
|
|
8809
8822
|
}
|
|
8810
8823
|
return { runeTx: a, assetTx: i };
|
|
8811
8824
|
});
|
|
8812
|
-
|
|
8825
|
+
T(this, "addLiquidity", async ({
|
|
8813
8826
|
runeAssetValue: t,
|
|
8814
8827
|
assetValue: n,
|
|
8815
8828
|
runeAddr: a,
|
|
@@ -8817,10 +8830,10 @@ class Ta {
|
|
|
8817
8830
|
isPendingSymmAsset: s,
|
|
8818
8831
|
mode: p = "sym"
|
|
8819
8832
|
}) => {
|
|
8820
|
-
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"),
|
|
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"), c = s || l, f = c ? a || this.getAddress(r.THORChain) : "", _ = o || p === "asset" ? i || this.getAddress(u) : "";
|
|
8821
8834
|
if (!(l || b))
|
|
8822
8835
|
throw new d("core_transaction_add_liquidity_invalid_params");
|
|
8823
|
-
if (
|
|
8836
|
+
if (c && !f)
|
|
8824
8837
|
throw new d("core_transaction_add_liquidity_no_rune_address");
|
|
8825
8838
|
let M, v;
|
|
8826
8839
|
if (l && t)
|
|
@@ -8851,7 +8864,7 @@ class Ta {
|
|
|
8851
8864
|
}
|
|
8852
8865
|
return { runeTx: M, assetTx: v };
|
|
8853
8866
|
});
|
|
8854
|
-
|
|
8867
|
+
T(this, "addLiquidityPart", ({
|
|
8855
8868
|
assetValue: t,
|
|
8856
8869
|
poolAddress: n,
|
|
8857
8870
|
address: a,
|
|
@@ -8866,14 +8879,14 @@ class Ta {
|
|
|
8866
8879
|
});
|
|
8867
8880
|
return g(this, P).call(this, { assetValue: t, memo: s });
|
|
8868
8881
|
});
|
|
8869
|
-
|
|
8882
|
+
T(this, "withdraw", ({
|
|
8870
8883
|
memo: t,
|
|
8871
8884
|
assetValue: n,
|
|
8872
8885
|
percent: a,
|
|
8873
8886
|
from: i,
|
|
8874
8887
|
to: s
|
|
8875
8888
|
}) => {
|
|
8876
|
-
const p = s === "rune" && i !== "rune" ?
|
|
8889
|
+
const p = s === "rune" && i !== "rune" ? x.fromChainOrSignature(r.THORChain) : i === "sym" && s === "sym" || i === "rune" || i === "asset" ? void 0 : n, u = ge(i === "asset" ? n.chain : r.THORChain), y = t || F(w.WITHDRAW, {
|
|
8877
8890
|
symbol: n.symbol,
|
|
8878
8891
|
chain: n.chain,
|
|
8879
8892
|
ticker: n.ticker,
|
|
@@ -8883,7 +8896,7 @@ class Ta {
|
|
|
8883
8896
|
});
|
|
8884
8897
|
return g(this, P).call(this, { assetValue: u, memo: y });
|
|
8885
8898
|
});
|
|
8886
|
-
|
|
8899
|
+
T(this, "savings", ({
|
|
8887
8900
|
assetValue: t,
|
|
8888
8901
|
memo: n,
|
|
8889
8902
|
percent: a,
|
|
@@ -8895,10 +8908,10 @@ class Ta {
|
|
|
8895
8908
|
chain: t.chain,
|
|
8896
8909
|
singleSide: !0,
|
|
8897
8910
|
basisPoints: a ? Math.min(1e4, Math.round(a * 100)) : void 0
|
|
8898
|
-
}), u = s === w.DEPOSIT ? t :
|
|
8911
|
+
}), u = s === w.DEPOSIT ? t : ge(t.chain);
|
|
8899
8912
|
return g(this, P).call(this, { memo: p, assetValue: u });
|
|
8900
8913
|
});
|
|
8901
|
-
|
|
8914
|
+
T(this, "loan", ({
|
|
8902
8915
|
assetValue: t,
|
|
8903
8916
|
memo: n,
|
|
8904
8917
|
minAmount: a,
|
|
@@ -8911,7 +8924,7 @@ class Ta {
|
|
|
8911
8924
|
address: this.getAddress(t.chain)
|
|
8912
8925
|
})
|
|
8913
8926
|
}));
|
|
8914
|
-
|
|
8927
|
+
T(this, "nodeAction", ({
|
|
8915
8928
|
type: t,
|
|
8916
8929
|
assetValue: n,
|
|
8917
8930
|
address: a
|
|
@@ -8922,17 +8935,17 @@ class Ta {
|
|
|
8922
8935
|
});
|
|
8923
8936
|
return g(this, ie).call(this, {
|
|
8924
8937
|
memo: s,
|
|
8925
|
-
assetValue: t === "bond" ? n :
|
|
8938
|
+
assetValue: t === "bond" ? n : ge(r.THORChain)
|
|
8926
8939
|
});
|
|
8927
8940
|
});
|
|
8928
|
-
|
|
8941
|
+
T(this, "registerThorname", ({
|
|
8929
8942
|
assetValue: t,
|
|
8930
8943
|
...n
|
|
8931
8944
|
}) => g(this, ie).call(this, {
|
|
8932
8945
|
assetValue: t,
|
|
8933
8946
|
memo: F(w.THORNAME_REGISTER, n)
|
|
8934
8947
|
}));
|
|
8935
|
-
|
|
8948
|
+
T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: i = {} }) => {
|
|
8936
8949
|
try {
|
|
8937
8950
|
for (const s of t)
|
|
8938
8951
|
this[s.connectMethodName] = s.connect({
|
|
@@ -8945,7 +8958,7 @@ class Ta {
|
|
|
8945
8958
|
throw new d("core_extend_error", s);
|
|
8946
8959
|
}
|
|
8947
8960
|
});
|
|
8948
|
-
|
|
8961
|
+
T(this, "estimateMaxSendableAmount", async ({
|
|
8949
8962
|
chain: t,
|
|
8950
8963
|
params: n
|
|
8951
8964
|
}) => {
|
|
@@ -8985,42 +8998,42 @@ class Ta {
|
|
|
8985
8998
|
* Wallet connection methods
|
|
8986
8999
|
*/
|
|
8987
9000
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
8988
|
-
|
|
9001
|
+
T(this, "connectXDEFI", async (t) => {
|
|
8989
9002
|
throw new d("core_wallet_xdefi_not_installed");
|
|
8990
9003
|
});
|
|
8991
9004
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
8992
|
-
|
|
9005
|
+
T(this, "connectEVMWallet", async (t, n) => {
|
|
8993
9006
|
throw new d("core_wallet_evmwallet_not_installed");
|
|
8994
9007
|
});
|
|
8995
9008
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
8996
|
-
|
|
9009
|
+
T(this, "connectWalletconnect", async (t, n) => {
|
|
8997
9010
|
throw new d("core_wallet_walletconnect_not_installed");
|
|
8998
9011
|
});
|
|
8999
9012
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9000
|
-
|
|
9013
|
+
T(this, "connectKeepkey", async (t, n) => {
|
|
9001
9014
|
throw new d("core_wallet_keepkey_not_installed");
|
|
9002
9015
|
});
|
|
9003
9016
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9004
|
-
|
|
9017
|
+
T(this, "connectKeystore", async (t, n) => {
|
|
9005
9018
|
throw new d("core_wallet_keystore_not_installed");
|
|
9006
9019
|
});
|
|
9007
9020
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9008
|
-
|
|
9021
|
+
T(this, "connectLedger", async (t, n) => {
|
|
9009
9022
|
throw new d("core_wallet_ledger_not_installed");
|
|
9010
9023
|
});
|
|
9011
9024
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9012
|
-
|
|
9025
|
+
T(this, "connectTrezor", async (t, n) => {
|
|
9013
9026
|
throw new d("core_wallet_trezor_not_installed");
|
|
9014
9027
|
});
|
|
9015
9028
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9016
|
-
|
|
9029
|
+
T(this, "connectKeplr", async (t) => {
|
|
9017
9030
|
throw new d("core_wallet_keplr_not_installed");
|
|
9018
9031
|
});
|
|
9019
9032
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9020
|
-
|
|
9033
|
+
T(this, "connectOkx", async (t) => {
|
|
9021
9034
|
throw new d("core_wallet_okx_not_installed");
|
|
9022
9035
|
});
|
|
9023
|
-
|
|
9036
|
+
T(this, "disconnectChain", (t) => {
|
|
9024
9037
|
this.connectedChains[t] = null, this.connectedWallets[t] = null;
|
|
9025
9038
|
});
|
|
9026
9039
|
q(this, $, async (t) => {
|
|
@@ -9029,7 +9042,7 @@ class Ta {
|
|
|
9029
9042
|
case r.THORChain:
|
|
9030
9043
|
return { gas_rate: "0", router: "", address: "", halted: !1, chain: t };
|
|
9031
9044
|
default: {
|
|
9032
|
-
const a = (await
|
|
9045
|
+
const a = (await Un(this.stagenet)).find((i) => i.chain === t);
|
|
9033
9046
|
if (!a)
|
|
9034
9047
|
throw new d("core_inbound_data_not_found");
|
|
9035
9048
|
if (a != null && a.halted)
|
|
@@ -9062,14 +9075,14 @@ class Ta {
|
|
|
9062
9075
|
const l = this.connectedWallets[s], b = n === "checkOnly" ? l == null ? void 0 : l.isApproved : l == null ? void 0 : l.approve;
|
|
9063
9076
|
if (!b)
|
|
9064
9077
|
throw new d("core_wallet_connection_not_found");
|
|
9065
|
-
const
|
|
9066
|
-
if (!(i &&
|
|
9078
|
+
const c = this.getAddress(s);
|
|
9079
|
+
if (!(i && c))
|
|
9067
9080
|
throw new d("core_approve_asset_address_or_from_not_found");
|
|
9068
9081
|
const f = a || (await g(this, $).call(this, s)).router;
|
|
9069
9082
|
return b({
|
|
9070
9083
|
amount: t.getBaseValue("bigint"),
|
|
9071
9084
|
assetAddress: i,
|
|
9072
|
-
from:
|
|
9085
|
+
from: c,
|
|
9073
9086
|
spenderAddress: f
|
|
9074
9087
|
});
|
|
9075
9088
|
});
|
|
@@ -9082,7 +9095,7 @@ class Ta {
|
|
|
9082
9095
|
gas_rate: i,
|
|
9083
9096
|
router: s,
|
|
9084
9097
|
address: p
|
|
9085
|
-
} = await g(this, $).call(this, t.chain), u = (parseInt(i) || 0) *
|
|
9098
|
+
} = await g(this, $).call(this, t.chain), u = (parseInt(i) || 0) * un[a];
|
|
9086
9099
|
return this.deposit({
|
|
9087
9100
|
assetValue: t,
|
|
9088
9101
|
recipient: p,
|
|
@@ -9095,7 +9108,7 @@ class Ta {
|
|
|
9095
9108
|
memo: t,
|
|
9096
9109
|
assetValue: n
|
|
9097
9110
|
}) => {
|
|
9098
|
-
const a = await
|
|
9111
|
+
const a = await Xn(this.stagenet);
|
|
9099
9112
|
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
9100
9113
|
throw new d("core_chain_halted");
|
|
9101
9114
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
@@ -9111,74 +9124,75 @@ class Ta {
|
|
|
9111
9124
|
}
|
|
9112
9125
|
$ = new WeakMap(), me = new WeakMap(), ae = new WeakMap(), P = new WeakMap(), ie = new WeakMap(), se = new WeakMap();
|
|
9113
9126
|
export {
|
|
9114
|
-
|
|
9127
|
+
_t as AGG_SWAP,
|
|
9115
9128
|
L as ApiEndpoints,
|
|
9116
9129
|
te as ApiUrl,
|
|
9117
|
-
|
|
9130
|
+
An as ApproveMode,
|
|
9131
|
+
x as AssetValue,
|
|
9118
9132
|
A as BaseDecimal,
|
|
9119
|
-
|
|
9133
|
+
xe as BigIntArithmetics,
|
|
9120
9134
|
r as Chain,
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9135
|
+
Se as ChainId,
|
|
9136
|
+
aa as ChainIdToChain,
|
|
9137
|
+
Ke as ChainToChainId,
|
|
9138
|
+
Qe as ChainToExplorerUrl,
|
|
9139
|
+
na as ChainToHexChainId,
|
|
9140
|
+
Rt as ChainToRPC,
|
|
9141
|
+
Et as ContractAddress,
|
|
9142
|
+
ea as CosmosChainList,
|
|
9143
|
+
xt as CosmosChains,
|
|
9144
|
+
Ct as DerivationPath,
|
|
9145
|
+
Zn as EVMChainList,
|
|
9146
|
+
je as EVMChains,
|
|
9133
9147
|
Q as FeeOption,
|
|
9134
|
-
|
|
9148
|
+
It as LedgerErrorCode,
|
|
9135
9149
|
w as MemoType,
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9150
|
+
Yn as NetworkDerivationPath,
|
|
9151
|
+
gt as QuoteMode,
|
|
9152
|
+
Ge as RPCUrl,
|
|
9139
9153
|
R as RequestClient,
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9154
|
+
Mt as SWAP_IN,
|
|
9155
|
+
vt as SWAP_OUT,
|
|
9156
|
+
tn as StreamingSwapProgressStatus,
|
|
9157
|
+
Jn as SubstrateChains,
|
|
9158
|
+
ba as SwapKit,
|
|
9159
|
+
sa as SwapKitApi,
|
|
9160
|
+
fa as SwapKitCore,
|
|
9147
9161
|
d as SwapKitError,
|
|
9148
9162
|
D as SwapKitNumber,
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9163
|
+
wt as TCAvalancheDepositABI,
|
|
9164
|
+
At as TCBscDepositABI,
|
|
9165
|
+
ht as TCEthereumVaultAbi,
|
|
9166
|
+
ta as TCSupportedChainList,
|
|
9167
|
+
kt as TCSupportedChains,
|
|
9168
|
+
zt as TransactionType,
|
|
9169
|
+
en as TxStatus,
|
|
9170
|
+
zn as UTXOChainList,
|
|
9171
|
+
Ot as UTXOChains,
|
|
9172
|
+
Bt as WalletOption,
|
|
9173
|
+
ra as assetFromString,
|
|
9174
|
+
at as defaultRequestHeaders,
|
|
9175
|
+
ca as derivationPathToString,
|
|
9176
|
+
Qn as erc20ABI,
|
|
9177
|
+
pa as filterAssets,
|
|
9164
9178
|
fe as formatBigIntToSafeValue,
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9179
|
+
un as gasFeeMultiplier,
|
|
9180
|
+
on as getAssetType,
|
|
9181
|
+
Tn as getAsymmetricAssetShare,
|
|
9182
|
+
ya as getAsymmetricAssetWithdrawAmount,
|
|
9183
|
+
mn as getAsymmetricRuneShare,
|
|
9184
|
+
ua as getAsymmetricRuneWithdrawAmount,
|
|
9185
|
+
yn as getCommonAssetInfo,
|
|
9186
|
+
pn as getDecimal,
|
|
9187
|
+
da as getEstimatedPoolShare,
|
|
9188
|
+
la as getLiquiditySlippage,
|
|
9175
9189
|
F as getMemoFor,
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9190
|
+
ge as getMinAmountByChain,
|
|
9191
|
+
cn as getSymmetricPoolShare,
|
|
9192
|
+
oa as getSymmetricWithdraw,
|
|
9193
|
+
ma as getTHORNameCost,
|
|
9194
|
+
st as isGasAsset,
|
|
9195
|
+
ia as setRequestClientConfig,
|
|
9196
|
+
Ta as validateTHORName
|
|
9183
9197
|
};
|
|
9184
9198
|
//# sourceMappingURL=index.es.js.map
|