@swapkit/core 1.0.0-rc.67 → 1.0.0-rc.69
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.cjs.map +1 -1
- package/dist/index.es.js +493 -449
- package/dist/index.es.js.map +1 -1
- package/package.json +8 -8
package/dist/index.es.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var T = (e, t, n) => (
|
|
1
|
+
var Ge = Object.defineProperty;
|
|
2
|
+
var qe = (e, t, n) => t in e ? Ge(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var T = (e, t, n) => (qe(e, typeof t != "symbol" ? t + "" : t, n), n), We = (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) => (We(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 je = Object.defineProperty, Ke = (e, t, n) => t in e ? je(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (Ke(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
13
|
+
const _n = [
|
|
14
14
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
15
15
|
{
|
|
16
16
|
anonymous: !1,
|
|
@@ -108,7 +108,7 @@ const bn = [
|
|
|
108
108
|
stateMutability: "nonpayable",
|
|
109
109
|
type: "function"
|
|
110
110
|
}
|
|
111
|
-
],
|
|
111
|
+
], Ye = [
|
|
112
112
|
{
|
|
113
113
|
inputs: [{ internalType: "address", name: "rune", type: "address" }],
|
|
114
114
|
stateMutability: "nonpayable",
|
|
@@ -283,7 +283,7 @@ const bn = [
|
|
|
283
283
|
stateMutability: "view",
|
|
284
284
|
type: "function"
|
|
285
285
|
}
|
|
286
|
-
],
|
|
286
|
+
], Xe = [
|
|
287
287
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
288
288
|
{
|
|
289
289
|
anonymous: !1,
|
|
@@ -447,7 +447,7 @@ const bn = [
|
|
|
447
447
|
stateMutability: "view",
|
|
448
448
|
type: "function"
|
|
449
449
|
}
|
|
450
|
-
],
|
|
450
|
+
], Je = [
|
|
451
451
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
452
452
|
{
|
|
453
453
|
anonymous: !1,
|
|
@@ -600,13 +600,13 @@ const bn = [
|
|
|
600
600
|
type: "function"
|
|
601
601
|
}
|
|
602
602
|
];
|
|
603
|
-
var
|
|
604
|
-
const
|
|
603
|
+
var Qe = /* @__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))(Qe || {});
|
|
604
|
+
const ze = [
|
|
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
|
+
], et = [
|
|
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 Ie = /* @__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))(Ie || {}), tt = /* @__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))(tt || {}), 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 nt = {
|
|
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 at = {
|
|
|
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
|
+
}, oe = (e, t) => {
|
|
680
|
+
let n = nt[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
|
-
|
|
685
|
+
class Se extends Error {
|
|
686
686
|
constructor({
|
|
687
687
|
status: t,
|
|
688
688
|
revision: n,
|
|
@@ -690,22 +690,22 @@ let wn = class Ce extends Error {
|
|
|
690
690
|
code: s,
|
|
691
691
|
message: r,
|
|
692
692
|
type: o,
|
|
693
|
-
options: { shouldLog: p, shouldThrow: d, shouldTrace:
|
|
693
|
+
options: { shouldLog: p, shouldThrow: d, shouldTrace: l } = {
|
|
694
694
|
shouldLog: !0,
|
|
695
695
|
shouldThrow: !0,
|
|
696
696
|
shouldTrace: !0
|
|
697
697
|
},
|
|
698
|
-
displayMessageParams:
|
|
698
|
+
displayMessageParams: u
|
|
699
699
|
}) {
|
|
700
|
-
const m = r ||
|
|
701
|
-
super(m), 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 = m, this.display =
|
|
700
|
+
const m = r || oe(s, u || []) || "";
|
|
701
|
+
super(m), 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 = m, this.display = oe(s, u || []), this.code = s, this.type = o || Ie.UNHANDLED_ERROR, this.options = {
|
|
702
702
|
shouldLog: p || !0,
|
|
703
|
-
shouldTrace:
|
|
703
|
+
shouldTrace: l || !0,
|
|
704
704
|
shouldThrow: d || !1
|
|
705
|
-
}, this.displayMessageParams =
|
|
705
|
+
}, this.displayMessageParams = u || [], this.options.shouldTrace && Error.captureStackTrace(this);
|
|
706
706
|
}
|
|
707
707
|
static fromErrorInfo(t) {
|
|
708
|
-
return new
|
|
708
|
+
return new Se(t);
|
|
709
709
|
}
|
|
710
710
|
toErrorInfo() {
|
|
711
711
|
return { ...this, identifier: this.identifier };
|
|
@@ -714,7 +714,7 @@ let wn = class Ce 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 oe(this.code, this.displayMessageParams || []);
|
|
718
718
|
}
|
|
719
719
|
handle() {
|
|
720
720
|
const t = `[${this.identifier}]: ${this.message}`;
|
|
@@ -723,9 +723,9 @@ let wn = class Ce 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 || {}), at = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(at || {}), st = /* @__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))(st || {});
|
|
728
|
+
const fn = {
|
|
729
729
|
ARB: [44, 60, 0, 0, 0],
|
|
730
730
|
AVAX: [44, 60, 0, 0, 0],
|
|
731
731
|
BCH: [44, 145, 0, 0, 0],
|
|
@@ -742,8 +742,8 @@ const An = {
|
|
|
742
742
|
OP: [44, 60, 0, 0, 0],
|
|
743
743
|
THOR: [44, 931, 0, 0, 0]
|
|
744
744
|
};
|
|
745
|
-
var
|
|
746
|
-
const
|
|
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 it = [
|
|
747
747
|
"ETH",
|
|
748
748
|
"AVAX",
|
|
749
749
|
"BSC",
|
|
@@ -751,18 +751,18 @@ const rt = [
|
|
|
751
751
|
"OP",
|
|
752
752
|
"MATIC"
|
|
753
753
|
/* Polygon */
|
|
754
|
-
],
|
|
754
|
+
], bn = [
|
|
755
755
|
"BTC",
|
|
756
756
|
"BCH",
|
|
757
757
|
"DOGE",
|
|
758
758
|
"LTC"
|
|
759
759
|
/* Litecoin */
|
|
760
|
-
],
|
|
760
|
+
], wn = [
|
|
761
761
|
"GAIA",
|
|
762
762
|
"THOR",
|
|
763
763
|
"BNB"
|
|
764
764
|
/* Binance */
|
|
765
|
-
],
|
|
765
|
+
], An = [
|
|
766
766
|
"AVAX",
|
|
767
767
|
"BNB",
|
|
768
768
|
"BSC",
|
|
@@ -775,26 +775,26 @@ const rt = [
|
|
|
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 || {}), ve = /* @__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))(ve || {}), W = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.net", e.ThorswapStatic = "https://static.thorswap.net", e))(W || {});
|
|
779
|
+
const se = Object.values(i), rt = Object.keys(i), fe = se.reduce(
|
|
780
780
|
(e, t) => {
|
|
781
|
-
const n =
|
|
781
|
+
const n = rt.find((a) => i[a] === t);
|
|
782
782
|
return n && (e[t] = n), e;
|
|
783
783
|
},
|
|
784
784
|
{}
|
|
785
|
-
),
|
|
786
|
-
(e, t) => (e[t] = fe[
|
|
785
|
+
), ot = se.reduce(
|
|
786
|
+
(e, t) => (e[t] = _e[fe[t]], e),
|
|
787
787
|
{}
|
|
788
|
-
),
|
|
789
|
-
(e, t) => (e[t] =
|
|
788
|
+
), pt = se.reduce(
|
|
789
|
+
(e, t) => (e[t] = ve[fe[t]], e),
|
|
790
790
|
{}
|
|
791
|
-
),
|
|
791
|
+
), En = se.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
|
+
), Rn = {
|
|
798
798
|
"0xa4b1": "ARB",
|
|
799
799
|
42161: "ARB",
|
|
800
800
|
"0xa86a": "AVAX",
|
|
@@ -819,7 +819,7 @@ const ae = Object.values(i), ot = Object.keys(i), be = ae.reduce(
|
|
|
819
819
|
"thorchain-stagenet-v2": "THOR",
|
|
820
820
|
"thorchain-mainnet-v1": "THOR"
|
|
821
821
|
/* THORChain */
|
|
822
|
-
},
|
|
822
|
+
}, Ce = {
|
|
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), ot = Object.keys(i), be = ae.reduce(
|
|
|
836
836
|
MATIC: "https://polygonscan.com",
|
|
837
837
|
THOR: "https://runescan.io"
|
|
838
838
|
};
|
|
839
|
-
var
|
|
839
|
+
var dt = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(dt || {}), 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 || {}), ut = /* @__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.OKX_MOBILE = "OKX_MOBILE", e.BRAVE = "BRAVE", e.WALLETCONNECT = "WALLETCONNECT", e))(ut || {}), lt = Object.defineProperty, yt = (e, t, n) => t in e ? lt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, S = (e, t, n) => (yt(e, typeof t != "symbol" ? t + "" : t, n), n), ct = (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
|
-
}, R = (e, t, n) => (
|
|
847
|
-
const
|
|
846
|
+
}, R = (e, t, n) => (ct(e, t, "access private method"), n);
|
|
847
|
+
const mt = "0x313ce567", Me = async ({ chain: e, to: t }) => {
|
|
848
848
|
try {
|
|
849
|
-
const { result: n } = await
|
|
849
|
+
const { result: n } = await we.post(pt[e], {
|
|
850
850
|
headers: {
|
|
851
851
|
accept: "*/*",
|
|
852
852
|
"content-type": "application/json",
|
|
@@ -856,37 +856,37 @@ const Tt = "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: mt }, "latest"]
|
|
860
860
|
})
|
|
861
861
|
});
|
|
862
862
|
return parseInt(BigInt(n).toString());
|
|
863
863
|
} catch (n) {
|
|
864
|
-
return console.error(n),
|
|
864
|
+
return console.error(n), A[e];
|
|
865
865
|
}
|
|
866
|
-
},
|
|
866
|
+
}, Tt = async (e) => {
|
|
867
867
|
if (e === i.Ethereum)
|
|
868
|
-
return
|
|
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") ? Me({ chain: i.Ethereum, to: t }) : A.ETH;
|
|
871
|
+
}, ht = async (e) => {
|
|
872
872
|
const [, t] = e.split("-");
|
|
873
|
-
return t != null && t.startsWith("0x") ?
|
|
874
|
-
},
|
|
873
|
+
return t != null && t.startsWith("0x") ? Me({ chain: i.Avalanche, to: t.toLowerCase() }) : A.AVAX;
|
|
874
|
+
}, _t = async (e) => (e === i.BinanceSmartChain, A.BSC), ft = async ({ chain: e, symbol: t }) => {
|
|
875
875
|
switch (e) {
|
|
876
876
|
case i.Ethereum:
|
|
877
|
-
return
|
|
877
|
+
return Tt(t);
|
|
878
878
|
case i.Avalanche:
|
|
879
|
-
return
|
|
879
|
+
return ht(t);
|
|
880
880
|
case i.BinanceSmartChain:
|
|
881
|
-
return
|
|
881
|
+
return _t(t);
|
|
882
882
|
default:
|
|
883
|
-
return
|
|
883
|
+
return A[e];
|
|
884
884
|
}
|
|
885
|
-
},
|
|
885
|
+
}, bt = {
|
|
886
886
|
[F.Average]: 1.2,
|
|
887
887
|
[F.Fast]: 1.5,
|
|
888
888
|
[F.Fastest]: 2
|
|
889
|
-
},
|
|
889
|
+
}, Ne = ({ chain: e, symbol: t }) => {
|
|
890
890
|
switch (e) {
|
|
891
891
|
case i.Bitcoin:
|
|
892
892
|
case i.BitcoinCash:
|
|
@@ -912,20 +912,20 @@ const Tt = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
912
912
|
case i.THORChain:
|
|
913
913
|
return t === "RUNE";
|
|
914
914
|
}
|
|
915
|
-
},
|
|
915
|
+
}, wt = (e) => {
|
|
916
916
|
switch (e) {
|
|
917
917
|
case "ETH.THOR":
|
|
918
918
|
return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
|
|
919
919
|
case "ETH.vTHOR":
|
|
920
920
|
return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
|
|
921
921
|
case i.Cosmos:
|
|
922
|
-
return { identifier: "GAIA.ATOM", decimal:
|
|
922
|
+
return { identifier: "GAIA.ATOM", decimal: A[e] };
|
|
923
923
|
case i.THORChain:
|
|
924
|
-
return { identifier: "THOR.RUNE", decimal:
|
|
924
|
+
return { identifier: "THOR.RUNE", decimal: A[e] };
|
|
925
925
|
case i.BinanceSmartChain:
|
|
926
|
-
return { identifier: "BSC.BNB", decimal:
|
|
926
|
+
return { identifier: "BSC.BNB", decimal: A[e] };
|
|
927
927
|
case i.Maya:
|
|
928
|
-
return { identifier: "MAYA.CACAO", decimal:
|
|
928
|
+
return { identifier: "MAYA.CACAO", decimal: A.MAYA };
|
|
929
929
|
case "MAYA.MAYA":
|
|
930
930
|
return { identifier: "MAYA.MAYA", decimal: 4 };
|
|
931
931
|
case i.Kujira:
|
|
@@ -939,9 +939,9 @@ const Tt = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
939
939
|
case i.Polygon:
|
|
940
940
|
case i.Bitcoin:
|
|
941
941
|
case i.Ethereum:
|
|
942
|
-
return { identifier: `${e}.${e}`, decimal:
|
|
942
|
+
return { identifier: `${e}.${e}`, decimal: A[e] };
|
|
943
943
|
}
|
|
944
|
-
},
|
|
944
|
+
}, At = ({ chain: e, symbol: t }) => {
|
|
945
945
|
if (t.includes("/"))
|
|
946
946
|
return "Synth";
|
|
947
947
|
switch (e) {
|
|
@@ -971,92 +971,108 @@ const Tt = "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
|
+
}, gn = (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
|
+
}, Et = new RegExp(
|
|
979
979
|
/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
|
|
980
980
|
"gmi"
|
|
981
|
-
),
|
|
981
|
+
), Rt = (e) => {
|
|
982
982
|
const [t, n] = e.split(".");
|
|
983
|
-
if (!
|
|
983
|
+
if (!it.includes(t))
|
|
984
984
|
return !0;
|
|
985
985
|
const [, a] = n.split("-");
|
|
986
|
-
return
|
|
987
|
-
},
|
|
986
|
+
return Ne({ chain: t, symbol: n }) || !!a;
|
|
987
|
+
}, On = (e) => e.filter((t) => {
|
|
988
988
|
const n = `${t.chain}.${t.symbol}`;
|
|
989
|
-
return !
|
|
990
|
-
})
|
|
989
|
+
return !Et.test(n) && Rt(n) && t.value !== "0";
|
|
990
|
+
});
|
|
991
|
+
function gt({
|
|
991
992
|
liquidityUnits: e,
|
|
992
993
|
poolUnits: t,
|
|
993
994
|
runeDepth: n
|
|
994
|
-
})
|
|
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),
|
|
996
|
-
return o.mul(p.sub(d).add(
|
|
997
|
-
}
|
|
995
|
+
}) {
|
|
996
|
+
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);
|
|
997
|
+
return o.mul(p.sub(d).add(l)).div(u);
|
|
998
|
+
}
|
|
999
|
+
function Ot({
|
|
998
1000
|
liquidityUnits: e,
|
|
999
1001
|
poolUnits: t,
|
|
1000
1002
|
assetDepth: n
|
|
1001
|
-
})
|
|
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),
|
|
1003
|
-
return
|
|
1004
|
-
}
|
|
1003
|
+
}) {
|
|
1004
|
+
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)), m = s.mul(s).mul(s);
|
|
1005
|
+
return u.div(m);
|
|
1006
|
+
}
|
|
1007
|
+
function In({
|
|
1005
1008
|
percent: e,
|
|
1006
1009
|
runeDepth: t,
|
|
1007
1010
|
liquidityUnits: n,
|
|
1008
1011
|
poolUnits: a
|
|
1009
|
-
})
|
|
1012
|
+
}) {
|
|
1013
|
+
return gt({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
|
|
1014
|
+
}
|
|
1015
|
+
function Sn({
|
|
1010
1016
|
percent: e,
|
|
1011
1017
|
assetDepth: t,
|
|
1012
1018
|
liquidityUnits: n,
|
|
1013
1019
|
poolUnits: a
|
|
1014
|
-
})
|
|
1020
|
+
}) {
|
|
1021
|
+
return Ot({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
|
|
1022
|
+
}
|
|
1023
|
+
function g(e) {
|
|
1024
|
+
return N.fromBigInt(BigInt(e), A.THOR);
|
|
1025
|
+
}
|
|
1026
|
+
function It({
|
|
1015
1027
|
liquidityUnits: e,
|
|
1016
1028
|
poolUnits: t,
|
|
1017
1029
|
runeDepth: n,
|
|
1018
1030
|
assetDepth: a
|
|
1019
|
-
})
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1031
|
+
}) {
|
|
1032
|
+
return {
|
|
1033
|
+
assetAmount: g(a).mul(e).div(t),
|
|
1034
|
+
runeAmount: g(n).mul(e).div(t)
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
function vn({
|
|
1023
1038
|
liquidityUnits: e,
|
|
1024
1039
|
poolUnits: t,
|
|
1025
1040
|
runeDepth: n,
|
|
1026
1041
|
assetDepth: a,
|
|
1027
1042
|
percent: s
|
|
1028
|
-
})
|
|
1029
|
-
Object.
|
|
1030
|
-
(
|
|
1031
|
-
|
|
1032
|
-
)
|
|
1043
|
+
}) {
|
|
1044
|
+
return Object.fromEntries(
|
|
1045
|
+
Object.entries(It({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
|
|
1046
|
+
([r, o]) => [r, o.mul(s)]
|
|
1047
|
+
)
|
|
1048
|
+
);
|
|
1049
|
+
}
|
|
1050
|
+
function Cn({
|
|
1033
1051
|
runeDepth: e,
|
|
1034
1052
|
poolUnits: t,
|
|
1035
1053
|
assetDepth: n,
|
|
1036
1054
|
liquidityUnits: a,
|
|
1037
1055
|
runeAmount: s,
|
|
1038
1056
|
assetAmount: r
|
|
1039
|
-
})
|
|
1040
|
-
const o = new
|
|
1057
|
+
}) {
|
|
1058
|
+
const o = new N({ value: e, decimal: 8 }), p = new N({ value: n, decimal: 8 }), d = new N({ value: t, decimal: 8 }), l = new N({ value: s, decimal: 8 }), u = new N({ value: r, decimal: 8 }), m = l.mul(p), _ = u.mul(o), b = l.mul(u), w = o.mul(p), E = d.mul(m.add(_.add(b.mul(2)))), O = m.add(_.add(w.mul(2))), I = E.div(O), D = g(a).add(I);
|
|
1041
1059
|
if (I.getBaseValue("number") === 0)
|
|
1042
1060
|
return D.div(d).getBaseValue("number");
|
|
1043
|
-
const
|
|
1044
|
-
return D.div(
|
|
1045
|
-
}
|
|
1061
|
+
const re = d.add(D);
|
|
1062
|
+
return D.div(re).getBaseValue("number");
|
|
1063
|
+
}
|
|
1064
|
+
function Mn({
|
|
1046
1065
|
runeAmount: e,
|
|
1047
1066
|
assetAmount: t,
|
|
1048
1067
|
runeDepth: n,
|
|
1049
1068
|
assetDepth: a
|
|
1050
|
-
})
|
|
1069
|
+
}) {
|
|
1051
1070
|
if (e === "0" || t === "0" || n === "0" || a === "0")
|
|
1052
1071
|
return 0;
|
|
1053
|
-
const s = g(n), r = g(a), o = g(t), p = g(e), d = o.mul(s).sub(r.mul(p)),
|
|
1054
|
-
return Math.abs(d.div(
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
ticker: t,
|
|
1058
|
-
chain: n
|
|
1059
|
-
}) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e, M = (e, t) => {
|
|
1072
|
+
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));
|
|
1073
|
+
return Math.abs(d.div(l).getBaseValue("number"));
|
|
1074
|
+
}
|
|
1075
|
+
const M = (e, t) => {
|
|
1060
1076
|
switch (e) {
|
|
1061
1077
|
case h.LEAVE:
|
|
1062
1078
|
case h.BOND: {
|
|
@@ -1087,8 +1103,8 @@ const Tt = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
1087
1103
|
})(n, a)}:${s || ""}:t:0`;
|
|
1088
1104
|
}
|
|
1089
1105
|
case h.WITHDRAW: {
|
|
1090
|
-
const { chain: n, ticker: a, symbol: s, basisPoints: r, targetAssetString: o, singleSide: p } = t, d =
|
|
1091
|
-
return `${e}:${n}${p ? "/" : "."}${
|
|
1106
|
+
const { chain: n, ticker: a, symbol: s, basisPoints: r, targetAssetString: o, singleSide: p } = t, d = n === "ETH" && a !== "ETH" ? `${a}-${s.slice(-3)}` : s, l = !p && o ? `:${o}` : "";
|
|
1107
|
+
return `${e}:${n}${p ? "/" : "."}${d}:${r}${l}`;
|
|
1092
1108
|
}
|
|
1093
1109
|
case h.OPEN_LOAN:
|
|
1094
1110
|
case h.CLOSE_LOAN: {
|
|
@@ -1098,17 +1114,22 @@ const Tt = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
1098
1114
|
default:
|
|
1099
1115
|
return "";
|
|
1100
1116
|
}
|
|
1101
|
-
}
|
|
1117
|
+
};
|
|
1118
|
+
function Nn(e) {
|
|
1102
1119
|
if (e < 0)
|
|
1103
1120
|
throw new Error("Invalid number of year");
|
|
1104
1121
|
return 10 + e;
|
|
1105
|
-
}
|
|
1122
|
+
}
|
|
1123
|
+
function xn(e) {
|
|
1106
1124
|
if (e.length > 30)
|
|
1107
1125
|
return !1;
|
|
1108
1126
|
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
1109
1127
|
return !!e.match(t);
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1128
|
+
}
|
|
1129
|
+
function Dn([e, t, n, a, s]) {
|
|
1130
|
+
return `${e}'/${t}'/${n}'/${a}${typeof s != "number" ? "" : `/${s}`}`;
|
|
1131
|
+
}
|
|
1132
|
+
class Ae extends Error {
|
|
1112
1133
|
constructor(t, n, a) {
|
|
1113
1134
|
const s = t.status || t.status === 0 ? t.status : "", r = t.statusText || "", o = `${s} ${r}`.trim(), p = o ? `status code ${o}` : "an unknown error";
|
|
1114
1135
|
super(`Request failed with ${p}`), Object.defineProperty(this, "response", {
|
|
@@ -1129,7 +1150,7 @@ class Ee extends Error {
|
|
|
1129
1150
|
}), this.name = "HTTPError", this.response = t, this.request = n, this.options = a;
|
|
1130
1151
|
}
|
|
1131
1152
|
}
|
|
1132
|
-
class
|
|
1153
|
+
class xe extends Error {
|
|
1133
1154
|
constructor(t) {
|
|
1134
1155
|
super("Request timed out"), Object.defineProperty(this, "request", {
|
|
1135
1156
|
enumerable: !0,
|
|
@@ -1139,28 +1160,28 @@ class Pe extends Error {
|
|
|
1139
1160
|
}), this.name = "TimeoutError", this.request = t;
|
|
1140
1161
|
}
|
|
1141
1162
|
}
|
|
1142
|
-
const
|
|
1163
|
+
const Q = (e) => e !== null && typeof e == "object", J = (...e) => {
|
|
1143
1164
|
for (const t of e)
|
|
1144
|
-
if ((!
|
|
1165
|
+
if ((!Q(t) || Array.isArray(t)) && t !== void 0)
|
|
1145
1166
|
throw new TypeError("The `options` argument must be an object");
|
|
1146
|
-
return
|
|
1147
|
-
},
|
|
1167
|
+
return be({}, ...e);
|
|
1168
|
+
}, De = (e = {}, t = {}) => {
|
|
1148
1169
|
const n = new globalThis.Headers(e), a = t instanceof globalThis.Headers, s = new globalThis.Headers(t);
|
|
1149
1170
|
for (const [r, o] of s.entries())
|
|
1150
1171
|
a && o === "undefined" || o === void 0 ? n.delete(r) : n.set(r, o);
|
|
1151
1172
|
return n;
|
|
1152
|
-
},
|
|
1173
|
+
}, be = (...e) => {
|
|
1153
1174
|
let t = {}, n = {};
|
|
1154
1175
|
for (const a of e)
|
|
1155
1176
|
if (Array.isArray(a))
|
|
1156
1177
|
Array.isArray(t) || (t = []), t = [...t, ...a];
|
|
1157
|
-
else if (
|
|
1178
|
+
else if (Q(a)) {
|
|
1158
1179
|
for (let [s, r] of Object.entries(a))
|
|
1159
|
-
|
|
1160
|
-
|
|
1180
|
+
Q(r) && s in t && (r = be(t[s], r)), t = { ...t, [s]: r };
|
|
1181
|
+
Q(a.headers) && (n = De(n, a.headers), t.headers = n);
|
|
1161
1182
|
}
|
|
1162
1183
|
return t;
|
|
1163
|
-
},
|
|
1184
|
+
}, St = (() => {
|
|
1164
1185
|
let e = !1, t = !1;
|
|
1165
1186
|
const n = typeof globalThis.ReadableStream == "function", a = typeof globalThis.Request == "function";
|
|
1166
1187
|
return n && a && (t = new globalThis.Request("https://empty.invalid", {
|
|
@@ -1171,13 +1192,13 @@ const J = (e) => e !== null && typeof e == "object", X = (...e) => {
|
|
|
1171
1192
|
return e = !0, "half";
|
|
1172
1193
|
}
|
|
1173
1194
|
}).headers.has("Content-Type")), e && !t;
|
|
1174
|
-
})(),
|
|
1195
|
+
})(), vt = typeof globalThis.AbortController == "function", Ct = typeof globalThis.ReadableStream == "function", Mt = typeof globalThis.FormData == "function", Pe = ["get", "post", "put", "patch", "head", "delete"], Nt = {
|
|
1175
1196
|
json: "application/json",
|
|
1176
1197
|
text: "text/*",
|
|
1177
1198
|
formData: "multipart/form-data",
|
|
1178
1199
|
arrayBuffer: "*/*",
|
|
1179
1200
|
blob: "*/*"
|
|
1180
|
-
},
|
|
1201
|
+
}, pe = 2147483647, Be = Symbol("stop"), xt = {
|
|
1181
1202
|
json: !0,
|
|
1182
1203
|
parseJson: !0,
|
|
1183
1204
|
searchParams: !0,
|
|
@@ -1188,7 +1209,7 @@ const J = (e) => e !== null && typeof e == "object", X = (...e) => {
|
|
|
1188
1209
|
throwHttpErrors: !0,
|
|
1189
1210
|
onDownloadProgress: !0,
|
|
1190
1211
|
fetch: !0
|
|
1191
|
-
},
|
|
1212
|
+
}, Dt = {
|
|
1192
1213
|
method: !0,
|
|
1193
1214
|
headers: !0,
|
|
1194
1215
|
body: !0,
|
|
@@ -1204,18 +1225,18 @@ const J = (e) => e !== null && typeof e == "object", X = (...e) => {
|
|
|
1204
1225
|
window: !0,
|
|
1205
1226
|
dispatcher: !0,
|
|
1206
1227
|
duplex: !0
|
|
1207
|
-
},
|
|
1228
|
+
}, Pt = (e) => Pe.includes(e) ? e.toUpperCase() : e, Bt = ["get", "put", "head", "delete", "options", "trace"], Lt = [408, 413, 429, 500, 502, 503, 504], Le = [413, 429, 503], Ee = {
|
|
1208
1229
|
limit: 2,
|
|
1209
|
-
methods:
|
|
1210
|
-
statusCodes:
|
|
1211
|
-
afterStatusCodes:
|
|
1230
|
+
methods: Bt,
|
|
1231
|
+
statusCodes: Lt,
|
|
1232
|
+
afterStatusCodes: Le,
|
|
1212
1233
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
1213
1234
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
1214
1235
|
delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
|
|
1215
|
-
},
|
|
1236
|
+
}, Vt = (e = {}) => {
|
|
1216
1237
|
if (typeof e == "number")
|
|
1217
1238
|
return {
|
|
1218
|
-
...
|
|
1239
|
+
...Ee,
|
|
1219
1240
|
limit: e
|
|
1220
1241
|
};
|
|
1221
1242
|
if (e.methods && !Array.isArray(e.methods))
|
|
@@ -1223,22 +1244,22 @@ const J = (e) => e !== null && typeof e == "object", X = (...e) => {
|
|
|
1223
1244
|
if (e.statusCodes && !Array.isArray(e.statusCodes))
|
|
1224
1245
|
throw new Error("retry.statusCodes must be an array");
|
|
1225
1246
|
return {
|
|
1226
|
-
...
|
|
1247
|
+
...Ee,
|
|
1227
1248
|
...e,
|
|
1228
|
-
afterStatusCodes:
|
|
1249
|
+
afterStatusCodes: Le
|
|
1229
1250
|
};
|
|
1230
1251
|
};
|
|
1231
|
-
async function
|
|
1252
|
+
async function Ut(e, t, n, a) {
|
|
1232
1253
|
return new Promise((s, r) => {
|
|
1233
1254
|
const o = setTimeout(() => {
|
|
1234
|
-
n && n.abort(), r(new
|
|
1255
|
+
n && n.abort(), r(new xe(e));
|
|
1235
1256
|
}, a.timeout);
|
|
1236
1257
|
a.fetch(e, t).then(s).catch(r).then(() => {
|
|
1237
1258
|
clearTimeout(o);
|
|
1238
1259
|
});
|
|
1239
1260
|
});
|
|
1240
1261
|
}
|
|
1241
|
-
async function
|
|
1262
|
+
async function Ht(e, { signal: t }) {
|
|
1242
1263
|
return new Promise((n, a) => {
|
|
1243
1264
|
t && (t.throwIfAborted(), t.addEventListener("abort", s, { once: !0 }));
|
|
1244
1265
|
function s() {
|
|
@@ -1249,17 +1270,17 @@ async function kt(e, { signal: t }) {
|
|
|
1249
1270
|
}, e);
|
|
1250
1271
|
});
|
|
1251
1272
|
}
|
|
1252
|
-
const
|
|
1273
|
+
const $t = (e, t) => {
|
|
1253
1274
|
const n = {};
|
|
1254
1275
|
for (const a in t)
|
|
1255
|
-
!(a in
|
|
1276
|
+
!(a in Dt) && !(a in xt) && !(a in e) && (n[a] = t[a]);
|
|
1256
1277
|
return n;
|
|
1257
1278
|
};
|
|
1258
|
-
class
|
|
1279
|
+
class ee {
|
|
1259
1280
|
static create(t, n) {
|
|
1260
|
-
const a = new
|
|
1261
|
-
if (typeof a._options.timeout == "number" && a._options.timeout >
|
|
1262
|
-
throw new RangeError(`The \`timeout\` option cannot be greater than ${
|
|
1281
|
+
const a = new ee(t, n), s = async () => {
|
|
1282
|
+
if (typeof a._options.timeout == "number" && a._options.timeout > pe)
|
|
1283
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${pe}`);
|
|
1263
1284
|
await Promise.resolve();
|
|
1264
1285
|
let o = await a._fetch();
|
|
1265
1286
|
for (const p of a._options.hooks.afterResponse) {
|
|
@@ -1267,7 +1288,7 @@ class Z {
|
|
|
1267
1288
|
d instanceof globalThis.Response && (o = d);
|
|
1268
1289
|
}
|
|
1269
1290
|
if (a._decorateResponse(o), !o.ok && a._options.throwHttpErrors) {
|
|
1270
|
-
let p = new
|
|
1291
|
+
let p = new Ae(o, a.request, a._options);
|
|
1271
1292
|
for (const d of a._options.hooks.beforeError)
|
|
1272
1293
|
p = await d(p);
|
|
1273
1294
|
throw p;
|
|
@@ -1275,13 +1296,13 @@ class Z {
|
|
|
1275
1296
|
if (a._options.onDownloadProgress) {
|
|
1276
1297
|
if (typeof a._options.onDownloadProgress != "function")
|
|
1277
1298
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
1278
|
-
if (!
|
|
1299
|
+
if (!Ct)
|
|
1279
1300
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
1280
1301
|
return a._stream(o.clone(), a._options.onDownloadProgress);
|
|
1281
1302
|
}
|
|
1282
1303
|
return o;
|
|
1283
1304
|
}, r = a._options.retry.methods.includes(a.request.method.toLowerCase()) ? a._retry(s) : s();
|
|
1284
|
-
for (const [o, p] of Object.entries(
|
|
1305
|
+
for (const [o, p] of Object.entries(Nt))
|
|
1285
1306
|
r[o] = async () => {
|
|
1286
1307
|
a.request.headers.set("accept", a.request.headers.get("accept") || p);
|
|
1287
1308
|
const d = (await r).clone();
|
|
@@ -1326,17 +1347,17 @@ class Z {
|
|
|
1326
1347
|
// TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
|
|
1327
1348
|
credentials: this._input.credentials || "same-origin",
|
|
1328
1349
|
...n,
|
|
1329
|
-
headers:
|
|
1330
|
-
hooks:
|
|
1350
|
+
headers: De(this._input.headers, n.headers),
|
|
1351
|
+
hooks: be({
|
|
1331
1352
|
beforeRequest: [],
|
|
1332
1353
|
beforeRetry: [],
|
|
1333
1354
|
beforeError: [],
|
|
1334
1355
|
afterResponse: []
|
|
1335
1356
|
}, n.hooks),
|
|
1336
|
-
method:
|
|
1357
|
+
method: Pt(n.method ?? this._input.method),
|
|
1337
1358
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
1338
1359
|
prefixUrl: String(n.prefixUrl || ""),
|
|
1339
|
-
retry:
|
|
1360
|
+
retry: Vt(n.retry),
|
|
1340
1361
|
throwHttpErrors: n.throwHttpErrors !== !1,
|
|
1341
1362
|
timeout: n.timeout ?? 1e4,
|
|
1342
1363
|
fetch: n.fetch ?? globalThis.fetch.bind(globalThis)
|
|
@@ -1347,7 +1368,7 @@ class Z {
|
|
|
1347
1368
|
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
1348
1369
|
this._options.prefixUrl.endsWith("/") || (this._options.prefixUrl += "/"), this._input = this._options.prefixUrl + this._input;
|
|
1349
1370
|
}
|
|
1350
|
-
if (
|
|
1371
|
+
if (vt) {
|
|
1351
1372
|
if (this.abortController = new globalThis.AbortController(), this._options.signal) {
|
|
1352
1373
|
const a = this._options.signal;
|
|
1353
1374
|
this._options.signal.addEventListener("abort", () => {
|
|
@@ -1356,15 +1377,15 @@ class Z {
|
|
|
1356
1377
|
}
|
|
1357
1378
|
this._options.signal = this.abortController.signal;
|
|
1358
1379
|
}
|
|
1359
|
-
if (
|
|
1380
|
+
if (St && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
|
|
1360
1381
|
const a = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), s = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, a);
|
|
1361
|
-
(
|
|
1382
|
+
(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);
|
|
1362
1383
|
}
|
|
1363
1384
|
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 }));
|
|
1364
1385
|
}
|
|
1365
1386
|
_calculateRetryDelay(t) {
|
|
1366
|
-
if (this._retryCount++, this._retryCount < this._options.retry.limit && !(t instanceof
|
|
1367
|
-
if (t instanceof
|
|
1387
|
+
if (this._retryCount++, this._retryCount < this._options.retry.limit && !(t instanceof xe)) {
|
|
1388
|
+
if (t instanceof Ae) {
|
|
1368
1389
|
if (!this._options.retry.statusCodes.includes(t.response.status))
|
|
1369
1390
|
return 0;
|
|
1370
1391
|
const a = t.response.headers.get("Retry-After");
|
|
@@ -1387,16 +1408,16 @@ class Z {
|
|
|
1387
1408
|
try {
|
|
1388
1409
|
return await t();
|
|
1389
1410
|
} catch (n) {
|
|
1390
|
-
const a = Math.min(this._calculateRetryDelay(n),
|
|
1411
|
+
const a = Math.min(this._calculateRetryDelay(n), pe);
|
|
1391
1412
|
if (a !== 0 && this._retryCount > 0) {
|
|
1392
|
-
await
|
|
1413
|
+
await Ht(a, { signal: this._options.signal });
|
|
1393
1414
|
for (const s of this._options.hooks.beforeRetry)
|
|
1394
1415
|
if (await s({
|
|
1395
1416
|
request: this.request,
|
|
1396
1417
|
options: this._options,
|
|
1397
1418
|
error: n,
|
|
1398
1419
|
retryCount: this._retryCount
|
|
1399
|
-
}) ===
|
|
1420
|
+
}) === Be)
|
|
1400
1421
|
return;
|
|
1401
1422
|
return this._retry(t);
|
|
1402
1423
|
}
|
|
@@ -1413,8 +1434,8 @@ class Z {
|
|
|
1413
1434
|
if (a instanceof Response)
|
|
1414
1435
|
return a;
|
|
1415
1436
|
}
|
|
1416
|
-
const t =
|
|
1417
|
-
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) :
|
|
1437
|
+
const t = $t(this.request, this._options);
|
|
1438
|
+
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Ut(this.request.clone(), t, this.abortController, this._options);
|
|
1418
1439
|
}
|
|
1419
1440
|
/* istanbul ignore next */
|
|
1420
1441
|
_stream(t, n) {
|
|
@@ -1429,17 +1450,17 @@ class Z {
|
|
|
1429
1450
|
const o = t.body.getReader();
|
|
1430
1451
|
n && n({ percent: 0, transferredBytes: 0, totalBytes: a }, new Uint8Array());
|
|
1431
1452
|
async function p() {
|
|
1432
|
-
const { done: d, value:
|
|
1453
|
+
const { done: d, value: l } = await o.read();
|
|
1433
1454
|
if (d) {
|
|
1434
1455
|
r.close();
|
|
1435
1456
|
return;
|
|
1436
1457
|
}
|
|
1437
1458
|
if (n) {
|
|
1438
|
-
s +=
|
|
1439
|
-
const
|
|
1440
|
-
n({ percent:
|
|
1459
|
+
s += l.byteLength;
|
|
1460
|
+
const u = a === 0 ? 0 : s / a;
|
|
1461
|
+
n({ percent: u, transferredBytes: s, totalBytes: a }, l);
|
|
1441
1462
|
}
|
|
1442
|
-
r.enqueue(
|
|
1463
|
+
r.enqueue(l), await p();
|
|
1443
1464
|
}
|
|
1444
1465
|
await p();
|
|
1445
1466
|
}
|
|
@@ -1451,30 +1472,34 @@ class Z {
|
|
|
1451
1472
|
}
|
|
1452
1473
|
}
|
|
1453
1474
|
/*! MIT License © Sindre Sorhus */
|
|
1454
|
-
const
|
|
1455
|
-
const t = (n, a) =>
|
|
1456
|
-
for (const n of
|
|
1457
|
-
t[n] = (a, s) =>
|
|
1458
|
-
return t.create = (n) =>
|
|
1459
|
-
},
|
|
1460
|
-
get: (e, t) =>
|
|
1461
|
-
post: (e, t) =>
|
|
1462
|
-
},
|
|
1475
|
+
const ye = (e) => {
|
|
1476
|
+
const t = (n, a) => ee.create(n, J(e, a));
|
|
1477
|
+
for (const n of Pe)
|
|
1478
|
+
t[n] = (a, s) => ee.create(a, J(e, s, { method: n }));
|
|
1479
|
+
return t.create = (n) => ye(J(n)), t.extend = (n) => ye(J(e, n)), t.stop = Be, t;
|
|
1480
|
+
}, kt = ye(), Ft = kt, Gt = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, Re = Ft.create({ headers: Gt }), we = {
|
|
1481
|
+
get: (e, t) => Re.get(e, t).json(),
|
|
1482
|
+
post: (e, t) => Re.post(e, t).json()
|
|
1483
|
+
}, ge = [...Object.values(i), "TERRA"];
|
|
1484
|
+
function qt(e = "") {
|
|
1463
1485
|
const t = e.toUpperCase(), [n] = t.split(".");
|
|
1464
|
-
if (
|
|
1486
|
+
if (ge.includes(n))
|
|
1465
1487
|
return !0;
|
|
1466
1488
|
const [a] = t.split("/");
|
|
1467
|
-
if (
|
|
1489
|
+
if (ge.includes(a))
|
|
1468
1490
|
return !0;
|
|
1469
1491
|
throw new Error(
|
|
1470
1492
|
`Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
|
|
1471
1493
|
);
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1494
|
+
}
|
|
1495
|
+
const j = 8, L = (e) => 10n ** BigInt(e), G = (e) => Math.log10(parseFloat(e.toString()));
|
|
1496
|
+
function ie({
|
|
1474
1497
|
value: e,
|
|
1475
|
-
bigIntDecimal: t =
|
|
1476
|
-
decimal: n =
|
|
1498
|
+
bigIntDecimal: t = j,
|
|
1499
|
+
decimal: n = j
|
|
1477
1500
|
}) {
|
|
1501
|
+
if (n === 0)
|
|
1502
|
+
return e.toString();
|
|
1478
1503
|
const a = e < 0n;
|
|
1479
1504
|
let s = e.toString().substring(a ? 1 : 0);
|
|
1480
1505
|
const r = n - (s.length - 1);
|
|
@@ -1486,17 +1511,17 @@ function se({
|
|
|
1486
1511
|
""
|
|
1487
1512
|
);
|
|
1488
1513
|
}
|
|
1489
|
-
var U, k, B, H,
|
|
1490
|
-
const
|
|
1514
|
+
var U, k, B, H, ce, Ve, z, de, te, me;
|
|
1515
|
+
const Wt = class Ue {
|
|
1491
1516
|
constructor(t) {
|
|
1492
|
-
$(this, U), $(this, B), $(this,
|
|
1517
|
+
$(this, U), $(this, B), $(this, ce), $(this, z), $(this, te), S(this, "decimalMultiplier", 10n ** 8n), S(this, "bigIntValue", 0n), S(this, "decimal");
|
|
1493
1518
|
const n = Te(t), a = typeof t == "object";
|
|
1494
|
-
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier : L(Math.max(
|
|
1519
|
+
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier : L(Math.max($e(ne(n)), this.decimal || 0)), R(this, ce, Ve).call(this, n);
|
|
1495
1520
|
}
|
|
1496
1521
|
static fromBigInt(t, n) {
|
|
1497
|
-
return new
|
|
1522
|
+
return new Ue({
|
|
1498
1523
|
decimal: n,
|
|
1499
|
-
value:
|
|
1524
|
+
value: ie({ value: t, bigIntDecimal: n, decimal: n })
|
|
1500
1525
|
});
|
|
1501
1526
|
}
|
|
1502
1527
|
static shiftDecimals({
|
|
@@ -1556,7 +1581,7 @@ const Kt = class $e {
|
|
|
1556
1581
|
}
|
|
1557
1582
|
// @ts-expect-error
|
|
1558
1583
|
getBaseValue(t) {
|
|
1559
|
-
const n = this.decimalMultiplier / L(this.decimal ||
|
|
1584
|
+
const n = this.decimalMultiplier / L(this.decimal || A.THOR), a = this.bigIntValue / n;
|
|
1560
1585
|
switch (t) {
|
|
1561
1586
|
case "number":
|
|
1562
1587
|
return Number(a);
|
|
@@ -1569,8 +1594,8 @@ const Kt = class $e {
|
|
|
1569
1594
|
getBigIntValue(t, n) {
|
|
1570
1595
|
if (!n && typeof t == "object")
|
|
1571
1596
|
return t.bigIntValue;
|
|
1572
|
-
const a = Te(t), s =
|
|
1573
|
-
return s === "0" || s === "undefined" ? 0n : R(this,
|
|
1597
|
+
const a = Te(t), s = ne(a);
|
|
1598
|
+
return s === "0" || s === "undefined" ? 0n : R(this, te, me).call(this, s, n);
|
|
1574
1599
|
}
|
|
1575
1600
|
toSignificant(t = 6) {
|
|
1576
1601
|
const [n, a] = this.getValue("string").split("."), s = n || "", r = a || "";
|
|
@@ -1612,36 +1637,36 @@ const Kt = class $e {
|
|
|
1612
1637
|
decimalSeparator: s = ".",
|
|
1613
1638
|
thousandSeparator: r = ","
|
|
1614
1639
|
} = {}) {
|
|
1615
|
-
const o = this.getValue("number"), [p, d = ""] = o.toFixed(6).split("."),
|
|
1616
|
-
return `${n === "start" ? t : ""}${
|
|
1640
|
+
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)}` : ""}`;
|
|
1641
|
+
return `${n === "start" ? t : ""}${u}${n === "end" ? t : ""}`;
|
|
1617
1642
|
}
|
|
1618
1643
|
formatBigIntToSafeValue(t, n) {
|
|
1619
|
-
const a = n || this.decimal ||
|
|
1644
|
+
const a = n || this.decimal || j, s = Math.max(
|
|
1620
1645
|
a,
|
|
1621
1646
|
G(this.decimalMultiplier)
|
|
1622
|
-
), r = t < 0n, o = t.toString().substring(r ? 1 : 0), p = s - (o.length - 1), d = p > 0 ? "0".repeat(p) + o : o,
|
|
1623
|
-
let
|
|
1624
|
-
return parseInt(
|
|
1647
|
+
), 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;
|
|
1648
|
+
let u = d.slice(-s);
|
|
1649
|
+
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(
|
|
1625
1650
|
0,
|
|
1626
|
-
|
|
1627
|
-
)}.${
|
|
1651
|
+
l
|
|
1652
|
+
)}.${u}`.replace(/\.?0*$/, "");
|
|
1628
1653
|
}
|
|
1629
1654
|
};
|
|
1630
1655
|
U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
1631
|
-
const n = R(this,
|
|
1656
|
+
const n = R(this, z, de).call(this, this, ...t), a = Math.max(n, G(this.decimalMultiplier)), s = L(a), r = t.reduce(
|
|
1632
1657
|
(p, d) => {
|
|
1633
|
-
const
|
|
1658
|
+
const l = this.getBigIntValue(d, a);
|
|
1634
1659
|
switch (e) {
|
|
1635
1660
|
case "add":
|
|
1636
|
-
return p +
|
|
1661
|
+
return p + l;
|
|
1637
1662
|
case "sub":
|
|
1638
|
-
return p -
|
|
1663
|
+
return p - l;
|
|
1639
1664
|
case "mul":
|
|
1640
|
-
return p *
|
|
1665
|
+
return p * l / s;
|
|
1641
1666
|
case "div": {
|
|
1642
|
-
if (
|
|
1667
|
+
if (l === 0n)
|
|
1643
1668
|
throw new RangeError("Division by zero");
|
|
1644
|
-
return p * s /
|
|
1669
|
+
return p * s / l;
|
|
1645
1670
|
}
|
|
1646
1671
|
default:
|
|
1647
1672
|
return p;
|
|
@@ -1649,7 +1674,7 @@ U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
|
1649
1674
|
},
|
|
1650
1675
|
//normalize is to precision multiplier base
|
|
1651
1676
|
this.bigIntValue * s / this.decimalMultiplier
|
|
1652
|
-
), o =
|
|
1677
|
+
), o = ie({
|
|
1653
1678
|
bigIntDecimal: a,
|
|
1654
1679
|
decimal: a,
|
|
1655
1680
|
value: r
|
|
@@ -1661,7 +1686,7 @@ U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
|
1661
1686
|
identifier: this.toString()
|
|
1662
1687
|
});
|
|
1663
1688
|
}, B = /* @__PURE__ */ new WeakSet(), H = function(e, ...t) {
|
|
1664
|
-
const n = R(this,
|
|
1689
|
+
const n = R(this, z, de).call(this, this, ...t), a = this.getBigIntValue(t[0], n), s = this.getBigIntValue(this, n);
|
|
1665
1690
|
switch (e) {
|
|
1666
1691
|
case "gt":
|
|
1667
1692
|
return s > a;
|
|
@@ -1674,52 +1699,46 @@ U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
|
1674
1699
|
case "eqValue":
|
|
1675
1700
|
return s === a;
|
|
1676
1701
|
}
|
|
1677
|
-
},
|
|
1678
|
-
const t =
|
|
1679
|
-
this.bigIntValue = R(this,
|
|
1680
|
-
},
|
|
1681
|
-
const t = e.map((n) => typeof n == "object" ? n.decimal || G(n.decimalMultiplier) :
|
|
1682
|
-
return Math.max(...t,
|
|
1683
|
-
},
|
|
1702
|
+
}, ce = /* @__PURE__ */ new WeakSet(), Ve = function(e) {
|
|
1703
|
+
const t = ne(e) || "0";
|
|
1704
|
+
this.bigIntValue = R(this, te, me).call(this, t);
|
|
1705
|
+
}, z = /* @__PURE__ */ new WeakSet(), de = function(...e) {
|
|
1706
|
+
const t = e.map((n) => typeof n == "object" ? n.decimal || G(n.decimalMultiplier) : $e(ne(n))).filter(Boolean);
|
|
1707
|
+
return Math.max(...t, j);
|
|
1708
|
+
}, te = /* @__PURE__ */ new WeakSet(), me = function(e, t) {
|
|
1684
1709
|
const n = t ? L(t) : this.decimalMultiplier, a = G(n), [s = "", r = ""] = e.split(".");
|
|
1685
1710
|
return BigInt(`${s}${r.padEnd(a, "0")}`);
|
|
1686
1711
|
};
|
|
1687
|
-
let
|
|
1688
|
-
const
|
|
1712
|
+
let He = Wt;
|
|
1713
|
+
const jt = Intl.NumberFormat("fullwide", {
|
|
1689
1714
|
useGrouping: !1,
|
|
1690
1715
|
maximumFractionDigits: 20
|
|
1691
1716
|
});
|
|
1692
|
-
function
|
|
1693
|
-
const t = `${typeof e == "number" ?
|
|
1717
|
+
function ne(e) {
|
|
1718
|
+
const t = `${typeof e == "number" ? jt.format(e) : Te(e)}`.replaceAll(",", ".").split(".");
|
|
1694
1719
|
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1695
1720
|
}
|
|
1696
|
-
function
|
|
1721
|
+
function $e(e) {
|
|
1697
1722
|
var t;
|
|
1698
1723
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1699
|
-
return Math.max(n,
|
|
1724
|
+
return Math.max(n, j);
|
|
1700
1725
|
}
|
|
1701
1726
|
function Te(e) {
|
|
1702
1727
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1703
1728
|
}
|
|
1704
|
-
const
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
};
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`;
|
|
1718
|
-
super(
|
|
1719
|
-
t.value instanceof me ? t.value : { decimal: t.decimal, value: t.value }
|
|
1720
|
-
), 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");
|
|
1721
|
-
const a = _e(n);
|
|
1722
|
-
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;
|
|
1729
|
+
const q = /* @__PURE__ */ new Map();
|
|
1730
|
+
class x extends He {
|
|
1731
|
+
constructor({
|
|
1732
|
+
value: t,
|
|
1733
|
+
decimal: n,
|
|
1734
|
+
tax: a,
|
|
1735
|
+
chain: s,
|
|
1736
|
+
symbol: r,
|
|
1737
|
+
identifier: o
|
|
1738
|
+
}) {
|
|
1739
|
+
super(typeof t == "object" ? t : { decimal: n, value: t }), 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");
|
|
1740
|
+
const p = he(o || `${s}.${r}`);
|
|
1741
|
+
this.type = At(p), this.tax = a, this.chain = p.chain, this.ticker = p.ticker, this.symbol = p.symbol, this.address = p.address, this.isSynthetic = p.isSynthetic, this.isGasAsset = p.isGasAsset;
|
|
1723
1742
|
}
|
|
1724
1743
|
toString() {
|
|
1725
1744
|
return this.isSynthetic ? this.symbol : `${this.chain}.${this.symbol}`;
|
|
@@ -1738,44 +1757,59 @@ class N extends me {
|
|
|
1738
1757
|
if (!a || !s)
|
|
1739
1758
|
throw new Error("Invalid asset url");
|
|
1740
1759
|
const o = a === i.THORChain && r ? `${a}.${s}/${r}` : t;
|
|
1741
|
-
return
|
|
1760
|
+
return le(o, n);
|
|
1742
1761
|
}
|
|
1743
1762
|
static fromString(t, n = 0) {
|
|
1744
|
-
return
|
|
1745
|
-
}
|
|
1746
|
-
static fromStringSync(t, n = 0) {
|
|
1747
|
-
const { isSynthetic: a } = _e(t), {
|
|
1748
|
-
tax: s,
|
|
1749
|
-
decimal: r,
|
|
1750
|
-
identifier: o
|
|
1751
|
-
} = Ie(t), p = z(n, r);
|
|
1752
|
-
return o ? new N({ tax: s, decimal: r, identifier: o, value: p }) : a ? new N({ tax: s, decimal: 8, identifier: t, value: p }) : void 0;
|
|
1763
|
+
return le(t, n);
|
|
1753
1764
|
}
|
|
1754
1765
|
static fromIdentifier(t, n = 0) {
|
|
1755
|
-
return
|
|
1766
|
+
return le(t, n);
|
|
1767
|
+
}
|
|
1768
|
+
static fromStringSync(t, n = 0) {
|
|
1769
|
+
const { isSynthetic: a } = he(t), s = q.get(t.toUpperCase());
|
|
1770
|
+
if (!s) {
|
|
1771
|
+
console.error(
|
|
1772
|
+
`Asset ${t} is not loaded. Use AssetValue.loadStaticAssets() to load it`
|
|
1773
|
+
);
|
|
1774
|
+
return;
|
|
1775
|
+
}
|
|
1776
|
+
const { tax: r, decimal: o, identifier: p } = s;
|
|
1777
|
+
return new x({
|
|
1778
|
+
tax: r,
|
|
1779
|
+
value: Z(n, o),
|
|
1780
|
+
identifier: a ? t : p,
|
|
1781
|
+
decimal: a ? 8 : o
|
|
1782
|
+
});
|
|
1756
1783
|
}
|
|
1757
1784
|
static fromIdentifierSync(t, n = 0) {
|
|
1758
|
-
const
|
|
1759
|
-
|
|
1785
|
+
const a = q.get(t);
|
|
1786
|
+
if (!a) {
|
|
1787
|
+
console.error(
|
|
1788
|
+
`Asset ${t} is not loaded. Use AssetValue.loadStaticAssets() to load it`
|
|
1789
|
+
);
|
|
1790
|
+
return;
|
|
1791
|
+
}
|
|
1792
|
+
const { tax: s, decimal: r, identifier: o } = a;
|
|
1793
|
+
return new x({ tax: s, decimal: r, identifier: o, value: Z(n, r) });
|
|
1760
1794
|
}
|
|
1761
1795
|
static fromChainOrSignature(t, n = 0) {
|
|
1762
|
-
const { decimal: a, identifier: s } =
|
|
1763
|
-
return new
|
|
1796
|
+
const { decimal: a, identifier: s } = wt(t);
|
|
1797
|
+
return new x({ value: Z(n, a), decimal: a, identifier: s });
|
|
1764
1798
|
}
|
|
1765
1799
|
static loadStaticAssets() {
|
|
1766
1800
|
return new Promise(
|
|
1767
1801
|
async (t, n) => {
|
|
1768
1802
|
try {
|
|
1769
1803
|
const a = await import("@swapkit/tokens");
|
|
1770
|
-
|
|
1771
|
-
var
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
identifier:
|
|
1775
|
-
decimal: "decimals" in
|
|
1804
|
+
Object.values(a).forEach((s) => {
|
|
1805
|
+
var r;
|
|
1806
|
+
(r = s == null ? void 0 : s.tokens) == null || r.forEach(({ identifier: o, chain: p, ...d }) => {
|
|
1807
|
+
q.set(o.toUpperCase(), {
|
|
1808
|
+
identifier: o,
|
|
1809
|
+
decimal: "decimals" in d ? d.decimals : A[p]
|
|
1776
1810
|
});
|
|
1777
|
-
})
|
|
1778
|
-
}
|
|
1811
|
+
});
|
|
1812
|
+
}), t({ ok: !0 });
|
|
1779
1813
|
} catch (a) {
|
|
1780
1814
|
console.error(a), n({
|
|
1781
1815
|
ok: !1,
|
|
@@ -1787,8 +1821,8 @@ class N extends me {
|
|
|
1787
1821
|
);
|
|
1788
1822
|
}
|
|
1789
1823
|
}
|
|
1790
|
-
|
|
1791
|
-
const t =
|
|
1824
|
+
function ue(e) {
|
|
1825
|
+
const t = x.fromChainOrSignature(e);
|
|
1792
1826
|
switch (e) {
|
|
1793
1827
|
case i.Bitcoin:
|
|
1794
1828
|
case i.Litecoin:
|
|
@@ -1805,17 +1839,27 @@ const ue = (e) => {
|
|
|
1805
1839
|
default:
|
|
1806
1840
|
return t.set(1e-8);
|
|
1807
1841
|
}
|
|
1808
|
-
}
|
|
1842
|
+
}
|
|
1843
|
+
async function le(e, t = 0) {
|
|
1844
|
+
qt(e);
|
|
1845
|
+
const n = q.get(e.toUpperCase()), a = (n == null ? void 0 : n.decimal) || await ft(he(e));
|
|
1846
|
+
return n || q.set(e.toUpperCase(), { identifier: e, decimal: a }), new x({ decimal: a, value: Z(t, a), identifier: e });
|
|
1847
|
+
}
|
|
1848
|
+
function Z(e, t) {
|
|
1849
|
+
return typeof e == "bigint" ? ie({ value: e, bigIntDecimal: t, decimal: t }) : e;
|
|
1850
|
+
}
|
|
1851
|
+
function he(e) {
|
|
1809
1852
|
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("-");
|
|
1810
1853
|
return {
|
|
1811
1854
|
address: d == null ? void 0 : d.toLowerCase(),
|
|
1812
1855
|
chain: r,
|
|
1813
|
-
isGasAsset:
|
|
1856
|
+
isGasAsset: Ne({ chain: r, symbol: o }),
|
|
1814
1857
|
isSynthetic: t,
|
|
1815
1858
|
symbol: (t ? `${n}/` : "") + (d ? `${p}-${(d == null ? void 0 : d.toLowerCase()) ?? ""}` : o),
|
|
1816
1859
|
ticker: p
|
|
1817
1860
|
};
|
|
1818
|
-
}
|
|
1861
|
+
}
|
|
1862
|
+
const Kt = {
|
|
1819
1863
|
/**
|
|
1820
1864
|
* Core
|
|
1821
1865
|
*/
|
|
@@ -1875,21 +1919,21 @@ const ue = (e) => {
|
|
|
1875
1919
|
};
|
|
1876
1920
|
class c extends Error {
|
|
1877
1921
|
constructor(t, n) {
|
|
1878
|
-
console.error(n, { stack: n == null ? void 0 : n.stack, message: n == null ? void 0 : n.message }), super(t, { cause: { code:
|
|
1922
|
+
console.error(n, { stack: n == null ? void 0 : n.stack, message: n == null ? void 0 : n.message }), super(t, { cause: { code: Kt[t], message: t } }), Object.setPrototypeOf(this, c.prototype);
|
|
1879
1923
|
}
|
|
1880
1924
|
}
|
|
1881
|
-
class
|
|
1925
|
+
class N extends He {
|
|
1882
1926
|
eq(t) {
|
|
1883
1927
|
return this.eqValue(t);
|
|
1884
1928
|
}
|
|
1885
1929
|
static fromBigInt(t, n) {
|
|
1886
|
-
return new
|
|
1930
|
+
return new N({
|
|
1887
1931
|
decimal: n,
|
|
1888
|
-
value:
|
|
1932
|
+
value: ie({ value: t, bigIntDecimal: n, decimal: n })
|
|
1889
1933
|
});
|
|
1890
1934
|
}
|
|
1891
1935
|
}
|
|
1892
|
-
const
|
|
1936
|
+
const Yt = [
|
|
1893
1937
|
{
|
|
1894
1938
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
1895
1939
|
stateMutability: "nonpayable",
|
|
@@ -1980,7 +2024,7 @@ const Jt = [
|
|
|
1980
2024
|
type: "function"
|
|
1981
2025
|
},
|
|
1982
2026
|
{ stateMutability: "payable", type: "receive" }
|
|
1983
|
-
],
|
|
2027
|
+
], Xt = [
|
|
1984
2028
|
{
|
|
1985
2029
|
inputs: [
|
|
1986
2030
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2124,7 +2168,7 @@ const Jt = [
|
|
|
2124
2168
|
type: "function"
|
|
2125
2169
|
},
|
|
2126
2170
|
{ stateMutability: "payable", type: "receive" }
|
|
2127
|
-
],
|
|
2171
|
+
], Jt = [
|
|
2128
2172
|
{
|
|
2129
2173
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2130
2174
|
stateMutability: "nonpayable",
|
|
@@ -2229,7 +2273,7 @@ const Jt = [
|
|
|
2229
2273
|
type: "function"
|
|
2230
2274
|
},
|
|
2231
2275
|
{ stateMutability: "payable", type: "receive" }
|
|
2232
|
-
],
|
|
2276
|
+
], Qt = [
|
|
2233
2277
|
{
|
|
2234
2278
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2235
2279
|
stateMutability: "nonpayable",
|
|
@@ -2320,7 +2364,7 @@ const Jt = [
|
|
|
2320
2364
|
type: "function"
|
|
2321
2365
|
},
|
|
2322
2366
|
{ stateMutability: "payable", type: "receive" }
|
|
2323
|
-
],
|
|
2367
|
+
], zt = [
|
|
2324
2368
|
{
|
|
2325
2369
|
inputs: [
|
|
2326
2370
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2464,7 +2508,7 @@ const Jt = [
|
|
|
2464
2508
|
type: "function"
|
|
2465
2509
|
},
|
|
2466
2510
|
{ stateMutability: "payable", type: "receive" }
|
|
2467
|
-
],
|
|
2511
|
+
], Zt = [
|
|
2468
2512
|
{
|
|
2469
2513
|
inputs: [
|
|
2470
2514
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2583,7 +2627,7 @@ const Jt = [
|
|
|
2583
2627
|
type: "function"
|
|
2584
2628
|
},
|
|
2585
2629
|
{ stateMutability: "payable", type: "receive" }
|
|
2586
|
-
],
|
|
2630
|
+
], en = [
|
|
2587
2631
|
{
|
|
2588
2632
|
inputs: [
|
|
2589
2633
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2702,7 +2746,7 @@ const Jt = [
|
|
|
2702
2746
|
type: "function"
|
|
2703
2747
|
},
|
|
2704
2748
|
{ stateMutability: "payable", type: "receive" }
|
|
2705
|
-
],
|
|
2749
|
+
], tn = [
|
|
2706
2750
|
{
|
|
2707
2751
|
inputs: [
|
|
2708
2752
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2821,7 +2865,7 @@ const Jt = [
|
|
|
2821
2865
|
type: "function"
|
|
2822
2866
|
},
|
|
2823
2867
|
{ stateMutability: "payable", type: "receive" }
|
|
2824
|
-
],
|
|
2868
|
+
], nn = [
|
|
2825
2869
|
{
|
|
2826
2870
|
inputs: [
|
|
2827
2871
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2940,7 +2984,7 @@ const Jt = [
|
|
|
2940
2984
|
type: "function"
|
|
2941
2985
|
},
|
|
2942
2986
|
{ stateMutability: "payable", type: "receive" }
|
|
2943
|
-
],
|
|
2987
|
+
], an = [
|
|
2944
2988
|
{
|
|
2945
2989
|
inputs: [
|
|
2946
2990
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3067,7 +3111,7 @@ const Jt = [
|
|
|
3067
3111
|
type: "function"
|
|
3068
3112
|
},
|
|
3069
3113
|
{ stateMutability: "payable", type: "receive" }
|
|
3070
|
-
],
|
|
3114
|
+
], sn = [
|
|
3071
3115
|
{
|
|
3072
3116
|
inputs: [
|
|
3073
3117
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3194,7 +3238,7 @@ const Jt = [
|
|
|
3194
3238
|
type: "function"
|
|
3195
3239
|
},
|
|
3196
3240
|
{ stateMutability: "payable", type: "receive" }
|
|
3197
|
-
],
|
|
3241
|
+
], rn = [
|
|
3198
3242
|
{
|
|
3199
3243
|
inputs: [
|
|
3200
3244
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3321,7 +3365,7 @@ const Jt = [
|
|
|
3321
3365
|
type: "function"
|
|
3322
3366
|
},
|
|
3323
3367
|
{ stateMutability: "payable", type: "receive" }
|
|
3324
|
-
],
|
|
3368
|
+
], on = [
|
|
3325
3369
|
{
|
|
3326
3370
|
inputs: [
|
|
3327
3371
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3448,7 +3492,7 @@ const Jt = [
|
|
|
3448
3492
|
type: "function"
|
|
3449
3493
|
},
|
|
3450
3494
|
{ stateMutability: "payable", type: "receive" }
|
|
3451
|
-
],
|
|
3495
|
+
], pn = [
|
|
3452
3496
|
{
|
|
3453
3497
|
inputs: [
|
|
3454
3498
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3575,27 +3619,27 @@ const Jt = [
|
|
|
3575
3619
|
type: "function"
|
|
3576
3620
|
},
|
|
3577
3621
|
{ stateMutability: "payable", type: "receive" }
|
|
3578
|
-
],
|
|
3579
|
-
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]:
|
|
3580
|
-
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]:
|
|
3581
|
-
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]:
|
|
3582
|
-
},
|
|
3583
|
-
...
|
|
3622
|
+
], ke = {
|
|
3623
|
+
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: Yt,
|
|
3624
|
+
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: Jt,
|
|
3625
|
+
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: Qt
|
|
3626
|
+
}, dn = {
|
|
3627
|
+
...ke,
|
|
3584
3628
|
// AVAX
|
|
3585
|
-
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]:
|
|
3586
|
-
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]:
|
|
3587
|
-
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]:
|
|
3629
|
+
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: Zt,
|
|
3630
|
+
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: Xt,
|
|
3631
|
+
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: tn,
|
|
3588
3632
|
// BSC
|
|
3589
|
-
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]:
|
|
3633
|
+
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: zt,
|
|
3590
3634
|
// ETH
|
|
3591
|
-
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]:
|
|
3592
|
-
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]:
|
|
3593
|
-
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]:
|
|
3594
|
-
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]:
|
|
3595
|
-
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]:
|
|
3596
|
-
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]:
|
|
3597
|
-
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]:
|
|
3598
|
-
},
|
|
3635
|
+
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: en,
|
|
3636
|
+
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: nn,
|
|
3637
|
+
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: an,
|
|
3638
|
+
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: sn,
|
|
3639
|
+
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: rn,
|
|
3640
|
+
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: on,
|
|
3641
|
+
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: pn
|
|
3642
|
+
}, un = ({
|
|
3599
3643
|
streamSwap: e,
|
|
3600
3644
|
contractAddress: t,
|
|
3601
3645
|
recipient: n,
|
|
@@ -3606,38 +3650,38 @@ const Jt = [
|
|
|
3606
3650
|
data: o = "",
|
|
3607
3651
|
deadline: p,
|
|
3608
3652
|
memo: d,
|
|
3609
|
-
router:
|
|
3610
|
-
memoStreamingSwap:
|
|
3653
|
+
router: l,
|
|
3654
|
+
memoStreamingSwap: u,
|
|
3611
3655
|
tcMemo: m,
|
|
3612
3656
|
tcRouter: _,
|
|
3613
3657
|
tcVault: b,
|
|
3614
|
-
vault:
|
|
3658
|
+
vault: w,
|
|
3615
3659
|
token: E
|
|
3616
3660
|
}
|
|
3617
3661
|
}) => {
|
|
3618
|
-
const O = !!
|
|
3619
|
-
if (O && !
|
|
3662
|
+
const O = !!ke[t.toLowerCase()];
|
|
3663
|
+
if (O && !l)
|
|
3620
3664
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
3621
|
-
const I = m || d, D = e &&
|
|
3622
|
-
if (!b && !
|
|
3665
|
+
const I = m || d, D = e && u || I;
|
|
3666
|
+
if (!b && !w)
|
|
3623
3667
|
throw new Error("TC Vault is required on calldata");
|
|
3624
|
-
if (!_ && !
|
|
3668
|
+
if (!_ && !l)
|
|
3625
3669
|
throw new Error("TC Router is required on calldata");
|
|
3626
3670
|
if (!D)
|
|
3627
3671
|
throw new Error("TC Memo is required on calldata");
|
|
3628
3672
|
if (!E)
|
|
3629
3673
|
throw new Error("Token is required on calldata");
|
|
3630
|
-
const
|
|
3674
|
+
const re = [
|
|
3631
3675
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
3632
|
-
a(_ ||
|
|
3633
|
-
a(b ||
|
|
3676
|
+
a(_ || l),
|
|
3677
|
+
a(b || w),
|
|
3634
3678
|
D.replace("{recipientAddress}", n),
|
|
3635
3679
|
a(E),
|
|
3636
3680
|
s
|
|
3637
|
-
],
|
|
3638
|
-
return [...
|
|
3639
|
-
},
|
|
3640
|
-
const n =
|
|
3681
|
+
], Fe = O ? [a(l), o, p] : [r, p];
|
|
3682
|
+
return [...re, ...Fe];
|
|
3683
|
+
}, ln = ({ chain: e, txHash: t }) => {
|
|
3684
|
+
const n = Ce[e];
|
|
3641
3685
|
switch (e) {
|
|
3642
3686
|
case i.Binance:
|
|
3643
3687
|
case i.Maya:
|
|
@@ -3661,8 +3705,8 @@ const Jt = [
|
|
|
3661
3705
|
default:
|
|
3662
3706
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3663
3707
|
}
|
|
3664
|
-
},
|
|
3665
|
-
const n =
|
|
3708
|
+
}, yn = ({ chain: e, address: t }) => {
|
|
3709
|
+
const n = Ce[e];
|
|
3666
3710
|
switch (e) {
|
|
3667
3711
|
case i.Arbitrum:
|
|
3668
3712
|
case i.Avalanche:
|
|
@@ -3684,16 +3728,16 @@ const Jt = [
|
|
|
3684
3728
|
default:
|
|
3685
3729
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3686
3730
|
}
|
|
3687
|
-
},
|
|
3688
|
-
const t = e ?
|
|
3689
|
-
return
|
|
3690
|
-
},
|
|
3691
|
-
const t = e ?
|
|
3692
|
-
return
|
|
3693
|
-
},
|
|
3731
|
+
}, cn = (e) => {
|
|
3732
|
+
const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
|
|
3733
|
+
return we.get(`${t}/thorchain/inbound_addresses`);
|
|
3734
|
+
}, mn = (e) => {
|
|
3735
|
+
const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
|
|
3736
|
+
return we.get(`${t}/thorchain/mimir`);
|
|
3737
|
+
}, Oe = () => Object.values(i).reduce(
|
|
3694
3738
|
(e, t) => (e[t] = null, e),
|
|
3695
3739
|
{}
|
|
3696
|
-
),
|
|
3740
|
+
), Tn = async ({ chain: e, address: t }) => {
|
|
3697
3741
|
if (!t)
|
|
3698
3742
|
return !1;
|
|
3699
3743
|
switch (e) {
|
|
@@ -3703,19 +3747,19 @@ const Jt = [
|
|
|
3703
3747
|
return !0;
|
|
3704
3748
|
}
|
|
3705
3749
|
};
|
|
3706
|
-
var V,
|
|
3707
|
-
class
|
|
3750
|
+
var V, ae, K, v, Y, X;
|
|
3751
|
+
class Pn {
|
|
3708
3752
|
constructor({ stagenet: t } = {}) {
|
|
3709
|
-
T(this, "connectedChains",
|
|
3710
|
-
T(this, "connectedWallets",
|
|
3753
|
+
T(this, "connectedChains", Oe());
|
|
3754
|
+
T(this, "connectedWallets", Oe());
|
|
3711
3755
|
T(this, "stagenet", !1);
|
|
3712
3756
|
T(this, "getAddress", (t) => {
|
|
3713
3757
|
var n;
|
|
3714
3758
|
return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
|
|
3715
3759
|
});
|
|
3716
|
-
T(this, "getExplorerTxUrl", (t, n) =>
|
|
3760
|
+
T(this, "getExplorerTxUrl", (t, n) => ln({ chain: t, txHash: n }));
|
|
3717
3761
|
T(this, "getWallet", (t) => this.connectedWallets[t]);
|
|
3718
|
-
T(this, "getExplorerAddressUrl", (t, n) =>
|
|
3762
|
+
T(this, "getExplorerAddressUrl", (t, n) => yn({ chain: t, address: n }));
|
|
3719
3763
|
T(this, "getBalance", async (t, n) => {
|
|
3720
3764
|
const a = await this.getWalletByChain(t, n);
|
|
3721
3765
|
return (a == null ? void 0 : a.balance) || [];
|
|
@@ -3726,65 +3770,65 @@ class Vn {
|
|
|
3726
3770
|
if (!a.complete)
|
|
3727
3771
|
throw new c("core_swap_route_not_complete");
|
|
3728
3772
|
try {
|
|
3729
|
-
if (
|
|
3730
|
-
const
|
|
3731
|
-
if (!(
|
|
3773
|
+
if (ze.includes(r)) {
|
|
3774
|
+
const l = this.connectedWallets[o];
|
|
3775
|
+
if (!(l != null && l.sendTransaction))
|
|
3732
3776
|
throw new c("core_wallet_connection_not_found");
|
|
3733
3777
|
if (!(t ? (p = a == null ? void 0 : a.streamingSwap) == null ? void 0 : p.transaction : a == null ? void 0 : a.transaction))
|
|
3734
3778
|
throw new c("core_swap_route_transaction_not_found");
|
|
3735
|
-
const { data: m, from: _, to: b, value:
|
|
3779
|
+
const { data: m, from: _, to: b, value: w } = a.transaction, E = {
|
|
3736
3780
|
data: m,
|
|
3737
3781
|
from: _,
|
|
3738
3782
|
to: b.toLowerCase(),
|
|
3739
|
-
chainId: BigInt(
|
|
3740
|
-
value:
|
|
3783
|
+
chainId: BigInt(ot[o]),
|
|
3784
|
+
value: w ? BigInt(w) : 0n
|
|
3741
3785
|
};
|
|
3742
|
-
return
|
|
3786
|
+
return l.sendTransaction(E, s);
|
|
3743
3787
|
}
|
|
3744
|
-
if (
|
|
3788
|
+
if (et.includes(r)) {
|
|
3745
3789
|
if (!a.calldata.fromAsset)
|
|
3746
3790
|
throw new c("core_swap_asset_not_recognized");
|
|
3747
|
-
const
|
|
3748
|
-
if (!
|
|
3791
|
+
const l = await x.fromString(a.calldata.fromAsset);
|
|
3792
|
+
if (!l)
|
|
3749
3793
|
throw new c("core_swap_asset_not_recognized");
|
|
3750
|
-
const { address:
|
|
3794
|
+
const { address: u } = await f(this, V).call(this, l.chain), {
|
|
3751
3795
|
contract: m,
|
|
3752
|
-
calldata: { expiration: _, amountIn: b, memo:
|
|
3753
|
-
} = a, O =
|
|
3796
|
+
calldata: { expiration: _, amountIn: b, memo: w, memoStreamingSwap: E }
|
|
3797
|
+
} = a, O = l.add(N.fromBigInt(BigInt(b), l.decimal)), I = t && E || w;
|
|
3754
3798
|
return this.deposit({
|
|
3755
3799
|
expiration: _,
|
|
3756
3800
|
assetValue: O,
|
|
3757
3801
|
memo: I,
|
|
3758
3802
|
feeOptionKey: s,
|
|
3759
3803
|
router: m,
|
|
3760
|
-
recipient:
|
|
3804
|
+
recipient: u
|
|
3761
3805
|
});
|
|
3762
3806
|
}
|
|
3763
|
-
if (
|
|
3764
|
-
const { calldata:
|
|
3765
|
-
if (!
|
|
3807
|
+
if (Ze.includes(r)) {
|
|
3808
|
+
const { calldata: l, contract: u } = a;
|
|
3809
|
+
if (!u)
|
|
3766
3810
|
throw new c("core_swap_contract_not_found");
|
|
3767
3811
|
const m = this.connectedWallets[o], _ = this.getAddress(o);
|
|
3768
3812
|
if (!(m != null && m.sendTransaction) || !_)
|
|
3769
3813
|
throw new c("core_wallet_connection_not_found");
|
|
3770
|
-
const { getProvider: b, toChecksumAddress:
|
|
3814
|
+
const { getProvider: b, toChecksumAddress: w } = await import("@swapkit/toolbox-evm"), E = b(o), O = dn[u.toLowerCase()];
|
|
3771
3815
|
if (!O)
|
|
3772
|
-
throw new c("core_swap_contract_not_supported", { contractAddress:
|
|
3773
|
-
const D = await (await ((d = m.createContract) == null ? void 0 : d.call(m,
|
|
3774
|
-
...
|
|
3816
|
+
throw new c("core_swap_contract_not_supported", { contractAddress: u });
|
|
3817
|
+
const D = await (await ((d = m.createContract) == null ? void 0 : d.call(m, u, O, E))).getFunction("swapIn").populateTransaction(
|
|
3818
|
+
...un({
|
|
3775
3819
|
streamSwap: t,
|
|
3776
|
-
toChecksumAddress:
|
|
3777
|
-
contractAddress:
|
|
3820
|
+
toChecksumAddress: w,
|
|
3821
|
+
contractAddress: u,
|
|
3778
3822
|
recipient: n,
|
|
3779
|
-
calldata:
|
|
3823
|
+
calldata: l
|
|
3780
3824
|
}),
|
|
3781
3825
|
{ from: _ }
|
|
3782
3826
|
);
|
|
3783
3827
|
return m.sendTransaction(D, s);
|
|
3784
3828
|
}
|
|
3785
3829
|
throw new c("core_swap_quote_mode_not_supported", { quoteMode: r });
|
|
3786
|
-
} catch (
|
|
3787
|
-
throw new c("core_swap_transaction_error",
|
|
3830
|
+
} catch (l) {
|
|
3831
|
+
throw new c("core_swap_transaction_error", l);
|
|
3788
3832
|
}
|
|
3789
3833
|
});
|
|
3790
3834
|
T(this, "getWalletByChain", async (t, n) => {
|
|
@@ -3792,7 +3836,7 @@ class Vn {
|
|
|
3792
3836
|
const a = this.getAddress(t);
|
|
3793
3837
|
if (!a)
|
|
3794
3838
|
return null;
|
|
3795
|
-
const s = [
|
|
3839
|
+
const s = [x.fromChainOrSignature(t)], r = (o = this.connectedChains[t]) == null ? void 0 : o.walletType;
|
|
3796
3840
|
try {
|
|
3797
3841
|
const d = await ((p = this.getWallet(t)) == null ? void 0 : p.getBalance(a, n));
|
|
3798
3842
|
return this.connectedChains[t] = {
|
|
@@ -3804,8 +3848,8 @@ class Vn {
|
|
|
3804
3848
|
return console.error(d), { address: a, balance: s, walletType: r };
|
|
3805
3849
|
}
|
|
3806
3850
|
});
|
|
3807
|
-
T(this, "approveAssetValue", (t, n) => f(this,
|
|
3808
|
-
T(this, "isAssetValueApproved", (t, n) => f(this,
|
|
3851
|
+
T(this, "approveAssetValue", (t, n) => f(this, K).call(this, { assetValue: t, type: "approve", contractAddress: n }));
|
|
3852
|
+
T(this, "isAssetValueApproved", (t, n) => f(this, K).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
|
|
3809
3853
|
T(this, "validateAddress", ({ address: t, chain: n }) => {
|
|
3810
3854
|
var a, s;
|
|
3811
3855
|
return (s = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : s.call(a, t);
|
|
@@ -3815,7 +3859,7 @@ class Vn {
|
|
|
3815
3859
|
if (!n)
|
|
3816
3860
|
throw new c("core_wallet_connection_not_found");
|
|
3817
3861
|
try {
|
|
3818
|
-
return await n.transfer(f(this,
|
|
3862
|
+
return await n.transfer(f(this, X).call(this, t));
|
|
3819
3863
|
} catch (a) {
|
|
3820
3864
|
throw new c("core_swap_transaction_error", a);
|
|
3821
3865
|
}
|
|
@@ -3827,44 +3871,44 @@ class Vn {
|
|
|
3827
3871
|
...s
|
|
3828
3872
|
}) => {
|
|
3829
3873
|
const { chain: r, symbol: o, ticker: p } = t, d = this.connectedWallets[r];
|
|
3830
|
-
if (!await
|
|
3874
|
+
if (!await Tn({ address: await (d == null ? void 0 : d.getAddress()), chain: r }))
|
|
3831
3875
|
throw new c("core_transaction_invalid_sender_address");
|
|
3832
3876
|
if (!d)
|
|
3833
3877
|
throw new c("core_wallet_connection_not_found");
|
|
3834
|
-
const
|
|
3878
|
+
const l = f(this, X).call(this, { assetValue: t, recipient: n, router: a, ...s });
|
|
3835
3879
|
try {
|
|
3836
3880
|
switch (r) {
|
|
3837
3881
|
case i.THORChain: {
|
|
3838
|
-
const
|
|
3839
|
-
return await (n === "" ?
|
|
3882
|
+
const u = d;
|
|
3883
|
+
return await (n === "" ? u.deposit(l) : u.transfer(l));
|
|
3840
3884
|
}
|
|
3841
3885
|
case i.Ethereum:
|
|
3842
3886
|
case i.BinanceSmartChain:
|
|
3843
3887
|
case i.Avalanche: {
|
|
3844
|
-
const { getChecksumAddressFromAsset:
|
|
3888
|
+
const { getChecksumAddressFromAsset: u } = await import("@swapkit/toolbox-evm"), m = r === i.Avalanche ? Xe : r === i.BinanceSmartChain ? Je : Ye;
|
|
3845
3889
|
return await d.call({
|
|
3846
3890
|
abi: m,
|
|
3847
3891
|
contractAddress: a || (await f(this, V).call(this, r)).router,
|
|
3848
3892
|
funcName: "depositWithExpiry",
|
|
3849
3893
|
funcParams: [
|
|
3850
3894
|
n,
|
|
3851
|
-
|
|
3895
|
+
u({ chain: r, symbol: o, ticker: p }, r),
|
|
3852
3896
|
t.getBaseValue("string"),
|
|
3853
|
-
|
|
3897
|
+
l.memo,
|
|
3854
3898
|
s.expiration || parseInt(`${((/* @__PURE__ */ new Date()).getTime() + 15 * 60 * 1e3) / 1e3}`)
|
|
3855
3899
|
],
|
|
3856
3900
|
txOverrides: {
|
|
3857
|
-
from:
|
|
3901
|
+
from: l.from,
|
|
3858
3902
|
value: t.isGasAsset ? t.getBaseValue("bigint") : void 0
|
|
3859
3903
|
}
|
|
3860
3904
|
});
|
|
3861
3905
|
}
|
|
3862
3906
|
default:
|
|
3863
|
-
return await d.transfer(
|
|
3907
|
+
return await d.transfer(l);
|
|
3864
3908
|
}
|
|
3865
|
-
} catch (
|
|
3866
|
-
const m = ((
|
|
3867
|
-
throw new c(E,
|
|
3909
|
+
} catch (u) {
|
|
3910
|
+
const m = ((u == null ? void 0 : u.message) || (u == null ? void 0 : u.toString())).toLowerCase(), _ = m == null ? void 0 : m.includes("insufficient funds"), b = m == null ? void 0 : m.includes("gas"), w = m == null ? void 0 : m.includes("server"), E = _ ? "core_transaction_deposit_insufficient_funds_error" : b ? "core_transaction_deposit_gas_error" : w ? "core_transaction_deposit_server_error" : "core_transaction_deposit_error";
|
|
3911
|
+
throw new c(E, u);
|
|
3868
3912
|
}
|
|
3869
3913
|
});
|
|
3870
3914
|
/**
|
|
@@ -3909,17 +3953,17 @@ class Vn {
|
|
|
3909
3953
|
isPendingSymmAsset: r,
|
|
3910
3954
|
mode: o = "sym"
|
|
3911
3955
|
}) => {
|
|
3912
|
-
const { chain: p, symbol: d } = n,
|
|
3913
|
-
if (!
|
|
3956
|
+
const { chain: p, symbol: d } = n, l = o === "sym", u = (t == null ? void 0 : t.gt(0)) && (l || o === "rune"), m = (n == null ? void 0 : n.gt(0)) && (l || o === "asset"), _ = r || u, b = _ ? a || this.getAddress(i.THORChain) : "", w = l || o === "asset" ? s || this.getAddress(p) : "";
|
|
3957
|
+
if (!u && !m)
|
|
3914
3958
|
throw new c("core_transaction_add_liquidity_invalid_params");
|
|
3915
3959
|
if (_ && !b)
|
|
3916
3960
|
throw new c("core_transaction_add_liquidity_no_rune_address");
|
|
3917
3961
|
let E, O;
|
|
3918
|
-
if (
|
|
3962
|
+
if (u && t)
|
|
3919
3963
|
try {
|
|
3920
3964
|
E = await f(this, v).call(this, {
|
|
3921
3965
|
assetValue: t,
|
|
3922
|
-
memo: M(h.DEPOSIT, { chain: p, symbol: d, address:
|
|
3966
|
+
memo: M(h.DEPOSIT, { chain: p, symbol: d, address: w })
|
|
3923
3967
|
});
|
|
3924
3968
|
} catch (I) {
|
|
3925
3969
|
throw new c("core_transaction_add_liquidity_rune_error", I);
|
|
@@ -3957,7 +4001,7 @@ class Vn {
|
|
|
3957
4001
|
from: s,
|
|
3958
4002
|
to: r
|
|
3959
4003
|
}) => {
|
|
3960
|
-
const o = r === "rune" ?
|
|
4004
|
+
const o = r === "rune" ? x.fromChainOrSignature(i.THORChain) : s === "sym" && r === "sym" || s === "rune" || s === "asset" ? void 0 : n, p = ue(s === "asset" ? n.chain : i.THORChain), d = t || M(h.WITHDRAW, {
|
|
3961
4005
|
symbol: n.symbol,
|
|
3962
4006
|
chain: n.chain,
|
|
3963
4007
|
ticker: n.ticker,
|
|
@@ -4004,7 +4048,7 @@ class Vn {
|
|
|
4004
4048
|
address: a,
|
|
4005
4049
|
unbondAmount: t === "unbond" ? n.getBaseValue("number") : void 0
|
|
4006
4050
|
});
|
|
4007
|
-
return f(this,
|
|
4051
|
+
return f(this, Y).call(this, {
|
|
4008
4052
|
memo: r,
|
|
4009
4053
|
assetValue: t === "bond" ? n : ue(i.THORChain)
|
|
4010
4054
|
});
|
|
@@ -4012,12 +4056,12 @@ class Vn {
|
|
|
4012
4056
|
T(this, "registerThorname", ({
|
|
4013
4057
|
assetValue: t,
|
|
4014
4058
|
...n
|
|
4015
|
-
}) => f(this,
|
|
4059
|
+
}) => f(this, Y).call(this, { assetValue: t, memo: M(h.THORNAME_REGISTER, n) }));
|
|
4016
4060
|
T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: s = {} }) => {
|
|
4017
4061
|
try {
|
|
4018
4062
|
t.forEach((r) => {
|
|
4019
4063
|
this[r.connectMethodName] = r.connect({
|
|
4020
|
-
addChain: f(this,
|
|
4064
|
+
addChain: f(this, ae),
|
|
4021
4065
|
config: n || {},
|
|
4022
4066
|
apis: a,
|
|
4023
4067
|
rpcUrls: s
|
|
@@ -4102,17 +4146,17 @@ class Vn {
|
|
|
4102
4146
|
halted: !1,
|
|
4103
4147
|
chain: i.THORChain
|
|
4104
4148
|
};
|
|
4105
|
-
const a = (await
|
|
4149
|
+
const a = (await cn(this.stagenet)).find((s) => s.chain === t);
|
|
4106
4150
|
if (!a)
|
|
4107
4151
|
throw new c("core_inbound_data_not_found");
|
|
4108
4152
|
if (a != null && a.halted)
|
|
4109
4153
|
throw new c("core_chain_halted");
|
|
4110
4154
|
return a;
|
|
4111
4155
|
});
|
|
4112
|
-
P(this,
|
|
4156
|
+
P(this, ae, ({ chain: t, wallet: n, walletMethods: a }) => {
|
|
4113
4157
|
this.connectedChains[t] = n, this.connectedWallets[t] = a;
|
|
4114
4158
|
});
|
|
4115
|
-
P(this,
|
|
4159
|
+
P(this, K, async ({
|
|
4116
4160
|
assetValue: t,
|
|
4117
4161
|
type: n = "checkOnly",
|
|
4118
4162
|
contractAddress: a
|
|
@@ -4120,7 +4164,7 @@ class Vn {
|
|
|
4120
4164
|
const { address: s, chain: r, isGasAsset: o, isSynthetic: p } = t, d = [i.Ethereum, i.Avalanche, i.BinanceSmartChain].includes(r);
|
|
4121
4165
|
if (d && o || !d || p)
|
|
4122
4166
|
return !0;
|
|
4123
|
-
const
|
|
4167
|
+
const u = this.connectedWallets[r], m = n === "checkOnly" ? u == null ? void 0 : u.isApproved : u == null ? void 0 : u.approve;
|
|
4124
4168
|
if (!m)
|
|
4125
4169
|
throw new c("core_wallet_connection_not_found");
|
|
4126
4170
|
const _ = this.getAddress(r);
|
|
@@ -4143,7 +4187,7 @@ class Vn {
|
|
|
4143
4187
|
gas_rate: s,
|
|
4144
4188
|
router: r,
|
|
4145
4189
|
address: o
|
|
4146
|
-
} = await f(this, V).call(this, t.chain), p = (parseInt(s) || 0) *
|
|
4190
|
+
} = await f(this, V).call(this, t.chain), p = (parseInt(s) || 0) * bt[a];
|
|
4147
4191
|
return this.deposit({
|
|
4148
4192
|
assetValue: t,
|
|
4149
4193
|
recipient: o,
|
|
@@ -4152,13 +4196,13 @@ class Vn {
|
|
|
4152
4196
|
feeRate: p
|
|
4153
4197
|
});
|
|
4154
4198
|
});
|
|
4155
|
-
P(this,
|
|
4156
|
-
const a = await
|
|
4199
|
+
P(this, Y, async ({ memo: t, assetValue: n }) => {
|
|
4200
|
+
const a = await mn(this.stagenet);
|
|
4157
4201
|
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
4158
4202
|
throw new c("core_chain_halted");
|
|
4159
4203
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
4160
4204
|
});
|
|
4161
|
-
P(this,
|
|
4205
|
+
P(this, X, ({ assetValue: t, ...n }) => ({
|
|
4162
4206
|
...n,
|
|
4163
4207
|
memo: n.memo || "",
|
|
4164
4208
|
from: this.getAddress(t.chain),
|
|
@@ -4167,67 +4211,67 @@ class Vn {
|
|
|
4167
4211
|
this.stagenet = !!t;
|
|
4168
4212
|
}
|
|
4169
4213
|
}
|
|
4170
|
-
V = new WeakMap(),
|
|
4214
|
+
V = new WeakMap(), ae = new WeakMap(), K = new WeakMap(), v = new WeakMap(), Y = new WeakMap(), X = new WeakMap();
|
|
4171
4215
|
export {
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4216
|
+
ze as AGG_SWAP,
|
|
4217
|
+
Se as ApiError,
|
|
4218
|
+
W as ApiUrl,
|
|
4219
|
+
x as AssetValue,
|
|
4220
|
+
A as BaseDecimal,
|
|
4221
|
+
He as BigIntArithmetics,
|
|
4178
4222
|
i as Chain,
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4223
|
+
_e as ChainId,
|
|
4224
|
+
Rn as ChainIdToChain,
|
|
4225
|
+
ot as ChainToChainId,
|
|
4226
|
+
Ce as ChainToExplorerUrl,
|
|
4227
|
+
En as ChainToHexChainId,
|
|
4228
|
+
pt as ChainToRPC,
|
|
4229
|
+
at as ContractAddress,
|
|
4230
|
+
wn as CosmosChainList,
|
|
4231
|
+
st as DerivationPath,
|
|
4188
4232
|
y as ERROR_CODE,
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4233
|
+
tt as ERROR_MODULE,
|
|
4234
|
+
Ie as ERROR_TYPE,
|
|
4235
|
+
it as EVMChainList,
|
|
4236
|
+
dt as ErrorCode,
|
|
4193
4237
|
F as FeeOption,
|
|
4194
4238
|
h as MemoType,
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4239
|
+
fn as NetworkDerivationPath,
|
|
4240
|
+
Qe as QuoteMode,
|
|
4241
|
+
ve as RPCUrl,
|
|
4242
|
+
we as RequestClient,
|
|
4243
|
+
Ze as SWAP_IN,
|
|
4244
|
+
et as SWAP_OUT,
|
|
4245
|
+
Pn as SwapKitCore,
|
|
4202
4246
|
c as SwapKitError,
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4247
|
+
N as SwapKitNumber,
|
|
4248
|
+
Xe as TCAvalancheDepositABI,
|
|
4249
|
+
Je as TCBscDepositABI,
|
|
4250
|
+
Ye as TCEthereumVaultAbi,
|
|
4251
|
+
An as TCSupportedChainList,
|
|
4252
|
+
bn as UTXOChainList,
|
|
4253
|
+
ut as WalletOption,
|
|
4254
|
+
gn as assetFromString,
|
|
4255
|
+
Dn as derivationPathToString,
|
|
4256
|
+
_n as erc20ABI,
|
|
4257
|
+
On as filterAssets,
|
|
4258
|
+
ie as formatBigIntToSafeValue,
|
|
4259
|
+
bt as gasFeeMultiplier,
|
|
4260
|
+
At as getAssetType,
|
|
4261
|
+
Ot as getAsymmetricAssetShare,
|
|
4262
|
+
Sn as getAsymmetricAssetWithdrawAmount,
|
|
4263
|
+
gt as getAsymmetricRuneShare,
|
|
4264
|
+
In as getAsymmetricRuneWithdrawAmount,
|
|
4265
|
+
wt as getCommonAssetInfo,
|
|
4266
|
+
ft as getDecimal,
|
|
4267
|
+
Cn as getEstimatedPoolShare,
|
|
4268
|
+
Mn as getLiquiditySlippage,
|
|
4225
4269
|
M as getMemoFor,
|
|
4226
4270
|
ue as getMinAmountByChain,
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4271
|
+
It as getSymmetricPoolShare,
|
|
4272
|
+
vn as getSymmetricWithdraw,
|
|
4273
|
+
Nn as getTHORNameCost,
|
|
4274
|
+
Ne as isGasAsset,
|
|
4275
|
+
xn as validateTHORName
|
|
4232
4276
|
};
|
|
4233
4277
|
//# sourceMappingURL=index.es.js.map
|