@swapkit/core 1.0.0-rc.43 → 1.0.0-rc.45
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 +452 -433
- package/package.json +14 -14
package/dist/index.es.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var T = (e, t, n) => (
|
|
1
|
+
var qe = Object.defineProperty;
|
|
2
|
+
var We = (e, t, n) => t in e ? qe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var T = (e, t, n) => (We(e, typeof t != "symbol" ? t + "" : t, n), n), je = (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) => (je(e, t, "read from private field"), n ? n.call(e) : t.get(e)), P = (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 Ke = Object.defineProperty, Ye = (e, t, n) => t in e ? Ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (Ye(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
13
|
+
const fn = [
|
|
14
14
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
15
15
|
{
|
|
16
16
|
anonymous: !1,
|
|
@@ -108,7 +108,7 @@ const hn = [
|
|
|
108
108
|
stateMutability: "nonpayable",
|
|
109
109
|
type: "function"
|
|
110
110
|
}
|
|
111
|
-
],
|
|
111
|
+
], Xe = [
|
|
112
112
|
{
|
|
113
113
|
inputs: [{ internalType: "address", name: "rune", type: "address" }],
|
|
114
114
|
stateMutability: "nonpayable",
|
|
@@ -283,7 +283,7 @@ const hn = [
|
|
|
283
283
|
stateMutability: "view",
|
|
284
284
|
type: "function"
|
|
285
285
|
}
|
|
286
|
-
],
|
|
286
|
+
], Je = [
|
|
287
287
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
288
288
|
{
|
|
289
289
|
anonymous: !1,
|
|
@@ -447,7 +447,7 @@ const hn = [
|
|
|
447
447
|
stateMutability: "view",
|
|
448
448
|
type: "function"
|
|
449
449
|
}
|
|
450
|
-
],
|
|
450
|
+
], Qe = [
|
|
451
451
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
452
452
|
{
|
|
453
453
|
anonymous: !1,
|
|
@@ -600,13 +600,13 @@ const hn = [
|
|
|
600
600
|
type: "function"
|
|
601
601
|
}
|
|
602
602
|
];
|
|
603
|
-
var
|
|
604
|
-
const
|
|
603
|
+
var ze = /* @__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))(ze || {});
|
|
604
|
+
const Ze = [
|
|
605
605
|
"ERC20-ERC20",
|
|
606
606
|
"ARC20-ARC20",
|
|
607
607
|
"BEP20-BEP20"
|
|
608
608
|
/* BSC_TO_BSC */
|
|
609
|
-
],
|
|
609
|
+
], et = [
|
|
610
610
|
"ERC20-TC",
|
|
611
611
|
"ERC20-ARC20",
|
|
612
612
|
"ERC20-BEP20",
|
|
@@ -617,15 +617,15 @@ const Qe = [
|
|
|
617
617
|
"BEP20-ERC20",
|
|
618
618
|
"BEP20-ARC20"
|
|
619
619
|
/* BSC_TO_AVAX */
|
|
620
|
-
],
|
|
620
|
+
], tt = [
|
|
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 ve = /* @__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))(ve || {}), nt = /* @__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))(nt || {}), y = /* @__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))(y || {});
|
|
628
|
+
const at = {
|
|
629
629
|
[y.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
|
|
630
630
|
[y.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
|
|
631
631
|
[y.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
|
|
@@ -676,13 +676,13 @@ const tt = {
|
|
|
676
676
|
[y.PRICE_IS_STALE]: "Price is stale for asset {0}.",
|
|
677
677
|
[y.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
|
|
678
678
|
[y.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
|
|
679
|
-
},
|
|
680
|
-
let n =
|
|
679
|
+
}, re = (e, t) => {
|
|
680
|
+
let n = at[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
|
+
let bn = class Ce extends Error {
|
|
686
686
|
constructor({
|
|
687
687
|
status: t,
|
|
688
688
|
revision: n,
|
|
@@ -697,15 +697,15 @@ class Se extends Error {
|
|
|
697
697
|
},
|
|
698
698
|
displayMessageParams: u
|
|
699
699
|
}) {
|
|
700
|
-
const c = r ||
|
|
701
|
-
super(c),
|
|
700
|
+
const c = r || re(s, u || []) || "";
|
|
701
|
+
super(c), C(this, "status"), C(this, "revision"), C(this, "type"), C(this, "module"), C(this, "code"), C(this, "message"), C(this, "display"), C(this, "stack"), C(this, "options"), C(this, "displayMessageParams"), this.status = t, this.revision = n || "NO_REVISION", this.module = a, this.message = c, this.display = re(s, u || []), this.code = s, this.type = o || ve.UNHANDLED_ERROR, this.options = {
|
|
702
702
|
shouldLog: p || !0,
|
|
703
703
|
shouldTrace: l || !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 Ce(t);
|
|
709
709
|
}
|
|
710
710
|
toErrorInfo() {
|
|
711
711
|
return { ...this, identifier: this.identifier };
|
|
@@ -714,7 +714,7 @@ class Se extends Error {
|
|
|
714
714
|
return `${this.revision}-${this.type || "NO_TYPE"}-${this.module}-${this.code}`;
|
|
715
715
|
}
|
|
716
716
|
get displayMessage() {
|
|
717
|
-
return
|
|
717
|
+
return re(this.code, this.displayMessageParams || []);
|
|
718
718
|
}
|
|
719
719
|
handle() {
|
|
720
720
|
const t = `[${this.identifier}]: ${this.message}`;
|
|
@@ -723,9 +723,9 @@ class Se extends Error {
|
|
|
723
723
|
throw Error(t, { cause: this.stack });
|
|
724
724
|
return this.toErrorInfo();
|
|
725
725
|
}
|
|
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
|
|
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 || {}), st = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(st || {}), it = /* @__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))(it || {});
|
|
728
|
+
const wn = {
|
|
729
729
|
ARB: [44, 60, 0, 0, 0],
|
|
730
730
|
AVAX: [44, 60, 0, 0, 0],
|
|
731
731
|
BCH: [44, 145, 0, 0, 0],
|
|
@@ -743,7 +743,7 @@ const _n = {
|
|
|
743
743
|
THOR: [44, 931, 0, 0, 0]
|
|
744
744
|
};
|
|
745
745
|
var w = /* @__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))(w || {});
|
|
746
|
-
const
|
|
746
|
+
const rt = [
|
|
747
747
|
"ETH",
|
|
748
748
|
"AVAX",
|
|
749
749
|
"BSC",
|
|
@@ -751,18 +751,18 @@ const st = [
|
|
|
751
751
|
"OP",
|
|
752
752
|
"MATIC"
|
|
753
753
|
/* Polygon */
|
|
754
|
-
],
|
|
754
|
+
], An = [
|
|
755
755
|
"BTC",
|
|
756
756
|
"BCH",
|
|
757
757
|
"DOGE",
|
|
758
758
|
"LTC"
|
|
759
759
|
/* Litecoin */
|
|
760
|
-
],
|
|
760
|
+
], En = [
|
|
761
761
|
"GAIA",
|
|
762
762
|
"THOR",
|
|
763
763
|
"BNB"
|
|
764
764
|
/* Binance */
|
|
765
|
-
],
|
|
765
|
+
], Rn = [
|
|
766
766
|
"AVAX",
|
|
767
767
|
"BNB",
|
|
768
768
|
"BSC",
|
|
@@ -775,26 +775,26 @@ const st = [
|
|
|
775
775
|
"THOR"
|
|
776
776
|
/* THORChain */
|
|
777
777
|
];
|
|
778
|
-
var
|
|
779
|
-
const
|
|
778
|
+
var _e = /* @__PURE__ */ ((e) => (e.Arbitrum = "42161", e.ArbitrumHex = "0xa4b1", e.Avalanche = "43114", e.AvalancheHex = "0xa86a", e.Binance = "Binance-Chain-Tigris", e.BinanceSmartChain = "56", e.BinanceSmartChainHex = "0x38", e.Bitcoin = "bitcoin", e.BitcoinCash = "bitcoincash", e.Cosmos = "cosmoshub-4", e.Dogecoin = "dogecoin", e.Kujira = "kaiyo-1", e.Ethereum = "1", e.EthereumHex = "0x1", e.Litecoin = "litecoin", e.Maya = "mayachain-mainnet-v1", e.MayaStagenet = "mayachain-stagenet-v1", e.Optimism = "10", e.OptimismHex = "0xa", e.Polygon = "137", e.PolygonHex = "0x89", e.THORChain = "thorchain-mainnet-v1", e.THORChainStagenet = "thorchain-stagenet-v2", e))(_e || {}), Me = /* @__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))(Me || {}), q = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.finance", e.ThorswapStatic = "https://static.thorswap.net", e))(q || {});
|
|
779
|
+
const ae = Object.values(i), ot = Object.keys(i), fe = ae.reduce(
|
|
780
780
|
(e, t) => {
|
|
781
|
-
const n =
|
|
781
|
+
const n = ot.find((a) => i[a] === t);
|
|
782
782
|
return n && (e[t] = n), e;
|
|
783
783
|
},
|
|
784
784
|
{}
|
|
785
|
-
),
|
|
786
|
-
(e, t) => (e[t] =
|
|
785
|
+
), pt = ae.reduce(
|
|
786
|
+
(e, t) => (e[t] = _e[fe[t]], e),
|
|
787
787
|
{}
|
|
788
|
-
),
|
|
789
|
-
(e, t) => (e[t] =
|
|
788
|
+
), dt = ae.reduce(
|
|
789
|
+
(e, t) => (e[t] = Me[fe[t]], e),
|
|
790
790
|
{}
|
|
791
|
-
),
|
|
791
|
+
), gn = ae.reduce(
|
|
792
792
|
(e, t) => {
|
|
793
|
-
const n = `${
|
|
794
|
-
return e[t] =
|
|
793
|
+
const n = `${fe[t]}Hex`;
|
|
794
|
+
return e[t] = _e[n], e;
|
|
795
795
|
},
|
|
796
796
|
{}
|
|
797
|
-
),
|
|
797
|
+
), On = {
|
|
798
798
|
"0xa4b1": "ARB",
|
|
799
799
|
42161: "ARB",
|
|
800
800
|
"0xa86a": "AVAX",
|
|
@@ -819,7 +819,7 @@ const ee = Object.values(i), it = Object.keys(i), Te = ee.reduce(
|
|
|
819
819
|
"thorchain-stagenet-v2": "THOR",
|
|
820
820
|
"thorchain-mainnet-v1": "THOR"
|
|
821
821
|
/* THORChain */
|
|
822
|
-
},
|
|
822
|
+
}, Ne = {
|
|
823
823
|
ARB: "https://arbiscan.io",
|
|
824
824
|
AVAX: "https://snowtrace.io",
|
|
825
825
|
BSC: "https://bscscan.com",
|
|
@@ -836,17 +836,17 @@ const ee = Object.values(i), it = Object.keys(i), Te = ee.reduce(
|
|
|
836
836
|
MATIC: "https://polygonscan.com",
|
|
837
837
|
THOR: "https://viewblock.io/thorchain"
|
|
838
838
|
};
|
|
839
|
-
var
|
|
839
|
+
var ut = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(ut || {}), h = /* @__PURE__ */ ((e) => (e.BOND = "BOND", e.DEPOSIT = "+", e.LEAVE = "LEAVE", e.THORNAME_REGISTER = "~", e.UNBOND = "UNBOND", e.WITHDRAW = "-", e.OPEN_LOAN = "$+", e.CLOSE_LOAN = "$-", e))(h || {}), F = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(F || {}), lt = /* @__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))(lt || {}), yt = Object.defineProperty, ct = (e, t, n) => t in e ? yt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, S = (e, t, n) => (ct(e, typeof t != "symbol" ? t + "" : t, n), n), mt = (e, t, n) => {
|
|
840
840
|
if (!t.has(e))
|
|
841
841
|
throw TypeError("Cannot " + n);
|
|
842
|
-
},
|
|
842
|
+
}, $ = (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
|
-
},
|
|
847
|
-
const
|
|
846
|
+
}, R = (e, t, n) => (mt(e, t, "access private method"), n);
|
|
847
|
+
const Tt = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
848
848
|
try {
|
|
849
|
-
const { result: n } = await
|
|
849
|
+
const { result: n } = await we.post(dt[e], {
|
|
850
850
|
headers: {
|
|
851
851
|
accept: "*/*",
|
|
852
852
|
"content-type": "application/json",
|
|
@@ -856,37 +856,37 @@ const ct = "0x313ce567", Me = 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: Tt }, "latest"]
|
|
860
860
|
})
|
|
861
861
|
});
|
|
862
862
|
return parseInt(BigInt(n).toString());
|
|
863
863
|
} catch (n) {
|
|
864
864
|
return console.error(n), w[e];
|
|
865
865
|
}
|
|
866
|
-
},
|
|
866
|
+
}, ht = async (e) => {
|
|
867
867
|
if (e === i.Ethereum)
|
|
868
868
|
return w.ETH;
|
|
869
869
|
const [, t] = e.split("-");
|
|
870
|
-
return t != null && t.startsWith("0x") ?
|
|
871
|
-
},
|
|
870
|
+
return t != null && t.startsWith("0x") ? xe({ chain: i.Ethereum, to: t }) : w.ETH;
|
|
871
|
+
}, _t = async (e) => {
|
|
872
872
|
const [, t] = e.split("-");
|
|
873
|
-
return t != null && t.startsWith("0x") ?
|
|
874
|
-
},
|
|
873
|
+
return t != null && t.startsWith("0x") ? xe({ chain: i.Avalanche, to: t.toLowerCase() }) : w.AVAX;
|
|
874
|
+
}, ft = async (e) => (e === i.BinanceSmartChain, w.BSC), bt = async ({ chain: e, symbol: t }) => {
|
|
875
875
|
switch (e) {
|
|
876
876
|
case i.Ethereum:
|
|
877
|
-
return
|
|
877
|
+
return ht(t);
|
|
878
878
|
case i.Avalanche:
|
|
879
|
-
return
|
|
879
|
+
return _t(t);
|
|
880
880
|
case i.BinanceSmartChain:
|
|
881
|
-
return
|
|
881
|
+
return ft(t);
|
|
882
882
|
default:
|
|
883
883
|
return w[e];
|
|
884
884
|
}
|
|
885
|
-
},
|
|
886
|
-
[
|
|
887
|
-
[
|
|
888
|
-
[
|
|
889
|
-
},
|
|
885
|
+
}, wt = {
|
|
886
|
+
[F.Average]: 1.2,
|
|
887
|
+
[F.Fast]: 1.5,
|
|
888
|
+
[F.Fastest]: 2
|
|
889
|
+
}, De = ({ chain: e, symbol: t }) => {
|
|
890
890
|
switch (e) {
|
|
891
891
|
case i.Bitcoin:
|
|
892
892
|
case i.BitcoinCash:
|
|
@@ -912,7 +912,7 @@ const ct = "0x313ce567", Me = async ({ chain: e, to: t }) => {
|
|
|
912
912
|
case i.THORChain:
|
|
913
913
|
return t === "RUNE";
|
|
914
914
|
}
|
|
915
|
-
},
|
|
915
|
+
}, At = (e) => {
|
|
916
916
|
switch (e) {
|
|
917
917
|
case "ETH.THOR":
|
|
918
918
|
return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
|
|
@@ -941,7 +941,7 @@ const ct = "0x313ce567", Me = async ({ chain: e, to: t }) => {
|
|
|
941
941
|
case i.Ethereum:
|
|
942
942
|
return { identifier: `${e}.${e}`, decimal: w[e] };
|
|
943
943
|
}
|
|
944
|
-
},
|
|
944
|
+
}, Et = ({ chain: e, symbol: t }) => {
|
|
945
945
|
if (t.includes("/"))
|
|
946
946
|
return "Synth";
|
|
947
947
|
switch (e) {
|
|
@@ -971,65 +971,65 @@ const ct = "0x313ce567", Me = 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
|
+
}, In = (e) => {
|
|
975
975
|
var t;
|
|
976
976
|
const [n, ...a] = e.split("."), s = e.includes("/"), r = a.join("."), o = (t = r == null ? void 0 : r.split("-")) == null ? void 0 : t[0];
|
|
977
977
|
return { chain: n, symbol: r, ticker: o, synth: s };
|
|
978
|
-
},
|
|
978
|
+
}, Rt = new RegExp(
|
|
979
979
|
/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
|
|
980
980
|
"gmi"
|
|
981
|
-
),
|
|
981
|
+
), gt = (e) => {
|
|
982
982
|
const [t, n] = e.split(".");
|
|
983
|
-
if (!
|
|
983
|
+
if (!rt.includes(t))
|
|
984
984
|
return !0;
|
|
985
985
|
const [, a] = n.split("-");
|
|
986
|
-
return
|
|
987
|
-
},
|
|
986
|
+
return De({ chain: t, symbol: n }) || !!a;
|
|
987
|
+
}, Sn = (e) => e.filter((t) => {
|
|
988
988
|
const n = `${t.chain}.${t.symbol}`;
|
|
989
|
-
return !
|
|
990
|
-
}),
|
|
989
|
+
return !Rt.test(n) && gt(n) && t.value !== "0";
|
|
990
|
+
}), Ot = ({
|
|
991
991
|
liquidityUnits: e,
|
|
992
992
|
poolUnits: t,
|
|
993
993
|
runeDepth: n
|
|
994
994
|
}) => {
|
|
995
|
-
const a =
|
|
995
|
+
const a = g(e), s = g(t), r = g(n), o = a.mul(r), p = s.mul(s).mul(2), d = s.mul(a).mul(2), l = a.mul(a), u = s.mul(s).mul(s);
|
|
996
996
|
return o.mul(p.sub(d).add(l)).div(u);
|
|
997
|
-
},
|
|
997
|
+
}, It = ({
|
|
998
998
|
liquidityUnits: e,
|
|
999
999
|
poolUnits: t,
|
|
1000
1000
|
assetDepth: n
|
|
1001
1001
|
}) => {
|
|
1002
|
-
const a =
|
|
1002
|
+
const a = g(e), s = g(t), r = g(n), o = a.mul(r), p = s.mul(s).mul(2), d = s.mul(a).mul(2), l = a.mul(a), u = o.mul(p.sub(d).add(l)), c = s.mul(s).mul(s);
|
|
1003
1003
|
return u.div(c);
|
|
1004
|
-
},
|
|
1004
|
+
}, vn = ({
|
|
1005
1005
|
percent: e,
|
|
1006
1006
|
runeDepth: t,
|
|
1007
1007
|
liquidityUnits: n,
|
|
1008
1008
|
poolUnits: a
|
|
1009
|
-
}) =>
|
|
1009
|
+
}) => Ot({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), Cn = ({
|
|
1010
1010
|
percent: e,
|
|
1011
1011
|
assetDepth: t,
|
|
1012
1012
|
liquidityUnits: n,
|
|
1013
1013
|
poolUnits: a
|
|
1014
|
-
}) =>
|
|
1014
|
+
}) => It({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), g = (e) => x.fromBigInt(BigInt(e), w.THOR), St = ({
|
|
1015
1015
|
liquidityUnits: e,
|
|
1016
1016
|
poolUnits: t,
|
|
1017
1017
|
runeDepth: n,
|
|
1018
1018
|
assetDepth: a
|
|
1019
1019
|
}) => ({
|
|
1020
|
-
assetAmount:
|
|
1021
|
-
runeAmount:
|
|
1022
|
-
}),
|
|
1020
|
+
assetAmount: g(a).mul(e).div(t),
|
|
1021
|
+
runeAmount: g(n).mul(e).div(t)
|
|
1022
|
+
}), Mn = ({
|
|
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(St({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
|
|
1030
1030
|
([r, o]) => [r, o.mul(s)]
|
|
1031
1031
|
)
|
|
1032
|
-
),
|
|
1032
|
+
), Nn = ({
|
|
1033
1033
|
runeDepth: e,
|
|
1034
1034
|
poolUnits: t,
|
|
1035
1035
|
assetDepth: n,
|
|
@@ -1037,12 +1037,12 @@ const ct = "0x313ce567", Me = async ({ chain: e, to: t }) => {
|
|
|
1037
1037
|
runeAmount: s,
|
|
1038
1038
|
assetAmount: r
|
|
1039
1039
|
}) => {
|
|
1040
|
-
const o = new
|
|
1041
|
-
if (
|
|
1042
|
-
return
|
|
1043
|
-
const
|
|
1044
|
-
return
|
|
1045
|
-
},
|
|
1040
|
+
const o = new x({ value: e, decimal: 8 }), p = new x({ value: n, decimal: 8 }), d = new x({ value: t, decimal: 8 }), l = new x({ value: s, decimal: 8 }), u = new x({ value: r, decimal: 8 }), c = l.mul(p), _ = u.mul(o), b = l.mul(u), A = o.mul(p), E = d.mul(c.add(_.add(b.mul(2)))), O = c.add(_.add(A.mul(2))), I = E.div(O), D = g(a).add(I);
|
|
1041
|
+
if (I.getBaseValue("number") === 0)
|
|
1042
|
+
return D.div(d).getBaseValue("number");
|
|
1043
|
+
const ie = d.add(D);
|
|
1044
|
+
return D.div(ie).getBaseValue("number");
|
|
1045
|
+
}, xn = ({
|
|
1046
1046
|
runeAmount: e,
|
|
1047
1047
|
assetAmount: t,
|
|
1048
1048
|
runeDepth: n,
|
|
@@ -1050,13 +1050,13 @@ const ct = "0x313ce567", Me = async ({ chain: e, to: t }) => {
|
|
|
1050
1050
|
}) => {
|
|
1051
1051
|
if (e === "0" || t === "0" || n === "0" || a === "0")
|
|
1052
1052
|
return 0;
|
|
1053
|
-
const s =
|
|
1053
|
+
const s = g(n), r = g(a), o = g(t), p = g(e), d = o.mul(s).sub(r.mul(p)), l = r.mul(p).add(s.mul(r));
|
|
1054
1054
|
return Math.abs(d.div(l).getBaseValue("number"));
|
|
1055
|
-
},
|
|
1055
|
+
}, vt = ({
|
|
1056
1056
|
symbol: e,
|
|
1057
1057
|
ticker: t,
|
|
1058
1058
|
chain: n
|
|
1059
|
-
}) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e,
|
|
1059
|
+
}) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e, N = (e, t) => {
|
|
1060
1060
|
switch (e) {
|
|
1061
1061
|
case h.LEAVE:
|
|
1062
1062
|
case h.BOND: {
|
|
@@ -1076,7 +1076,7 @@ const ct = "0x313ce567", Me = 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}` : "", l =
|
|
1079
|
+
const { chain: n, ticker: a, symbol: s, basisPoints: r, targetAssetString: o, singleSide: p } = t, d = !p && o ? `:${o}` : "", l = vt({ chain: n, symbol: s, ticker: a });
|
|
1080
1080
|
return `${e}:${n}${p ? "/" : "."}${l}:${r}${d}`;
|
|
1081
1081
|
}
|
|
1082
1082
|
case h.OPEN_LOAN:
|
|
@@ -1087,17 +1087,17 @@ const ct = "0x313ce567", Me = async ({ chain: e, to: t }) => {
|
|
|
1087
1087
|
default:
|
|
1088
1088
|
return "";
|
|
1089
1089
|
}
|
|
1090
|
-
},
|
|
1090
|
+
}, Dn = (e) => {
|
|
1091
1091
|
if (e < 0)
|
|
1092
1092
|
throw new Error("Invalid number of year");
|
|
1093
1093
|
return 10 + e;
|
|
1094
|
-
},
|
|
1094
|
+
}, Pn = (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
|
-
},
|
|
1100
|
-
class
|
|
1099
|
+
}, Bn = ([e, t, n, a, s]) => `${e}'/${t}'/${n}'/${a}${typeof s != "number" ? "" : `/${s}`}`;
|
|
1100
|
+
class Ae 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";
|
|
1103
1103
|
super(`Request failed with ${p}`), Object.defineProperty(this, "response", {
|
|
@@ -1118,7 +1118,7 @@ class fe extends Error {
|
|
|
1118
1118
|
}), this.name = "HTTPError", this.response = t, this.request = n, this.options = a;
|
|
1119
1119
|
}
|
|
1120
1120
|
}
|
|
1121
|
-
class
|
|
1121
|
+
class Pe extends Error {
|
|
1122
1122
|
constructor(t) {
|
|
1123
1123
|
super("Request timed out"), Object.defineProperty(this, "request", {
|
|
1124
1124
|
enumerable: !0,
|
|
@@ -1128,28 +1128,28 @@ class xe extends Error {
|
|
|
1128
1128
|
}), this.name = "TimeoutError", this.request = t;
|
|
1129
1129
|
}
|
|
1130
1130
|
}
|
|
1131
|
-
const
|
|
1131
|
+
const J = (e) => e !== null && typeof e == "object", X = (...e) => {
|
|
1132
1132
|
for (const t of e)
|
|
1133
|
-
if ((!
|
|
1133
|
+
if ((!J(t) || Array.isArray(t)) && t !== void 0)
|
|
1134
1134
|
throw new TypeError("The `options` argument must be an object");
|
|
1135
|
-
return
|
|
1136
|
-
},
|
|
1135
|
+
return be({}, ...e);
|
|
1136
|
+
}, Be = (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);
|
|
1140
1140
|
return n;
|
|
1141
|
-
},
|
|
1141
|
+
}, be = (...e) => {
|
|
1142
1142
|
let t = {}, n = {};
|
|
1143
1143
|
for (const a of e)
|
|
1144
1144
|
if (Array.isArray(a))
|
|
1145
1145
|
Array.isArray(t) || (t = []), t = [...t, ...a];
|
|
1146
|
-
else if (
|
|
1146
|
+
else if (J(a)) {
|
|
1147
1147
|
for (let [s, r] of Object.entries(a))
|
|
1148
|
-
|
|
1149
|
-
|
|
1148
|
+
J(r) && s in t && (r = be(t[s], r)), t = { ...t, [s]: r };
|
|
1149
|
+
J(a.headers) && (n = Be(n, a.headers), t.headers = n);
|
|
1150
1150
|
}
|
|
1151
1151
|
return t;
|
|
1152
|
-
},
|
|
1152
|
+
}, Ct = (() => {
|
|
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 K = (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
|
+
})(), Mt = typeof globalThis.AbortController == "function", Nt = typeof globalThis.ReadableStream == "function", xt = typeof globalThis.FormData == "function", Le = ["get", "post", "put", "patch", "head", "delete"], Dt = {
|
|
1164
1164
|
json: "application/json",
|
|
1165
1165
|
text: "text/*",
|
|
1166
1166
|
formData: "multipart/form-data",
|
|
1167
1167
|
arrayBuffer: "*/*",
|
|
1168
1168
|
blob: "*/*"
|
|
1169
|
-
},
|
|
1169
|
+
}, oe = 2147483647, Ve = Symbol("stop"), Pt = {
|
|
1170
1170
|
json: !0,
|
|
1171
1171
|
parseJson: !0,
|
|
1172
1172
|
searchParams: !0,
|
|
@@ -1177,7 +1177,7 @@ const K = (e) => e !== null && typeof e == "object", Y = (...e) => {
|
|
|
1177
1177
|
throwHttpErrors: !0,
|
|
1178
1178
|
onDownloadProgress: !0,
|
|
1179
1179
|
fetch: !0
|
|
1180
|
-
},
|
|
1180
|
+
}, Bt = {
|
|
1181
1181
|
method: !0,
|
|
1182
1182
|
headers: !0,
|
|
1183
1183
|
body: !0,
|
|
@@ -1193,18 +1193,18 @@ const K = (e) => e !== null && typeof e == "object", Y = (...e) => {
|
|
|
1193
1193
|
window: !0,
|
|
1194
1194
|
dispatcher: !0,
|
|
1195
1195
|
duplex: !0
|
|
1196
|
-
},
|
|
1196
|
+
}, Lt = (e) => Le.includes(e) ? e.toUpperCase() : e, Vt = ["get", "put", "head", "delete", "options", "trace"], Ut = [408, 413, 429, 500, 502, 503, 504], Ue = [413, 429, 503], Ee = {
|
|
1197
1197
|
limit: 2,
|
|
1198
|
-
methods:
|
|
1199
|
-
statusCodes:
|
|
1200
|
-
afterStatusCodes:
|
|
1198
|
+
methods: Vt,
|
|
1199
|
+
statusCodes: Ut,
|
|
1200
|
+
afterStatusCodes: Ue,
|
|
1201
1201
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
1202
1202
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
1203
1203
|
delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
|
|
1204
|
-
},
|
|
1204
|
+
}, Ht = (e = {}) => {
|
|
1205
1205
|
if (typeof e == "number")
|
|
1206
1206
|
return {
|
|
1207
|
-
...
|
|
1207
|
+
...Ee,
|
|
1208
1208
|
limit: e
|
|
1209
1209
|
};
|
|
1210
1210
|
if (e.methods && !Array.isArray(e.methods))
|
|
@@ -1212,22 +1212,22 @@ const K = (e) => e !== null && typeof e == "object", Y = (...e) => {
|
|
|
1212
1212
|
if (e.statusCodes && !Array.isArray(e.statusCodes))
|
|
1213
1213
|
throw new Error("retry.statusCodes must be an array");
|
|
1214
1214
|
return {
|
|
1215
|
-
...
|
|
1215
|
+
...Ee,
|
|
1216
1216
|
...e,
|
|
1217
|
-
afterStatusCodes:
|
|
1217
|
+
afterStatusCodes: Ue
|
|
1218
1218
|
};
|
|
1219
1219
|
};
|
|
1220
|
-
async function
|
|
1220
|
+
async function $t(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 Pe(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 kt(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,17 +1238,17 @@ async function Ht(e, { signal: t }) {
|
|
|
1238
1238
|
}, e);
|
|
1239
1239
|
});
|
|
1240
1240
|
}
|
|
1241
|
-
const
|
|
1241
|
+
const Ft = (e, t) => {
|
|
1242
1242
|
const n = {};
|
|
1243
1243
|
for (const a in t)
|
|
1244
|
-
!(a in
|
|
1244
|
+
!(a in Bt) && !(a in Pt) && !(a in e) && (n[a] = t[a]);
|
|
1245
1245
|
return n;
|
|
1246
1246
|
};
|
|
1247
|
-
class
|
|
1247
|
+
class Z {
|
|
1248
1248
|
static create(t, n) {
|
|
1249
|
-
const a = new
|
|
1250
|
-
if (typeof a._options.timeout == "number" && a._options.timeout >
|
|
1251
|
-
throw new RangeError(`The \`timeout\` option cannot be greater than ${
|
|
1249
|
+
const a = new Z(t, n), s = async () => {
|
|
1250
|
+
if (typeof a._options.timeout == "number" && a._options.timeout > oe)
|
|
1251
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${oe}`);
|
|
1252
1252
|
await Promise.resolve();
|
|
1253
1253
|
let o = await a._fetch();
|
|
1254
1254
|
for (const p of a._options.hooks.afterResponse) {
|
|
@@ -1256,7 +1256,7 @@ class J {
|
|
|
1256
1256
|
d instanceof globalThis.Response && (o = d);
|
|
1257
1257
|
}
|
|
1258
1258
|
if (a._decorateResponse(o), !o.ok && a._options.throwHttpErrors) {
|
|
1259
|
-
let p = new
|
|
1259
|
+
let p = new Ae(o, a.request, a._options);
|
|
1260
1260
|
for (const d of a._options.hooks.beforeError)
|
|
1261
1261
|
p = await d(p);
|
|
1262
1262
|
throw p;
|
|
@@ -1264,13 +1264,13 @@ class J {
|
|
|
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 (!Nt)
|
|
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(Dt))
|
|
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 J {
|
|
|
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:
|
|
1319
|
-
hooks:
|
|
1318
|
+
headers: Be(this._input.headers, n.headers),
|
|
1319
|
+
hooks: be({
|
|
1320
1320
|
beforeRequest: [],
|
|
1321
1321
|
beforeRetry: [],
|
|
1322
1322
|
beforeError: [],
|
|
1323
1323
|
afterResponse: []
|
|
1324
1324
|
}, n.hooks),
|
|
1325
|
-
method:
|
|
1325
|
+
method: Lt(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: Ht(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 J {
|
|
|
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 (Mt) {
|
|
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,15 +1345,15 @@ class J {
|
|
|
1345
1345
|
}
|
|
1346
1346
|
this._options.signal = this.abortController.signal;
|
|
1347
1347
|
}
|
|
1348
|
-
if (
|
|
1348
|
+
if (Ct && (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
|
+
(xt && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"]) && this.request.headers.delete("content-type"), this.request = new globalThis.Request(new globalThis.Request(s, { ...this.request }), this._options);
|
|
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
|
|
1356
|
-
if (t instanceof
|
|
1355
|
+
if (this._retryCount++, this._retryCount < this._options.retry.limit && !(t instanceof Pe)) {
|
|
1356
|
+
if (t instanceof Ae) {
|
|
1357
1357
|
if (!this._options.retry.statusCodes.includes(t.response.status))
|
|
1358
1358
|
return 0;
|
|
1359
1359
|
const a = t.response.headers.get("Retry-After");
|
|
@@ -1376,16 +1376,16 @@ class J {
|
|
|
1376
1376
|
try {
|
|
1377
1377
|
return await t();
|
|
1378
1378
|
} catch (n) {
|
|
1379
|
-
const a = Math.min(this._calculateRetryDelay(n),
|
|
1379
|
+
const a = Math.min(this._calculateRetryDelay(n), oe);
|
|
1380
1380
|
if (a !== 0 && this._retryCount > 0) {
|
|
1381
|
-
await
|
|
1381
|
+
await kt(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
|
+
}) === Ve)
|
|
1389
1389
|
return;
|
|
1390
1390
|
return this._retry(t);
|
|
1391
1391
|
}
|
|
@@ -1402,8 +1402,8 @@ class J {
|
|
|
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 = Ft(this.request, this._options);
|
|
1406
|
+
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : $t(this.request.clone(), t, this.abortController, this._options);
|
|
1407
1407
|
}
|
|
1408
1408
|
/* istanbul ignore next */
|
|
1409
1409
|
_stream(t, n) {
|
|
@@ -1440,29 +1440,29 @@ class J {
|
|
|
1440
1440
|
}
|
|
1441
1441
|
}
|
|
1442
1442
|
/*! MIT License © Sindre Sorhus */
|
|
1443
|
-
const
|
|
1444
|
-
const t = (n, a) =>
|
|
1445
|
-
for (const n of
|
|
1446
|
-
t[n] = (a, s) =>
|
|
1447
|
-
return t.create = (n) =>
|
|
1448
|
-
},
|
|
1449
|
-
get: (e, t) =>
|
|
1450
|
-
post: (e, t) =>
|
|
1451
|
-
},
|
|
1443
|
+
const ue = (e) => {
|
|
1444
|
+
const t = (n, a) => Z.create(n, X(e, a));
|
|
1445
|
+
for (const n of Le)
|
|
1446
|
+
t[n] = (a, s) => Z.create(a, X(e, s, { method: n }));
|
|
1447
|
+
return t.create = (n) => ue(X(n)), t.extend = (n) => ue(X(e, n)), t.stop = Ve, t;
|
|
1448
|
+
}, Gt = ue(), qt = Gt, Wt = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, Re = qt.create({ headers: Wt }), we = {
|
|
1449
|
+
get: (e, t) => Re.get(e, t).json(),
|
|
1450
|
+
post: (e, t) => Re.post(e, t).json()
|
|
1451
|
+
}, ge = Object.values(i), jt = (e = "") => {
|
|
1452
1452
|
const t = e.toUpperCase(), [n] = t.split(".");
|
|
1453
|
-
if (
|
|
1453
|
+
if (ge.includes(n))
|
|
1454
1454
|
return !0;
|
|
1455
1455
|
const [a] = t.split("/");
|
|
1456
|
-
if (
|
|
1456
|
+
if (ge.includes(a))
|
|
1457
1457
|
return !0;
|
|
1458
1458
|
throw new Error(
|
|
1459
1459
|
`Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
|
|
1460
1460
|
);
|
|
1461
|
-
},
|
|
1462
|
-
function
|
|
1461
|
+
}, W = 8, L = (e) => 10n ** BigInt(e), G = (e) => Math.log10(parseFloat(e.toString()));
|
|
1462
|
+
function se({
|
|
1463
1463
|
value: e,
|
|
1464
|
-
bigIntDecimal: t =
|
|
1465
|
-
decimal: n =
|
|
1464
|
+
bigIntDecimal: t = W,
|
|
1465
|
+
decimal: n = W
|
|
1466
1466
|
}) {
|
|
1467
1467
|
const a = e < 0n;
|
|
1468
1468
|
let s = e.toString().substring(a ? 1 : 0);
|
|
@@ -1475,19 +1475,17 @@ function te({
|
|
|
1475
1475
|
""
|
|
1476
1476
|
);
|
|
1477
1477
|
}
|
|
1478
|
-
var
|
|
1479
|
-
const
|
|
1478
|
+
var U, k, B, H, le, He, Q, pe, ee, ye;
|
|
1479
|
+
const Kt = class $e {
|
|
1480
1480
|
constructor(t) {
|
|
1481
|
-
|
|
1482
|
-
const n =
|
|
1483
|
-
this.decimal =
|
|
1484
|
-
Math.max(He(z(n)), this.decimal || 0)
|
|
1485
|
-
), D(this, oe, Ve).call(this, n);
|
|
1481
|
+
$(this, U), $(this, B), $(this, le), $(this, Q), $(this, ee), S(this, "decimalMultiplier", 10n ** 8n), S(this, "bigIntValue", 0n), S(this, "decimal");
|
|
1482
|
+
const n = me(t), a = typeof t == "object";
|
|
1483
|
+
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier : L(Math.max(ke(te(n)), this.decimal || 0)), R(this, le, He).call(this, n);
|
|
1486
1484
|
}
|
|
1487
1485
|
static fromBigInt(t, n) {
|
|
1488
|
-
return new
|
|
1486
|
+
return new $e({
|
|
1489
1487
|
decimal: n,
|
|
1490
|
-
value:
|
|
1488
|
+
value: se({ value: t, bigIntDecimal: n, decimal: n })
|
|
1491
1489
|
});
|
|
1492
1490
|
}
|
|
1493
1491
|
static shiftDecimals({
|
|
@@ -1496,7 +1494,7 @@ const Wt = class Ue {
|
|
|
1496
1494
|
to: a
|
|
1497
1495
|
}) {
|
|
1498
1496
|
return this.fromBigInt(
|
|
1499
|
-
t.getBaseValue("bigint") *
|
|
1497
|
+
t.getBaseValue("bigint") * L(a) / L(n),
|
|
1500
1498
|
a
|
|
1501
1499
|
);
|
|
1502
1500
|
}
|
|
@@ -1504,73 +1502,64 @@ const Wt = class Ue {
|
|
|
1504
1502
|
return new this.constructor({ decimal: this.decimal, value: t, identifier: this.toString() });
|
|
1505
1503
|
}
|
|
1506
1504
|
add(...t) {
|
|
1507
|
-
return
|
|
1505
|
+
return R(this, U, k).call(this, "add", ...t);
|
|
1508
1506
|
}
|
|
1509
1507
|
sub(...t) {
|
|
1510
|
-
return
|
|
1508
|
+
return R(this, U, k).call(this, "sub", ...t);
|
|
1511
1509
|
}
|
|
1512
1510
|
mul(...t) {
|
|
1513
|
-
return
|
|
1511
|
+
return R(this, U, k).call(this, "mul", ...t);
|
|
1514
1512
|
}
|
|
1515
1513
|
div(...t) {
|
|
1516
|
-
return
|
|
1514
|
+
return R(this, U, k).call(this, "div", ...t);
|
|
1517
1515
|
}
|
|
1518
1516
|
gt(t) {
|
|
1519
|
-
return this
|
|
1517
|
+
return R(this, B, H).call(this, "gt", t);
|
|
1520
1518
|
}
|
|
1521
1519
|
gte(t) {
|
|
1522
|
-
return this
|
|
1520
|
+
return R(this, B, H).call(this, "gte", t);
|
|
1523
1521
|
}
|
|
1524
1522
|
lt(t) {
|
|
1525
|
-
return this
|
|
1523
|
+
return R(this, B, H).call(this, "lt", t);
|
|
1526
1524
|
}
|
|
1527
1525
|
lte(t) {
|
|
1528
|
-
return this
|
|
1526
|
+
return R(this, B, H).call(this, "lte", t);
|
|
1529
1527
|
}
|
|
1530
1528
|
eqValue(t) {
|
|
1531
|
-
return this
|
|
1529
|
+
return R(this, B, H).call(this, "eqValue", t);
|
|
1532
1530
|
}
|
|
1531
|
+
// @ts-expect-error False positive
|
|
1533
1532
|
getValue(t) {
|
|
1534
1533
|
const n = this.formatBigIntToSafeValue(
|
|
1535
1534
|
this.bigIntValue,
|
|
1536
|
-
this.decimal ||
|
|
1535
|
+
this.decimal || G(this.decimalMultiplier)
|
|
1537
1536
|
);
|
|
1538
1537
|
switch (t) {
|
|
1539
1538
|
case "number":
|
|
1540
1539
|
return Number(n);
|
|
1541
1540
|
case "string":
|
|
1542
1541
|
return n;
|
|
1543
|
-
|
|
1544
|
-
return this.bigIntValue * BigInt(this.decimal || 8n) / this.decimalMultiplier;
|
|
1542
|
+
case "bigint":
|
|
1543
|
+
return this.bigIntValue * 10n ** BigInt(this.decimal || 8n) / this.decimalMultiplier;
|
|
1545
1544
|
}
|
|
1546
1545
|
}
|
|
1546
|
+
// @ts-expect-error
|
|
1547
1547
|
getBaseValue(t) {
|
|
1548
|
-
const n = this.decimalMultiplier /
|
|
1548
|
+
const n = this.decimalMultiplier / L(this.decimal || w.THOR), a = this.bigIntValue / n;
|
|
1549
1549
|
switch (t) {
|
|
1550
1550
|
case "number":
|
|
1551
1551
|
return Number(a);
|
|
1552
1552
|
case "string":
|
|
1553
1553
|
return a.toString();
|
|
1554
|
-
|
|
1554
|
+
case "bigint":
|
|
1555
1555
|
return a;
|
|
1556
1556
|
}
|
|
1557
1557
|
}
|
|
1558
1558
|
getBigIntValue(t, n) {
|
|
1559
1559
|
if (!n && typeof t == "object")
|
|
1560
1560
|
return t.bigIntValue;
|
|
1561
|
-
const a =
|
|
1562
|
-
return s === "0" || s === "undefined" ? 0n :
|
|
1563
|
-
}
|
|
1564
|
-
formatBigIntToSafeValue(t, n) {
|
|
1565
|
-
const a = n || this.decimal || F, s = Math.max(
|
|
1566
|
-
a,
|
|
1567
|
-
$(this.decimalMultiplier)
|
|
1568
|
-
), r = t < 0n, o = t.toString().substring(r ? 1 : 0), p = s - (o.length - 1), d = p > 0 ? "0".repeat(p) + o : o, l = d.length - s;
|
|
1569
|
-
let u = d.slice(-s);
|
|
1570
|
-
return parseInt(u[a]) >= 5 ? u = `${u.substring(0, a - 1)}${(parseInt(u[a - 1]) + 1).toString()}` : u = u.substring(0, a), `${r ? "-" : ""}${d.slice(
|
|
1571
|
-
0,
|
|
1572
|
-
l
|
|
1573
|
-
)}.${u}`.replace(/\.?0*$/, "");
|
|
1561
|
+
const a = me(t), s = te(a);
|
|
1562
|
+
return s === "0" || s === "undefined" ? 0n : R(this, ee, ye).call(this, s, n);
|
|
1574
1563
|
}
|
|
1575
1564
|
toSignificant(t = 6) {
|
|
1576
1565
|
const [n, a] = this.getValue("string").split("."), s = n || "", r = a || "";
|
|
@@ -1615,83 +1604,111 @@ const Wt = class Ue {
|
|
|
1615
1604
|
const o = this.getValue("number"), [p, d = ""] = o.toFixed(6).split("."), l = p.replace(/\B(?=(\d{3})+(?!\d))/g, r), u = !p && !d ? "0.00" : p === "0" ? `${parseFloat(`0.${d}`)}`.replace(".", s) : `${l}${parseInt(d) ? `${s}${d.slice(0, a)}` : ""}`;
|
|
1616
1605
|
return `${n === "start" ? t : ""}${u}${n === "end" ? t : ""}`;
|
|
1617
1606
|
}
|
|
1607
|
+
formatBigIntToSafeValue(t, n) {
|
|
1608
|
+
const a = n || this.decimal || W, s = Math.max(
|
|
1609
|
+
a,
|
|
1610
|
+
G(this.decimalMultiplier)
|
|
1611
|
+
), r = t < 0n, o = t.toString().substring(r ? 1 : 0), p = s - (o.length - 1), d = p > 0 ? "0".repeat(p) + o : o, l = d.length - s;
|
|
1612
|
+
let u = d.slice(-s);
|
|
1613
|
+
return parseInt(u[a]) >= 5 ? u = `${u.substring(0, a - 1)}${(parseInt(u[a - 1]) + 1).toString()}` : u = u.substring(0, a), `${r ? "-" : ""}${d.slice(
|
|
1614
|
+
0,
|
|
1615
|
+
l
|
|
1616
|
+
)}.${u}`.replace(/\.?0*$/, "");
|
|
1617
|
+
}
|
|
1618
1618
|
};
|
|
1619
|
-
|
|
1620
|
-
const n =
|
|
1621
|
-
(
|
|
1622
|
-
const
|
|
1619
|
+
U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
1620
|
+
const n = R(this, Q, pe).call(this, this, ...t), a = Math.max(n, G(this.decimalMultiplier)), s = L(a), r = t.reduce(
|
|
1621
|
+
(p, d) => {
|
|
1622
|
+
const l = this.getBigIntValue(d, a);
|
|
1623
1623
|
switch (e) {
|
|
1624
1624
|
case "add":
|
|
1625
|
-
return
|
|
1625
|
+
return p + l;
|
|
1626
1626
|
case "sub":
|
|
1627
|
-
return
|
|
1627
|
+
return p - l;
|
|
1628
1628
|
case "mul":
|
|
1629
|
-
return
|
|
1629
|
+
return p * l / s;
|
|
1630
1630
|
case "div": {
|
|
1631
|
-
if (
|
|
1631
|
+
if (l === 0n)
|
|
1632
1632
|
throw new RangeError("Division by zero");
|
|
1633
|
-
return
|
|
1633
|
+
return p * s / l;
|
|
1634
1634
|
}
|
|
1635
1635
|
default:
|
|
1636
|
-
return
|
|
1636
|
+
return p;
|
|
1637
1637
|
}
|
|
1638
1638
|
},
|
|
1639
1639
|
//normalize is to precision multiplier base
|
|
1640
|
-
this.bigIntValue *
|
|
1641
|
-
),
|
|
1642
|
-
bigIntDecimal:
|
|
1643
|
-
decimal:
|
|
1644
|
-
value:
|
|
1640
|
+
this.bigIntValue * s / this.decimalMultiplier
|
|
1641
|
+
), o = se({
|
|
1642
|
+
bigIntDecimal: a,
|
|
1643
|
+
decimal: a,
|
|
1644
|
+
value: r
|
|
1645
|
+
});
|
|
1646
|
+
return new this.constructor({
|
|
1647
|
+
decimalMultiplier: L(a),
|
|
1648
|
+
decimal: this.decimal,
|
|
1649
|
+
value: o,
|
|
1650
|
+
identifier: this.toString()
|
|
1645
1651
|
});
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1652
|
+
}, B = /* @__PURE__ */ new WeakSet(), H = function(e, ...t) {
|
|
1653
|
+
const n = R(this, Q, pe).call(this, this, ...t), a = this.getBigIntValue(t[0], n), s = this.getBigIntValue(this, n);
|
|
1654
|
+
switch (e) {
|
|
1655
|
+
case "gt":
|
|
1656
|
+
return s > a;
|
|
1657
|
+
case "gte":
|
|
1658
|
+
return s >= a;
|
|
1659
|
+
case "lt":
|
|
1660
|
+
return s < a;
|
|
1661
|
+
case "lte":
|
|
1662
|
+
return s <= a;
|
|
1663
|
+
case "eqValue":
|
|
1664
|
+
return s === a;
|
|
1665
|
+
}
|
|
1666
|
+
}, le = /* @__PURE__ */ new WeakSet(), He = function(e) {
|
|
1667
|
+
const t = te(e) || "0";
|
|
1668
|
+
this.bigIntValue = R(this, ee, ye).call(this, t);
|
|
1669
|
+
}, Q = /* @__PURE__ */ new WeakSet(), pe = function(...e) {
|
|
1670
|
+
const t = e.map((n) => typeof n == "object" ? n.decimal || G(n.decimalMultiplier) : ke(te(n))).filter(Boolean);
|
|
1671
|
+
return Math.max(...t, W);
|
|
1672
|
+
}, ee = /* @__PURE__ */ new WeakSet(), ye = function(e, t) {
|
|
1673
|
+
const n = t ? L(t) : this.decimalMultiplier, a = G(n), [s = "", r = ""] = e.split(".");
|
|
1657
1674
|
return BigInt(`${s}${r.padEnd(a, "0")}`);
|
|
1658
1675
|
};
|
|
1659
|
-
let
|
|
1660
|
-
const
|
|
1676
|
+
let ce = Kt;
|
|
1677
|
+
const Yt = Intl.NumberFormat("fullwide", {
|
|
1661
1678
|
useGrouping: !1,
|
|
1662
1679
|
maximumFractionDigits: 20
|
|
1663
1680
|
});
|
|
1664
|
-
function
|
|
1665
|
-
const t = `${typeof e == "number" ?
|
|
1681
|
+
function te(e) {
|
|
1682
|
+
const t = `${typeof e == "number" ? Yt.format(e) : me(e)}`.replaceAll(",", ".").split(".");
|
|
1666
1683
|
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1667
1684
|
}
|
|
1668
|
-
function
|
|
1685
|
+
function ke(e) {
|
|
1669
1686
|
var t;
|
|
1670
1687
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1671
|
-
return Math.max(n,
|
|
1688
|
+
return Math.max(n, W);
|
|
1672
1689
|
}
|
|
1673
|
-
function
|
|
1690
|
+
function me(e) {
|
|
1674
1691
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1675
1692
|
}
|
|
1676
|
-
const
|
|
1677
|
-
let
|
|
1678
|
-
const
|
|
1679
|
-
if (!
|
|
1693
|
+
const z = (e, t) => typeof e == "bigint" ? se({ value: e, bigIntDecimal: t, decimal: t }) : e;
|
|
1694
|
+
let Te;
|
|
1695
|
+
const Oe = (e) => {
|
|
1696
|
+
if (!Te)
|
|
1680
1697
|
throw new Error("Static assets not loaded, call await AssetValue.loadStaticAssets() first");
|
|
1681
|
-
return
|
|
1682
|
-
},
|
|
1683
|
-
|
|
1684
|
-
const n = await
|
|
1685
|
-
return new
|
|
1698
|
+
return Te.get(e.toUpperCase()) || { decimal: w.THOR, identifier: "" };
|
|
1699
|
+
}, Ie = async (e, t = 0) => {
|
|
1700
|
+
jt(e);
|
|
1701
|
+
const n = await bt(he(e)), a = z(t, n);
|
|
1702
|
+
return new M({ decimal: n, value: a, identifier: e });
|
|
1686
1703
|
};
|
|
1687
|
-
class
|
|
1704
|
+
class M extends ce {
|
|
1688
1705
|
constructor(t) {
|
|
1689
1706
|
const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`;
|
|
1690
1707
|
super(
|
|
1691
|
-
t.value instanceof
|
|
1692
|
-
),
|
|
1693
|
-
const a =
|
|
1694
|
-
this.type =
|
|
1708
|
+
t.value instanceof ce ? t.value : { decimal: t.decimal, value: t.value }
|
|
1709
|
+
), S(this, "address"), S(this, "chain"), S(this, "isGasAsset", !1), S(this, "isSynthetic", !1), S(this, "symbol"), S(this, "tax"), S(this, "ticker"), S(this, "type");
|
|
1710
|
+
const a = he(n);
|
|
1711
|
+
this.type = Et(a), this.chain = a.chain, this.ticker = a.ticker, this.symbol = a.symbol, this.address = a.address, this.isSynthetic = a.isSynthetic, this.isGasAsset = a.isGasAsset, this.tax = t.tax;
|
|
1695
1712
|
}
|
|
1696
1713
|
toString(t = !1) {
|
|
1697
1714
|
const n = this.isSynthetic ? this.symbol.split("-")[0] : this.ticker;
|
|
@@ -1704,24 +1721,26 @@ class C extends ue {
|
|
|
1704
1721
|
return this.chain === t && this.symbol === n;
|
|
1705
1722
|
}
|
|
1706
1723
|
static async fromString(t, n = 0) {
|
|
1707
|
-
return
|
|
1724
|
+
return Ie(t, n);
|
|
1708
1725
|
}
|
|
1709
1726
|
static fromStringSync(t, n = 0) {
|
|
1710
|
-
const { isSynthetic: a } =
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1727
|
+
const { isSynthetic: a } = he(t), {
|
|
1728
|
+
tax: s,
|
|
1729
|
+
decimal: r,
|
|
1730
|
+
identifier: o
|
|
1731
|
+
} = Oe(t), p = z(n, r);
|
|
1732
|
+
return o ? new M({ tax: s, decimal: r, identifier: o, value: p }) : a ? new M({ tax: s, decimal: 8, identifier: t, value: p }) : void 0;
|
|
1714
1733
|
}
|
|
1715
1734
|
static async fromIdentifier(t, n = 0) {
|
|
1716
|
-
return
|
|
1735
|
+
return Ie(t, n);
|
|
1717
1736
|
}
|
|
1718
1737
|
static fromIdentifierSync(t, n = 0) {
|
|
1719
|
-
const { decimal: a, identifier: s } =
|
|
1720
|
-
return new
|
|
1738
|
+
const { decimal: a, identifier: s } = Oe(t), r = z(n, a);
|
|
1739
|
+
return new M({ decimal: a, identifier: s, value: r });
|
|
1721
1740
|
}
|
|
1722
1741
|
static fromChainOrSignature(t, n = 0) {
|
|
1723
|
-
const { decimal: a, identifier: s } =
|
|
1724
|
-
return new
|
|
1742
|
+
const { decimal: a, identifier: s } = At(t), r = z(n, a);
|
|
1743
|
+
return new M({ value: r, decimal: a, identifier: s });
|
|
1725
1744
|
}
|
|
1726
1745
|
static async loadStaticAssets() {
|
|
1727
1746
|
return new Promise(
|
|
@@ -1734,7 +1753,7 @@ class C extends ue {
|
|
|
1734
1753
|
NativeList: s,
|
|
1735
1754
|
...r
|
|
1736
1755
|
} = await import("@swapkit/tokens");
|
|
1737
|
-
|
|
1756
|
+
Te = [s, ...Object.values(r)].reduce(
|
|
1738
1757
|
(o, { tokens: p }) => (p.forEach(({ identifier: d, chain: l, ...u }) => {
|
|
1739
1758
|
const c = "decimals" in u ? u.decimals : w[l];
|
|
1740
1759
|
o.set(d, { identifier: d, decimal: c });
|
|
@@ -1752,8 +1771,8 @@ class C extends ue {
|
|
|
1752
1771
|
);
|
|
1753
1772
|
}
|
|
1754
1773
|
}
|
|
1755
|
-
const
|
|
1756
|
-
const t =
|
|
1774
|
+
const de = (e) => {
|
|
1775
|
+
const t = M.fromChainOrSignature(e);
|
|
1757
1776
|
switch (e) {
|
|
1758
1777
|
case i.Bitcoin:
|
|
1759
1778
|
case i.Litecoin:
|
|
@@ -1770,17 +1789,17 @@ const ie = (e) => {
|
|
|
1770
1789
|
default:
|
|
1771
1790
|
return t.set(1e-8);
|
|
1772
1791
|
}
|
|
1773
|
-
},
|
|
1792
|
+
}, he = (e) => {
|
|
1774
1793
|
const t = e.slice(0, 14).includes("/"), [n, a] = e.split(".").pop().split("/"), s = e.includes(".") && !t ? e : `${i.THORChain}.${a}`, [r, o] = s.split("."), [p, d] = (t ? a : o).split("-");
|
|
1775
1794
|
return {
|
|
1776
1795
|
address: d == null ? void 0 : d.toLowerCase(),
|
|
1777
1796
|
chain: r,
|
|
1778
|
-
isGasAsset:
|
|
1797
|
+
isGasAsset: De({ chain: r, symbol: o }),
|
|
1779
1798
|
isSynthetic: t,
|
|
1780
1799
|
symbol: (t ? `${n}/` : "") + (d ? `${p}-${(d == null ? void 0 : d.toLowerCase()) ?? ""}` : o),
|
|
1781
1800
|
ticker: p
|
|
1782
1801
|
};
|
|
1783
|
-
},
|
|
1802
|
+
}, Xt = {
|
|
1784
1803
|
/**
|
|
1785
1804
|
* Core
|
|
1786
1805
|
*/
|
|
@@ -1839,21 +1858,21 @@ const ie = (e) => {
|
|
|
1839
1858
|
};
|
|
1840
1859
|
class m extends Error {
|
|
1841
1860
|
constructor(t, n) {
|
|
1842
|
-
console.error(n), super(t, { cause: { code:
|
|
1861
|
+
console.error(n), super(t, { cause: { code: Xt[t], message: t } }), Object.setPrototypeOf(this, m.prototype);
|
|
1843
1862
|
}
|
|
1844
1863
|
}
|
|
1845
|
-
class
|
|
1864
|
+
class x extends ce {
|
|
1846
1865
|
eq(t) {
|
|
1847
1866
|
return this.eqValue(t);
|
|
1848
1867
|
}
|
|
1849
1868
|
static fromBigInt(t, n) {
|
|
1850
|
-
return new
|
|
1869
|
+
return new x({
|
|
1851
1870
|
decimal: n,
|
|
1852
|
-
value:
|
|
1871
|
+
value: se({ value: t, bigIntDecimal: n, decimal: n })
|
|
1853
1872
|
});
|
|
1854
1873
|
}
|
|
1855
1874
|
}
|
|
1856
|
-
const
|
|
1875
|
+
const Jt = [
|
|
1857
1876
|
{
|
|
1858
1877
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
1859
1878
|
stateMutability: "nonpayable",
|
|
@@ -1944,7 +1963,7 @@ const Kt = [
|
|
|
1944
1963
|
type: "function"
|
|
1945
1964
|
},
|
|
1946
1965
|
{ stateMutability: "payable", type: "receive" }
|
|
1947
|
-
],
|
|
1966
|
+
], Qt = [
|
|
1948
1967
|
{
|
|
1949
1968
|
inputs: [
|
|
1950
1969
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2088,7 +2107,7 @@ const Kt = [
|
|
|
2088
2107
|
type: "function"
|
|
2089
2108
|
},
|
|
2090
2109
|
{ stateMutability: "payable", type: "receive" }
|
|
2091
|
-
],
|
|
2110
|
+
], zt = [
|
|
2092
2111
|
{
|
|
2093
2112
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2094
2113
|
stateMutability: "nonpayable",
|
|
@@ -2193,7 +2212,7 @@ const Kt = [
|
|
|
2193
2212
|
type: "function"
|
|
2194
2213
|
},
|
|
2195
2214
|
{ stateMutability: "payable", type: "receive" }
|
|
2196
|
-
],
|
|
2215
|
+
], Zt = [
|
|
2197
2216
|
{
|
|
2198
2217
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2199
2218
|
stateMutability: "nonpayable",
|
|
@@ -2284,7 +2303,7 @@ const Kt = [
|
|
|
2284
2303
|
type: "function"
|
|
2285
2304
|
},
|
|
2286
2305
|
{ stateMutability: "payable", type: "receive" }
|
|
2287
|
-
],
|
|
2306
|
+
], en = [
|
|
2288
2307
|
{
|
|
2289
2308
|
inputs: [
|
|
2290
2309
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2428,7 +2447,7 @@ const Kt = [
|
|
|
2428
2447
|
type: "function"
|
|
2429
2448
|
},
|
|
2430
2449
|
{ stateMutability: "payable", type: "receive" }
|
|
2431
|
-
],
|
|
2450
|
+
], tn = [
|
|
2432
2451
|
{
|
|
2433
2452
|
inputs: [
|
|
2434
2453
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2547,7 +2566,7 @@ const Kt = [
|
|
|
2547
2566
|
type: "function"
|
|
2548
2567
|
},
|
|
2549
2568
|
{ stateMutability: "payable", type: "receive" }
|
|
2550
|
-
],
|
|
2569
|
+
], nn = [
|
|
2551
2570
|
{
|
|
2552
2571
|
inputs: [
|
|
2553
2572
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2666,7 +2685,7 @@ const Kt = [
|
|
|
2666
2685
|
type: "function"
|
|
2667
2686
|
},
|
|
2668
2687
|
{ stateMutability: "payable", type: "receive" }
|
|
2669
|
-
],
|
|
2688
|
+
], an = [
|
|
2670
2689
|
{
|
|
2671
2690
|
inputs: [
|
|
2672
2691
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2785,7 +2804,7 @@ const Kt = [
|
|
|
2785
2804
|
type: "function"
|
|
2786
2805
|
},
|
|
2787
2806
|
{ stateMutability: "payable", type: "receive" }
|
|
2788
|
-
],
|
|
2807
|
+
], sn = [
|
|
2789
2808
|
{
|
|
2790
2809
|
inputs: [
|
|
2791
2810
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2904,7 +2923,7 @@ const Kt = [
|
|
|
2904
2923
|
type: "function"
|
|
2905
2924
|
},
|
|
2906
2925
|
{ stateMutability: "payable", type: "receive" }
|
|
2907
|
-
],
|
|
2926
|
+
], rn = [
|
|
2908
2927
|
{
|
|
2909
2928
|
inputs: [
|
|
2910
2929
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3031,7 +3050,7 @@ const Kt = [
|
|
|
3031
3050
|
type: "function"
|
|
3032
3051
|
},
|
|
3033
3052
|
{ stateMutability: "payable", type: "receive" }
|
|
3034
|
-
],
|
|
3053
|
+
], on = [
|
|
3035
3054
|
{
|
|
3036
3055
|
inputs: [
|
|
3037
3056
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3158,7 +3177,7 @@ const Kt = [
|
|
|
3158
3177
|
type: "function"
|
|
3159
3178
|
},
|
|
3160
3179
|
{ stateMutability: "payable", type: "receive" }
|
|
3161
|
-
],
|
|
3180
|
+
], pn = [
|
|
3162
3181
|
{
|
|
3163
3182
|
inputs: [
|
|
3164
3183
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3285,7 +3304,7 @@ const Kt = [
|
|
|
3285
3304
|
type: "function"
|
|
3286
3305
|
},
|
|
3287
3306
|
{ stateMutability: "payable", type: "receive" }
|
|
3288
|
-
],
|
|
3307
|
+
], dn = [
|
|
3289
3308
|
{
|
|
3290
3309
|
inputs: [
|
|
3291
3310
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3412,7 +3431,7 @@ const Kt = [
|
|
|
3412
3431
|
type: "function"
|
|
3413
3432
|
},
|
|
3414
3433
|
{ stateMutability: "payable", type: "receive" }
|
|
3415
|
-
],
|
|
3434
|
+
], un = [
|
|
3416
3435
|
{
|
|
3417
3436
|
inputs: [
|
|
3418
3437
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3539,27 +3558,27 @@ const Kt = [
|
|
|
3539
3558
|
type: "function"
|
|
3540
3559
|
},
|
|
3541
3560
|
{ stateMutability: "payable", type: "receive" }
|
|
3542
|
-
],
|
|
3543
|
-
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]:
|
|
3544
|
-
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]:
|
|
3545
|
-
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]:
|
|
3546
|
-
},
|
|
3547
|
-
|
|
3561
|
+
], Fe = {
|
|
3562
|
+
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: Jt,
|
|
3563
|
+
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: zt,
|
|
3564
|
+
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: Zt
|
|
3565
|
+
}, ln = {
|
|
3566
|
+
...Fe,
|
|
3548
3567
|
// AVAX
|
|
3549
|
-
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]:
|
|
3550
|
-
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]:
|
|
3551
|
-
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]:
|
|
3568
|
+
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: tn,
|
|
3569
|
+
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: Qt,
|
|
3570
|
+
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: an,
|
|
3552
3571
|
// BSC
|
|
3553
|
-
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]:
|
|
3572
|
+
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: en,
|
|
3554
3573
|
// ETH
|
|
3555
|
-
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]:
|
|
3556
|
-
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]:
|
|
3557
|
-
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]:
|
|
3558
|
-
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]:
|
|
3559
|
-
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]:
|
|
3560
|
-
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]:
|
|
3561
|
-
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]:
|
|
3562
|
-
},
|
|
3574
|
+
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: nn,
|
|
3575
|
+
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: sn,
|
|
3576
|
+
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: rn,
|
|
3577
|
+
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: on,
|
|
3578
|
+
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: pn,
|
|
3579
|
+
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: dn,
|
|
3580
|
+
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: un
|
|
3581
|
+
}, yn = ({
|
|
3563
3582
|
streamSwap: e,
|
|
3564
3583
|
contractAddress: t,
|
|
3565
3584
|
recipient: n,
|
|
@@ -3579,29 +3598,29 @@ const Kt = [
|
|
|
3579
3598
|
token: E
|
|
3580
3599
|
}
|
|
3581
3600
|
}) => {
|
|
3582
|
-
const
|
|
3583
|
-
if (
|
|
3601
|
+
const O = !!Fe[t.toLowerCase()];
|
|
3602
|
+
if (O && !l)
|
|
3584
3603
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
3585
|
-
const
|
|
3604
|
+
const I = c || d, D = e && u || I;
|
|
3586
3605
|
if (!b && !A)
|
|
3587
3606
|
throw new Error("TC Vault is required on calldata");
|
|
3588
3607
|
if (!_ && !l)
|
|
3589
3608
|
throw new Error("TC Router is required on calldata");
|
|
3590
|
-
if (!
|
|
3609
|
+
if (!D)
|
|
3591
3610
|
throw new Error("TC Memo is required on calldata");
|
|
3592
3611
|
if (!E)
|
|
3593
3612
|
throw new Error("Token is required on calldata");
|
|
3594
|
-
const
|
|
3613
|
+
const ie = [
|
|
3595
3614
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
3596
3615
|
a(_ || l),
|
|
3597
3616
|
a(b || A),
|
|
3598
|
-
|
|
3617
|
+
D.replace("{recipientAddress}", n),
|
|
3599
3618
|
a(E),
|
|
3600
3619
|
s
|
|
3601
|
-
],
|
|
3602
|
-
return [...
|
|
3603
|
-
},
|
|
3604
|
-
const n =
|
|
3620
|
+
], Ge = O ? [a(l), o, p] : [r, p];
|
|
3621
|
+
return [...ie, ...Ge];
|
|
3622
|
+
}, cn = ({ chain: e, txHash: t }) => {
|
|
3623
|
+
const n = Ne[e];
|
|
3605
3624
|
switch (e) {
|
|
3606
3625
|
case i.Binance:
|
|
3607
3626
|
case i.Bitcoin:
|
|
@@ -3626,8 +3645,8 @@ const Kt = [
|
|
|
3626
3645
|
default:
|
|
3627
3646
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3628
3647
|
}
|
|
3629
|
-
},
|
|
3630
|
-
const n =
|
|
3648
|
+
}, mn = ({ chain: e, address: t }) => {
|
|
3649
|
+
const n = Ne[e];
|
|
3631
3650
|
switch (e) {
|
|
3632
3651
|
case i.Arbitrum:
|
|
3633
3652
|
case i.Avalanche:
|
|
@@ -3650,29 +3669,29 @@ const Kt = [
|
|
|
3650
3669
|
default:
|
|
3651
3670
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3652
3671
|
}
|
|
3653
|
-
},
|
|
3654
|
-
const t = e ?
|
|
3655
|
-
return
|
|
3656
|
-
},
|
|
3657
|
-
const t = e ?
|
|
3658
|
-
return
|
|
3659
|
-
},
|
|
3672
|
+
}, Tn = (e) => {
|
|
3673
|
+
const t = e ? q.ThornodeStagenet : q.ThornodeMainnet;
|
|
3674
|
+
return we.get(`${t}/thorchain/inbound_addresses`);
|
|
3675
|
+
}, hn = (e) => {
|
|
3676
|
+
const t = e ? q.ThornodeStagenet : q.ThornodeMainnet;
|
|
3677
|
+
return we.get(`${t}/thorchain/mimir`);
|
|
3678
|
+
}, Se = () => Object.values(i).reduce(
|
|
3660
3679
|
(e, t) => (e[t] = null, e),
|
|
3661
3680
|
{}
|
|
3662
3681
|
);
|
|
3663
|
-
var
|
|
3664
|
-
class
|
|
3682
|
+
var V, ne, j, v, K, Y;
|
|
3683
|
+
class Ln {
|
|
3665
3684
|
constructor({ stagenet: t } = {}) {
|
|
3666
|
-
T(this, "connectedChains",
|
|
3667
|
-
T(this, "connectedWallets",
|
|
3685
|
+
T(this, "connectedChains", Se());
|
|
3686
|
+
T(this, "connectedWallets", Se());
|
|
3668
3687
|
T(this, "stagenet", !1);
|
|
3669
3688
|
T(this, "getAddress", (t) => {
|
|
3670
3689
|
var n;
|
|
3671
3690
|
return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
|
|
3672
3691
|
});
|
|
3673
|
-
T(this, "getExplorerTxUrl", (t, n) =>
|
|
3692
|
+
T(this, "getExplorerTxUrl", (t, n) => cn({ chain: t, txHash: n }));
|
|
3674
3693
|
T(this, "getWallet", (t) => this.connectedWallets[t]);
|
|
3675
|
-
T(this, "getExplorerAddressUrl", (t, n) =>
|
|
3694
|
+
T(this, "getExplorerAddressUrl", (t, n) => mn({ chain: t, address: n }));
|
|
3676
3695
|
T(this, "getBalance", async (t, n) => {
|
|
3677
3696
|
const a = await this.getWalletByChain(t, n);
|
|
3678
3697
|
return (a == null ? void 0 : a.balance) || [];
|
|
@@ -3683,7 +3702,7 @@ class Dn {
|
|
|
3683
3702
|
if (!a.complete)
|
|
3684
3703
|
throw new m("core_swap_route_not_complete");
|
|
3685
3704
|
try {
|
|
3686
|
-
if (
|
|
3705
|
+
if (Ze.includes(r)) {
|
|
3687
3706
|
const l = this.connectedWallets[o];
|
|
3688
3707
|
if (!(l != null && l.sendTransaction))
|
|
3689
3708
|
throw new m("core_wallet_connection_not_found");
|
|
@@ -3693,42 +3712,42 @@ class Dn {
|
|
|
3693
3712
|
data: c,
|
|
3694
3713
|
from: _,
|
|
3695
3714
|
to: b.toLowerCase(),
|
|
3696
|
-
chainId: BigInt(
|
|
3715
|
+
chainId: BigInt(pt[o]),
|
|
3697
3716
|
value: A ? BigInt(A) : 0n
|
|
3698
3717
|
};
|
|
3699
3718
|
return l.sendTransaction(E, s);
|
|
3700
3719
|
}
|
|
3701
|
-
if (
|
|
3720
|
+
if (tt.includes(r)) {
|
|
3702
3721
|
if (!a.calldata.fromAsset)
|
|
3703
3722
|
throw new m("core_swap_asset_not_recognized");
|
|
3704
|
-
const l = await
|
|
3723
|
+
const l = await M.fromString(a.calldata.fromAsset);
|
|
3705
3724
|
if (!l)
|
|
3706
3725
|
throw new m("core_swap_asset_not_recognized");
|
|
3707
|
-
const { address: u } = await f(this,
|
|
3726
|
+
const { address: u } = await f(this, V).call(this, l.chain), {
|
|
3708
3727
|
contract: c,
|
|
3709
3728
|
calldata: { expiration: _, amountIn: b, memo: A, memoStreamingSwap: E }
|
|
3710
|
-
} = a,
|
|
3729
|
+
} = a, O = l.add(x.fromBigInt(BigInt(b), l.decimal)), I = t && E || A;
|
|
3711
3730
|
return this.deposit({
|
|
3712
3731
|
expiration: _,
|
|
3713
|
-
assetValue:
|
|
3714
|
-
memo:
|
|
3732
|
+
assetValue: O,
|
|
3733
|
+
memo: I,
|
|
3715
3734
|
feeOptionKey: s,
|
|
3716
3735
|
router: c,
|
|
3717
3736
|
recipient: u
|
|
3718
3737
|
});
|
|
3719
3738
|
}
|
|
3720
|
-
if (
|
|
3739
|
+
if (et.includes(r)) {
|
|
3721
3740
|
const { calldata: l, contract: u } = a;
|
|
3722
3741
|
if (!u)
|
|
3723
3742
|
throw new m("core_swap_contract_not_found");
|
|
3724
3743
|
const c = this.connectedWallets[o], _ = this.getAddress(o);
|
|
3725
3744
|
if (!(c != null && c.sendTransaction) || !_)
|
|
3726
3745
|
throw new m("core_wallet_connection_not_found");
|
|
3727
|
-
const { getProvider: b, toChecksumAddress: A } = await import("@swapkit/toolbox-evm"), E = b(o),
|
|
3728
|
-
if (!
|
|
3746
|
+
const { getProvider: b, toChecksumAddress: A } = await import("@swapkit/toolbox-evm"), E = b(o), O = ln[u.toLowerCase()];
|
|
3747
|
+
if (!O)
|
|
3729
3748
|
throw new m("core_swap_contract_not_supported", { contractAddress: u });
|
|
3730
|
-
const
|
|
3731
|
-
...
|
|
3749
|
+
const D = await (await ((d = c.createContract) == null ? void 0 : d.call(c, u, O, E))).getFunction("swapIn").populateTransaction(
|
|
3750
|
+
...yn({
|
|
3732
3751
|
streamSwap: t,
|
|
3733
3752
|
toChecksumAddress: A,
|
|
3734
3753
|
contractAddress: u,
|
|
@@ -3737,7 +3756,7 @@ class Dn {
|
|
|
3737
3756
|
}),
|
|
3738
3757
|
{ from: _ }
|
|
3739
3758
|
);
|
|
3740
|
-
return c.sendTransaction(
|
|
3759
|
+
return c.sendTransaction(D, s);
|
|
3741
3760
|
}
|
|
3742
3761
|
throw new m("core_swap_quote_mode_not_supported", { quoteMode: r });
|
|
3743
3762
|
} catch (l) {
|
|
@@ -3749,7 +3768,7 @@ class Dn {
|
|
|
3749
3768
|
const a = this.getAddress(t);
|
|
3750
3769
|
if (!a)
|
|
3751
3770
|
return null;
|
|
3752
|
-
const s = [
|
|
3771
|
+
const s = [M.fromChainOrSignature(t)], r = (o = this.connectedChains[t]) == null ? void 0 : o.walletType;
|
|
3753
3772
|
try {
|
|
3754
3773
|
const d = await ((p = this.getWallet(t)) == null ? void 0 : p.getBalance(a, n));
|
|
3755
3774
|
return this.connectedChains[t] = {
|
|
@@ -3761,8 +3780,8 @@ class Dn {
|
|
|
3761
3780
|
return console.error(d), { address: a, balance: s, walletType: r };
|
|
3762
3781
|
}
|
|
3763
3782
|
});
|
|
3764
|
-
T(this, "approveAssetValue", (t, n) => f(this,
|
|
3765
|
-
T(this, "isAssetValueApproved", (t, n) => f(this,
|
|
3783
|
+
T(this, "approveAssetValue", (t, n) => f(this, j).call(this, { assetValue: t, type: "approve", contractAddress: n }));
|
|
3784
|
+
T(this, "isAssetValueApproved", (t, n) => f(this, j).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
|
|
3766
3785
|
T(this, "validateAddress", ({ address: t, chain: n }) => {
|
|
3767
3786
|
var a, s;
|
|
3768
3787
|
return (s = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : s.call(a, t);
|
|
@@ -3772,7 +3791,7 @@ class Dn {
|
|
|
3772
3791
|
if (!n)
|
|
3773
3792
|
throw new m("core_wallet_connection_not_found");
|
|
3774
3793
|
try {
|
|
3775
|
-
return await n.transfer(f(this,
|
|
3794
|
+
return await n.transfer(f(this, Y).call(this, t));
|
|
3776
3795
|
} catch (a) {
|
|
3777
3796
|
throw new m("core_swap_transaction_error", a);
|
|
3778
3797
|
}
|
|
@@ -3786,7 +3805,7 @@ class Dn {
|
|
|
3786
3805
|
const { chain: r, symbol: o, ticker: p } = t, d = this.connectedWallets[r];
|
|
3787
3806
|
if (!d)
|
|
3788
3807
|
throw new m("core_wallet_connection_not_found");
|
|
3789
|
-
const l = f(this,
|
|
3808
|
+
const l = f(this, Y).call(this, { assetValue: t, recipient: n, router: a, ...s });
|
|
3790
3809
|
try {
|
|
3791
3810
|
switch (r) {
|
|
3792
3811
|
case i.THORChain: {
|
|
@@ -3796,10 +3815,10 @@ class Dn {
|
|
|
3796
3815
|
case i.Ethereum:
|
|
3797
3816
|
case i.BinanceSmartChain:
|
|
3798
3817
|
case i.Avalanche: {
|
|
3799
|
-
const { getChecksumAddressFromAsset: u } = await import("@swapkit/toolbox-evm"), c = r === i.Avalanche ?
|
|
3818
|
+
const { getChecksumAddressFromAsset: u } = await import("@swapkit/toolbox-evm"), c = r === i.Avalanche ? Je : r === i.BinanceSmartChain ? Qe : Xe;
|
|
3800
3819
|
return await d.call({
|
|
3801
3820
|
abi: c,
|
|
3802
|
-
contractAddress: a || (await f(this,
|
|
3821
|
+
contractAddress: a || (await f(this, V).call(this, r)).router,
|
|
3803
3822
|
funcName: "depositWithExpiry",
|
|
3804
3823
|
funcParams: [
|
|
3805
3824
|
n,
|
|
@@ -3833,9 +3852,9 @@ class Dn {
|
|
|
3833
3852
|
throw new m("core_transaction_create_liquidity_invalid_params");
|
|
3834
3853
|
let a = "", s = "";
|
|
3835
3854
|
try {
|
|
3836
|
-
a = await f(this,
|
|
3855
|
+
a = await f(this, v).call(this, {
|
|
3837
3856
|
assetValue: t,
|
|
3838
|
-
memo:
|
|
3857
|
+
memo: N(h.DEPOSIT, {
|
|
3839
3858
|
...n,
|
|
3840
3859
|
address: this.getAddress(n.chain)
|
|
3841
3860
|
})
|
|
@@ -3844,9 +3863,9 @@ class Dn {
|
|
|
3844
3863
|
throw new m("core_transaction_create_liquidity_rune_error", r);
|
|
3845
3864
|
}
|
|
3846
3865
|
try {
|
|
3847
|
-
s = await f(this,
|
|
3866
|
+
s = await f(this, v).call(this, {
|
|
3848
3867
|
assetValue: n,
|
|
3849
|
-
memo:
|
|
3868
|
+
memo: N(h.DEPOSIT, {
|
|
3850
3869
|
...n,
|
|
3851
3870
|
address: this.getAddress(i.THORChain)
|
|
3852
3871
|
})
|
|
@@ -3869,26 +3888,26 @@ class Dn {
|
|
|
3869
3888
|
throw new m("core_transaction_add_liquidity_invalid_params");
|
|
3870
3889
|
if (_ && !b)
|
|
3871
3890
|
throw new m("core_transaction_add_liquidity_no_rune_address");
|
|
3872
|
-
let E,
|
|
3891
|
+
let E, O;
|
|
3873
3892
|
if (u && t)
|
|
3874
3893
|
try {
|
|
3875
|
-
E = await f(this,
|
|
3894
|
+
E = await f(this, v).call(this, {
|
|
3876
3895
|
assetValue: t,
|
|
3877
|
-
memo:
|
|
3896
|
+
memo: N(h.DEPOSIT, { chain: p, symbol: d, address: A })
|
|
3878
3897
|
});
|
|
3879
|
-
} catch (
|
|
3880
|
-
throw new m("core_transaction_add_liquidity_rune_error",
|
|
3898
|
+
} catch (I) {
|
|
3899
|
+
throw new m("core_transaction_add_liquidity_rune_error", I);
|
|
3881
3900
|
}
|
|
3882
3901
|
if (c && n)
|
|
3883
3902
|
try {
|
|
3884
|
-
|
|
3903
|
+
O = await f(this, v).call(this, {
|
|
3885
3904
|
assetValue: n,
|
|
3886
|
-
memo:
|
|
3905
|
+
memo: N(h.DEPOSIT, { chain: p, symbol: d, address: b })
|
|
3887
3906
|
});
|
|
3888
|
-
} catch (
|
|
3889
|
-
throw new m("core_transaction_add_liquidity_asset_error",
|
|
3907
|
+
} catch (I) {
|
|
3908
|
+
throw new m("core_transaction_add_liquidity_asset_error", I);
|
|
3890
3909
|
}
|
|
3891
|
-
return { runeTx: E, assetTx:
|
|
3910
|
+
return { runeTx: E, assetTx: O };
|
|
3892
3911
|
});
|
|
3893
3912
|
T(this, "addLiquidityPart", ({
|
|
3894
3913
|
assetValue: t,
|
|
@@ -3898,7 +3917,7 @@ class Dn {
|
|
|
3898
3917
|
}) => {
|
|
3899
3918
|
if (s && !a)
|
|
3900
3919
|
throw new m("core_transaction_add_liquidity_invalid_params");
|
|
3901
|
-
return f(this,
|
|
3920
|
+
return f(this, v).call(this, { assetValue: t, memo: `+:${n}:${a || ""}:t:0` });
|
|
3902
3921
|
});
|
|
3903
3922
|
T(this, "withdraw", async ({
|
|
3904
3923
|
memo: t,
|
|
@@ -3907,7 +3926,7 @@ class Dn {
|
|
|
3907
3926
|
from: s,
|
|
3908
3927
|
to: r
|
|
3909
3928
|
}) => {
|
|
3910
|
-
const o = r === "rune" ?
|
|
3929
|
+
const o = r === "rune" ? M.fromChainOrSignature(i.THORChain) : s === "sym" && r === "sym" || s === "rune" || s === "asset" ? void 0 : n, p = de(s === "asset" ? n.chain : i.THORChain), d = t || N(h.WITHDRAW, {
|
|
3911
3930
|
symbol: n.symbol,
|
|
3912
3931
|
chain: n.chain,
|
|
3913
3932
|
ticker: n.ticker,
|
|
@@ -3915,7 +3934,7 @@ class Dn {
|
|
|
3915
3934
|
targetAssetString: o == null ? void 0 : o.toString(),
|
|
3916
3935
|
singleSide: !1
|
|
3917
3936
|
});
|
|
3918
|
-
return f(this,
|
|
3937
|
+
return f(this, v).call(this, { assetValue: p, memo: d });
|
|
3919
3938
|
});
|
|
3920
3939
|
T(this, "savings", async ({
|
|
3921
3940
|
assetValue: t,
|
|
@@ -3923,23 +3942,23 @@ class Dn {
|
|
|
3923
3942
|
percent: a,
|
|
3924
3943
|
type: s
|
|
3925
3944
|
}) => {
|
|
3926
|
-
const r = s === "add" ? h.DEPOSIT : h.WITHDRAW, o = n ||
|
|
3945
|
+
const r = s === "add" ? h.DEPOSIT : h.WITHDRAW, o = n || N(r, {
|
|
3927
3946
|
ticker: t.ticker,
|
|
3928
3947
|
symbol: t.symbol,
|
|
3929
3948
|
chain: t.chain,
|
|
3930
3949
|
singleSide: !0,
|
|
3931
3950
|
basisPoints: a ? Math.min(1e4, Math.round(a * 100)) : void 0
|
|
3932
|
-
}), p = r === h.DEPOSIT ? t :
|
|
3933
|
-
return f(this,
|
|
3951
|
+
}), p = r === h.DEPOSIT ? t : de(t.chain);
|
|
3952
|
+
return f(this, v).call(this, { memo: o, assetValue: p });
|
|
3934
3953
|
});
|
|
3935
3954
|
T(this, "loan", ({
|
|
3936
3955
|
assetValue: t,
|
|
3937
3956
|
memo: n,
|
|
3938
3957
|
minAmount: a,
|
|
3939
3958
|
type: s
|
|
3940
|
-
}) => f(this,
|
|
3959
|
+
}) => f(this, v).call(this, {
|
|
3941
3960
|
assetValue: t,
|
|
3942
|
-
memo: n ||
|
|
3961
|
+
memo: n || N(s === "open" ? h.OPEN_LOAN : h.CLOSE_LOAN, {
|
|
3943
3962
|
asset: t.toString(),
|
|
3944
3963
|
minAmount: a.toString(),
|
|
3945
3964
|
address: this.getAddress(t.chain)
|
|
@@ -3950,24 +3969,24 @@ class Dn {
|
|
|
3950
3969
|
assetValue: n,
|
|
3951
3970
|
address: a
|
|
3952
3971
|
}) => {
|
|
3953
|
-
const s = t === "bond" ? h.BOND : t === "unbond" ? h.UNBOND : h.LEAVE, r =
|
|
3972
|
+
const s = t === "bond" ? h.BOND : t === "unbond" ? h.UNBOND : h.LEAVE, r = N(s, {
|
|
3954
3973
|
address: a,
|
|
3955
3974
|
unbondAmount: t === "unbond" ? n.getBaseValue("number") : void 0
|
|
3956
3975
|
});
|
|
3957
|
-
return f(this,
|
|
3976
|
+
return f(this, K).call(this, {
|
|
3958
3977
|
memo: r,
|
|
3959
|
-
assetValue: t === "bond" ? n :
|
|
3978
|
+
assetValue: t === "bond" ? n : de(i.THORChain)
|
|
3960
3979
|
});
|
|
3961
3980
|
});
|
|
3962
3981
|
T(this, "registerThorname", ({
|
|
3963
3982
|
assetValue: t,
|
|
3964
3983
|
...n
|
|
3965
|
-
}) => f(this,
|
|
3984
|
+
}) => f(this, K).call(this, { assetValue: t, memo: N(h.THORNAME_REGISTER, n) }));
|
|
3966
3985
|
T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: s = {} }) => {
|
|
3967
3986
|
try {
|
|
3968
3987
|
t.forEach((r) => {
|
|
3969
3988
|
this[r.connectMethodName] = r.connect({
|
|
3970
|
-
addChain: f(this,
|
|
3989
|
+
addChain: f(this, ne),
|
|
3971
3990
|
config: n || {},
|
|
3972
3991
|
apis: a,
|
|
3973
3992
|
rpcUrls: s
|
|
@@ -4043,7 +4062,7 @@ class Dn {
|
|
|
4043
4062
|
T(this, "disconnectChain", (t) => {
|
|
4044
4063
|
this.connectedChains[t] = null, this.connectedWallets[t] = null;
|
|
4045
4064
|
});
|
|
4046
|
-
P(this,
|
|
4065
|
+
P(this, V, async (t) => {
|
|
4047
4066
|
if (t === i.THORChain)
|
|
4048
4067
|
return {
|
|
4049
4068
|
gas_rate: "0",
|
|
@@ -4052,17 +4071,17 @@ class Dn {
|
|
|
4052
4071
|
halted: !1,
|
|
4053
4072
|
chain: i.THORChain
|
|
4054
4073
|
};
|
|
4055
|
-
const a = (await
|
|
4074
|
+
const a = (await Tn(this.stagenet)).find((s) => s.chain === t);
|
|
4056
4075
|
if (!a)
|
|
4057
4076
|
throw new m("core_inbound_data_not_found");
|
|
4058
4077
|
if (a != null && a.halted)
|
|
4059
4078
|
throw new m("core_chain_halted");
|
|
4060
4079
|
return a;
|
|
4061
4080
|
});
|
|
4062
|
-
P(this,
|
|
4081
|
+
P(this, ne, ({ chain: t, wallet: n, walletMethods: a }) => {
|
|
4063
4082
|
this.connectedChains[t] = n, this.connectedWallets[t] = a;
|
|
4064
4083
|
});
|
|
4065
|
-
P(this,
|
|
4084
|
+
P(this, j, async ({
|
|
4066
4085
|
assetValue: t,
|
|
4067
4086
|
type: n = "checkOnly",
|
|
4068
4087
|
contractAddress: a
|
|
@@ -4076,7 +4095,7 @@ class Dn {
|
|
|
4076
4095
|
const _ = this.getAddress(r);
|
|
4077
4096
|
if (!s || !_)
|
|
4078
4097
|
throw new m("core_approve_asset_address_or_from_not_found");
|
|
4079
|
-
const b = a || (await f(this,
|
|
4098
|
+
const b = a || (await f(this, V).call(this, r)).router;
|
|
4080
4099
|
return c({
|
|
4081
4100
|
amount: t.getBaseValue("bigint"),
|
|
4082
4101
|
assetAddress: s,
|
|
@@ -4084,16 +4103,16 @@ class Dn {
|
|
|
4084
4103
|
spenderAddress: b
|
|
4085
4104
|
});
|
|
4086
4105
|
});
|
|
4087
|
-
P(this,
|
|
4106
|
+
P(this, v, async ({
|
|
4088
4107
|
assetValue: t,
|
|
4089
4108
|
memo: n,
|
|
4090
|
-
feeOptionKey: a =
|
|
4109
|
+
feeOptionKey: a = F.Fast
|
|
4091
4110
|
}) => {
|
|
4092
4111
|
const {
|
|
4093
4112
|
gas_rate: s,
|
|
4094
4113
|
router: r,
|
|
4095
4114
|
address: o
|
|
4096
|
-
} = await f(this,
|
|
4115
|
+
} = await f(this, V).call(this, t.chain), p = (parseInt(s) || 0) * wt[a];
|
|
4097
4116
|
return this.deposit({
|
|
4098
4117
|
assetValue: t,
|
|
4099
4118
|
recipient: o,
|
|
@@ -4102,13 +4121,13 @@ class Dn {
|
|
|
4102
4121
|
feeRate: p
|
|
4103
4122
|
});
|
|
4104
4123
|
});
|
|
4105
|
-
P(this,
|
|
4106
|
-
const a = await
|
|
4124
|
+
P(this, K, async ({ memo: t, assetValue: n }) => {
|
|
4125
|
+
const a = await hn(this.stagenet);
|
|
4107
4126
|
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
4108
4127
|
throw new m("core_chain_halted");
|
|
4109
4128
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
4110
4129
|
});
|
|
4111
|
-
P(this,
|
|
4130
|
+
P(this, Y, ({ assetValue: t, ...n }) => ({
|
|
4112
4131
|
...n,
|
|
4113
4132
|
memo: n.memo || "",
|
|
4114
4133
|
from: this.getAddress(t.chain),
|
|
@@ -4117,66 +4136,66 @@ class Dn {
|
|
|
4117
4136
|
this.stagenet = !!t;
|
|
4118
4137
|
}
|
|
4119
4138
|
}
|
|
4120
|
-
|
|
4139
|
+
V = new WeakMap(), ne = new WeakMap(), j = new WeakMap(), v = new WeakMap(), K = new WeakMap(), Y = new WeakMap();
|
|
4121
4140
|
export {
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4141
|
+
Ze as AGG_SWAP,
|
|
4142
|
+
bn as ApiError,
|
|
4143
|
+
q as ApiUrl,
|
|
4144
|
+
M as AssetValue,
|
|
4126
4145
|
w as BaseDecimal,
|
|
4127
|
-
|
|
4146
|
+
ce as BigIntArithmetics,
|
|
4128
4147
|
i as Chain,
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4148
|
+
_e as ChainId,
|
|
4149
|
+
On as ChainIdToChain,
|
|
4150
|
+
pt as ChainToChainId,
|
|
4151
|
+
Ne as ChainToExplorerUrl,
|
|
4152
|
+
gn as ChainToHexChainId,
|
|
4153
|
+
dt as ChainToRPC,
|
|
4154
|
+
st as ContractAddress,
|
|
4155
|
+
En as CosmosChainList,
|
|
4156
|
+
it as DerivationPath,
|
|
4138
4157
|
y as ERROR_CODE,
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4158
|
+
nt as ERROR_MODULE,
|
|
4159
|
+
ve as ERROR_TYPE,
|
|
4160
|
+
rt as EVMChainList,
|
|
4161
|
+
ut as ErrorCode,
|
|
4162
|
+
F as FeeOption,
|
|
4144
4163
|
h as MemoType,
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4164
|
+
wn as NetworkDerivationPath,
|
|
4165
|
+
ze as QuoteMode,
|
|
4166
|
+
Me as RPCUrl,
|
|
4167
|
+
we as RequestClient,
|
|
4168
|
+
et as SWAP_IN,
|
|
4169
|
+
tt as SWAP_OUT,
|
|
4170
|
+
Ln as SwapKitCore,
|
|
4152
4171
|
m as SwapKitError,
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4172
|
+
x as SwapKitNumber,
|
|
4173
|
+
Je as TCAvalancheDepositABI,
|
|
4174
|
+
Qe as TCBscDepositABI,
|
|
4175
|
+
Xe as TCEthereumVaultAbi,
|
|
4176
|
+
Rn as TCSupportedChainList,
|
|
4177
|
+
An as UTXOChainList,
|
|
4178
|
+
lt as WalletOption,
|
|
4179
|
+
In as assetFromString,
|
|
4180
|
+
Bn as derivationPathToString,
|
|
4181
|
+
fn as erc20ABI,
|
|
4182
|
+
Sn as filterAssets,
|
|
4183
|
+
se as formatBigIntToSafeValue,
|
|
4184
|
+
wt as gasFeeMultiplier,
|
|
4185
|
+
Et as getAssetType,
|
|
4186
|
+
It as getAsymmetricAssetShare,
|
|
4187
|
+
Cn as getAsymmetricAssetWithdrawAmount,
|
|
4188
|
+
Ot as getAsymmetricRuneShare,
|
|
4189
|
+
vn as getAsymmetricRuneWithdrawAmount,
|
|
4190
|
+
At as getCommonAssetInfo,
|
|
4191
|
+
bt as getDecimal,
|
|
4192
|
+
Nn as getEstimatedPoolShare,
|
|
4193
|
+
xn as getLiquiditySlippage,
|
|
4194
|
+
N as getMemoFor,
|
|
4195
|
+
de as getMinAmountByChain,
|
|
4196
|
+
St as getSymmetricPoolShare,
|
|
4197
|
+
Mn as getSymmetricWithdraw,
|
|
4198
|
+
Dn as getTHORNameCost,
|
|
4199
|
+
De as isGasAsset,
|
|
4200
|
+
Pn as validateTHORName
|
|
4182
4201
|
};
|