@swapkit/core 1.0.0-rc.100 → 1.0.0-rc.101
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 +485 -473
- package/dist/index.es.js.map +1 -1
- package/package.json +13 -13
- package/src/client/index.ts +24 -21
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",
|
|
@@ -750,37 +750,37 @@ const Te = Object.values(r), Ct = Object.keys(r), Se = Te.reduce(
|
|
|
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,61 @@ 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.Polygon:
|
|
1962
|
+
return `${n}/tx/${t.startsWith("0x") ? t : `0x${t}`}`;
|
|
1963
|
+
case r.Cosmos:
|
|
1964
|
+
return `${n}/transactions/${t}`;
|
|
1965
|
+
case r.Litecoin:
|
|
1966
|
+
case r.Bitcoin:
|
|
1967
|
+
case r.BitcoinCash:
|
|
1968
|
+
case r.Dogecoin:
|
|
1969
|
+
return `${n}/transaction/${t.toLowerCase()}`;
|
|
1970
|
+
default:
|
|
1971
|
+
throw new Error(`Unsupported chain: ${e}`);
|
|
1972
|
+
}
|
|
1973
|
+
}, yt = ({ chain: e, address: t }) => {
|
|
1974
|
+
const n = Qe[e];
|
|
1975
|
+
switch (e) {
|
|
1976
|
+
case r.Arbitrum:
|
|
1977
|
+
case r.Avalanche:
|
|
1978
|
+
case r.Binance:
|
|
1979
|
+
case r.BinanceSmartChain:
|
|
1980
|
+
case r.Bitcoin:
|
|
1981
|
+
case r.BitcoinCash:
|
|
1982
|
+
case r.Dogecoin:
|
|
1983
|
+
case r.Ethereum:
|
|
1984
|
+
case r.Kujira:
|
|
1985
|
+
case r.Litecoin:
|
|
1986
|
+
case r.Maya:
|
|
1987
|
+
case r.Optimism:
|
|
1988
|
+
case r.Polygon:
|
|
1989
|
+
case r.THORChain:
|
|
1990
|
+
return `${n}/address/${t}`;
|
|
1991
|
+
case r.Cosmos:
|
|
1992
|
+
return `${n}/account/${t}`;
|
|
1993
|
+
default:
|
|
1994
|
+
throw new Error(`Unsupported chain: ${e}`);
|
|
1995
|
+
}
|
|
1996
|
+
};
|
|
1997
|
+
var An = /* @__PURE__ */ ((e) => (e.Approve = "approve", e.CheckOnly = "checkOnly", e))(An || {});
|
|
1998
|
+
function ba({
|
|
1948
1999
|
stagenet: e,
|
|
1949
2000
|
wallets: t,
|
|
1950
2001
|
providers: n,
|
|
@@ -1953,18 +2004,18 @@ function ma({
|
|
|
1953
2004
|
rpcUrls: s
|
|
1954
2005
|
}) {
|
|
1955
2006
|
const p = {}, u = {};
|
|
1956
|
-
for (const
|
|
1957
|
-
const { name: h, methods: B } =
|
|
2007
|
+
for (const m of n) {
|
|
2008
|
+
const { name: h, methods: B } = m({ wallets: p, stagenet: e });
|
|
1958
2009
|
u[h] = B;
|
|
1959
2010
|
}
|
|
1960
|
-
const y = t.reduce((
|
|
2011
|
+
const y = t.reduce((m, h) => (m[h.connectMethodName] = h.connect({
|
|
1961
2012
|
addChain: l,
|
|
1962
2013
|
config: a,
|
|
1963
2014
|
apis: i,
|
|
1964
2015
|
rpcUrls: s
|
|
1965
|
-
}),
|
|
1966
|
-
function o(
|
|
1967
|
-
const h = u[
|
|
2016
|
+
}), m), {});
|
|
2017
|
+
function o(m) {
|
|
2018
|
+
const h = u[m] || Object.values(u)[0];
|
|
1968
2019
|
if (!h)
|
|
1969
2020
|
throw new d(
|
|
1970
2021
|
"core_swap_provider_not_found",
|
|
@@ -1972,48 +2023,54 @@ function ma({
|
|
|
1972
2023
|
);
|
|
1973
2024
|
return h;
|
|
1974
2025
|
}
|
|
1975
|
-
function l(
|
|
1976
|
-
p[
|
|
2026
|
+
function l(m) {
|
|
2027
|
+
p[m.chain] = m;
|
|
1977
2028
|
}
|
|
1978
2029
|
function b({
|
|
1979
|
-
assetValue:
|
|
2030
|
+
assetValue: m,
|
|
1980
2031
|
type: h = "checkOnly",
|
|
1981
2032
|
contractAddress: B
|
|
1982
2033
|
}) {
|
|
1983
|
-
const { address: O, chain: H, isGasAsset:
|
|
1984
|
-
if (
|
|
2034
|
+
const { address: O, chain: H, isGasAsset: lt, isSynthetic: mt } = m, He = [r.Ethereum, r.Avalanche, r.BinanceSmartChain].includes(H);
|
|
2035
|
+
if (He && lt || !He || mt)
|
|
1985
2036
|
return Promise.resolve(h === "checkOnly" ? !0 : "approved");
|
|
1986
|
-
const U = p[H],
|
|
1987
|
-
if (!
|
|
2037
|
+
const U = p[H], Fe = h === "checkOnly" ? U == null ? void 0 : U.isApproved : U == null ? void 0 : U.approve;
|
|
2038
|
+
if (!Fe)
|
|
1988
2039
|
throw new d("core_wallet_connection_not_found");
|
|
1989
|
-
const
|
|
1990
|
-
if (!(O &&
|
|
2040
|
+
const De = f(H);
|
|
2041
|
+
if (!(O && De))
|
|
1991
2042
|
throw new d("core_approve_asset_address_or_from_not_found");
|
|
1992
|
-
const
|
|
1993
|
-
return
|
|
1994
|
-
amount:
|
|
2043
|
+
const Tt = B;
|
|
2044
|
+
return Fe({
|
|
2045
|
+
amount: m.getBaseValue("bigint"),
|
|
1995
2046
|
assetAddress: O,
|
|
1996
|
-
from:
|
|
1997
|
-
spenderAddress:
|
|
2047
|
+
from: De,
|
|
2048
|
+
spenderAddress: Tt
|
|
1998
2049
|
});
|
|
1999
2050
|
}
|
|
2000
|
-
function
|
|
2001
|
-
return p[
|
|
2051
|
+
function c(m) {
|
|
2052
|
+
return p[m];
|
|
2002
2053
|
}
|
|
2003
|
-
function f(
|
|
2054
|
+
function f(m) {
|
|
2004
2055
|
var h;
|
|
2005
|
-
return ((h =
|
|
2056
|
+
return ((h = c(m)) == null ? void 0 : h.address) || "";
|
|
2006
2057
|
}
|
|
2007
|
-
function _(
|
|
2058
|
+
function _(m) {
|
|
2008
2059
|
var h;
|
|
2009
|
-
return ((h =
|
|
2060
|
+
return ((h = c(m)) == null ? void 0 : h.balance) || [];
|
|
2061
|
+
}
|
|
2062
|
+
function M(m, h) {
|
|
2063
|
+
return ut({ chain: m, txHash: h });
|
|
2010
2064
|
}
|
|
2011
|
-
function
|
|
2065
|
+
function v(m, h) {
|
|
2066
|
+
return yt({ chain: m, address: h });
|
|
2067
|
+
}
|
|
2068
|
+
function E({ address: m, chain: h }) {
|
|
2012
2069
|
var B, O;
|
|
2013
|
-
return (O = (B =
|
|
2070
|
+
return (O = (B = c(h)) == null ? void 0 : B.validateAddress) == null ? void 0 : O.call(B, m);
|
|
2014
2071
|
}
|
|
2015
|
-
async function
|
|
2016
|
-
const B = [
|
|
2072
|
+
async function S(m, h) {
|
|
2073
|
+
const B = [x.fromChainOrSignature(m)], O = c(m);
|
|
2017
2074
|
try {
|
|
2018
2075
|
if (!O)
|
|
2019
2076
|
throw new d("core_wallet_connection_not_found");
|
|
@@ -2023,39 +2080,41 @@ function ma({
|
|
|
2023
2080
|
throw new d("core_wallet_connection_not_found", H);
|
|
2024
2081
|
}
|
|
2025
2082
|
}
|
|
2026
|
-
function
|
|
2083
|
+
function Y(m, h) {
|
|
2027
2084
|
return b({
|
|
2028
|
-
assetValue:
|
|
2085
|
+
assetValue: m,
|
|
2029
2086
|
contractAddress: h,
|
|
2030
2087
|
type: "approve"
|
|
2031
2088
|
/* Approve */
|
|
2032
2089
|
});
|
|
2033
2090
|
}
|
|
2034
|
-
function
|
|
2091
|
+
function he(m, h) {
|
|
2035
2092
|
return b({
|
|
2036
|
-
assetValue:
|
|
2093
|
+
assetValue: m,
|
|
2037
2094
|
contractAddress: h,
|
|
2038
2095
|
type: "checkOnly"
|
|
2039
2096
|
/* CheckOnly */
|
|
2040
2097
|
});
|
|
2041
2098
|
}
|
|
2042
|
-
function
|
|
2043
|
-
return o(
|
|
2099
|
+
function dt({ provider: m, ...h }) {
|
|
2100
|
+
return o(m == null ? void 0 : m.name).swap({ provider: m, ...h });
|
|
2044
2101
|
}
|
|
2045
2102
|
return {
|
|
2046
2103
|
...u,
|
|
2047
2104
|
...y,
|
|
2048
|
-
approveAssetValue:
|
|
2105
|
+
approveAssetValue: Y,
|
|
2049
2106
|
getAddress: f,
|
|
2050
2107
|
getBalance: _,
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2108
|
+
getExplorerAddressUrl: v,
|
|
2109
|
+
getExplorerTxUrl: M,
|
|
2110
|
+
getWallet: c,
|
|
2111
|
+
getWalletWithBalance: S,
|
|
2112
|
+
isAssetValueApproved: he,
|
|
2113
|
+
swap: dt,
|
|
2114
|
+
validateAddress: E
|
|
2056
2115
|
};
|
|
2057
2116
|
}
|
|
2058
|
-
const
|
|
2117
|
+
const gn = [
|
|
2059
2118
|
{
|
|
2060
2119
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2061
2120
|
stateMutability: "nonpayable",
|
|
@@ -2146,7 +2205,7 @@ const bn = [
|
|
|
2146
2205
|
type: "function"
|
|
2147
2206
|
},
|
|
2148
2207
|
{ stateMutability: "payable", type: "receive" }
|
|
2149
|
-
],
|
|
2208
|
+
], _n = [
|
|
2150
2209
|
{
|
|
2151
2210
|
inputs: [
|
|
2152
2211
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2290,7 +2349,7 @@ const bn = [
|
|
|
2290
2349
|
type: "function"
|
|
2291
2350
|
},
|
|
2292
2351
|
{ stateMutability: "payable", type: "receive" }
|
|
2293
|
-
],
|
|
2352
|
+
], Mn = [
|
|
2294
2353
|
{
|
|
2295
2354
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2296
2355
|
stateMutability: "nonpayable",
|
|
@@ -2395,7 +2454,7 @@ const bn = [
|
|
|
2395
2454
|
type: "function"
|
|
2396
2455
|
},
|
|
2397
2456
|
{ stateMutability: "payable", type: "receive" }
|
|
2398
|
-
],
|
|
2457
|
+
], vn = [
|
|
2399
2458
|
{
|
|
2400
2459
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2401
2460
|
stateMutability: "nonpayable",
|
|
@@ -2486,7 +2545,7 @@ const bn = [
|
|
|
2486
2545
|
type: "function"
|
|
2487
2546
|
},
|
|
2488
2547
|
{ stateMutability: "payable", type: "receive" }
|
|
2489
|
-
],
|
|
2548
|
+
], En = [
|
|
2490
2549
|
{
|
|
2491
2550
|
inputs: [
|
|
2492
2551
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2630,7 +2689,7 @@ const bn = [
|
|
|
2630
2689
|
type: "function"
|
|
2631
2690
|
},
|
|
2632
2691
|
{ stateMutability: "payable", type: "receive" }
|
|
2633
|
-
],
|
|
2692
|
+
], Cn = [
|
|
2634
2693
|
{
|
|
2635
2694
|
inputs: [
|
|
2636
2695
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2749,7 +2808,7 @@ const bn = [
|
|
|
2749
2808
|
type: "function"
|
|
2750
2809
|
},
|
|
2751
2810
|
{ stateMutability: "payable", type: "receive" }
|
|
2752
|
-
],
|
|
2811
|
+
], Ne = [
|
|
2753
2812
|
{
|
|
2754
2813
|
inputs: [{ internalType: "address", name: "_WETH", type: "address" }],
|
|
2755
2814
|
stateMutability: "nonpayable",
|
|
@@ -3150,7 +3209,7 @@ const bn = [
|
|
|
3150
3209
|
type: "function"
|
|
3151
3210
|
},
|
|
3152
3211
|
{ stateMutability: "payable", type: "receive" }
|
|
3153
|
-
],
|
|
3212
|
+
], $e = [
|
|
3154
3213
|
{
|
|
3155
3214
|
inputs: [
|
|
3156
3215
|
{
|
|
@@ -5337,7 +5396,7 @@ const bn = [
|
|
|
5337
5396
|
stateMutability: "payable",
|
|
5338
5397
|
type: "receive"
|
|
5339
5398
|
}
|
|
5340
|
-
],
|
|
5399
|
+
], Ue = [
|
|
5341
5400
|
{
|
|
5342
5401
|
inputs: [
|
|
5343
5402
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -5676,7 +5735,7 @@ const bn = [
|
|
|
5676
5735
|
type: "function"
|
|
5677
5736
|
},
|
|
5678
5737
|
{ stateMutability: "payable", type: "receive" }
|
|
5679
|
-
],
|
|
5738
|
+
], On = [
|
|
5680
5739
|
{
|
|
5681
5740
|
inputs: [
|
|
5682
5741
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -6015,7 +6074,7 @@ const bn = [
|
|
|
6015
6074
|
type: "function"
|
|
6016
6075
|
},
|
|
6017
6076
|
{ stateMutability: "payable", type: "receive" }
|
|
6018
|
-
],
|
|
6077
|
+
], xn = [
|
|
6019
6078
|
{
|
|
6020
6079
|
inputs: [
|
|
6021
6080
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -6354,7 +6413,7 @@ const bn = [
|
|
|
6354
6413
|
type: "function"
|
|
6355
6414
|
},
|
|
6356
6415
|
{ stateMutability: "payable", type: "receive" }
|
|
6357
|
-
],
|
|
6416
|
+
], kn = [
|
|
6358
6417
|
{
|
|
6359
6418
|
inputs: [
|
|
6360
6419
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -6693,7 +6752,7 @@ const bn = [
|
|
|
6693
6752
|
type: "function"
|
|
6694
6753
|
},
|
|
6695
6754
|
{ stateMutability: "payable", type: "receive" }
|
|
6696
|
-
],
|
|
6755
|
+
], Sn = [
|
|
6697
6756
|
{
|
|
6698
6757
|
inputs: [
|
|
6699
6758
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -7032,7 +7091,7 @@ const bn = [
|
|
|
7032
7091
|
type: "function"
|
|
7033
7092
|
},
|
|
7034
7093
|
{ stateMutability: "payable", type: "receive" }
|
|
7035
|
-
],
|
|
7094
|
+
], Rn = [
|
|
7036
7095
|
{
|
|
7037
7096
|
inputs: [
|
|
7038
7097
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -7285,7 +7344,7 @@ const bn = [
|
|
|
7285
7344
|
type: "function"
|
|
7286
7345
|
},
|
|
7287
7346
|
{ stateMutability: "payable", type: "receive" }
|
|
7288
|
-
],
|
|
7347
|
+
], Bn = [
|
|
7289
7348
|
{
|
|
7290
7349
|
inputs: [
|
|
7291
7350
|
{ internalType: "address", name: "_weth", type: "address" },
|
|
@@ -7455,23 +7514,23 @@ const bn = [
|
|
|
7455
7514
|
type: "function"
|
|
7456
7515
|
},
|
|
7457
7516
|
{ stateMutability: "payable", type: "receive" }
|
|
7458
|
-
],
|
|
7517
|
+
], In = {
|
|
7459
7518
|
// AVAX
|
|
7460
|
-
["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106".toLowerCase()]:
|
|
7461
|
-
["0xC22FBb3133dF781E6C25ea6acebe2D2Bb8CeA2f9".toLowerCase()]:
|
|
7462
|
-
["0x60aE616a2155Ee3d9A68541Ba4544862310933d4".toLowerCase()]:
|
|
7463
|
-
["0x1111111254fb6c44bAC0beD2854e76F90643097d".toLowerCase()]:
|
|
7464
|
-
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]:
|
|
7519
|
+
["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106".toLowerCase()]: On,
|
|
7520
|
+
["0xC22FBb3133dF781E6C25ea6acebe2D2Bb8CeA2f9".toLowerCase()]: Bn,
|
|
7521
|
+
["0x60aE616a2155Ee3d9A68541Ba4544862310933d4".toLowerCase()]: kn,
|
|
7522
|
+
["0x1111111254fb6c44bAC0beD2854e76F90643097d".toLowerCase()]: $e,
|
|
7523
|
+
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: Ne,
|
|
7465
7524
|
// BSC
|
|
7466
|
-
["0x10ED43C718714eb63d5aA57B78B54704E256024E".toLowerCase()]:
|
|
7525
|
+
["0x10ED43C718714eb63d5aA57B78B54704E256024E".toLowerCase()]: Ue,
|
|
7467
7526
|
// ETH
|
|
7468
|
-
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]:
|
|
7469
|
-
["0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f".toLowerCase()]:
|
|
7470
|
-
["0xEfF92A263d31888d860bD50809A8D171709b7b1c".toLowerCase()]:
|
|
7471
|
-
["0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D".toLowerCase()]:
|
|
7472
|
-
["0xE592427A0AEce92De3Edee1F18E0157C05861564".toLowerCase()]:
|
|
7473
|
-
["0x1111111254fb6c44bac0bed2854e76f90643097d".toLowerCase()]:
|
|
7474
|
-
},
|
|
7527
|
+
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: Ne,
|
|
7528
|
+
["0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f".toLowerCase()]: xn,
|
|
7529
|
+
["0xEfF92A263d31888d860bD50809A8D171709b7b1c".toLowerCase()]: Ue,
|
|
7530
|
+
["0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D".toLowerCase()]: Sn,
|
|
7531
|
+
["0xE592427A0AEce92De3Edee1F18E0157C05861564".toLowerCase()]: Rn,
|
|
7532
|
+
["0x1111111254fb6c44bac0bed2854e76f90643097d".toLowerCase()]: $e
|
|
7533
|
+
}, Pn = [
|
|
7475
7534
|
{
|
|
7476
7535
|
inputs: [
|
|
7477
7536
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -7590,7 +7649,7 @@ const bn = [
|
|
|
7590
7649
|
type: "function"
|
|
7591
7650
|
},
|
|
7592
7651
|
{ stateMutability: "payable", type: "receive" }
|
|
7593
|
-
],
|
|
7652
|
+
], Hn = [
|
|
7594
7653
|
{
|
|
7595
7654
|
inputs: [
|
|
7596
7655
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -7709,7 +7768,7 @@ const bn = [
|
|
|
7709
7768
|
type: "function"
|
|
7710
7769
|
},
|
|
7711
7770
|
{ stateMutability: "payable", type: "receive" }
|
|
7712
|
-
],
|
|
7771
|
+
], Fn = [
|
|
7713
7772
|
{
|
|
7714
7773
|
inputs: [
|
|
7715
7774
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -7828,7 +7887,7 @@ const bn = [
|
|
|
7828
7887
|
type: "function"
|
|
7829
7888
|
},
|
|
7830
7889
|
{ stateMutability: "payable", type: "receive" }
|
|
7831
|
-
],
|
|
7890
|
+
], Dn = [
|
|
7832
7891
|
{
|
|
7833
7892
|
inputs: [
|
|
7834
7893
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -7955,7 +8014,7 @@ const bn = [
|
|
|
7955
8014
|
type: "function"
|
|
7956
8015
|
},
|
|
7957
8016
|
{ stateMutability: "payable", type: "receive" }
|
|
7958
|
-
],
|
|
8017
|
+
], Ln = [
|
|
7959
8018
|
{
|
|
7960
8019
|
inputs: [
|
|
7961
8020
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -8082,7 +8141,7 @@ const bn = [
|
|
|
8082
8141
|
type: "function"
|
|
8083
8142
|
},
|
|
8084
8143
|
{ stateMutability: "payable", type: "receive" }
|
|
8085
|
-
],
|
|
8144
|
+
], Vn = [
|
|
8086
8145
|
{
|
|
8087
8146
|
inputs: [
|
|
8088
8147
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -8209,7 +8268,7 @@ const bn = [
|
|
|
8209
8268
|
type: "function"
|
|
8210
8269
|
},
|
|
8211
8270
|
{ stateMutability: "payable", type: "receive" }
|
|
8212
|
-
],
|
|
8271
|
+
], qn = [
|
|
8213
8272
|
{
|
|
8214
8273
|
inputs: [
|
|
8215
8274
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -8336,7 +8395,7 @@ const bn = [
|
|
|
8336
8395
|
type: "function"
|
|
8337
8396
|
},
|
|
8338
8397
|
{ stateMutability: "payable", type: "receive" }
|
|
8339
|
-
],
|
|
8398
|
+
], Wn = [
|
|
8340
8399
|
{
|
|
8341
8400
|
inputs: [
|
|
8342
8401
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -8463,28 +8522,28 @@ const bn = [
|
|
|
8463
8522
|
type: "function"
|
|
8464
8523
|
},
|
|
8465
8524
|
{ stateMutability: "payable", type: "receive" }
|
|
8466
|
-
],
|
|
8467
|
-
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]:
|
|
8468
|
-
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]:
|
|
8469
|
-
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]:
|
|
8470
|
-
},
|
|
8471
|
-
...
|
|
8472
|
-
...
|
|
8525
|
+
], ot = {
|
|
8526
|
+
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: gn,
|
|
8527
|
+
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: Mn,
|
|
8528
|
+
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: vn
|
|
8529
|
+
}, Nn = {
|
|
8530
|
+
...In,
|
|
8531
|
+
...ot,
|
|
8473
8532
|
// AVAX
|
|
8474
|
-
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]:
|
|
8475
|
-
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]:
|
|
8476
|
-
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]:
|
|
8533
|
+
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: Cn,
|
|
8534
|
+
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: _n,
|
|
8535
|
+
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: Hn,
|
|
8477
8536
|
// BSC
|
|
8478
|
-
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]:
|
|
8537
|
+
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: En,
|
|
8479
8538
|
// ETH
|
|
8480
|
-
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]:
|
|
8481
|
-
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]:
|
|
8482
|
-
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]:
|
|
8483
|
-
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]:
|
|
8484
|
-
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]:
|
|
8485
|
-
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]:
|
|
8486
|
-
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]:
|
|
8487
|
-
},
|
|
8539
|
+
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: Pn,
|
|
8540
|
+
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: Fn,
|
|
8541
|
+
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: Dn,
|
|
8542
|
+
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: Ln,
|
|
8543
|
+
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: Vn,
|
|
8544
|
+
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: qn,
|
|
8545
|
+
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: Wn
|
|
8546
|
+
}, $n = ({
|
|
8488
8547
|
streamSwap: e,
|
|
8489
8548
|
contractAddress: t,
|
|
8490
8549
|
recipient: n,
|
|
@@ -8498,19 +8557,19 @@ const bn = [
|
|
|
8498
8557
|
router: o,
|
|
8499
8558
|
memoStreamingSwap: l,
|
|
8500
8559
|
tcMemo: b,
|
|
8501
|
-
tcRouter:
|
|
8560
|
+
tcRouter: c,
|
|
8502
8561
|
tcVault: f,
|
|
8503
8562
|
vault: _,
|
|
8504
8563
|
token: M
|
|
8505
8564
|
}
|
|
8506
8565
|
}) => {
|
|
8507
|
-
const v = !!
|
|
8566
|
+
const v = !!ot[t.toLowerCase()];
|
|
8508
8567
|
if (v && !o)
|
|
8509
8568
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
8510
8569
|
const E = b || y, S = e && l || E;
|
|
8511
8570
|
if (!(f || _))
|
|
8512
8571
|
throw new Error("TC Vault is required on calldata");
|
|
8513
|
-
if (!(
|
|
8572
|
+
if (!(c || o))
|
|
8514
8573
|
throw new Error("TC Router is required on calldata");
|
|
8515
8574
|
if (!S)
|
|
8516
8575
|
throw new Error("TC Memo is required on calldata");
|
|
@@ -8518,71 +8577,23 @@ const bn = [
|
|
|
8518
8577
|
throw new Error("Token is required on calldata");
|
|
8519
8578
|
const Y = [
|
|
8520
8579
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
8521
|
-
a(
|
|
8580
|
+
a(c || o),
|
|
8522
8581
|
a(f || _),
|
|
8523
8582
|
S.replace("{recipientAddress}", n),
|
|
8524
8583
|
a(M),
|
|
8525
8584
|
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) => {
|
|
8585
|
+
], he = v ? [a(o), p, u] : [s, u];
|
|
8586
|
+
return [...Y, ...he];
|
|
8587
|
+
}, Un = (e) => {
|
|
8577
8588
|
const t = e ? te.ThornodeStagenet : te.ThornodeMainnet;
|
|
8578
8589
|
return R.get(`${t}/thorchain/inbound_addresses`);
|
|
8579
|
-
},
|
|
8590
|
+
}, Xn = (e) => {
|
|
8580
8591
|
const t = e ? te.ThornodeStagenet : te.ThornodeMainnet;
|
|
8581
8592
|
return R.get(`${t}/thorchain/mimir`);
|
|
8582
|
-
},
|
|
8593
|
+
}, Xe = () => Object.values(r).reduce(
|
|
8583
8594
|
(e, t) => (e[t] = null, e),
|
|
8584
8595
|
{}
|
|
8585
|
-
),
|
|
8596
|
+
), jn = ({
|
|
8586
8597
|
chain: e,
|
|
8587
8598
|
address: t
|
|
8588
8599
|
}) => {
|
|
@@ -8596,23 +8607,23 @@ const bn = [
|
|
|
8596
8607
|
}
|
|
8597
8608
|
};
|
|
8598
8609
|
var $, me, ae, P, ie, se;
|
|
8599
|
-
class
|
|
8610
|
+
class fa {
|
|
8600
8611
|
constructor({ stagenet: t } = {}) {
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8612
|
+
T(this, "connectedChains", Xe());
|
|
8613
|
+
T(this, "connectedWallets", Xe());
|
|
8614
|
+
T(this, "stagenet", !1);
|
|
8615
|
+
T(this, "getAddress", (t) => {
|
|
8605
8616
|
var n;
|
|
8606
8617
|
return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
|
|
8607
8618
|
});
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8619
|
+
T(this, "getExplorerTxUrl", (t, n) => ut({ chain: t, txHash: n }));
|
|
8620
|
+
T(this, "getWallet", (t) => this.connectedWallets[t]);
|
|
8621
|
+
T(this, "getExplorerAddressUrl", (t, n) => yt({ chain: t, address: n }));
|
|
8622
|
+
T(this, "getBalance", async (t, n) => {
|
|
8612
8623
|
const a = await this.getWalletByChain(t, n);
|
|
8613
8624
|
return (a == null ? void 0 : a.balance) || [];
|
|
8614
8625
|
});
|
|
8615
|
-
|
|
8626
|
+
T(this, "swap", async ({
|
|
8616
8627
|
streamSwap: t,
|
|
8617
8628
|
recipient: n,
|
|
8618
8629
|
route: a,
|
|
@@ -8626,33 +8637,33 @@ class Ta {
|
|
|
8626
8637
|
} = a, p = s.startsWith("ERC20-") ? r.Ethereum : s.startsWith("ARC20-") ? r.Avalanche : s.startsWith("BEP20-") ? r.BinanceSmartChain : void 0;
|
|
8627
8638
|
if (!a.complete)
|
|
8628
8639
|
throw new d("core_swap_route_not_complete");
|
|
8629
|
-
if (
|
|
8640
|
+
if (_t.includes(s) && p) {
|
|
8630
8641
|
const o = this.connectedWallets[p];
|
|
8631
8642
|
if (!(o != null && o.sendTransaction))
|
|
8632
8643
|
throw new d("core_wallet_connection_not_found");
|
|
8633
8644
|
if (!(t ? (u = a == null ? void 0 : a.streamingSwap) == null ? void 0 : u.transaction : a == null ? void 0 : a.transaction))
|
|
8634
8645
|
throw new d("core_swap_route_transaction_not_found");
|
|
8635
|
-
const { data: b, from:
|
|
8646
|
+
const { data: b, from: c, to: f, value: _ } = a.transaction, M = {
|
|
8636
8647
|
data: b,
|
|
8637
|
-
from:
|
|
8648
|
+
from: c,
|
|
8638
8649
|
to: f.toLowerCase(),
|
|
8639
|
-
chainId: BigInt(
|
|
8650
|
+
chainId: BigInt(Ke[p]),
|
|
8640
8651
|
value: _ ? BigInt(_) : 0n
|
|
8641
8652
|
};
|
|
8642
8653
|
return o.sendTransaction(M, i);
|
|
8643
8654
|
}
|
|
8644
|
-
if (
|
|
8655
|
+
if (vt.includes(s)) {
|
|
8645
8656
|
if (!a.calldata.fromAsset)
|
|
8646
8657
|
throw new d("core_swap_asset_not_recognized");
|
|
8647
|
-
const o = await
|
|
8658
|
+
const o = await x.fromString(a.calldata.fromAsset);
|
|
8648
8659
|
if (!o)
|
|
8649
8660
|
throw new d("core_swap_asset_not_recognized");
|
|
8650
8661
|
const { address: l } = await g(this, $).call(this, o.chain), {
|
|
8651
8662
|
contract: b,
|
|
8652
|
-
calldata: { expiration:
|
|
8663
|
+
calldata: { expiration: c, amountIn: f, memo: _, memoStreamingSwap: M }
|
|
8653
8664
|
} = a, v = o.add(D.fromBigInt(BigInt(f), o.decimal)), E = t && M || _;
|
|
8654
8665
|
return this.deposit({
|
|
8655
|
-
expiration:
|
|
8666
|
+
expiration: c,
|
|
8656
8667
|
assetValue: v,
|
|
8657
8668
|
memo: E,
|
|
8658
8669
|
feeOptionKey: i,
|
|
@@ -8660,38 +8671,38 @@ class Ta {
|
|
|
8660
8671
|
recipient: l
|
|
8661
8672
|
});
|
|
8662
8673
|
}
|
|
8663
|
-
if (
|
|
8674
|
+
if (Mt.includes(s) && p) {
|
|
8664
8675
|
const { calldata: o, contract: l } = a;
|
|
8665
8676
|
if (!l)
|
|
8666
8677
|
throw new d("core_swap_contract_not_found");
|
|
8667
|
-
const b = this.connectedWallets[p],
|
|
8668
|
-
if (!(b != null && b.sendTransaction &&
|
|
8678
|
+
const b = this.connectedWallets[p], c = this.getAddress(p);
|
|
8679
|
+
if (!(b != null && b.sendTransaction && c))
|
|
8669
8680
|
throw new d("core_wallet_connection_not_found");
|
|
8670
|
-
const { getProvider: f, toChecksumAddress: _ } = await import("@swapkit/toolbox-evm"), M = f(p), v =
|
|
8681
|
+
const { getProvider: f, toChecksumAddress: _ } = await import("@swapkit/toolbox-evm"), M = f(p), v = Nn[l.toLowerCase()];
|
|
8671
8682
|
if (!v)
|
|
8672
8683
|
throw new d("core_swap_contract_not_supported", {
|
|
8673
8684
|
contractAddress: l
|
|
8674
8685
|
});
|
|
8675
8686
|
const S = await (await ((y = b.createContract) == null ? void 0 : y.call(b, l, v, M))).getFunction("swapIn").populateTransaction(
|
|
8676
|
-
|
|
8687
|
+
...$n({
|
|
8677
8688
|
streamSwap: t,
|
|
8678
8689
|
toChecksumAddress: _,
|
|
8679
8690
|
contractAddress: l,
|
|
8680
8691
|
recipient: n,
|
|
8681
8692
|
calldata: o
|
|
8682
8693
|
}),
|
|
8683
|
-
{ from:
|
|
8694
|
+
{ from: c }
|
|
8684
8695
|
);
|
|
8685
8696
|
return b.sendTransaction(S, i);
|
|
8686
8697
|
}
|
|
8687
8698
|
throw new d("core_swap_quote_mode_not_supported", { quoteMode: s });
|
|
8688
8699
|
});
|
|
8689
|
-
|
|
8700
|
+
T(this, "getWalletByChain", async (t, n) => {
|
|
8690
8701
|
var p, u;
|
|
8691
8702
|
const a = this.getAddress(t);
|
|
8692
8703
|
if (!a)
|
|
8693
8704
|
return null;
|
|
8694
|
-
const i = [
|
|
8705
|
+
const i = [x.fromChainOrSignature(t)], s = (p = this.connectedChains[t]) == null ? void 0 : p.walletType;
|
|
8695
8706
|
try {
|
|
8696
8707
|
const y = await ((u = this.getWallet(t)) == null ? void 0 : u.getBalance(a, n));
|
|
8697
8708
|
return this.connectedChains[t] = {
|
|
@@ -8703,13 +8714,13 @@ class Ta {
|
|
|
8703
8714
|
return console.error(y), { address: a, balance: i, walletType: s };
|
|
8704
8715
|
}
|
|
8705
8716
|
});
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8717
|
+
T(this, "approveAssetValue", (t, n) => g(this, ae).call(this, { assetValue: t, type: "approve", contractAddress: n }));
|
|
8718
|
+
T(this, "isAssetValueApproved", (t, n) => g(this, ae).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
|
|
8719
|
+
T(this, "validateAddress", ({ address: t, chain: n }) => {
|
|
8709
8720
|
var a, i;
|
|
8710
8721
|
return (i = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : i.call(a, t);
|
|
8711
8722
|
});
|
|
8712
|
-
|
|
8723
|
+
T(this, "transfer", async (t) => {
|
|
8713
8724
|
const n = this.connectedWallets[t.assetValue.chain];
|
|
8714
8725
|
if (!n)
|
|
8715
8726
|
throw new d("core_wallet_connection_not_found");
|
|
@@ -8719,14 +8730,14 @@ class Ta {
|
|
|
8719
8730
|
throw new d("core_swap_transaction_error", a);
|
|
8720
8731
|
}
|
|
8721
8732
|
});
|
|
8722
|
-
|
|
8733
|
+
T(this, "deposit", async ({
|
|
8723
8734
|
assetValue: t,
|
|
8724
8735
|
recipient: n,
|
|
8725
8736
|
router: a,
|
|
8726
8737
|
...i
|
|
8727
8738
|
}) => {
|
|
8728
8739
|
const { chain: s, symbol: p, ticker: u } = t, y = this.connectedWallets[s], o = this.connectedChains[s];
|
|
8729
|
-
if (!await
|
|
8740
|
+
if (!await jn({
|
|
8730
8741
|
address: o == null ? void 0 : o.address,
|
|
8731
8742
|
chain: s
|
|
8732
8743
|
}))
|
|
@@ -8743,20 +8754,20 @@ class Ta {
|
|
|
8743
8754
|
switch (s) {
|
|
8744
8755
|
case r.THORChain:
|
|
8745
8756
|
case r.Maya: {
|
|
8746
|
-
const
|
|
8747
|
-
return await (n === "" ?
|
|
8757
|
+
const c = y;
|
|
8758
|
+
return await (n === "" ? c.deposit(b) : c.transfer(b));
|
|
8748
8759
|
}
|
|
8749
8760
|
case r.Ethereum:
|
|
8750
8761
|
case r.BinanceSmartChain:
|
|
8751
8762
|
case r.Avalanche: {
|
|
8752
|
-
const { getChecksumAddressFromAsset:
|
|
8763
|
+
const { getChecksumAddressFromAsset: c } = await import("@swapkit/toolbox-evm"), f = s === r.Avalanche ? wt : s === r.BinanceSmartChain ? At : ht;
|
|
8753
8764
|
return await y.call({
|
|
8754
8765
|
abi: f,
|
|
8755
8766
|
contractAddress: a || (await g(this, $).call(this, s)).router,
|
|
8756
8767
|
funcName: "depositWithExpiry",
|
|
8757
8768
|
funcParams: [
|
|
8758
8769
|
n,
|
|
8759
|
-
|
|
8770
|
+
c({ chain: s, symbol: p, ticker: u }, s),
|
|
8760
8771
|
t.getBaseValue("string"),
|
|
8761
8772
|
b.memo,
|
|
8762
8773
|
i.expiration || parseInt(`${((/* @__PURE__ */ new Date()).getTime() + 15 * 60 * 1e3) / 1e3}`)
|
|
@@ -8770,15 +8781,15 @@ class Ta {
|
|
|
8770
8781
|
default:
|
|
8771
8782
|
return await y.transfer(b);
|
|
8772
8783
|
}
|
|
8773
|
-
} catch (
|
|
8774
|
-
const f =
|
|
8775
|
-
throw new d(S,
|
|
8784
|
+
} catch (c) {
|
|
8785
|
+
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";
|
|
8786
|
+
throw new d(S, c);
|
|
8776
8787
|
}
|
|
8777
8788
|
});
|
|
8778
8789
|
/**
|
|
8779
8790
|
* TC related Methods
|
|
8780
8791
|
*/
|
|
8781
|
-
|
|
8792
|
+
T(this, "createLiquidity", async ({
|
|
8782
8793
|
runeAssetValue: t,
|
|
8783
8794
|
assetValue: n
|
|
8784
8795
|
}) => {
|
|
@@ -8809,7 +8820,7 @@ class Ta {
|
|
|
8809
8820
|
}
|
|
8810
8821
|
return { runeTx: a, assetTx: i };
|
|
8811
8822
|
});
|
|
8812
|
-
|
|
8823
|
+
T(this, "addLiquidity", async ({
|
|
8813
8824
|
runeAssetValue: t,
|
|
8814
8825
|
assetValue: n,
|
|
8815
8826
|
runeAddr: a,
|
|
@@ -8817,10 +8828,10 @@ class Ta {
|
|
|
8817
8828
|
isPendingSymmAsset: s,
|
|
8818
8829
|
mode: p = "sym"
|
|
8819
8830
|
}) => {
|
|
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"),
|
|
8831
|
+
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
8832
|
if (!(l || b))
|
|
8822
8833
|
throw new d("core_transaction_add_liquidity_invalid_params");
|
|
8823
|
-
if (
|
|
8834
|
+
if (c && !f)
|
|
8824
8835
|
throw new d("core_transaction_add_liquidity_no_rune_address");
|
|
8825
8836
|
let M, v;
|
|
8826
8837
|
if (l && t)
|
|
@@ -8851,7 +8862,7 @@ class Ta {
|
|
|
8851
8862
|
}
|
|
8852
8863
|
return { runeTx: M, assetTx: v };
|
|
8853
8864
|
});
|
|
8854
|
-
|
|
8865
|
+
T(this, "addLiquidityPart", ({
|
|
8855
8866
|
assetValue: t,
|
|
8856
8867
|
poolAddress: n,
|
|
8857
8868
|
address: a,
|
|
@@ -8866,14 +8877,14 @@ class Ta {
|
|
|
8866
8877
|
});
|
|
8867
8878
|
return g(this, P).call(this, { assetValue: t, memo: s });
|
|
8868
8879
|
});
|
|
8869
|
-
|
|
8880
|
+
T(this, "withdraw", ({
|
|
8870
8881
|
memo: t,
|
|
8871
8882
|
assetValue: n,
|
|
8872
8883
|
percent: a,
|
|
8873
8884
|
from: i,
|
|
8874
8885
|
to: s
|
|
8875
8886
|
}) => {
|
|
8876
|
-
const p = s === "rune" && i !== "rune" ?
|
|
8887
|
+
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
8888
|
symbol: n.symbol,
|
|
8878
8889
|
chain: n.chain,
|
|
8879
8890
|
ticker: n.ticker,
|
|
@@ -8883,7 +8894,7 @@ class Ta {
|
|
|
8883
8894
|
});
|
|
8884
8895
|
return g(this, P).call(this, { assetValue: u, memo: y });
|
|
8885
8896
|
});
|
|
8886
|
-
|
|
8897
|
+
T(this, "savings", ({
|
|
8887
8898
|
assetValue: t,
|
|
8888
8899
|
memo: n,
|
|
8889
8900
|
percent: a,
|
|
@@ -8895,10 +8906,10 @@ class Ta {
|
|
|
8895
8906
|
chain: t.chain,
|
|
8896
8907
|
singleSide: !0,
|
|
8897
8908
|
basisPoints: a ? Math.min(1e4, Math.round(a * 100)) : void 0
|
|
8898
|
-
}), u = s === w.DEPOSIT ? t :
|
|
8909
|
+
}), u = s === w.DEPOSIT ? t : ge(t.chain);
|
|
8899
8910
|
return g(this, P).call(this, { memo: p, assetValue: u });
|
|
8900
8911
|
});
|
|
8901
|
-
|
|
8912
|
+
T(this, "loan", ({
|
|
8902
8913
|
assetValue: t,
|
|
8903
8914
|
memo: n,
|
|
8904
8915
|
minAmount: a,
|
|
@@ -8911,7 +8922,7 @@ class Ta {
|
|
|
8911
8922
|
address: this.getAddress(t.chain)
|
|
8912
8923
|
})
|
|
8913
8924
|
}));
|
|
8914
|
-
|
|
8925
|
+
T(this, "nodeAction", ({
|
|
8915
8926
|
type: t,
|
|
8916
8927
|
assetValue: n,
|
|
8917
8928
|
address: a
|
|
@@ -8922,17 +8933,17 @@ class Ta {
|
|
|
8922
8933
|
});
|
|
8923
8934
|
return g(this, ie).call(this, {
|
|
8924
8935
|
memo: s,
|
|
8925
|
-
assetValue: t === "bond" ? n :
|
|
8936
|
+
assetValue: t === "bond" ? n : ge(r.THORChain)
|
|
8926
8937
|
});
|
|
8927
8938
|
});
|
|
8928
|
-
|
|
8939
|
+
T(this, "registerThorname", ({
|
|
8929
8940
|
assetValue: t,
|
|
8930
8941
|
...n
|
|
8931
8942
|
}) => g(this, ie).call(this, {
|
|
8932
8943
|
assetValue: t,
|
|
8933
8944
|
memo: F(w.THORNAME_REGISTER, n)
|
|
8934
8945
|
}));
|
|
8935
|
-
|
|
8946
|
+
T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: i = {} }) => {
|
|
8936
8947
|
try {
|
|
8937
8948
|
for (const s of t)
|
|
8938
8949
|
this[s.connectMethodName] = s.connect({
|
|
@@ -8945,7 +8956,7 @@ class Ta {
|
|
|
8945
8956
|
throw new d("core_extend_error", s);
|
|
8946
8957
|
}
|
|
8947
8958
|
});
|
|
8948
|
-
|
|
8959
|
+
T(this, "estimateMaxSendableAmount", async ({
|
|
8949
8960
|
chain: t,
|
|
8950
8961
|
params: n
|
|
8951
8962
|
}) => {
|
|
@@ -8985,42 +8996,42 @@ class Ta {
|
|
|
8985
8996
|
* Wallet connection methods
|
|
8986
8997
|
*/
|
|
8987
8998
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
8988
|
-
|
|
8999
|
+
T(this, "connectXDEFI", async (t) => {
|
|
8989
9000
|
throw new d("core_wallet_xdefi_not_installed");
|
|
8990
9001
|
});
|
|
8991
9002
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
8992
|
-
|
|
9003
|
+
T(this, "connectEVMWallet", async (t, n) => {
|
|
8993
9004
|
throw new d("core_wallet_evmwallet_not_installed");
|
|
8994
9005
|
});
|
|
8995
9006
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
8996
|
-
|
|
9007
|
+
T(this, "connectWalletconnect", async (t, n) => {
|
|
8997
9008
|
throw new d("core_wallet_walletconnect_not_installed");
|
|
8998
9009
|
});
|
|
8999
9010
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9000
|
-
|
|
9011
|
+
T(this, "connectKeepkey", async (t, n) => {
|
|
9001
9012
|
throw new d("core_wallet_keepkey_not_installed");
|
|
9002
9013
|
});
|
|
9003
9014
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9004
|
-
|
|
9015
|
+
T(this, "connectKeystore", async (t, n) => {
|
|
9005
9016
|
throw new d("core_wallet_keystore_not_installed");
|
|
9006
9017
|
});
|
|
9007
9018
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9008
|
-
|
|
9019
|
+
T(this, "connectLedger", async (t, n) => {
|
|
9009
9020
|
throw new d("core_wallet_ledger_not_installed");
|
|
9010
9021
|
});
|
|
9011
9022
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9012
|
-
|
|
9023
|
+
T(this, "connectTrezor", async (t, n) => {
|
|
9013
9024
|
throw new d("core_wallet_trezor_not_installed");
|
|
9014
9025
|
});
|
|
9015
9026
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9016
|
-
|
|
9027
|
+
T(this, "connectKeplr", async (t) => {
|
|
9017
9028
|
throw new d("core_wallet_keplr_not_installed");
|
|
9018
9029
|
});
|
|
9019
9030
|
// biome-ignore lint/nursery/useAwait: Extended methods
|
|
9020
|
-
|
|
9031
|
+
T(this, "connectOkx", async (t) => {
|
|
9021
9032
|
throw new d("core_wallet_okx_not_installed");
|
|
9022
9033
|
});
|
|
9023
|
-
|
|
9034
|
+
T(this, "disconnectChain", (t) => {
|
|
9024
9035
|
this.connectedChains[t] = null, this.connectedWallets[t] = null;
|
|
9025
9036
|
});
|
|
9026
9037
|
q(this, $, async (t) => {
|
|
@@ -9029,7 +9040,7 @@ class Ta {
|
|
|
9029
9040
|
case r.THORChain:
|
|
9030
9041
|
return { gas_rate: "0", router: "", address: "", halted: !1, chain: t };
|
|
9031
9042
|
default: {
|
|
9032
|
-
const a = (await
|
|
9043
|
+
const a = (await Un(this.stagenet)).find((i) => i.chain === t);
|
|
9033
9044
|
if (!a)
|
|
9034
9045
|
throw new d("core_inbound_data_not_found");
|
|
9035
9046
|
if (a != null && a.halted)
|
|
@@ -9062,14 +9073,14 @@ class Ta {
|
|
|
9062
9073
|
const l = this.connectedWallets[s], b = n === "checkOnly" ? l == null ? void 0 : l.isApproved : l == null ? void 0 : l.approve;
|
|
9063
9074
|
if (!b)
|
|
9064
9075
|
throw new d("core_wallet_connection_not_found");
|
|
9065
|
-
const
|
|
9066
|
-
if (!(i &&
|
|
9076
|
+
const c = this.getAddress(s);
|
|
9077
|
+
if (!(i && c))
|
|
9067
9078
|
throw new d("core_approve_asset_address_or_from_not_found");
|
|
9068
9079
|
const f = a || (await g(this, $).call(this, s)).router;
|
|
9069
9080
|
return b({
|
|
9070
9081
|
amount: t.getBaseValue("bigint"),
|
|
9071
9082
|
assetAddress: i,
|
|
9072
|
-
from:
|
|
9083
|
+
from: c,
|
|
9073
9084
|
spenderAddress: f
|
|
9074
9085
|
});
|
|
9075
9086
|
});
|
|
@@ -9082,7 +9093,7 @@ class Ta {
|
|
|
9082
9093
|
gas_rate: i,
|
|
9083
9094
|
router: s,
|
|
9084
9095
|
address: p
|
|
9085
|
-
} = await g(this, $).call(this, t.chain), u = (parseInt(i) || 0) *
|
|
9096
|
+
} = await g(this, $).call(this, t.chain), u = (parseInt(i) || 0) * un[a];
|
|
9086
9097
|
return this.deposit({
|
|
9087
9098
|
assetValue: t,
|
|
9088
9099
|
recipient: p,
|
|
@@ -9095,7 +9106,7 @@ class Ta {
|
|
|
9095
9106
|
memo: t,
|
|
9096
9107
|
assetValue: n
|
|
9097
9108
|
}) => {
|
|
9098
|
-
const a = await
|
|
9109
|
+
const a = await Xn(this.stagenet);
|
|
9099
9110
|
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
9100
9111
|
throw new d("core_chain_halted");
|
|
9101
9112
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
@@ -9111,74 +9122,75 @@ class Ta {
|
|
|
9111
9122
|
}
|
|
9112
9123
|
$ = new WeakMap(), me = new WeakMap(), ae = new WeakMap(), P = new WeakMap(), ie = new WeakMap(), se = new WeakMap();
|
|
9113
9124
|
export {
|
|
9114
|
-
|
|
9125
|
+
_t as AGG_SWAP,
|
|
9115
9126
|
L as ApiEndpoints,
|
|
9116
9127
|
te as ApiUrl,
|
|
9117
|
-
|
|
9128
|
+
An as ApproveMode,
|
|
9129
|
+
x as AssetValue,
|
|
9118
9130
|
A as BaseDecimal,
|
|
9119
|
-
|
|
9131
|
+
xe as BigIntArithmetics,
|
|
9120
9132
|
r as Chain,
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
+
Se as ChainId,
|
|
9134
|
+
aa as ChainIdToChain,
|
|
9135
|
+
Ke as ChainToChainId,
|
|
9136
|
+
Qe as ChainToExplorerUrl,
|
|
9137
|
+
na as ChainToHexChainId,
|
|
9138
|
+
Rt as ChainToRPC,
|
|
9139
|
+
Et as ContractAddress,
|
|
9140
|
+
ea as CosmosChainList,
|
|
9141
|
+
xt as CosmosChains,
|
|
9142
|
+
Ct as DerivationPath,
|
|
9143
|
+
Zn as EVMChainList,
|
|
9144
|
+
je as EVMChains,
|
|
9133
9145
|
Q as FeeOption,
|
|
9134
|
-
|
|
9146
|
+
It as LedgerErrorCode,
|
|
9135
9147
|
w as MemoType,
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9148
|
+
Yn as NetworkDerivationPath,
|
|
9149
|
+
gt as QuoteMode,
|
|
9150
|
+
Ge as RPCUrl,
|
|
9139
9151
|
R as RequestClient,
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9152
|
+
Mt as SWAP_IN,
|
|
9153
|
+
vt as SWAP_OUT,
|
|
9154
|
+
tn as StreamingSwapProgressStatus,
|
|
9155
|
+
Jn as SubstrateChainList,
|
|
9156
|
+
ba as SwapKit,
|
|
9157
|
+
sa as SwapKitApi,
|
|
9158
|
+
fa as SwapKitCore,
|
|
9147
9159
|
d as SwapKitError,
|
|
9148
9160
|
D as SwapKitNumber,
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9161
|
+
wt as TCAvalancheDepositABI,
|
|
9162
|
+
At as TCBscDepositABI,
|
|
9163
|
+
ht as TCEthereumVaultAbi,
|
|
9164
|
+
ta as TCSupportedChainList,
|
|
9165
|
+
kt as TCSupportedChains,
|
|
9166
|
+
zt as TransactionType,
|
|
9167
|
+
en as TxStatus,
|
|
9168
|
+
zn as UTXOChainList,
|
|
9169
|
+
Ot as UTXOChains,
|
|
9170
|
+
Bt as WalletOption,
|
|
9171
|
+
ra as assetFromString,
|
|
9172
|
+
at as defaultRequestHeaders,
|
|
9173
|
+
ca as derivationPathToString,
|
|
9174
|
+
Qn as erc20ABI,
|
|
9175
|
+
pa as filterAssets,
|
|
9164
9176
|
fe as formatBigIntToSafeValue,
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9177
|
+
un as gasFeeMultiplier,
|
|
9178
|
+
on as getAssetType,
|
|
9179
|
+
Tn as getAsymmetricAssetShare,
|
|
9180
|
+
ya as getAsymmetricAssetWithdrawAmount,
|
|
9181
|
+
mn as getAsymmetricRuneShare,
|
|
9182
|
+
ua as getAsymmetricRuneWithdrawAmount,
|
|
9183
|
+
yn as getCommonAssetInfo,
|
|
9184
|
+
pn as getDecimal,
|
|
9185
|
+
da as getEstimatedPoolShare,
|
|
9186
|
+
la as getLiquiditySlippage,
|
|
9175
9187
|
F as getMemoFor,
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9188
|
+
ge as getMinAmountByChain,
|
|
9189
|
+
cn as getSymmetricPoolShare,
|
|
9190
|
+
oa as getSymmetricWithdraw,
|
|
9191
|
+
ma as getTHORNameCost,
|
|
9192
|
+
st as isGasAsset,
|
|
9193
|
+
ia as setRequestClientConfig,
|
|
9194
|
+
Ta as validateTHORName
|
|
9183
9195
|
};
|
|
9184
9196
|
//# sourceMappingURL=index.es.js.map
|