@swapkit/core 1.0.0-rc.32 → 1.0.0-rc.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.es.js +227 -229
- package/package.json +13 -13
package/dist/index.es.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var T = (e, t, n) => (
|
|
1
|
+
var Fe = Object.defineProperty;
|
|
2
|
+
var Ge = (e, t, n) => t in e ? Fe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var T = (e, t, n) => (Ge(e, typeof t != "symbol" ? t + "" : t, n), n), qe = (e, t, n) => {
|
|
4
4
|
if (!t.has(e))
|
|
5
5
|
throw TypeError("Cannot " + n);
|
|
6
6
|
};
|
|
7
|
-
var f = (e, t, n) => (
|
|
7
|
+
var f = (e, t, n) => (qe(e, t, "read from private field"), n ? n.call(e) : t.get(e)), B = (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
|
-
var
|
|
13
|
-
const
|
|
12
|
+
var We = Object.defineProperty, je = (e, t, n) => t in e ? We(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, S = (e, t, n) => (je(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
13
|
+
const hn = [
|
|
14
14
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
15
15
|
{
|
|
16
16
|
anonymous: !1,
|
|
@@ -108,7 +108,7 @@ const _n = [
|
|
|
108
108
|
stateMutability: "nonpayable",
|
|
109
109
|
type: "function"
|
|
110
110
|
}
|
|
111
|
-
],
|
|
111
|
+
], Ke = [
|
|
112
112
|
{
|
|
113
113
|
inputs: [{ internalType: "address", name: "rune", type: "address" }],
|
|
114
114
|
stateMutability: "nonpayable",
|
|
@@ -283,7 +283,7 @@ const _n = [
|
|
|
283
283
|
stateMutability: "view",
|
|
284
284
|
type: "function"
|
|
285
285
|
}
|
|
286
|
-
],
|
|
286
|
+
], Ye = [
|
|
287
287
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
288
288
|
{
|
|
289
289
|
anonymous: !1,
|
|
@@ -447,7 +447,7 @@ const _n = [
|
|
|
447
447
|
stateMutability: "view",
|
|
448
448
|
type: "function"
|
|
449
449
|
}
|
|
450
|
-
],
|
|
450
|
+
], Xe = [
|
|
451
451
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
452
452
|
{
|
|
453
453
|
anonymous: !1,
|
|
@@ -600,13 +600,13 @@ const _n = [
|
|
|
600
600
|
type: "function"
|
|
601
601
|
}
|
|
602
602
|
];
|
|
603
|
-
var
|
|
604
|
-
const
|
|
603
|
+
var Je = /* @__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))(Je || {});
|
|
604
|
+
const Qe = [
|
|
605
605
|
"ERC20-ERC20",
|
|
606
606
|
"ARC20-ARC20",
|
|
607
607
|
"BEP20-BEP20"
|
|
608
608
|
/* BSC_TO_BSC */
|
|
609
|
-
],
|
|
609
|
+
], ze = [
|
|
610
610
|
"ERC20-TC",
|
|
611
611
|
"ERC20-ARC20",
|
|
612
612
|
"ERC20-BEP20",
|
|
@@ -617,15 +617,15 @@ const ze = [
|
|
|
617
617
|
"BEP20-ERC20",
|
|
618
618
|
"BEP20-ARC20"
|
|
619
619
|
/* BSC_TO_AVAX */
|
|
620
|
-
],
|
|
620
|
+
], Ze = [
|
|
621
621
|
"TC-TC",
|
|
622
622
|
"TC-ERC20",
|
|
623
623
|
"TC-ARC20",
|
|
624
624
|
"TC-BEP20"
|
|
625
625
|
/* TC_SUPPORTED_TO_BSC */
|
|
626
626
|
];
|
|
627
|
-
var
|
|
628
|
-
const
|
|
627
|
+
var Se = /* @__PURE__ */ ((e) => (e.VALIDATION_ERROR = "VALIDATION_ERROR", e.REQUEST_PARAMETER_ERROR = "REQUEST_PARAMETER_ERROR", e.RESPONSE_PARSING_ERROR = "RESPONSE_PARSING_ERROR", e.UNSUPPORTED = "UNSUPPORTED", e.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", e.INCOMPATIBLE_ASSETS_OPERATIONS = "INCOMPATIBLE_ASSETS_OPERATIONS", e.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", e.DOWN_FOR_MAINTENANCE = "DOWN_FOR_MAINTENANCE", e.MISSING_INBOUND_INFO = "MISSING_INBOUND_INFO", e.QUOTE_FETCHING_ERROR = "QUOTE_FETCHING_ERROR", e.AIRDROP_ERROR = "AIRDROP_ERROR", e.UNHANDLED_ERROR = "UNHANDLED_ERROR", e))(Se || {}), et = /* @__PURE__ */ ((e) => (e.HEALTH_CONTROLLER = "1000", e.LIQUIDITY_CONTROLLER = "1001", e.PROVIDER_CONTROLLER = "1002", e.QUOTE_CONTROLLER = "1003", e.SWAP_CONTROLLER = "1004", e.UTIL_CONTROLLER = "1005", e.AIRDROP_CONTROLLER = "1006", e.PROVIDER = "2000", e.ASSET = "2001", e.TOKEN_LIST = "2002", e.QUOTE = "2100", e.QUOTE_TXN_DETAILS = "2101", e.THORCHAIN_PROVIDER = "3000", e.UNISWAPV2_ETH_PROVIDER = "3001", e.UNISWAPV3_ETH_PROVIDER = "3002", e.SUSHISWAP_ETH_PROVIDER = "3003", e.PANCAKESWAP_BSC_PROVIDER = "3004", e.PANCAKESWAP_ETH_PROVIDER = "3005", e.ONEINCH_ETH_PROVIDER = "3006", e.ONEINCH_BSC_PROVIDER = "3007", e.ONEINCH_AVAX_PROVIDER = "3008", e.ZEROX_ETH_PROVIDER = "3009", e.WOOFI_AVAX_PROVIDER = "3010", e.PANGOLIN_AVAX_PROVIDER = "3011", e.TRADERJOE_AVAX_PROVIDER = "3012", e.KYBER_ETH_PROVIDER = "3013", e.KYBER_AVAX_PROVIDER = "3014", e.WOOFI_BSC_PROVIDER = "3015", e.STARGATE_PROVIDER = "3016", e.PROVIDER_UTIL = "4000", e.TXN_DETAILS = "5000", e.AIRDROP_UTIL = "6000", e))(et || {}), l = /* @__PURE__ */ ((e) => (e.INVALID_INPUT_PARAMETERS = "1000", e.UNKNOWN_PROVIDERS = "1001", e.CANNOT_FIND_INBOUND_ADDRESS = "1002", e.NO_INBOUND_ADDRESSES = "1003", e.CHAIN_HALTED_OR_UNSUPPORTED = "1004", e.MISSING_INPUT_PARAMETER = "1005", e.INVALID_TYPE_GENERIC = "1100", e.INVALID_NUMBER_STRING = "1101", e.INVALID_NUMBER = "1102", e.INVALID_BOOLEAN = "1103", e.INVALID_OBJECT = "1104", e.INVALID_ARRAY = "1105", e.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", e.SELL_BUY_ASSETS_ARE_THE_SAME = "2001", e.MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", e.AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", e.AFF_ADDRESS_TOO_LONG = "2004", e.AFF_BPS_INTEGER_0_100 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROFVIDER_NOT_SUPPORTED = "2008", e.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", e.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", e.SOURCE_ADDRESS_SMART_CONTRACT = "2011", e.INVALID_PROVIDER = "2100", e.MISSING_CROSS_CHAIN_PROVIDER = "2101", e.MISSING_AVAX_PROVIDER = "2102", e.MISSING_BSC_PROVIDER = "2103", e.MISSING_ETH_PROVIDER = "2104", e.INVALID_PROVIDER_FOR_SWAP_OUT = "2105", e.MISSING_ARB_PROVIDER = "2106", e.INVALID_CHAIN = "2200", e.INVALID_ASSET = "2201", e.INVALID_ASSET_IDENTIFIER = "2202", e.UNSUPPORTED_CHAIN = "2204", e.UNSUPPORTED_ASSET = "2203", e.UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205", e.INVALID_SOURCE_ADDRESS = "2300", e.INVALID_DESTINATION_ADDRESS = "2301", e.THORNODE_QUOTE_GENERIC_ERROR = "3000", e.NOT_ENOUGH_SYNTH_BALANCE = "3001", e.SYNTH_MINTING_CAP_REACHED = "3002", e.INVALID_QUOTE_MODE = "4000", e.NO_QUOTES = "4001", e.SERVICE_UNAVAILABLE_GENERIC = "5000", e.MISSING_GAS_DATA_GENERIC = "5100", e.MISSING_TOKEN_INFO_GENERIC = "5200", e.CANT_FIND_TOKEN_LIST = "5201", e.NO_PRICE = "5202", e.PRICE_IS_STALE = "5203", e.ADDRESS_NOT_WHITELISTED = "6000", e.ADDRESS_ALREADY_CLAIMED = "6001", e.TEMPORARY_ERROR = "9999", e))(l || {});
|
|
628
|
+
const tt = {
|
|
629
629
|
[l.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
|
|
630
630
|
[l.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
|
|
631
631
|
[l.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
|
|
@@ -677,12 +677,12 @@ const nt = {
|
|
|
677
677
|
[l.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
|
|
678
678
|
[l.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
|
|
679
679
|
}, ie = (e, t) => {
|
|
680
|
-
let n =
|
|
680
|
+
let n = tt[e];
|
|
681
681
|
for (let a = 0; a < t.length; a++)
|
|
682
682
|
n = n.replace(`{${a}}`, t[a]);
|
|
683
683
|
return t.length === 0 ? n.replace("{0}", "") : n;
|
|
684
684
|
};
|
|
685
|
-
class
|
|
685
|
+
class ve extends Error {
|
|
686
686
|
constructor({
|
|
687
687
|
status: t,
|
|
688
688
|
revision: n,
|
|
@@ -698,14 +698,14 @@ class Ce extends Error {
|
|
|
698
698
|
displayMessageParams: u
|
|
699
699
|
}) {
|
|
700
700
|
const c = r || ie(s, u || []) || "";
|
|
701
|
-
super(c), S(this, "status"), S(this, "revision"), S(this, "type"), S(this, "module"), S(this, "code"), S(this, "message"), S(this, "display"), S(this, "stack"), S(this, "options"), S(this, "displayMessageParams"), this.status = t, this.revision = n || "NO_REVISION", this.module = a, this.message = c, this.display = ie(s, u || []), this.code = s, this.type = o ||
|
|
701
|
+
super(c), S(this, "status"), S(this, "revision"), S(this, "type"), S(this, "module"), S(this, "code"), S(this, "message"), S(this, "display"), S(this, "stack"), S(this, "options"), S(this, "displayMessageParams"), this.status = t, this.revision = n || "NO_REVISION", this.module = a, this.message = c, this.display = ie(s, u || []), this.code = s, this.type = o || Se.UNHANDLED_ERROR, this.options = {
|
|
702
702
|
shouldLog: p || !0,
|
|
703
703
|
shouldTrace: y || !0,
|
|
704
704
|
shouldThrow: d || !1
|
|
705
705
|
}, this.displayMessageParams = u || [], this.options.shouldTrace && Error.captureStackTrace(this);
|
|
706
706
|
}
|
|
707
707
|
static fromErrorInfo(t) {
|
|
708
|
-
return new
|
|
708
|
+
return new ve(t);
|
|
709
709
|
}
|
|
710
710
|
toErrorInfo() {
|
|
711
711
|
return { ...this, identifier: this.identifier };
|
|
@@ -724,8 +724,8 @@ class Ce extends Error {
|
|
|
724
724
|
return this.toErrorInfo();
|
|
725
725
|
}
|
|
726
726
|
}
|
|
727
|
-
var i = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(i || {}),
|
|
728
|
-
const
|
|
727
|
+
var i = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(i || {}), nt = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(nt || {}), at = /* @__PURE__ */ ((e) => (e.ARB = "m/44'/60'/0'/0", e.AVAX = "m/44'/60'/0'/0", e.BCH = "m/44'/145'/0'/0", e.BNB = "m/44'/714'/0'/0", e.BSC = "m/44'/60'/0'/0", e.BTC = "m/84'/0'/0'/0", e.DOGE = "m/44'/3'/0'/0", e.ETH = "m/44'/60'/0'/0", e.GAIA = "m/44'/118'/0'/0", e.KUJI = "m/44'/118'/0'/0", e.LTC = "m/84'/2'/0'/0", e.MATIC = "m/44'/60'/0'/0", e.MAYA = "m/44'/931'/0'/0", e.OP = "m/44'/60'/0'/0", e.THOR = "m/44'/931'/0'/0", e))(at || {});
|
|
728
|
+
const _n = {
|
|
729
729
|
ARB: [44, 60, 0, 0, 0],
|
|
730
730
|
AVAX: [44, 60, 0, 0, 0],
|
|
731
731
|
BCH: [44, 145, 0, 0, 0],
|
|
@@ -743,7 +743,7 @@ const fn = {
|
|
|
743
743
|
THOR: [44, 931, 0, 0, 0]
|
|
744
744
|
};
|
|
745
745
|
var A = /* @__PURE__ */ ((e) => (e[e.ARB = 18] = "ARB", e[e.AVAX = 18] = "AVAX", e[e.BCH = 8] = "BCH", e[e.BNB = 8] = "BNB", e[e.BSC = 18] = "BSC", e[e.BTC = 8] = "BTC", e[e.DASH = 8] = "DASH", e[e.DOGE = 8] = "DOGE", e[e.ETH = 18] = "ETH", e[e.GAIA = 6] = "GAIA", e[e.KUJI = 6] = "KUJI", e[e.LTC = 8] = "LTC", e[e.MATIC = 18] = "MATIC", e[e.MAYA = 10] = "MAYA", e[e.OP = 18] = "OP", e[e.THOR = 8] = "THOR", e))(A || {});
|
|
746
|
-
const
|
|
746
|
+
const st = [
|
|
747
747
|
"ETH",
|
|
748
748
|
"AVAX",
|
|
749
749
|
"BSC",
|
|
@@ -751,18 +751,18 @@ const it = [
|
|
|
751
751
|
"OP",
|
|
752
752
|
"MATIC"
|
|
753
753
|
/* Polygon */
|
|
754
|
-
],
|
|
754
|
+
], fn = [
|
|
755
755
|
"BTC",
|
|
756
756
|
"BCH",
|
|
757
757
|
"DOGE",
|
|
758
758
|
"LTC"
|
|
759
759
|
/* Litecoin */
|
|
760
|
-
],
|
|
760
|
+
], bn = [
|
|
761
761
|
"GAIA",
|
|
762
762
|
"THOR",
|
|
763
763
|
"BNB"
|
|
764
764
|
/* Binance */
|
|
765
|
-
],
|
|
765
|
+
], wn = [
|
|
766
766
|
"AVAX",
|
|
767
767
|
"BNB",
|
|
768
768
|
"BSC",
|
|
@@ -775,26 +775,26 @@ const it = [
|
|
|
775
775
|
"THOR"
|
|
776
776
|
/* THORChain */
|
|
777
777
|
];
|
|
778
|
-
var Te = /* @__PURE__ */ ((e) => (e.Arbitrum = "42161", e.ArbitrumHex = "0xa4b1", e.Avalanche = "43114", e.AvalancheHex = "0xa86a", e.Binance = "Binance-Chain-Tigris", e.BinanceSmartChain = "56", e.BinanceSmartChainHex = "0x38", e.Bitcoin = "bitcoin", e.BitcoinCash = "bitcoincash", e.Cosmos = "cosmoshub-4", e.Dogecoin = "dogecoin", e.Kujira = "kaiyo-1", e.Ethereum = "1", e.EthereumHex = "0x1", e.Litecoin = "litecoin", e.Maya = "mayachain-mainnet-v1", e.MayaStagenet = "mayachain-stagenet-v1", e.Optimism = "10", e.OptimismHex = "0xa", e.Polygon = "137", e.PolygonHex = "0x89", e.THORChain = "thorchain-mainnet-v1", e.THORChainStagenet = "thorchain-stagenet-v2", e))(Te || {}),
|
|
779
|
-
const ae = Object.values(i),
|
|
778
|
+
var Te = /* @__PURE__ */ ((e) => (e.Arbitrum = "42161", e.ArbitrumHex = "0xa4b1", e.Avalanche = "43114", e.AvalancheHex = "0xa86a", e.Binance = "Binance-Chain-Tigris", e.BinanceSmartChain = "56", e.BinanceSmartChainHex = "0x38", e.Bitcoin = "bitcoin", e.BitcoinCash = "bitcoincash", e.Cosmos = "cosmoshub-4", e.Dogecoin = "dogecoin", e.Kujira = "kaiyo-1", e.Ethereum = "1", e.EthereumHex = "0x1", e.Litecoin = "litecoin", e.Maya = "mayachain-mainnet-v1", e.MayaStagenet = "mayachain-stagenet-v1", e.Optimism = "10", e.OptimismHex = "0xa", e.Polygon = "137", e.PolygonHex = "0x89", e.THORChain = "thorchain-mainnet-v1", e.THORChainStagenet = "thorchain-stagenet-v2", e))(Te || {}), Ce = /* @__PURE__ */ ((e) => (e.Arbitrum = "https://arb1.arbitrum.io/rpc", e.Avalanche = "https://node-router.thorswap.net/avalanche-c", e.Binance = "", e.BinanceSmartChain = "https://bsc-dataseed.binance.org", e.Bitcoin = "https://node-router.thorswap.net/bitcoin", e.BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash", e.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", e.Kujira = "https://rpc-kujira.synergynodes.com/", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Litecoin = "https://node-router.thorswap.net/litecoin", e.Maya = "https://tendermint.mayachain.info", e.MayaStagenet = "https://stagenet.tendermint.mayachain.info", e.Optimism = "https://mainnet.optimism.io", e.Polygon = "https://polygon-rpc.com", e.THORChain = "https://rpc.thorswap.net", e.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", e))(Ce || {}), F = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.finance", e.ThorswapStatic = "https://static.thorswap.net", e))(F || {});
|
|
779
|
+
const ae = Object.values(i), it = Object.keys(i), he = ae.reduce(
|
|
780
780
|
(e, t) => {
|
|
781
|
-
const n =
|
|
781
|
+
const n = it.find((a) => i[a] === t);
|
|
782
782
|
return n && (e[t] = n), e;
|
|
783
783
|
},
|
|
784
784
|
{}
|
|
785
|
-
),
|
|
785
|
+
), rt = ae.reduce(
|
|
786
786
|
(e, t) => (e[t] = Te[he[t]], e),
|
|
787
787
|
{}
|
|
788
|
-
),
|
|
789
|
-
(e, t) => (e[t] =
|
|
788
|
+
), ot = ae.reduce(
|
|
789
|
+
(e, t) => (e[t] = Ce[he[t]], e),
|
|
790
790
|
{}
|
|
791
|
-
),
|
|
791
|
+
), An = ae.reduce(
|
|
792
792
|
(e, t) => {
|
|
793
793
|
const n = `${he[t]}Hex`;
|
|
794
794
|
return e[t] = Te[n], e;
|
|
795
795
|
},
|
|
796
796
|
{}
|
|
797
|
-
),
|
|
797
|
+
), En = {
|
|
798
798
|
"0xa4b1": "ARB",
|
|
799
799
|
42161: "ARB",
|
|
800
800
|
"0xa86a": "AVAX",
|
|
@@ -819,7 +819,7 @@ const ae = Object.values(i), rt = Object.keys(i), he = ae.reduce(
|
|
|
819
819
|
"thorchain-stagenet-v2": "THOR",
|
|
820
820
|
"thorchain-mainnet-v1": "THOR"
|
|
821
821
|
/* THORChain */
|
|
822
|
-
},
|
|
822
|
+
}, Me = {
|
|
823
823
|
ARB: "https://arbiscan.io",
|
|
824
824
|
AVAX: "https://snowtrace.io",
|
|
825
825
|
BSC: "https://bscscan.com",
|
|
@@ -836,17 +836,17 @@ const ae = Object.values(i), rt = Object.keys(i), he = ae.reduce(
|
|
|
836
836
|
MATIC: "https://polygonscan.com",
|
|
837
837
|
THOR: "https://viewblock.io/thorchain"
|
|
838
838
|
};
|
|
839
|
-
var
|
|
839
|
+
var pt = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(pt || {}), h = /* @__PURE__ */ ((e) => (e.BOND = "BOND", e.DEPOSIT = "+", e.LEAVE = "LEAVE", e.THORNAME_REGISTER = "~", e.UNBOND = "UNBOND", e.WITHDRAW = "-", e.OPEN_LOAN = "$+", e.CLOSE_LOAN = "$-", e))(h || {}), $ = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))($ || {}), dt = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", e.XDEFI = "XDEFI", e.METAMASK = "METAMASK", e.COINBASE_WEB = "COINBASE_WEB", e.TREZOR = "TREZOR", e.TRUSTWALLET_WEB = "TRUSTWALLET_WEB", e.LEDGER = "LEDGER", e.KEPLR = "KEPLR", e.OKX = "OKX", e.BRAVE = "BRAVE", e.WALLETCONNECT = "WALLETCONNECT", e))(dt || {}), ut = Object.defineProperty, lt = (e, t, n) => t in e ? ut(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, v = (e, t, n) => (lt(e, typeof t != "symbol" ? t + "" : t, n), n), yt = (e, t, n) => {
|
|
840
840
|
if (!t.has(e))
|
|
841
841
|
throw TypeError("Cannot " + n);
|
|
842
842
|
}, K = (e, t, n) => {
|
|
843
843
|
if (t.has(e))
|
|
844
844
|
throw TypeError("Cannot add the same private member more than once");
|
|
845
845
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
846
|
-
}, x = (e, t, n) => (
|
|
847
|
-
const
|
|
846
|
+
}, x = (e, t, n) => (yt(e, t, "access private method"), n);
|
|
847
|
+
const ct = "0x313ce567", Ne = async ({ chain: e, to: t }) => {
|
|
848
848
|
try {
|
|
849
|
-
const { result: n } = await fe.post(
|
|
849
|
+
const { result: n } = await fe.post(ot[e], {
|
|
850
850
|
headers: {
|
|
851
851
|
accept: "*/*",
|
|
852
852
|
"content-type": "application/json",
|
|
@@ -856,37 +856,37 @@ const mt = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
856
856
|
id: 44,
|
|
857
857
|
jsonrpc: "2.0",
|
|
858
858
|
method: "eth_call",
|
|
859
|
-
params: [{ to: t.toLowerCase(), data:
|
|
859
|
+
params: [{ to: t.toLowerCase(), data: ct }, "latest"]
|
|
860
860
|
})
|
|
861
861
|
});
|
|
862
862
|
return parseInt(BigInt(n).toString());
|
|
863
863
|
} catch (n) {
|
|
864
864
|
return console.error(n), A[e];
|
|
865
865
|
}
|
|
866
|
-
},
|
|
866
|
+
}, mt = async (e) => {
|
|
867
867
|
if (e === i.Ethereum)
|
|
868
868
|
return A.ETH;
|
|
869
869
|
const [, t] = e.split("-");
|
|
870
|
-
return t != null && t.startsWith("0x") ?
|
|
871
|
-
},
|
|
870
|
+
return t != null && t.startsWith("0x") ? Ne({ chain: i.Ethereum, to: t }) : A.ETH;
|
|
871
|
+
}, Tt = async (e) => {
|
|
872
872
|
const [, t] = e.split("-");
|
|
873
|
-
return t != null && t.startsWith("0x") ?
|
|
874
|
-
},
|
|
873
|
+
return t != null && t.startsWith("0x") ? Ne({ chain: i.Avalanche, to: t.toLowerCase() }) : A.AVAX;
|
|
874
|
+
}, ht = async (e) => (e === i.BinanceSmartChain, A.BSC), _t = async ({ chain: e, symbol: t }) => {
|
|
875
875
|
switch (e) {
|
|
876
876
|
case i.Ethereum:
|
|
877
|
-
return
|
|
877
|
+
return mt(t);
|
|
878
878
|
case i.Avalanche:
|
|
879
|
-
return
|
|
879
|
+
return Tt(t);
|
|
880
880
|
case i.BinanceSmartChain:
|
|
881
|
-
return
|
|
881
|
+
return ht(t);
|
|
882
882
|
default:
|
|
883
883
|
return A[e];
|
|
884
884
|
}
|
|
885
|
-
},
|
|
885
|
+
}, ft = {
|
|
886
886
|
[$.Average]: 1.2,
|
|
887
887
|
[$.Fast]: 1.5,
|
|
888
888
|
[$.Fastest]: 2
|
|
889
|
-
},
|
|
889
|
+
}, xe = ({ chain: e, symbol: t }) => {
|
|
890
890
|
switch (e) {
|
|
891
891
|
case i.Bitcoin:
|
|
892
892
|
case i.BitcoinCash:
|
|
@@ -912,7 +912,7 @@ const mt = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
912
912
|
case i.THORChain:
|
|
913
913
|
return t === "RUNE";
|
|
914
914
|
}
|
|
915
|
-
},
|
|
915
|
+
}, bt = (e) => {
|
|
916
916
|
switch (e) {
|
|
917
917
|
case "ETH.THOR":
|
|
918
918
|
return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
|
|
@@ -941,7 +941,7 @@ const mt = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
941
941
|
case i.Ethereum:
|
|
942
942
|
return { identifier: `${e}.${e}`, decimal: A[e] };
|
|
943
943
|
}
|
|
944
|
-
},
|
|
944
|
+
}, wt = ({ chain: e, symbol: t }) => {
|
|
945
945
|
if (t.includes("/"))
|
|
946
946
|
return "Synth";
|
|
947
947
|
switch (e) {
|
|
@@ -971,47 +971,47 @@ const mt = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
971
971
|
case i.Optimism:
|
|
972
972
|
return [i.Ethereum, i.Optimism].includes(t) ? "Native" : "OPTIMISM";
|
|
973
973
|
}
|
|
974
|
-
},
|
|
974
|
+
}, Rn = (e) => {
|
|
975
975
|
var t;
|
|
976
976
|
const [n, ...a] = e.split("."), s = e.includes("/"), r = a.join("."), o = (t = r == null ? void 0 : r.split("-")) == null ? void 0 : t[0];
|
|
977
977
|
return { chain: n, symbol: r, ticker: o, synth: s };
|
|
978
|
-
},
|
|
978
|
+
}, At = new RegExp(
|
|
979
979
|
/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
|
|
980
980
|
"gmi"
|
|
981
|
-
),
|
|
981
|
+
), Et = (e) => {
|
|
982
982
|
const [t, n] = e.split(".");
|
|
983
|
-
if (!
|
|
983
|
+
if (!st.includes(t))
|
|
984
984
|
return !0;
|
|
985
985
|
const [, a] = n.split("-");
|
|
986
|
-
return
|
|
987
|
-
},
|
|
986
|
+
return xe({ chain: t, symbol: n }) || !!a;
|
|
987
|
+
}, gn = (e) => e.filter((t) => {
|
|
988
988
|
const n = `${t.chain}.${t.symbol}`;
|
|
989
|
-
return !
|
|
990
|
-
}),
|
|
989
|
+
return !At.test(n) && Et(n) && t.value !== "0";
|
|
990
|
+
}), Rt = ({
|
|
991
991
|
liquidityUnits: e,
|
|
992
992
|
poolUnits: t,
|
|
993
993
|
runeDepth: n
|
|
994
994
|
}) => {
|
|
995
995
|
const a = R(e), s = R(t), r = R(n), o = a.mul(r), p = s.mul(s).mul(2), d = s.mul(a).mul(2), y = a.mul(a), u = s.mul(s).mul(s);
|
|
996
996
|
return o.mul(p.sub(d).add(y)).div(u);
|
|
997
|
-
},
|
|
997
|
+
}, gt = ({
|
|
998
998
|
liquidityUnits: e,
|
|
999
999
|
poolUnits: t,
|
|
1000
1000
|
assetDepth: n
|
|
1001
1001
|
}) => {
|
|
1002
1002
|
const a = R(e), s = R(t), r = R(n), o = a.mul(r), p = s.mul(s).mul(2), d = s.mul(a).mul(2), y = a.mul(a), u = o.mul(p.sub(d).add(y)), c = s.mul(s).mul(s);
|
|
1003
1003
|
return u.div(c);
|
|
1004
|
-
},
|
|
1004
|
+
}, On = ({
|
|
1005
1005
|
percent: e,
|
|
1006
1006
|
runeDepth: t,
|
|
1007
1007
|
liquidityUnits: n,
|
|
1008
1008
|
poolUnits: a
|
|
1009
|
-
}) =>
|
|
1009
|
+
}) => Rt({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), In = ({
|
|
1010
1010
|
percent: e,
|
|
1011
1011
|
assetDepth: t,
|
|
1012
1012
|
liquidityUnits: n,
|
|
1013
1013
|
poolUnits: a
|
|
1014
|
-
}) =>
|
|
1014
|
+
}) => gt({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), R = (e) => D.fromBigInt(BigInt(e), A.THOR), Ot = ({
|
|
1015
1015
|
liquidityUnits: e,
|
|
1016
1016
|
poolUnits: t,
|
|
1017
1017
|
runeDepth: n,
|
|
@@ -1019,17 +1019,17 @@ const mt = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
1019
1019
|
}) => ({
|
|
1020
1020
|
assetAmount: R(a).mul(e).div(t),
|
|
1021
1021
|
runeAmount: R(n).mul(e).div(t)
|
|
1022
|
-
}),
|
|
1022
|
+
}), Sn = ({
|
|
1023
1023
|
liquidityUnits: e,
|
|
1024
1024
|
poolUnits: t,
|
|
1025
1025
|
runeDepth: n,
|
|
1026
1026
|
assetDepth: a,
|
|
1027
1027
|
percent: s
|
|
1028
1028
|
}) => Object.fromEntries(
|
|
1029
|
-
Object.entries(
|
|
1029
|
+
Object.entries(Ot({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
|
|
1030
1030
|
([r, o]) => [r, o.mul(s)]
|
|
1031
1031
|
)
|
|
1032
|
-
),
|
|
1032
|
+
), vn = ({
|
|
1033
1033
|
runeDepth: e,
|
|
1034
1034
|
poolUnits: t,
|
|
1035
1035
|
assetDepth: n,
|
|
@@ -1042,7 +1042,7 @@ const mt = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
1042
1042
|
return I.div(d).getBaseValue("number");
|
|
1043
1043
|
const P = d.add(I);
|
|
1044
1044
|
return I.div(P).getBaseValue("number");
|
|
1045
|
-
},
|
|
1045
|
+
}, Cn = ({
|
|
1046
1046
|
runeAmount: e,
|
|
1047
1047
|
assetAmount: t,
|
|
1048
1048
|
runeDepth: n,
|
|
@@ -1052,7 +1052,7 @@ const mt = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
1052
1052
|
return 0;
|
|
1053
1053
|
const s = R(n), r = R(a), o = R(t), p = R(e), d = o.mul(s).sub(r.mul(p)), y = r.mul(p).add(s.mul(r));
|
|
1054
1054
|
return Math.abs(d.div(y).getBaseValue("number"));
|
|
1055
|
-
},
|
|
1055
|
+
}, It = ({
|
|
1056
1056
|
symbol: e,
|
|
1057
1057
|
ticker: t,
|
|
1058
1058
|
chain: n
|
|
@@ -1076,7 +1076,7 @@ const mt = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
1076
1076
|
return r ? `${e}:${n}/${a}::t:0` : `${e}:${n}.${a}:${s || ""}:t:0`;
|
|
1077
1077
|
}
|
|
1078
1078
|
case h.WITHDRAW: {
|
|
1079
|
-
const { chain: n, ticker: a, symbol: s, basisPoints: r, targetAssetString: o, singleSide: p } = t, d = !p && o ? `:${o}` : "", y =
|
|
1079
|
+
const { chain: n, ticker: a, symbol: s, basisPoints: r, targetAssetString: o, singleSide: p } = t, d = !p && o ? `:${o}` : "", y = It({ chain: n, symbol: s, ticker: a });
|
|
1080
1080
|
return `${e}:${n}${p ? "/" : "."}${y}:${r}${d}`;
|
|
1081
1081
|
}
|
|
1082
1082
|
case h.OPEN_LOAN:
|
|
@@ -1087,16 +1087,16 @@ const mt = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
1087
1087
|
default:
|
|
1088
1088
|
return "";
|
|
1089
1089
|
}
|
|
1090
|
-
},
|
|
1090
|
+
}, Mn = (e) => {
|
|
1091
1091
|
if (e < 0)
|
|
1092
1092
|
throw new Error("Invalid number of year");
|
|
1093
1093
|
return 10 + e;
|
|
1094
|
-
},
|
|
1094
|
+
}, Nn = (e) => {
|
|
1095
1095
|
if (e.length > 30)
|
|
1096
1096
|
return !1;
|
|
1097
1097
|
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
1098
1098
|
return !!e.match(t);
|
|
1099
|
-
},
|
|
1099
|
+
}, xn = ([e, t, n, a, s]) => `${e}'/${t}'/${n}'/${a}${typeof s != "number" ? "" : `/${s}`}`;
|
|
1100
1100
|
class be extends Error {
|
|
1101
1101
|
constructor(t, n, a) {
|
|
1102
1102
|
const s = t.status || t.status === 0 ? t.status : "", r = t.statusText || "", o = `${s} ${r}`.trim(), p = o ? `status code ${o}` : "an unknown error";
|
|
@@ -1118,7 +1118,7 @@ class be extends Error {
|
|
|
1118
1118
|
}), this.name = "HTTPError", this.response = t, this.request = n, this.options = a;
|
|
1119
1119
|
}
|
|
1120
1120
|
}
|
|
1121
|
-
class
|
|
1121
|
+
class De extends Error {
|
|
1122
1122
|
constructor(t) {
|
|
1123
1123
|
super("Request timed out"), Object.defineProperty(this, "request", {
|
|
1124
1124
|
enumerable: !0,
|
|
@@ -1133,7 +1133,7 @@ const X = (e) => e !== null && typeof e == "object", Y = (...e) => {
|
|
|
1133
1133
|
if ((!X(t) || Array.isArray(t)) && t !== void 0)
|
|
1134
1134
|
throw new TypeError("The `options` argument must be an object");
|
|
1135
1135
|
return _e({}, ...e);
|
|
1136
|
-
},
|
|
1136
|
+
}, Pe = (e = {}, t = {}) => {
|
|
1137
1137
|
const n = new globalThis.Headers(e), a = t instanceof globalThis.Headers, s = new globalThis.Headers(t);
|
|
1138
1138
|
for (const [r, o] of s.entries())
|
|
1139
1139
|
a && o === "undefined" || o === void 0 ? n.delete(r) : n.set(r, o);
|
|
@@ -1146,10 +1146,10 @@ const X = (e) => e !== null && typeof e == "object", Y = (...e) => {
|
|
|
1146
1146
|
else if (X(a)) {
|
|
1147
1147
|
for (let [s, r] of Object.entries(a))
|
|
1148
1148
|
X(r) && s in t && (r = _e(t[s], r)), t = { ...t, [s]: r };
|
|
1149
|
-
X(a.headers) && (n =
|
|
1149
|
+
X(a.headers) && (n = Pe(n, a.headers), t.headers = n);
|
|
1150
1150
|
}
|
|
1151
1151
|
return t;
|
|
1152
|
-
},
|
|
1152
|
+
}, St = (() => {
|
|
1153
1153
|
let e = !1, t = !1;
|
|
1154
1154
|
const n = typeof globalThis.ReadableStream == "function", a = typeof globalThis.Request == "function";
|
|
1155
1155
|
return n && a && (t = new globalThis.Request("https://empty.invalid", {
|
|
@@ -1160,13 +1160,13 @@ const X = (e) => e !== null && typeof e == "object", Y = (...e) => {
|
|
|
1160
1160
|
return e = !0, "half";
|
|
1161
1161
|
}
|
|
1162
1162
|
}).headers.has("Content-Type")), e && !t;
|
|
1163
|
-
})(),
|
|
1163
|
+
})(), vt = typeof globalThis.AbortController == "function", Ct = typeof globalThis.ReadableStream == "function", Mt = typeof globalThis.FormData == "function", Be = ["get", "post", "put", "patch", "head", "delete"], Nt = {
|
|
1164
1164
|
json: "application/json",
|
|
1165
1165
|
text: "text/*",
|
|
1166
1166
|
formData: "multipart/form-data",
|
|
1167
1167
|
arrayBuffer: "*/*",
|
|
1168
1168
|
blob: "*/*"
|
|
1169
|
-
}, re = 2147483647,
|
|
1169
|
+
}, re = 2147483647, Le = Symbol("stop"), xt = {
|
|
1170
1170
|
json: !0,
|
|
1171
1171
|
parseJson: !0,
|
|
1172
1172
|
searchParams: !0,
|
|
@@ -1177,7 +1177,7 @@ const X = (e) => e !== null && typeof e == "object", Y = (...e) => {
|
|
|
1177
1177
|
throwHttpErrors: !0,
|
|
1178
1178
|
onDownloadProgress: !0,
|
|
1179
1179
|
fetch: !0
|
|
1180
|
-
},
|
|
1180
|
+
}, Dt = {
|
|
1181
1181
|
method: !0,
|
|
1182
1182
|
headers: !0,
|
|
1183
1183
|
body: !0,
|
|
@@ -1193,15 +1193,15 @@ const X = (e) => e !== null && typeof e == "object", Y = (...e) => {
|
|
|
1193
1193
|
window: !0,
|
|
1194
1194
|
dispatcher: !0,
|
|
1195
1195
|
duplex: !0
|
|
1196
|
-
},
|
|
1196
|
+
}, Pt = (e) => Be.includes(e) ? e.toUpperCase() : e, Bt = ["get", "put", "head", "delete", "options", "trace"], Lt = [408, 413, 429, 500, 502, 503, 504], Ve = [413, 429, 503], we = {
|
|
1197
1197
|
limit: 2,
|
|
1198
|
-
methods:
|
|
1199
|
-
statusCodes:
|
|
1200
|
-
afterStatusCodes:
|
|
1198
|
+
methods: Bt,
|
|
1199
|
+
statusCodes: Lt,
|
|
1200
|
+
afterStatusCodes: Ve,
|
|
1201
1201
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
1202
1202
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
1203
1203
|
delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
|
|
1204
|
-
},
|
|
1204
|
+
}, Vt = (e = {}) => {
|
|
1205
1205
|
if (typeof e == "number")
|
|
1206
1206
|
return {
|
|
1207
1207
|
...we,
|
|
@@ -1214,20 +1214,20 @@ const X = (e) => e !== null && typeof e == "object", Y = (...e) => {
|
|
|
1214
1214
|
return {
|
|
1215
1215
|
...we,
|
|
1216
1216
|
...e,
|
|
1217
|
-
afterStatusCodes:
|
|
1217
|
+
afterStatusCodes: Ve
|
|
1218
1218
|
};
|
|
1219
1219
|
};
|
|
1220
|
-
async function
|
|
1220
|
+
async function Ut(e, t, n, a) {
|
|
1221
1221
|
return new Promise((s, r) => {
|
|
1222
1222
|
const o = setTimeout(() => {
|
|
1223
|
-
n && n.abort(), r(new
|
|
1223
|
+
n && n.abort(), r(new De(e));
|
|
1224
1224
|
}, a.timeout);
|
|
1225
1225
|
a.fetch(e, t).then(s).catch(r).then(() => {
|
|
1226
1226
|
clearTimeout(o);
|
|
1227
1227
|
});
|
|
1228
1228
|
});
|
|
1229
1229
|
}
|
|
1230
|
-
async function
|
|
1230
|
+
async function Ht(e, { signal: t }) {
|
|
1231
1231
|
return new Promise((n, a) => {
|
|
1232
1232
|
t && (t.throwIfAborted(), t.addEventListener("abort", s, { once: !0 }));
|
|
1233
1233
|
function s() {
|
|
@@ -1238,10 +1238,10 @@ async function $t(e, { signal: t }) {
|
|
|
1238
1238
|
}, e);
|
|
1239
1239
|
});
|
|
1240
1240
|
}
|
|
1241
|
-
const
|
|
1241
|
+
const $t = (e, t) => {
|
|
1242
1242
|
const n = {};
|
|
1243
1243
|
for (const a in t)
|
|
1244
|
-
!(a in
|
|
1244
|
+
!(a in Dt) && !(a in xt) && !(a in e) && (n[a] = t[a]);
|
|
1245
1245
|
return n;
|
|
1246
1246
|
};
|
|
1247
1247
|
class Z {
|
|
@@ -1264,13 +1264,13 @@ class Z {
|
|
|
1264
1264
|
if (a._options.onDownloadProgress) {
|
|
1265
1265
|
if (typeof a._options.onDownloadProgress != "function")
|
|
1266
1266
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
1267
|
-
if (!
|
|
1267
|
+
if (!Ct)
|
|
1268
1268
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
1269
1269
|
return a._stream(o.clone(), a._options.onDownloadProgress);
|
|
1270
1270
|
}
|
|
1271
1271
|
return o;
|
|
1272
1272
|
}, r = a._options.retry.methods.includes(a.request.method.toLowerCase()) ? a._retry(s) : s();
|
|
1273
|
-
for (const [o, p] of Object.entries(
|
|
1273
|
+
for (const [o, p] of Object.entries(Nt))
|
|
1274
1274
|
r[o] = async () => {
|
|
1275
1275
|
a.request.headers.set("accept", a.request.headers.get("accept") || p);
|
|
1276
1276
|
const d = (await r).clone();
|
|
@@ -1315,17 +1315,17 @@ class Z {
|
|
|
1315
1315
|
// TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
|
|
1316
1316
|
credentials: this._input.credentials || "same-origin",
|
|
1317
1317
|
...n,
|
|
1318
|
-
headers:
|
|
1318
|
+
headers: Pe(this._input.headers, n.headers),
|
|
1319
1319
|
hooks: _e({
|
|
1320
1320
|
beforeRequest: [],
|
|
1321
1321
|
beforeRetry: [],
|
|
1322
1322
|
beforeError: [],
|
|
1323
1323
|
afterResponse: []
|
|
1324
1324
|
}, n.hooks),
|
|
1325
|
-
method:
|
|
1325
|
+
method: Pt(n.method ?? this._input.method),
|
|
1326
1326
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
1327
1327
|
prefixUrl: String(n.prefixUrl || ""),
|
|
1328
|
-
retry:
|
|
1328
|
+
retry: Vt(n.retry),
|
|
1329
1329
|
throwHttpErrors: n.throwHttpErrors !== !1,
|
|
1330
1330
|
timeout: n.timeout ?? 1e4,
|
|
1331
1331
|
fetch: n.fetch ?? globalThis.fetch.bind(globalThis)
|
|
@@ -1336,7 +1336,7 @@ class Z {
|
|
|
1336
1336
|
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
1337
1337
|
this._options.prefixUrl.endsWith("/") || (this._options.prefixUrl += "/"), this._input = this._options.prefixUrl + this._input;
|
|
1338
1338
|
}
|
|
1339
|
-
if (
|
|
1339
|
+
if (vt) {
|
|
1340
1340
|
if (this.abortController = new globalThis.AbortController(), this._options.signal) {
|
|
1341
1341
|
const a = this._options.signal;
|
|
1342
1342
|
this._options.signal.addEventListener("abort", () => {
|
|
@@ -1345,14 +1345,14 @@ class Z {
|
|
|
1345
1345
|
}
|
|
1346
1346
|
this._options.signal = this.abortController.signal;
|
|
1347
1347
|
}
|
|
1348
|
-
if (
|
|
1348
|
+
if (St && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
|
|
1349
1349
|
const a = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), s = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, a);
|
|
1350
|
-
(
|
|
1350
|
+
(Mt && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"]) && this.request.headers.delete("content-type"), this.request = new globalThis.Request(new globalThis.Request(s, { ...this.request }), this._options);
|
|
1351
1351
|
}
|
|
1352
1352
|
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 }));
|
|
1353
1353
|
}
|
|
1354
1354
|
_calculateRetryDelay(t) {
|
|
1355
|
-
if (this._retryCount++, this._retryCount < this._options.retry.limit && !(t instanceof
|
|
1355
|
+
if (this._retryCount++, this._retryCount < this._options.retry.limit && !(t instanceof De)) {
|
|
1356
1356
|
if (t instanceof be) {
|
|
1357
1357
|
if (!this._options.retry.statusCodes.includes(t.response.status))
|
|
1358
1358
|
return 0;
|
|
@@ -1378,14 +1378,14 @@ class Z {
|
|
|
1378
1378
|
} catch (n) {
|
|
1379
1379
|
const a = Math.min(this._calculateRetryDelay(n), re);
|
|
1380
1380
|
if (a !== 0 && this._retryCount > 0) {
|
|
1381
|
-
await
|
|
1381
|
+
await Ht(a, { signal: this._options.signal });
|
|
1382
1382
|
for (const s of this._options.hooks.beforeRetry)
|
|
1383
1383
|
if (await s({
|
|
1384
1384
|
request: this.request,
|
|
1385
1385
|
options: this._options,
|
|
1386
1386
|
error: n,
|
|
1387
1387
|
retryCount: this._retryCount
|
|
1388
|
-
}) ===
|
|
1388
|
+
}) === Le)
|
|
1389
1389
|
return;
|
|
1390
1390
|
return this._retry(t);
|
|
1391
1391
|
}
|
|
@@ -1402,8 +1402,8 @@ class Z {
|
|
|
1402
1402
|
if (a instanceof Response)
|
|
1403
1403
|
return a;
|
|
1404
1404
|
}
|
|
1405
|
-
const t =
|
|
1406
|
-
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) :
|
|
1405
|
+
const t = $t(this.request, this._options);
|
|
1406
|
+
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Ut(this.request.clone(), t, this.abortController, this._options);
|
|
1407
1407
|
}
|
|
1408
1408
|
/* istanbul ignore next */
|
|
1409
1409
|
_stream(t, n) {
|
|
@@ -1442,13 +1442,13 @@ class Z {
|
|
|
1442
1442
|
/*! MIT License © Sindre Sorhus */
|
|
1443
1443
|
const pe = (e) => {
|
|
1444
1444
|
const t = (n, a) => Z.create(n, Y(e, a));
|
|
1445
|
-
for (const n of
|
|
1445
|
+
for (const n of Be)
|
|
1446
1446
|
t[n] = (a, s) => Z.create(a, Y(e, s, { method: n }));
|
|
1447
|
-
return t.create = (n) => pe(Y(n)), t.extend = (n) => pe(Y(e, n)), t.stop =
|
|
1448
|
-
},
|
|
1447
|
+
return t.create = (n) => pe(Y(n)), t.extend = (n) => pe(Y(e, n)), t.stop = Le, t;
|
|
1448
|
+
}, kt = pe(), Ft = kt, Gt = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, Ae = Ft.create({ headers: Gt }), fe = {
|
|
1449
1449
|
get: (e, t) => Ae.get(e, t).json(),
|
|
1450
1450
|
post: (e, t) => Ae.post(e, t).json()
|
|
1451
|
-
}, Ee = Object.values(i),
|
|
1451
|
+
}, Ee = Object.values(i), qt = (e = "") => {
|
|
1452
1452
|
const t = e.toUpperCase(), [n] = t.split(".");
|
|
1453
1453
|
if (Ee.includes(n))
|
|
1454
1454
|
return !0;
|
|
@@ -1476,16 +1476,16 @@ function se({
|
|
|
1476
1476
|
);
|
|
1477
1477
|
}
|
|
1478
1478
|
var V, H, J, de, ue, Re, ee, le;
|
|
1479
|
-
const
|
|
1479
|
+
const Wt = class Ue {
|
|
1480
1480
|
constructor(t) {
|
|
1481
1481
|
K(this, V), K(this, J), K(this, ue), K(this, ee), v(this, "decimalMultiplier", 10n ** 8n), v(this, "bigIntValue", 0n), v(this, "decimal");
|
|
1482
1482
|
const n = Q(t);
|
|
1483
1483
|
this.decimal = typeof t == "object" ? t.decimal : void 0, this.decimalMultiplier = U(
|
|
1484
|
-
Math.max(
|
|
1484
|
+
Math.max(He(te(n)), this.decimal || 0)
|
|
1485
1485
|
), x(this, J, de).call(this, n);
|
|
1486
1486
|
}
|
|
1487
1487
|
static fromBigInt(t, n) {
|
|
1488
|
-
return new
|
|
1488
|
+
return new Ue({
|
|
1489
1489
|
decimal: n,
|
|
1490
1490
|
value: se({ value: t, bigIntDecimal: n, decimal: n })
|
|
1491
1491
|
});
|
|
@@ -1649,23 +1649,23 @@ V = /* @__PURE__ */ new WeakSet(), H = function(e, ...t) {
|
|
|
1649
1649
|
this.bigIntValue = x(this, ee, le).call(this, t);
|
|
1650
1650
|
}, ue = /* @__PURE__ */ new WeakSet(), Re = function(...e) {
|
|
1651
1651
|
const t = e.map(
|
|
1652
|
-
(n) => typeof n == "object" ? n.decimal || k(n.decimalMultiplier) :
|
|
1652
|
+
(n) => typeof n == "object" ? n.decimal || k(n.decimalMultiplier) : He(te(n))
|
|
1653
1653
|
).filter(Boolean);
|
|
1654
1654
|
return Math.max(...t, G);
|
|
1655
1655
|
}, ee = /* @__PURE__ */ new WeakSet(), le = function(e, t) {
|
|
1656
1656
|
const n = t ? U(t) : this.decimalMultiplier, a = k(n), [s = "", r = ""] = e.split(".");
|
|
1657
1657
|
return BigInt(`${s}${r.padEnd(a, "0")}`);
|
|
1658
1658
|
};
|
|
1659
|
-
let ye =
|
|
1660
|
-
const
|
|
1659
|
+
let ye = Wt;
|
|
1660
|
+
const jt = Intl.NumberFormat("fullwide", {
|
|
1661
1661
|
useGrouping: !1,
|
|
1662
1662
|
maximumFractionDigits: 20
|
|
1663
1663
|
});
|
|
1664
1664
|
function te(e) {
|
|
1665
|
-
const t = `${typeof e == "number" ?
|
|
1665
|
+
const t = `${typeof e == "number" ? jt.format(e) : Q(e)}`.replaceAll(",", ".").split(".");
|
|
1666
1666
|
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1667
1667
|
}
|
|
1668
|
-
function
|
|
1668
|
+
function He(e) {
|
|
1669
1669
|
var t;
|
|
1670
1670
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1671
1671
|
return Math.max(n, G);
|
|
@@ -1680,20 +1680,18 @@ const ge = (e) => {
|
|
|
1680
1680
|
throw new Error("Static assets not loaded, call await AssetValue.loadStaticAssets() first");
|
|
1681
1681
|
return ce.get(e.toUpperCase()) || { decimal: A.THOR, identifier: "" };
|
|
1682
1682
|
}, Oe = async (e, t = 0) => {
|
|
1683
|
-
|
|
1684
|
-
const n = await
|
|
1683
|
+
qt(e);
|
|
1684
|
+
const n = await _t(me(e)), a = z(t, n);
|
|
1685
1685
|
return new M({ decimal: n, value: a, identifier: e });
|
|
1686
|
-
}
|
|
1686
|
+
};
|
|
1687
1687
|
class M extends ye {
|
|
1688
1688
|
constructor(t) {
|
|
1689
|
-
const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}
|
|
1690
|
-
if (a)
|
|
1691
|
-
return a.set(t.value);
|
|
1689
|
+
const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`;
|
|
1692
1690
|
super(
|
|
1693
1691
|
t.value instanceof ye ? t.value : { decimal: t.decimal, value: t.value }
|
|
1694
1692
|
), v(this, "address"), v(this, "isSynthetic", !1), v(this, "isGasAsset", !1), v(this, "chain"), v(this, "symbol"), v(this, "ticker"), v(this, "type");
|
|
1695
|
-
const
|
|
1696
|
-
this.type =
|
|
1693
|
+
const a = me(n);
|
|
1694
|
+
this.type = wt(a), this.chain = a.chain, this.ticker = a.ticker, this.symbol = a.symbol, this.address = a.address, this.isSynthetic = a.isSynthetic, this.isGasAsset = a.isGasAsset;
|
|
1697
1695
|
}
|
|
1698
1696
|
toString(t = !1) {
|
|
1699
1697
|
const n = this.isSynthetic ? this.symbol.split("-")[0] : this.ticker;
|
|
@@ -1722,7 +1720,7 @@ class M extends ye {
|
|
|
1722
1720
|
return new M({ decimal: a, identifier: s, value: r });
|
|
1723
1721
|
}
|
|
1724
1722
|
static fromChainOrSignature(t, n = 0) {
|
|
1725
|
-
const { decimal: a, identifier: s } =
|
|
1723
|
+
const { decimal: a, identifier: s } = bt(t), r = z(n, a);
|
|
1726
1724
|
return new M({ value: r, decimal: a, identifier: s });
|
|
1727
1725
|
}
|
|
1728
1726
|
static async loadStaticAssets() {
|
|
@@ -1777,12 +1775,12 @@ const oe = (e) => {
|
|
|
1777
1775
|
return {
|
|
1778
1776
|
address: d == null ? void 0 : d.toLowerCase(),
|
|
1779
1777
|
chain: r,
|
|
1780
|
-
isGasAsset:
|
|
1778
|
+
isGasAsset: xe({ chain: r, symbol: o }),
|
|
1781
1779
|
isSynthetic: t,
|
|
1782
1780
|
symbol: (t ? `${n}/` : "") + (d ? `${p}-${(d == null ? void 0 : d.toLowerCase()) ?? ""}` : o),
|
|
1783
1781
|
ticker: p
|
|
1784
1782
|
};
|
|
1785
|
-
},
|
|
1783
|
+
}, Kt = {
|
|
1786
1784
|
/**
|
|
1787
1785
|
* Core
|
|
1788
1786
|
*/
|
|
@@ -1841,7 +1839,7 @@ const oe = (e) => {
|
|
|
1841
1839
|
};
|
|
1842
1840
|
class m extends Error {
|
|
1843
1841
|
constructor(t, n) {
|
|
1844
|
-
console.error(n), super(t, { cause: { code:
|
|
1842
|
+
console.error(n), super(t, { cause: { code: Kt[t], message: t } }), Object.setPrototypeOf(this, m.prototype);
|
|
1845
1843
|
}
|
|
1846
1844
|
}
|
|
1847
1845
|
class D extends ye {
|
|
@@ -1855,7 +1853,7 @@ class D extends ye {
|
|
|
1855
1853
|
});
|
|
1856
1854
|
}
|
|
1857
1855
|
}
|
|
1858
|
-
const
|
|
1856
|
+
const Yt = [
|
|
1859
1857
|
{
|
|
1860
1858
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
1861
1859
|
stateMutability: "nonpayable",
|
|
@@ -1946,7 +1944,7 @@ const Xt = [
|
|
|
1946
1944
|
type: "function"
|
|
1947
1945
|
},
|
|
1948
1946
|
{ stateMutability: "payable", type: "receive" }
|
|
1949
|
-
],
|
|
1947
|
+
], Xt = [
|
|
1950
1948
|
{
|
|
1951
1949
|
inputs: [
|
|
1952
1950
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2090,7 +2088,7 @@ const Xt = [
|
|
|
2090
2088
|
type: "function"
|
|
2091
2089
|
},
|
|
2092
2090
|
{ stateMutability: "payable", type: "receive" }
|
|
2093
|
-
],
|
|
2091
|
+
], Jt = [
|
|
2094
2092
|
{
|
|
2095
2093
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2096
2094
|
stateMutability: "nonpayable",
|
|
@@ -2195,7 +2193,7 @@ const Xt = [
|
|
|
2195
2193
|
type: "function"
|
|
2196
2194
|
},
|
|
2197
2195
|
{ stateMutability: "payable", type: "receive" }
|
|
2198
|
-
],
|
|
2196
|
+
], Qt = [
|
|
2199
2197
|
{
|
|
2200
2198
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2201
2199
|
stateMutability: "nonpayable",
|
|
@@ -2286,7 +2284,7 @@ const Xt = [
|
|
|
2286
2284
|
type: "function"
|
|
2287
2285
|
},
|
|
2288
2286
|
{ stateMutability: "payable", type: "receive" }
|
|
2289
|
-
],
|
|
2287
|
+
], zt = [
|
|
2290
2288
|
{
|
|
2291
2289
|
inputs: [
|
|
2292
2290
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2430,7 +2428,7 @@ const Xt = [
|
|
|
2430
2428
|
type: "function"
|
|
2431
2429
|
},
|
|
2432
2430
|
{ stateMutability: "payable", type: "receive" }
|
|
2433
|
-
],
|
|
2431
|
+
], Zt = [
|
|
2434
2432
|
{
|
|
2435
2433
|
inputs: [
|
|
2436
2434
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2549,7 +2547,7 @@ const Xt = [
|
|
|
2549
2547
|
type: "function"
|
|
2550
2548
|
},
|
|
2551
2549
|
{ stateMutability: "payable", type: "receive" }
|
|
2552
|
-
],
|
|
2550
|
+
], en = [
|
|
2553
2551
|
{
|
|
2554
2552
|
inputs: [
|
|
2555
2553
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2668,7 +2666,7 @@ const Xt = [
|
|
|
2668
2666
|
type: "function"
|
|
2669
2667
|
},
|
|
2670
2668
|
{ stateMutability: "payable", type: "receive" }
|
|
2671
|
-
],
|
|
2669
|
+
], tn = [
|
|
2672
2670
|
{
|
|
2673
2671
|
inputs: [
|
|
2674
2672
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2787,7 +2785,7 @@ const Xt = [
|
|
|
2787
2785
|
type: "function"
|
|
2788
2786
|
},
|
|
2789
2787
|
{ stateMutability: "payable", type: "receive" }
|
|
2790
|
-
],
|
|
2788
|
+
], nn = [
|
|
2791
2789
|
{
|
|
2792
2790
|
inputs: [
|
|
2793
2791
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2906,7 +2904,7 @@ const Xt = [
|
|
|
2906
2904
|
type: "function"
|
|
2907
2905
|
},
|
|
2908
2906
|
{ stateMutability: "payable", type: "receive" }
|
|
2909
|
-
],
|
|
2907
|
+
], an = [
|
|
2910
2908
|
{
|
|
2911
2909
|
inputs: [
|
|
2912
2910
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3033,7 +3031,7 @@ const Xt = [
|
|
|
3033
3031
|
type: "function"
|
|
3034
3032
|
},
|
|
3035
3033
|
{ stateMutability: "payable", type: "receive" }
|
|
3036
|
-
],
|
|
3034
|
+
], sn = [
|
|
3037
3035
|
{
|
|
3038
3036
|
inputs: [
|
|
3039
3037
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3160,7 +3158,7 @@ const Xt = [
|
|
|
3160
3158
|
type: "function"
|
|
3161
3159
|
},
|
|
3162
3160
|
{ stateMutability: "payable", type: "receive" }
|
|
3163
|
-
],
|
|
3161
|
+
], rn = [
|
|
3164
3162
|
{
|
|
3165
3163
|
inputs: [
|
|
3166
3164
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3287,7 +3285,7 @@ const Xt = [
|
|
|
3287
3285
|
type: "function"
|
|
3288
3286
|
},
|
|
3289
3287
|
{ stateMutability: "payable", type: "receive" }
|
|
3290
|
-
],
|
|
3288
|
+
], on = [
|
|
3291
3289
|
{
|
|
3292
3290
|
inputs: [
|
|
3293
3291
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3414,7 +3412,7 @@ const Xt = [
|
|
|
3414
3412
|
type: "function"
|
|
3415
3413
|
},
|
|
3416
3414
|
{ stateMutability: "payable", type: "receive" }
|
|
3417
|
-
],
|
|
3415
|
+
], pn = [
|
|
3418
3416
|
{
|
|
3419
3417
|
inputs: [
|
|
3420
3418
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3541,27 +3539,27 @@ const Xt = [
|
|
|
3541
3539
|
type: "function"
|
|
3542
3540
|
},
|
|
3543
3541
|
{ stateMutability: "payable", type: "receive" }
|
|
3544
|
-
],
|
|
3545
|
-
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]:
|
|
3546
|
-
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]:
|
|
3547
|
-
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]:
|
|
3548
|
-
},
|
|
3549
|
-
|
|
3542
|
+
], $e = {
|
|
3543
|
+
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: Yt,
|
|
3544
|
+
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: Jt,
|
|
3545
|
+
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: Qt
|
|
3546
|
+
}, dn = {
|
|
3547
|
+
...$e,
|
|
3550
3548
|
// AVAX
|
|
3551
|
-
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]:
|
|
3552
|
-
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]:
|
|
3553
|
-
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]:
|
|
3549
|
+
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: Zt,
|
|
3550
|
+
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: Xt,
|
|
3551
|
+
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: tn,
|
|
3554
3552
|
// BSC
|
|
3555
|
-
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]:
|
|
3553
|
+
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: zt,
|
|
3556
3554
|
// ETH
|
|
3557
|
-
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]:
|
|
3558
|
-
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]:
|
|
3559
|
-
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]:
|
|
3560
|
-
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]:
|
|
3561
|
-
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]:
|
|
3562
|
-
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]:
|
|
3563
|
-
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]:
|
|
3564
|
-
},
|
|
3555
|
+
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: en,
|
|
3556
|
+
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: nn,
|
|
3557
|
+
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: an,
|
|
3558
|
+
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: sn,
|
|
3559
|
+
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: rn,
|
|
3560
|
+
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: on,
|
|
3561
|
+
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: pn
|
|
3562
|
+
}, un = ({
|
|
3565
3563
|
streamSwap: e,
|
|
3566
3564
|
contractAddress: t,
|
|
3567
3565
|
recipient: n,
|
|
@@ -3581,7 +3579,7 @@ const Xt = [
|
|
|
3581
3579
|
token: E
|
|
3582
3580
|
}
|
|
3583
3581
|
}) => {
|
|
3584
|
-
const g =
|
|
3582
|
+
const g = !!$e[t.toLowerCase()];
|
|
3585
3583
|
if (g && !y)
|
|
3586
3584
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
3587
3585
|
const O = c || d, I = e && u || O;
|
|
@@ -3600,10 +3598,10 @@ const Xt = [
|
|
|
3600
3598
|
I.replace("{recipientAddress}", n),
|
|
3601
3599
|
a(E),
|
|
3602
3600
|
s
|
|
3603
|
-
],
|
|
3604
|
-
return [...P, ...
|
|
3605
|
-
},
|
|
3606
|
-
const n =
|
|
3601
|
+
], ke = g ? [a(y), o, p] : [r, p];
|
|
3602
|
+
return [...P, ...ke];
|
|
3603
|
+
}, ln = ({ chain: e, txHash: t }) => {
|
|
3604
|
+
const n = Me[e];
|
|
3607
3605
|
switch (e) {
|
|
3608
3606
|
case i.Binance:
|
|
3609
3607
|
case i.Bitcoin:
|
|
@@ -3628,8 +3626,8 @@ const Xt = [
|
|
|
3628
3626
|
default:
|
|
3629
3627
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3630
3628
|
}
|
|
3631
|
-
},
|
|
3632
|
-
const n =
|
|
3629
|
+
}, yn = ({ chain: e, address: t }) => {
|
|
3630
|
+
const n = Me[e];
|
|
3633
3631
|
switch (e) {
|
|
3634
3632
|
case i.Arbitrum:
|
|
3635
3633
|
case i.Avalanche:
|
|
@@ -3652,29 +3650,29 @@ const Xt = [
|
|
|
3652
3650
|
default:
|
|
3653
3651
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3654
3652
|
}
|
|
3655
|
-
},
|
|
3653
|
+
}, cn = (e) => {
|
|
3656
3654
|
const t = e ? F.ThornodeStagenet : F.ThornodeMainnet;
|
|
3657
3655
|
return fe.get(`${t}/thorchain/inbound_addresses`);
|
|
3658
|
-
},
|
|
3656
|
+
}, mn = (e) => {
|
|
3659
3657
|
const t = e ? F.ThornodeStagenet : F.ThornodeMainnet;
|
|
3660
3658
|
return fe.get(`${t}/thorchain/mimir`);
|
|
3661
|
-
},
|
|
3659
|
+
}, Ie = () => Object.values(i).reduce(
|
|
3662
3660
|
(e, t) => (e[t] = null, e),
|
|
3663
3661
|
{}
|
|
3664
3662
|
);
|
|
3665
3663
|
var L, ne, q, C, W, j;
|
|
3666
|
-
class
|
|
3664
|
+
class Dn {
|
|
3667
3665
|
constructor({ stagenet: t } = {}) {
|
|
3668
|
-
T(this, "connectedChains",
|
|
3669
|
-
T(this, "connectedWallets",
|
|
3666
|
+
T(this, "connectedChains", Ie());
|
|
3667
|
+
T(this, "connectedWallets", Ie());
|
|
3670
3668
|
T(this, "stagenet", !1);
|
|
3671
3669
|
T(this, "getAddress", (t) => {
|
|
3672
3670
|
var n;
|
|
3673
3671
|
return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
|
|
3674
3672
|
});
|
|
3675
|
-
T(this, "getExplorerTxUrl", (t, n) =>
|
|
3673
|
+
T(this, "getExplorerTxUrl", (t, n) => ln({ chain: t, txHash: n }));
|
|
3676
3674
|
T(this, "getWallet", (t) => this.connectedWallets[t]);
|
|
3677
|
-
T(this, "getExplorerAddressUrl", (t, n) =>
|
|
3675
|
+
T(this, "getExplorerAddressUrl", (t, n) => yn({ chain: t, address: n }));
|
|
3678
3676
|
T(this, "getBalance", async (t, n) => {
|
|
3679
3677
|
const a = await this.getWalletByChain(t, n);
|
|
3680
3678
|
return (a == null ? void 0 : a.balance) || [];
|
|
@@ -3685,7 +3683,7 @@ class Pn {
|
|
|
3685
3683
|
if (!a.complete)
|
|
3686
3684
|
throw new m("core_swap_route_not_complete");
|
|
3687
3685
|
try {
|
|
3688
|
-
if (
|
|
3686
|
+
if (Qe.includes(r)) {
|
|
3689
3687
|
const y = this.connectedWallets[o];
|
|
3690
3688
|
if (!(y != null && y.sendTransaction))
|
|
3691
3689
|
throw new m("core_wallet_connection_not_found");
|
|
@@ -3695,12 +3693,12 @@ class Pn {
|
|
|
3695
3693
|
data: c,
|
|
3696
3694
|
from: _,
|
|
3697
3695
|
to: b.toLowerCase(),
|
|
3698
|
-
chainId: BigInt(
|
|
3696
|
+
chainId: BigInt(rt[o]),
|
|
3699
3697
|
value: w ? BigInt(w) : 0n
|
|
3700
3698
|
};
|
|
3701
3699
|
return y.sendTransaction(E, s);
|
|
3702
3700
|
}
|
|
3703
|
-
if (
|
|
3701
|
+
if (Ze.includes(r)) {
|
|
3704
3702
|
if (!a.calldata.fromAsset)
|
|
3705
3703
|
throw new m("core_swap_asset_not_recognized");
|
|
3706
3704
|
const y = await M.fromString(a.calldata.fromAsset);
|
|
@@ -3719,18 +3717,18 @@ class Pn {
|
|
|
3719
3717
|
recipient: u
|
|
3720
3718
|
});
|
|
3721
3719
|
}
|
|
3722
|
-
if (
|
|
3720
|
+
if (ze.includes(r)) {
|
|
3723
3721
|
const { calldata: y, contract: u } = a;
|
|
3724
3722
|
if (!u)
|
|
3725
3723
|
throw new m("core_swap_contract_not_found");
|
|
3726
3724
|
const c = this.connectedWallets[o], _ = this.getAddress(o);
|
|
3727
3725
|
if (!(c != null && c.sendTransaction) || !_)
|
|
3728
3726
|
throw new m("core_wallet_connection_not_found");
|
|
3729
|
-
const { getProvider: b, toChecksumAddress: w } = await import("@swapkit/toolbox-evm"), E = b(o), g =
|
|
3727
|
+
const { getProvider: b, toChecksumAddress: w } = await import("@swapkit/toolbox-evm"), E = b(o), g = dn[u.toLowerCase()];
|
|
3730
3728
|
if (!g)
|
|
3731
3729
|
throw new m("core_swap_contract_not_supported", { contractAddress: u });
|
|
3732
3730
|
const I = await (await ((d = c.createContract) == null ? void 0 : d.call(c, u, g, E))).getFunction("swapIn").populateTransaction(
|
|
3733
|
-
...
|
|
3731
|
+
...un({
|
|
3734
3732
|
streamSwap: t,
|
|
3735
3733
|
toChecksumAddress: w,
|
|
3736
3734
|
contractAddress: u,
|
|
@@ -3798,7 +3796,7 @@ class Pn {
|
|
|
3798
3796
|
case i.Ethereum:
|
|
3799
3797
|
case i.BinanceSmartChain:
|
|
3800
3798
|
case i.Avalanche: {
|
|
3801
|
-
const { getChecksumAddressFromAsset: u } = await import("@swapkit/toolbox-evm"), c = r === i.Avalanche ?
|
|
3799
|
+
const { getChecksumAddressFromAsset: u } = await import("@swapkit/toolbox-evm"), c = r === i.Avalanche ? Ye : r === i.BinanceSmartChain ? Xe : Ke;
|
|
3802
3800
|
return await d.call({
|
|
3803
3801
|
abi: c,
|
|
3804
3802
|
contractAddress: a || (await f(this, L).call(this, r)).router,
|
|
@@ -4046,7 +4044,7 @@ class Pn {
|
|
|
4046
4044
|
halted: !1,
|
|
4047
4045
|
chain: i.THORChain
|
|
4048
4046
|
};
|
|
4049
|
-
const a = (await
|
|
4047
|
+
const a = (await cn(this.stagenet)).find((s) => s.chain === t);
|
|
4050
4048
|
if (!a)
|
|
4051
4049
|
throw new m("core_inbound_data_not_found");
|
|
4052
4050
|
if (a != null && a.halted)
|
|
@@ -4087,7 +4085,7 @@ class Pn {
|
|
|
4087
4085
|
gas_rate: s,
|
|
4088
4086
|
router: r,
|
|
4089
4087
|
address: o
|
|
4090
|
-
} = await f(this, L).call(this, t.chain), p = (parseInt(s) || 0) *
|
|
4088
|
+
} = await f(this, L).call(this, t.chain), p = (parseInt(s) || 0) * ft[a];
|
|
4091
4089
|
return this.deposit({
|
|
4092
4090
|
assetValue: t,
|
|
4093
4091
|
recipient: o,
|
|
@@ -4097,7 +4095,7 @@ class Pn {
|
|
|
4097
4095
|
});
|
|
4098
4096
|
});
|
|
4099
4097
|
B(this, W, async ({ memo: t, assetValue: n }) => {
|
|
4100
|
-
const a = await
|
|
4098
|
+
const a = await mn(this.stagenet);
|
|
4101
4099
|
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
4102
4100
|
throw new m("core_chain_halted");
|
|
4103
4101
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
@@ -4113,64 +4111,64 @@ class Pn {
|
|
|
4113
4111
|
}
|
|
4114
4112
|
L = new WeakMap(), ne = new WeakMap(), q = new WeakMap(), C = new WeakMap(), W = new WeakMap(), j = new WeakMap();
|
|
4115
4113
|
export {
|
|
4116
|
-
|
|
4117
|
-
|
|
4114
|
+
Qe as AGG_SWAP,
|
|
4115
|
+
ve as ApiError,
|
|
4118
4116
|
F as ApiUrl,
|
|
4119
4117
|
M as AssetValue,
|
|
4120
4118
|
A as BaseDecimal,
|
|
4121
4119
|
ye as BigIntArithmetics,
|
|
4122
4120
|
i as Chain,
|
|
4123
4121
|
Te as ChainId,
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4122
|
+
En as ChainIdToChain,
|
|
4123
|
+
rt as ChainToChainId,
|
|
4124
|
+
Me as ChainToExplorerUrl,
|
|
4125
|
+
An as ChainToHexChainId,
|
|
4126
|
+
ot as ChainToRPC,
|
|
4127
|
+
nt as ContractAddress,
|
|
4128
|
+
bn as CosmosChainList,
|
|
4129
|
+
at as DerivationPath,
|
|
4132
4130
|
l as ERROR_CODE,
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4131
|
+
et as ERROR_MODULE,
|
|
4132
|
+
Se as ERROR_TYPE,
|
|
4133
|
+
st as EVMChainList,
|
|
4134
|
+
pt as ErrorCode,
|
|
4137
4135
|
$ as FeeOption,
|
|
4138
4136
|
h as MemoType,
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4137
|
+
_n as NetworkDerivationPath,
|
|
4138
|
+
Je as QuoteMode,
|
|
4139
|
+
Ce as RPCUrl,
|
|
4142
4140
|
fe as RequestClient,
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4141
|
+
ze as SWAP_IN,
|
|
4142
|
+
Ze as SWAP_OUT,
|
|
4143
|
+
Dn as SwapKitCore,
|
|
4146
4144
|
m as SwapKitError,
|
|
4147
4145
|
D as SwapKitNumber,
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4146
|
+
Ye as TCAvalancheDepositABI,
|
|
4147
|
+
Xe as TCBscDepositABI,
|
|
4148
|
+
Ke as TCEthereumVaultAbi,
|
|
4149
|
+
wn as TCSupportedChainList,
|
|
4150
|
+
fn as UTXOChainList,
|
|
4151
|
+
dt as WalletOption,
|
|
4152
|
+
Rn as assetFromString,
|
|
4153
|
+
xn as derivationPathToString,
|
|
4154
|
+
hn as erc20ABI,
|
|
4155
|
+
gn as filterAssets,
|
|
4158
4156
|
se as formatBigIntToSafeValue,
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4157
|
+
ft as gasFeeMultiplier,
|
|
4158
|
+
wt as getAssetType,
|
|
4159
|
+
gt as getAsymmetricAssetShare,
|
|
4160
|
+
In as getAsymmetricAssetWithdrawAmount,
|
|
4161
|
+
Rt as getAsymmetricRuneShare,
|
|
4162
|
+
On as getAsymmetricRuneWithdrawAmount,
|
|
4163
|
+
bt as getCommonAssetInfo,
|
|
4164
|
+
_t as getDecimal,
|
|
4165
|
+
vn as getEstimatedPoolShare,
|
|
4166
|
+
Cn as getLiquiditySlippage,
|
|
4169
4167
|
N as getMemoFor,
|
|
4170
4168
|
oe as getMinAmountByChain,
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4169
|
+
Ot as getSymmetricPoolShare,
|
|
4170
|
+
Sn as getSymmetricWithdraw,
|
|
4171
|
+
Mn as getTHORNameCost,
|
|
4172
|
+
xe as isGasAsset,
|
|
4173
|
+
Nn as validateTHORName
|
|
4176
4174
|
};
|