@swapkit/core 1.0.0-rc.15 → 1.0.0-rc.17
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 +329 -315
- package/package.json +8 -8
package/dist/index.es.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var We = (e, t, n) => t in e ?
|
|
3
|
-
var T = (e, t, n) => (We(e, typeof t != "symbol" ? t + "" : t, n), 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 mn = [
|
|
14
14
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
15
15
|
{
|
|
16
16
|
anonymous: !1,
|
|
@@ -108,7 +108,7 @@ const cn = [
|
|
|
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 cn = [
|
|
|
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 cn = [
|
|
|
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 cn = [
|
|
|
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 ze = [
|
|
|
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 Me = /* @__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))(Me || {}), 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 || {}), l = /* @__PURE__ */ ((e) => (e.INVALID_INPUT_PARAMETERS = "1000", e.UNKNOWN_PROVIDERS = "1001", e.CANNOT_FIND_INBOUND_ADDRESS = "1002", e.NO_INBOUND_ADDRESSES = "1003", e.CHAIN_HALTED_OR_UNSUPPORTED = "1004", e.MISSING_INPUT_PARAMETER = "1005", e.INVALID_TYPE_GENERIC = "1100", e.INVALID_NUMBER_STRING = "1101", e.INVALID_NUMBER = "1102", e.INVALID_BOOLEAN = "1103", e.INVALID_OBJECT = "1104", e.INVALID_ARRAY = "1105", e.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", e.SELL_BUY_ASSETS_ARE_THE_SAME = "2001", e.MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", e.AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", e.AFF_ADDRESS_TOO_LONG = "2004", e.AFF_BPS_INTEGER_0_100 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROFVIDER_NOT_SUPPORTED = "2008", e.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", e.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", e.SOURCE_ADDRESS_SMART_CONTRACT = "2011", e.INVALID_PROVIDER = "2100", e.MISSING_CROSS_CHAIN_PROVIDER = "2101", e.MISSING_AVAX_PROVIDER = "2102", e.MISSING_BSC_PROVIDER = "2103", e.MISSING_ETH_PROVIDER = "2104", e.INVALID_PROVIDER_FOR_SWAP_OUT = "2105", e.MISSING_ARB_PROVIDER = "2106", e.INVALID_CHAIN = "2200", e.INVALID_ASSET = "2201", e.INVALID_ASSET_IDENTIFIER = "2202", e.UNSUPPORTED_CHAIN = "2204", e.UNSUPPORTED_ASSET = "2203", e.UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205", e.INVALID_SOURCE_ADDRESS = "2300", e.INVALID_DESTINATION_ADDRESS = "2301", e.THORNODE_QUOTE_GENERIC_ERROR = "3000", e.NOT_ENOUGH_SYNTH_BALANCE = "3001", e.SYNTH_MINTING_CAP_REACHED = "3002", e.INVALID_QUOTE_MODE = "4000", e.NO_QUOTES = "4001", e.SERVICE_UNAVAILABLE_GENERIC = "5000", e.MISSING_GAS_DATA_GENERIC = "5100", e.MISSING_TOKEN_INFO_GENERIC = "5200", e.CANT_FIND_TOKEN_LIST = "5201", e.NO_PRICE = "5202", e.PRICE_IS_STALE = "5203", e.ADDRESS_NOT_WHITELISTED = "6000", e.ADDRESS_ALREADY_CLAIMED = "6001", e.TEMPORARY_ERROR = "9999", e))(l || {});
|
|
628
|
+
const at = {
|
|
629
629
|
[l.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
|
|
630
630
|
[l.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
|
|
631
631
|
[l.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
|
|
@@ -676,13 +676,13 @@ const nt = {
|
|
|
676
676
|
[l.PRICE_IS_STALE]: "Price is stale for asset {0}.",
|
|
677
677
|
[l.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
|
|
678
678
|
[l.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
|
|
679
|
-
},
|
|
680
|
-
let n =
|
|
679
|
+
}, ie = (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
|
-
let
|
|
685
|
+
let Tn = class Ne extends Error {
|
|
686
686
|
constructor({
|
|
687
687
|
status: t,
|
|
688
688
|
revision: n,
|
|
@@ -697,15 +697,15 @@ let mn = class Ce extends Error {
|
|
|
697
697
|
},
|
|
698
698
|
displayMessageParams: d
|
|
699
699
|
}) {
|
|
700
|
-
const c = r ||
|
|
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 =
|
|
700
|
+
const c = r || ie(s, d || []) || "";
|
|
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 = ie(s, d || []), this.code = s, this.type = o || Me.UNHANDLED_ERROR, this.options = {
|
|
702
702
|
shouldLog: p || !0,
|
|
703
703
|
shouldTrace: y || !0,
|
|
704
704
|
shouldThrow: u || !1
|
|
705
705
|
}, this.displayMessageParams = d || [], this.options.shouldTrace && Error.captureStackTrace(this);
|
|
706
706
|
}
|
|
707
707
|
static fromErrorInfo(t) {
|
|
708
|
-
return new
|
|
708
|
+
return new Ne(t);
|
|
709
709
|
}
|
|
710
710
|
toErrorInfo() {
|
|
711
711
|
return { ...this, identifier: this.identifier };
|
|
@@ -714,7 +714,7 @@ let mn = 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 ie(this.code, this.displayMessageParams || []);
|
|
718
718
|
}
|
|
719
719
|
handle() {
|
|
720
720
|
const t = `[${this.identifier}]: ${this.message}`;
|
|
@@ -724,8 +724,8 @@ let mn = class Ce extends Error {
|
|
|
724
724
|
return this.toErrorInfo();
|
|
725
725
|
}
|
|
726
726
|
};
|
|
727
|
-
var i = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(i || {}),
|
|
728
|
-
const
|
|
727
|
+
var i = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(i || {}), 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 hn = {
|
|
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 Tn = {
|
|
|
743
743
|
THOR: [44, 931, 0, 0, 0]
|
|
744
744
|
};
|
|
745
745
|
var b = /* @__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))(b || {});
|
|
746
|
-
const
|
|
746
|
+
const _n = [
|
|
747
747
|
"ETH",
|
|
748
748
|
"AVAX",
|
|
749
749
|
"BSC",
|
|
@@ -751,38 +751,38 @@ const hn = [
|
|
|
751
751
|
"OP",
|
|
752
752
|
"MATIC"
|
|
753
753
|
/* Polygon */
|
|
754
|
-
],
|
|
754
|
+
], fn = [
|
|
755
755
|
"BTC",
|
|
756
756
|
"BCH",
|
|
757
757
|
"DOGE",
|
|
758
758
|
"LTC"
|
|
759
759
|
/* Litecoin */
|
|
760
|
-
],
|
|
760
|
+
], bn = [
|
|
761
761
|
"GAIA",
|
|
762
762
|
"THOR",
|
|
763
763
|
"BNB"
|
|
764
764
|
/* Binance */
|
|
765
765
|
];
|
|
766
|
-
var
|
|
767
|
-
const
|
|
766
|
+
var fe = /* @__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))(fe || {}), xe = /* @__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))(xe || {}), 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 || {});
|
|
767
|
+
const ae = Object.values(i), rt = Object.keys(i), be = ae.reduce(
|
|
768
768
|
(e, t) => {
|
|
769
|
-
const n =
|
|
769
|
+
const n = rt.find((a) => i[a] === t);
|
|
770
770
|
return n && (e[t] = n), e;
|
|
771
771
|
},
|
|
772
772
|
{}
|
|
773
|
-
),
|
|
774
|
-
(e, t) => (e[t] =
|
|
773
|
+
), ot = ae.reduce(
|
|
774
|
+
(e, t) => (e[t] = fe[be[t]], e),
|
|
775
775
|
{}
|
|
776
|
-
),
|
|
777
|
-
(e, t) => (e[t] =
|
|
776
|
+
), pt = ae.reduce(
|
|
777
|
+
(e, t) => (e[t] = xe[be[t]], e),
|
|
778
778
|
{}
|
|
779
|
-
),
|
|
779
|
+
), wn = ae.reduce(
|
|
780
780
|
(e, t) => {
|
|
781
|
-
const n = `${
|
|
782
|
-
return e[t] =
|
|
781
|
+
const n = `${be[t]}Hex`;
|
|
782
|
+
return e[t] = fe[n], e;
|
|
783
783
|
},
|
|
784
784
|
{}
|
|
785
|
-
),
|
|
785
|
+
), An = {
|
|
786
786
|
"0xa4b1": "ARB",
|
|
787
787
|
42161: "ARB",
|
|
788
788
|
"0xa86a": "AVAX",
|
|
@@ -807,7 +807,7 @@ const ne = Object.values(i), it = Object.keys(i), _e = ne.reduce(
|
|
|
807
807
|
"thorchain-stagenet-v2": "THOR",
|
|
808
808
|
"thorchain-mainnet-v1": "THOR"
|
|
809
809
|
/* THORChain */
|
|
810
|
-
},
|
|
810
|
+
}, De = {
|
|
811
811
|
ARB: "https://arbiscan.io",
|
|
812
812
|
AVAX: "https://snowtrace.io",
|
|
813
813
|
BSC: "https://bscscan.com",
|
|
@@ -824,53 +824,53 @@ const ne = Object.values(i), it = Object.keys(i), _e = ne.reduce(
|
|
|
824
824
|
MATIC: "https://polygonscan.com",
|
|
825
825
|
THOR: "https://viewblock.io/thorchain"
|
|
826
826
|
};
|
|
827
|
-
var
|
|
827
|
+
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 || {}), k = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(k || {}), 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.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, M = (e, t, n) => (yt(e, typeof t != "symbol" ? t + "" : t, n), n), ct = (e, t, n) => {
|
|
828
828
|
if (!t.has(e))
|
|
829
829
|
throw TypeError("Cannot " + n);
|
|
830
830
|
}, V = (e, t, n) => {
|
|
831
831
|
if (t.has(e))
|
|
832
832
|
throw TypeError("Cannot add the same private member more than once");
|
|
833
833
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
834
|
-
}, O = (e, t, n) => (
|
|
835
|
-
const
|
|
834
|
+
}, O = (e, t, n) => (ct(e, t, "access private method"), n);
|
|
835
|
+
const mt = "0x313ce567", Pe = async ({ chain: e, to: t }) => {
|
|
836
836
|
try {
|
|
837
|
-
const { result: n } = await
|
|
837
|
+
const { result: n } = await Ae.post(pt[e], {
|
|
838
838
|
headers: { accept: "*/*", "cache-control": "no-cache" },
|
|
839
839
|
body: JSON.stringify({
|
|
840
840
|
id: 44,
|
|
841
841
|
jsonrpc: "2.0",
|
|
842
842
|
method: "eth_call",
|
|
843
|
-
params: [{ to: t.toLowerCase(), data:
|
|
843
|
+
params: [{ to: t.toLowerCase(), data: mt }, "latest"]
|
|
844
844
|
})
|
|
845
845
|
});
|
|
846
846
|
return parseInt(BigInt(n).toString());
|
|
847
847
|
} catch (n) {
|
|
848
848
|
return console.error(n), b[e];
|
|
849
849
|
}
|
|
850
|
-
},
|
|
850
|
+
}, Tt = async (e) => {
|
|
851
851
|
if (e === i.Ethereum)
|
|
852
852
|
return b.ETH;
|
|
853
853
|
const [, t] = e.split("-");
|
|
854
|
-
return t != null && t.startsWith("0x") ?
|
|
855
|
-
},
|
|
854
|
+
return t != null && t.startsWith("0x") ? Pe({ chain: i.Ethereum, to: t }) : b.ETH;
|
|
855
|
+
}, ht = async (e) => {
|
|
856
856
|
const [, t] = e.split("-");
|
|
857
|
-
return t != null && t.startsWith("0x") ?
|
|
858
|
-
},
|
|
857
|
+
return t != null && t.startsWith("0x") ? Pe({ chain: i.Avalanche, to: t.toLowerCase() }) : b.AVAX;
|
|
858
|
+
}, _t = async (e) => (e === i.BinanceSmartChain, b.BSC), Be = async ({ chain: e, symbol: t }) => {
|
|
859
859
|
switch (e) {
|
|
860
860
|
case i.Ethereum:
|
|
861
|
-
return mt(t);
|
|
862
|
-
case i.Avalanche:
|
|
863
861
|
return Tt(t);
|
|
864
|
-
case i.
|
|
862
|
+
case i.Avalanche:
|
|
865
863
|
return ht(t);
|
|
864
|
+
case i.BinanceSmartChain:
|
|
865
|
+
return _t(t);
|
|
866
866
|
default:
|
|
867
867
|
return b[e];
|
|
868
868
|
}
|
|
869
|
-
},
|
|
869
|
+
}, ft = {
|
|
870
870
|
[k.Average]: 1.2,
|
|
871
871
|
[k.Fast]: 1.5,
|
|
872
872
|
[k.Fastest]: 2
|
|
873
|
-
},
|
|
873
|
+
}, bt = ({ chain: e, symbol: t }) => {
|
|
874
874
|
switch (e) {
|
|
875
875
|
case i.Bitcoin:
|
|
876
876
|
case i.BitcoinCash:
|
|
@@ -896,7 +896,7 @@ const ct = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
896
896
|
case i.THORChain:
|
|
897
897
|
return t === "RUNE";
|
|
898
898
|
}
|
|
899
|
-
},
|
|
899
|
+
}, wt = (e) => {
|
|
900
900
|
switch (e) {
|
|
901
901
|
case "ETH.THOR":
|
|
902
902
|
return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
|
|
@@ -925,7 +925,7 @@ const ct = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
925
925
|
case i.Ethereum:
|
|
926
926
|
return { identifier: `${e}.${e}`, decimal: b[e] };
|
|
927
927
|
}
|
|
928
|
-
},
|
|
928
|
+
}, At = ({ chain: e, symbol: t }) => {
|
|
929
929
|
if (t.includes("/"))
|
|
930
930
|
return "Synth";
|
|
931
931
|
switch (e) {
|
|
@@ -955,40 +955,40 @@ const ct = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
955
955
|
case i.Optimism:
|
|
956
956
|
return [i.Ethereum, i.Optimism].includes(t) ? "Native" : "OPTIMISM";
|
|
957
957
|
}
|
|
958
|
-
},
|
|
958
|
+
}, En = (e) => {
|
|
959
959
|
var t;
|
|
960
960
|
const [n, ...a] = e.split("."), s = e.includes("/"), r = a.join("."), o = (t = r == null ? void 0 : r.split("-")) == null ? void 0 : t[0];
|
|
961
961
|
return { chain: n, symbol: r, ticker: o, synth: s };
|
|
962
|
-
},
|
|
962
|
+
}, Et = new RegExp(
|
|
963
963
|
/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
|
|
964
964
|
"gmi"
|
|
965
|
-
),
|
|
966
|
-
(t) => !
|
|
967
|
-
),
|
|
965
|
+
), Rn = (e) => e.filter(
|
|
966
|
+
(t) => !Et.test(t.toString()) && !t.toString().includes("undefined")
|
|
967
|
+
), Rt = ({
|
|
968
968
|
liquidityUnits: e,
|
|
969
969
|
poolUnits: t,
|
|
970
970
|
runeDepth: n
|
|
971
971
|
}) => {
|
|
972
972
|
const a = w(e), s = w(t), r = w(n), o = a.mul(r), p = s.mul(s).mul(2), u = s.mul(a).mul(2), y = a.mul(a), d = s.mul(s).mul(s);
|
|
973
973
|
return o.mul(p.sub(u).add(y)).div(d);
|
|
974
|
-
},
|
|
974
|
+
}, gt = ({
|
|
975
975
|
liquidityUnits: e,
|
|
976
976
|
poolUnits: t,
|
|
977
977
|
assetDepth: n
|
|
978
978
|
}) => {
|
|
979
979
|
const a = w(e), s = w(t), r = w(n), o = a.mul(r), p = s.mul(s).mul(2), u = s.mul(a).mul(2), y = a.mul(a), d = o.mul(p.sub(u).add(y)), c = s.mul(s).mul(s);
|
|
980
980
|
return d.div(c);
|
|
981
|
-
},
|
|
981
|
+
}, gn = ({
|
|
982
982
|
percent: e,
|
|
983
983
|
runeDepth: t,
|
|
984
984
|
liquidityUnits: n,
|
|
985
985
|
poolUnits: a
|
|
986
|
-
}) =>
|
|
986
|
+
}) => Rt({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), On = ({
|
|
987
987
|
percent: e,
|
|
988
988
|
assetDepth: t,
|
|
989
989
|
liquidityUnits: n,
|
|
990
990
|
poolUnits: a
|
|
991
|
-
}) =>
|
|
991
|
+
}) => gt({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), w = (e) => new j({ value: e, decimal: b.THOR }), Ot = ({
|
|
992
992
|
liquidityUnits: e,
|
|
993
993
|
poolUnits: t,
|
|
994
994
|
runeDepth: n,
|
|
@@ -996,17 +996,17 @@ const ct = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
996
996
|
}) => ({
|
|
997
997
|
assetAmount: w(a).mul(e).div(t),
|
|
998
998
|
runeAmount: w(n).mul(e).div(t)
|
|
999
|
-
}),
|
|
999
|
+
}), In = ({
|
|
1000
1000
|
liquidityUnits: e,
|
|
1001
1001
|
poolUnits: t,
|
|
1002
1002
|
runeDepth: n,
|
|
1003
1003
|
assetDepth: a,
|
|
1004
1004
|
percent: s
|
|
1005
1005
|
}) => Object.fromEntries(
|
|
1006
|
-
Object.entries(
|
|
1006
|
+
Object.entries(Ot({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
|
|
1007
1007
|
([r, o]) => [r, o.mul(s)]
|
|
1008
1008
|
)
|
|
1009
|
-
),
|
|
1009
|
+
), Sn = ({
|
|
1010
1010
|
runeDepth: e,
|
|
1011
1011
|
poolUnits: t,
|
|
1012
1012
|
assetDepth: n,
|
|
@@ -1019,7 +1019,7 @@ const ct = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
1019
1019
|
return S.div(u).baseValueNumber;
|
|
1020
1020
|
const D = u.add(S);
|
|
1021
1021
|
return S.div(D).baseValueNumber;
|
|
1022
|
-
},
|
|
1022
|
+
}, vn = ({
|
|
1023
1023
|
runeAmount: e,
|
|
1024
1024
|
assetAmount: t,
|
|
1025
1025
|
runeDepth: n,
|
|
@@ -1027,7 +1027,7 @@ const ct = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
1027
1027
|
}) => {
|
|
1028
1028
|
const s = w(n), r = w(a), o = w(t), p = w(e), u = o.mul(s).sub(r.mul(p)), y = r.mul(p).add(s.mul(r));
|
|
1029
1029
|
return Math.abs(u.div(y).baseValueNumber);
|
|
1030
|
-
},
|
|
1030
|
+
}, It = ({
|
|
1031
1031
|
symbol: e,
|
|
1032
1032
|
ticker: t,
|
|
1033
1033
|
chain: n
|
|
@@ -1051,7 +1051,7 @@ const ct = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
1051
1051
|
return r ? `${e}:${n}/${a}::t:0` : `${e}:${n}.${a}:${s || ""}:t:0`;
|
|
1052
1052
|
}
|
|
1053
1053
|
case h.WITHDRAW: {
|
|
1054
|
-
const { chain: n, ticker: a, symbol: s, basisPoints: r, targetAssetString: o, singleSide: p } = t, u = !p && o ? `:${o}` : "", y =
|
|
1054
|
+
const { chain: n, ticker: a, symbol: s, basisPoints: r, targetAssetString: o, singleSide: p } = t, u = !p && o ? `:${o}` : "", y = It({ chain: n, symbol: s, ticker: a });
|
|
1055
1055
|
return `${e}:${n}${p ? "/" : "."}${y}:${r}${u}`;
|
|
1056
1056
|
}
|
|
1057
1057
|
case h.OPEN_LOAN:
|
|
@@ -1062,17 +1062,17 @@ const ct = "0x313ce567", xe = async ({ chain: e, to: t }) => {
|
|
|
1062
1062
|
default:
|
|
1063
1063
|
return "";
|
|
1064
1064
|
}
|
|
1065
|
-
},
|
|
1065
|
+
}, Cn = (e) => {
|
|
1066
1066
|
if (e < 0)
|
|
1067
1067
|
throw new Error("Invalid number of year");
|
|
1068
1068
|
return 10 + e;
|
|
1069
|
-
},
|
|
1069
|
+
}, Mn = (e) => {
|
|
1070
1070
|
if (e.length > 30)
|
|
1071
1071
|
return !1;
|
|
1072
1072
|
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
1073
1073
|
return !!e.match(t);
|
|
1074
|
-
},
|
|
1075
|
-
class
|
|
1074
|
+
}, Nn = ([e, t, n, a, s]) => `${e}'/${t}'/${n}'/${a}${typeof s != "number" ? "" : `/${s}`}`;
|
|
1075
|
+
class Ee extends Error {
|
|
1076
1076
|
constructor(t, n, a) {
|
|
1077
1077
|
const s = t.status || t.status === 0 ? t.status : "", r = t.statusText || "", o = `${s} ${r}`.trim(), p = o ? `status code ${o}` : "an unknown error";
|
|
1078
1078
|
super(`Request failed with ${p}`), Object.defineProperty(this, "response", {
|
|
@@ -1093,7 +1093,7 @@ class we extends Error {
|
|
|
1093
1093
|
}), this.name = "HTTPError", this.response = t, this.request = n, this.options = a;
|
|
1094
1094
|
}
|
|
1095
1095
|
}
|
|
1096
|
-
class
|
|
1096
|
+
class Ve extends Error {
|
|
1097
1097
|
constructor(t) {
|
|
1098
1098
|
super("Request timed out"), Object.defineProperty(this, "request", {
|
|
1099
1099
|
enumerable: !0,
|
|
@@ -1103,28 +1103,28 @@ class Pe extends Error {
|
|
|
1103
1103
|
}), this.name = "TimeoutError", this.request = t;
|
|
1104
1104
|
}
|
|
1105
1105
|
}
|
|
1106
|
-
const
|
|
1106
|
+
const Q = (e) => e !== null && typeof e == "object", J = (...e) => {
|
|
1107
1107
|
for (const t of e)
|
|
1108
|
-
if ((!
|
|
1108
|
+
if ((!Q(t) || Array.isArray(t)) && t !== void 0)
|
|
1109
1109
|
throw new TypeError("The `options` argument must be an object");
|
|
1110
|
-
return
|
|
1111
|
-
},
|
|
1110
|
+
return we({}, ...e);
|
|
1111
|
+
}, Le = (e = {}, t = {}) => {
|
|
1112
1112
|
const n = new globalThis.Headers(e), a = t instanceof globalThis.Headers, s = new globalThis.Headers(t);
|
|
1113
1113
|
for (const [r, o] of s.entries())
|
|
1114
1114
|
a && o === "undefined" || o === void 0 ? n.delete(r) : n.set(r, o);
|
|
1115
1115
|
return n;
|
|
1116
|
-
},
|
|
1116
|
+
}, we = (...e) => {
|
|
1117
1117
|
let t = {}, n = {};
|
|
1118
1118
|
for (const a of e)
|
|
1119
1119
|
if (Array.isArray(a))
|
|
1120
1120
|
Array.isArray(t) || (t = []), t = [...t, ...a];
|
|
1121
|
-
else if (
|
|
1121
|
+
else if (Q(a)) {
|
|
1122
1122
|
for (let [s, r] of Object.entries(a))
|
|
1123
|
-
|
|
1124
|
-
|
|
1123
|
+
Q(r) && s in t && (r = we(t[s], r)), t = { ...t, [s]: r };
|
|
1124
|
+
Q(a.headers) && (n = Le(n, a.headers), t.headers = n);
|
|
1125
1125
|
}
|
|
1126
1126
|
return t;
|
|
1127
|
-
},
|
|
1127
|
+
}, St = (() => {
|
|
1128
1128
|
let e = !1, t = !1;
|
|
1129
1129
|
const n = typeof globalThis.ReadableStream == "function", a = typeof globalThis.Request == "function";
|
|
1130
1130
|
return n && a && (t = new globalThis.Request("https://empty.invalid", {
|
|
@@ -1135,13 +1135,13 @@ const J = (e) => e !== null && typeof e == "object", X = (...e) => {
|
|
|
1135
1135
|
return e = !0, "half";
|
|
1136
1136
|
}
|
|
1137
1137
|
}).headers.has("Content-Type")), e && !t;
|
|
1138
|
-
})(),
|
|
1138
|
+
})(), vt = typeof globalThis.AbortController == "function", Ct = typeof globalThis.ReadableStream == "function", Mt = typeof globalThis.FormData == "function", Ue = ["get", "post", "put", "patch", "head", "delete"], Nt = {
|
|
1139
1139
|
json: "application/json",
|
|
1140
1140
|
text: "text/*",
|
|
1141
1141
|
formData: "multipart/form-data",
|
|
1142
1142
|
arrayBuffer: "*/*",
|
|
1143
1143
|
blob: "*/*"
|
|
1144
|
-
},
|
|
1144
|
+
}, re = 2147483647, He = Symbol("stop"), xt = {
|
|
1145
1145
|
json: !0,
|
|
1146
1146
|
parseJson: !0,
|
|
1147
1147
|
searchParams: !0,
|
|
@@ -1152,7 +1152,7 @@ const J = (e) => e !== null && typeof e == "object", X = (...e) => {
|
|
|
1152
1152
|
throwHttpErrors: !0,
|
|
1153
1153
|
onDownloadProgress: !0,
|
|
1154
1154
|
fetch: !0
|
|
1155
|
-
},
|
|
1155
|
+
}, Dt = {
|
|
1156
1156
|
method: !0,
|
|
1157
1157
|
headers: !0,
|
|
1158
1158
|
body: !0,
|
|
@@ -1168,18 +1168,18 @@ const J = (e) => e !== null && typeof e == "object", X = (...e) => {
|
|
|
1168
1168
|
window: !0,
|
|
1169
1169
|
dispatcher: !0,
|
|
1170
1170
|
duplex: !0
|
|
1171
|
-
},
|
|
1171
|
+
}, Pt = (e) => Ue.includes(e) ? e.toUpperCase() : e, Bt = ["get", "put", "head", "delete", "options", "trace"], Vt = [408, 413, 429, 500, 502, 503, 504], $e = [413, 429, 503], Re = {
|
|
1172
1172
|
limit: 2,
|
|
1173
|
-
methods:
|
|
1174
|
-
statusCodes:
|
|
1175
|
-
afterStatusCodes:
|
|
1173
|
+
methods: Bt,
|
|
1174
|
+
statusCodes: Vt,
|
|
1175
|
+
afterStatusCodes: $e,
|
|
1176
1176
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
1177
1177
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
1178
1178
|
delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
|
|
1179
|
-
},
|
|
1179
|
+
}, Lt = (e = {}) => {
|
|
1180
1180
|
if (typeof e == "number")
|
|
1181
1181
|
return {
|
|
1182
|
-
...
|
|
1182
|
+
...Re,
|
|
1183
1183
|
limit: e
|
|
1184
1184
|
};
|
|
1185
1185
|
if (e.methods && !Array.isArray(e.methods))
|
|
@@ -1187,22 +1187,22 @@ const J = (e) => e !== null && typeof e == "object", X = (...e) => {
|
|
|
1187
1187
|
if (e.statusCodes && !Array.isArray(e.statusCodes))
|
|
1188
1188
|
throw new Error("retry.statusCodes must be an array");
|
|
1189
1189
|
return {
|
|
1190
|
-
...
|
|
1190
|
+
...Re,
|
|
1191
1191
|
...e,
|
|
1192
|
-
afterStatusCodes:
|
|
1192
|
+
afterStatusCodes: $e
|
|
1193
1193
|
};
|
|
1194
1194
|
};
|
|
1195
|
-
async function
|
|
1195
|
+
async function Ut(e, t, n, a) {
|
|
1196
1196
|
return new Promise((s, r) => {
|
|
1197
1197
|
const o = setTimeout(() => {
|
|
1198
|
-
n && n.abort(), r(new
|
|
1198
|
+
n && n.abort(), r(new Ve(e));
|
|
1199
1199
|
}, a.timeout);
|
|
1200
1200
|
a.fetch(e, t).then(s).catch(r).then(() => {
|
|
1201
1201
|
clearTimeout(o);
|
|
1202
1202
|
});
|
|
1203
1203
|
});
|
|
1204
1204
|
}
|
|
1205
|
-
async function
|
|
1205
|
+
async function Ht(e, { signal: t }) {
|
|
1206
1206
|
return new Promise((n, a) => {
|
|
1207
1207
|
t && (t.throwIfAborted(), t.addEventListener("abort", s, { once: !0 }));
|
|
1208
1208
|
function s() {
|
|
@@ -1213,17 +1213,17 @@ async function Ut(e, { signal: t }) {
|
|
|
1213
1213
|
}, e);
|
|
1214
1214
|
});
|
|
1215
1215
|
}
|
|
1216
|
-
const
|
|
1216
|
+
const $t = (e, t) => {
|
|
1217
1217
|
const n = {};
|
|
1218
1218
|
for (const a in t)
|
|
1219
|
-
!(a in
|
|
1219
|
+
!(a in Dt) && !(a in xt) && !(a in e) && (n[a] = t[a]);
|
|
1220
1220
|
return n;
|
|
1221
1221
|
};
|
|
1222
|
-
class
|
|
1222
|
+
class Z {
|
|
1223
1223
|
static create(t, n) {
|
|
1224
|
-
const a = new
|
|
1225
|
-
if (typeof a._options.timeout == "number" && a._options.timeout >
|
|
1226
|
-
throw new RangeError(`The \`timeout\` option cannot be greater than ${
|
|
1224
|
+
const a = new Z(t, n), s = async () => {
|
|
1225
|
+
if (typeof a._options.timeout == "number" && a._options.timeout > re)
|
|
1226
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${re}`);
|
|
1227
1227
|
await Promise.resolve();
|
|
1228
1228
|
let o = await a._fetch();
|
|
1229
1229
|
for (const p of a._options.hooks.afterResponse) {
|
|
@@ -1231,7 +1231,7 @@ class z {
|
|
|
1231
1231
|
u instanceof globalThis.Response && (o = u);
|
|
1232
1232
|
}
|
|
1233
1233
|
if (a._decorateResponse(o), !o.ok && a._options.throwHttpErrors) {
|
|
1234
|
-
let p = new
|
|
1234
|
+
let p = new Ee(o, a.request, a._options);
|
|
1235
1235
|
for (const u of a._options.hooks.beforeError)
|
|
1236
1236
|
p = await u(p);
|
|
1237
1237
|
throw p;
|
|
@@ -1239,13 +1239,13 @@ class z {
|
|
|
1239
1239
|
if (a._options.onDownloadProgress) {
|
|
1240
1240
|
if (typeof a._options.onDownloadProgress != "function")
|
|
1241
1241
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
1242
|
-
if (!
|
|
1242
|
+
if (!Ct)
|
|
1243
1243
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
1244
1244
|
return a._stream(o.clone(), a._options.onDownloadProgress);
|
|
1245
1245
|
}
|
|
1246
1246
|
return o;
|
|
1247
1247
|
}, r = a._options.retry.methods.includes(a.request.method.toLowerCase()) ? a._retry(s) : s();
|
|
1248
|
-
for (const [o, p] of Object.entries(
|
|
1248
|
+
for (const [o, p] of Object.entries(Nt))
|
|
1249
1249
|
r[o] = async () => {
|
|
1250
1250
|
a.request.headers.set("accept", a.request.headers.get("accept") || p);
|
|
1251
1251
|
const u = (await r).clone();
|
|
@@ -1290,17 +1290,17 @@ class z {
|
|
|
1290
1290
|
// TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
|
|
1291
1291
|
credentials: this._input.credentials || "same-origin",
|
|
1292
1292
|
...n,
|
|
1293
|
-
headers:
|
|
1294
|
-
hooks:
|
|
1293
|
+
headers: Le(this._input.headers, n.headers),
|
|
1294
|
+
hooks: we({
|
|
1295
1295
|
beforeRequest: [],
|
|
1296
1296
|
beforeRetry: [],
|
|
1297
1297
|
beforeError: [],
|
|
1298
1298
|
afterResponse: []
|
|
1299
1299
|
}, n.hooks),
|
|
1300
|
-
method:
|
|
1300
|
+
method: Pt(n.method ?? this._input.method),
|
|
1301
1301
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
1302
1302
|
prefixUrl: String(n.prefixUrl || ""),
|
|
1303
|
-
retry:
|
|
1303
|
+
retry: Lt(n.retry),
|
|
1304
1304
|
throwHttpErrors: n.throwHttpErrors !== !1,
|
|
1305
1305
|
timeout: n.timeout ?? 1e4,
|
|
1306
1306
|
fetch: n.fetch ?? globalThis.fetch.bind(globalThis)
|
|
@@ -1311,7 +1311,7 @@ class z {
|
|
|
1311
1311
|
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
1312
1312
|
this._options.prefixUrl.endsWith("/") || (this._options.prefixUrl += "/"), this._input = this._options.prefixUrl + this._input;
|
|
1313
1313
|
}
|
|
1314
|
-
if (
|
|
1314
|
+
if (vt) {
|
|
1315
1315
|
if (this.abortController = new globalThis.AbortController(), this._options.signal) {
|
|
1316
1316
|
const a = this._options.signal;
|
|
1317
1317
|
this._options.signal.addEventListener("abort", () => {
|
|
@@ -1320,15 +1320,15 @@ class z {
|
|
|
1320
1320
|
}
|
|
1321
1321
|
this._options.signal = this.abortController.signal;
|
|
1322
1322
|
}
|
|
1323
|
-
if (
|
|
1323
|
+
if (St && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
|
|
1324
1324
|
const a = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), s = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, a);
|
|
1325
|
-
(
|
|
1325
|
+
(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);
|
|
1326
1326
|
}
|
|
1327
1327
|
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 }));
|
|
1328
1328
|
}
|
|
1329
1329
|
_calculateRetryDelay(t) {
|
|
1330
|
-
if (this._retryCount++, this._retryCount < this._options.retry.limit && !(t instanceof
|
|
1331
|
-
if (t instanceof
|
|
1330
|
+
if (this._retryCount++, this._retryCount < this._options.retry.limit && !(t instanceof Ve)) {
|
|
1331
|
+
if (t instanceof Ee) {
|
|
1332
1332
|
if (!this._options.retry.statusCodes.includes(t.response.status))
|
|
1333
1333
|
return 0;
|
|
1334
1334
|
const a = t.response.headers.get("Retry-After");
|
|
@@ -1351,16 +1351,16 @@ class z {
|
|
|
1351
1351
|
try {
|
|
1352
1352
|
return await t();
|
|
1353
1353
|
} catch (n) {
|
|
1354
|
-
const a = Math.min(this._calculateRetryDelay(n),
|
|
1354
|
+
const a = Math.min(this._calculateRetryDelay(n), re);
|
|
1355
1355
|
if (a !== 0 && this._retryCount > 0) {
|
|
1356
|
-
await
|
|
1356
|
+
await Ht(a, { signal: this._options.signal });
|
|
1357
1357
|
for (const s of this._options.hooks.beforeRetry)
|
|
1358
1358
|
if (await s({
|
|
1359
1359
|
request: this.request,
|
|
1360
1360
|
options: this._options,
|
|
1361
1361
|
error: n,
|
|
1362
1362
|
retryCount: this._retryCount
|
|
1363
|
-
}) ===
|
|
1363
|
+
}) === He)
|
|
1364
1364
|
return;
|
|
1365
1365
|
return this._retry(t);
|
|
1366
1366
|
}
|
|
@@ -1377,8 +1377,8 @@ class z {
|
|
|
1377
1377
|
if (a instanceof Response)
|
|
1378
1378
|
return a;
|
|
1379
1379
|
}
|
|
1380
|
-
const t =
|
|
1381
|
-
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) :
|
|
1380
|
+
const t = $t(this.request, this._options);
|
|
1381
|
+
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Ut(this.request.clone(), t, this.abortController, this._options);
|
|
1382
1382
|
}
|
|
1383
1383
|
/* istanbul ignore next */
|
|
1384
1384
|
_stream(t, n) {
|
|
@@ -1415,35 +1415,35 @@ class z {
|
|
|
1415
1415
|
}
|
|
1416
1416
|
}
|
|
1417
1417
|
/*! MIT License © Sindre Sorhus */
|
|
1418
|
-
const
|
|
1419
|
-
const t = (n, a) =>
|
|
1420
|
-
for (const n of
|
|
1421
|
-
t[n] = (a, s) =>
|
|
1422
|
-
return t.create = (n) =>
|
|
1423
|
-
},
|
|
1418
|
+
const pe = (e) => {
|
|
1419
|
+
const t = (n, a) => Z.create(n, J(e, a));
|
|
1420
|
+
for (const n of Ue)
|
|
1421
|
+
t[n] = (a, s) => Z.create(a, J(e, s, { method: n }));
|
|
1422
|
+
return t.create = (n) => pe(J(n)), t.extend = (n) => pe(J(e, n)), t.stop = He, t;
|
|
1423
|
+
}, kt = pe(), Ft = kt, ge = Ft.create({
|
|
1424
1424
|
headers: {
|
|
1425
1425
|
referrer: "https://sk.thorswap.net",
|
|
1426
1426
|
referer: "https://sk.thorswap.net",
|
|
1427
1427
|
"Content-Type": "application/json"
|
|
1428
1428
|
}
|
|
1429
|
-
}),
|
|
1430
|
-
get: (e, t) =>
|
|
1431
|
-
post: (e, t) =>
|
|
1432
|
-
},
|
|
1429
|
+
}), Ae = {
|
|
1430
|
+
get: (e, t) => ge.get(e, t).json(),
|
|
1431
|
+
post: (e, t) => ge.post(e, t).json()
|
|
1432
|
+
}, Oe = Object.values(i), Gt = (e = "") => {
|
|
1433
1433
|
const t = e.toUpperCase(), [n] = t.split(".");
|
|
1434
|
-
if (
|
|
1434
|
+
if (Oe.includes(n))
|
|
1435
1435
|
return !0;
|
|
1436
1436
|
const [a] = t.split("/");
|
|
1437
|
-
if (
|
|
1437
|
+
if (Oe.includes(a))
|
|
1438
1438
|
return !0;
|
|
1439
1439
|
throw new Error(
|
|
1440
1440
|
`Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
|
|
1441
1441
|
);
|
|
1442
|
-
},
|
|
1443
|
-
function
|
|
1442
|
+
}, W = 8, U = (e) => 10n ** BigInt(e), F = (e) => Math.log10(parseFloat(e.toString()));
|
|
1443
|
+
function se({
|
|
1444
1444
|
value: e,
|
|
1445
|
-
bigIntDecimal: t =
|
|
1446
|
-
decimal: n =
|
|
1445
|
+
bigIntDecimal: t = W,
|
|
1446
|
+
decimal: n = W
|
|
1447
1447
|
}) {
|
|
1448
1448
|
const a = e < 0n;
|
|
1449
1449
|
let s = e.toString().substring(a ? 1 : 0);
|
|
@@ -1456,19 +1456,19 @@ function He({
|
|
|
1456
1456
|
""
|
|
1457
1457
|
);
|
|
1458
1458
|
}
|
|
1459
|
-
var L, $,
|
|
1460
|
-
const
|
|
1459
|
+
var L, $, de, ke, ue, Ie, ee, le, H, G, te, ye;
|
|
1460
|
+
const qt = class ce {
|
|
1461
1461
|
constructor(t) {
|
|
1462
|
-
V(this, L), V(this,
|
|
1463
|
-
const n =
|
|
1462
|
+
V(this, L), V(this, de), V(this, ue), V(this, ee), V(this, H), V(this, te), M(this, "decimalMultiplier", 10n ** 8n), M(this, "bigIntValue", 0n), M(this, "decimal");
|
|
1463
|
+
const n = Te(t);
|
|
1464
1464
|
this.decimal = typeof t == "object" ? t.decimal : void 0, this.decimalMultiplier = U(
|
|
1465
|
-
Math.max(O(this,
|
|
1466
|
-
), O(this,
|
|
1465
|
+
Math.max(O(this, te, ye).call(this, O(this, H, G).call(this, n)), this.decimal || 0)
|
|
1466
|
+
), O(this, de, ke).call(this, n);
|
|
1467
1467
|
}
|
|
1468
1468
|
static fromBigInt(t, n) {
|
|
1469
|
-
return new
|
|
1469
|
+
return new ce({
|
|
1470
1470
|
decimal: n,
|
|
1471
|
-
value:
|
|
1471
|
+
value: se({ value: t, bigIntDecimal: n, decimal: n })
|
|
1472
1472
|
});
|
|
1473
1473
|
}
|
|
1474
1474
|
static shiftDecimals({
|
|
@@ -1476,8 +1476,8 @@ const Gt = class Q {
|
|
|
1476
1476
|
from: n,
|
|
1477
1477
|
to: a
|
|
1478
1478
|
}) {
|
|
1479
|
-
return
|
|
1480
|
-
new
|
|
1479
|
+
return this.fromBigInt(
|
|
1480
|
+
new ce(t).bigIntValue * U(a) / U(n),
|
|
1481
1481
|
a
|
|
1482
1482
|
);
|
|
1483
1483
|
}
|
|
@@ -1557,11 +1557,11 @@ const Gt = class Q {
|
|
|
1557
1557
|
getBigIntValue(t, n) {
|
|
1558
1558
|
if (!n && typeof t == "object")
|
|
1559
1559
|
return t.bigIntValue;
|
|
1560
|
-
const a =
|
|
1561
|
-
return s === "0" || s === "undefined" ? 0n : O(this,
|
|
1560
|
+
const a = Te(t), s = O(this, H, G).call(this, a);
|
|
1561
|
+
return s === "0" || s === "undefined" ? 0n : O(this, ee, le).call(this, s, n);
|
|
1562
1562
|
}
|
|
1563
1563
|
formatBigIntToSafeValue(t, n) {
|
|
1564
|
-
const a = n || this.decimal ||
|
|
1564
|
+
const a = n || this.decimal || W, s = Math.max(
|
|
1565
1565
|
a,
|
|
1566
1566
|
F(this.decimalMultiplier)
|
|
1567
1567
|
), r = t < 0n, o = t.toString().substring(r ? 1 : 0), p = s - (o.length - 1), u = p > 0 ? "0".repeat(p) + o : o, y = u.length - s;
|
|
@@ -1598,9 +1598,16 @@ const Gt = class Q {
|
|
|
1598
1598
|
"0"
|
|
1599
1599
|
)}`;
|
|
1600
1600
|
}
|
|
1601
|
+
toAbbreviation(t = 2) {
|
|
1602
|
+
const n = this.getValue("number"), a = ["", "K", "M", "B", "T", "Q", "Qi", "S"], s = Math.floor(Math.log10(Math.abs(n)) / 3), r = a[s];
|
|
1603
|
+
if (!r)
|
|
1604
|
+
return n;
|
|
1605
|
+
const o = 10 ** (s * 3);
|
|
1606
|
+
return `${(n / o).toFixed(t)}${r}`;
|
|
1607
|
+
}
|
|
1601
1608
|
};
|
|
1602
1609
|
L = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
|
|
1603
|
-
const n = O(this,
|
|
1610
|
+
const n = O(this, ue, Ie).call(this, this, ...t), a = U(n), s = t.reduce(
|
|
1604
1611
|
(o, p) => {
|
|
1605
1612
|
const u = this.getBigIntValue(p, n);
|
|
1606
1613
|
switch (e) {
|
|
@@ -1621,55 +1628,56 @@ L = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
|
|
|
1621
1628
|
},
|
|
1622
1629
|
//normalize is to precision multiplier base
|
|
1623
1630
|
this.bigIntValue * a / this.decimalMultiplier
|
|
1624
|
-
), r =
|
|
1631
|
+
), r = se({
|
|
1625
1632
|
bigIntDecimal: n,
|
|
1626
1633
|
decimal: Math.max(n, F(this.decimalMultiplier)),
|
|
1627
1634
|
value: s
|
|
1628
1635
|
});
|
|
1629
1636
|
return new this.constructor({ decimal: this.decimal, value: r, identifier: this.toString() });
|
|
1630
|
-
},
|
|
1637
|
+
}, de = /* @__PURE__ */ new WeakSet(), ke = function(e) {
|
|
1631
1638
|
const t = O(this, H, G).call(this, e) || "0";
|
|
1632
|
-
this.bigIntValue = O(this,
|
|
1633
|
-
},
|
|
1639
|
+
this.bigIntValue = O(this, ee, le).call(this, t);
|
|
1640
|
+
}, ue = /* @__PURE__ */ new WeakSet(), Ie = function(...e) {
|
|
1634
1641
|
const t = e.map(
|
|
1635
|
-
(n) => typeof n == "object" ? n.decimal || F(n.decimalMultiplier) : O(this,
|
|
1642
|
+
(n) => typeof n == "object" ? n.decimal || F(n.decimalMultiplier) : O(this, te, ye).call(this, O(this, H, G).call(this, n))
|
|
1636
1643
|
).filter(Boolean);
|
|
1637
|
-
return Math.max(...t,
|
|
1638
|
-
},
|
|
1644
|
+
return Math.max(...t, W);
|
|
1645
|
+
}, ee = /* @__PURE__ */ new WeakSet(), le = function(e, t) {
|
|
1639
1646
|
const n = t ? U(t) : this.decimalMultiplier, a = F(n), [s = "", r = ""] = e.split(".");
|
|
1640
1647
|
return BigInt(`${s}${r.padEnd(a, "0")}`);
|
|
1641
1648
|
}, H = /* @__PURE__ */ new WeakSet(), G = function(e) {
|
|
1642
1649
|
const t = `${typeof e == "number" ? Number(e).toLocaleString("fullwide", {
|
|
1643
1650
|
useGrouping: !1,
|
|
1644
1651
|
maximumFractionDigits: 20
|
|
1645
|
-
}) :
|
|
1652
|
+
}) : Te(e)}`.replaceAll(",", ".").split(".");
|
|
1646
1653
|
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1647
|
-
},
|
|
1654
|
+
}, te = /* @__PURE__ */ new WeakSet(), ye = function(e) {
|
|
1648
1655
|
var t;
|
|
1649
1656
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1650
|
-
return Math.max(n,
|
|
1657
|
+
return Math.max(n, W);
|
|
1651
1658
|
};
|
|
1652
|
-
let
|
|
1653
|
-
function
|
|
1659
|
+
let me = qt;
|
|
1660
|
+
function Te(e) {
|
|
1654
1661
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1655
1662
|
}
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1663
|
+
const z = (e, t) => typeof e == "bigint" ? se({ value: e, bigIntDecimal: t, decimal: t }) : e;
|
|
1664
|
+
let he;
|
|
1665
|
+
const oe = (e) => {
|
|
1666
|
+
if (!he)
|
|
1659
1667
|
throw new Error("Static assets not loaded, call await AssetValue.loadStaticAssets() first");
|
|
1660
|
-
return
|
|
1661
|
-
},
|
|
1662
|
-
|
|
1663
|
-
const n = await
|
|
1664
|
-
return new v({ decimal: n, value:
|
|
1668
|
+
return he.get(e.toUpperCase()) || { decimal: b.THOR, identifier: "" };
|
|
1669
|
+
}, Se = async (e, t = 0) => {
|
|
1670
|
+
Gt(e);
|
|
1671
|
+
const n = await Be(_e(e)), a = z(t, n);
|
|
1672
|
+
return new v({ decimal: n, value: a, identifier: e });
|
|
1665
1673
|
};
|
|
1666
|
-
class v extends
|
|
1674
|
+
class v extends me {
|
|
1667
1675
|
constructor(t) {
|
|
1668
1676
|
super(
|
|
1669
|
-
t.value instanceof
|
|
1677
|
+
t.value instanceof me ? t.value : { decimal: t.decimal, value: t.value }
|
|
1670
1678
|
), M(this, "address"), M(this, "chain"), M(this, "isSynthetic", !1), M(this, "isGasAsset", !1), M(this, "symbol"), M(this, "ticker"), M(this, "type");
|
|
1671
|
-
const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a =
|
|
1672
|
-
this.type =
|
|
1679
|
+
const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a = _e(n);
|
|
1680
|
+
this.type = At(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;
|
|
1673
1681
|
}
|
|
1674
1682
|
get assetValue() {
|
|
1675
1683
|
return `${this.getValue("string")} ${this.ticker}`;
|
|
@@ -1685,31 +1693,31 @@ class v extends le {
|
|
|
1685
1693
|
return this.chain === t && this.symbol === n;
|
|
1686
1694
|
}
|
|
1687
1695
|
static async fromString(t, n = 0) {
|
|
1688
|
-
return
|
|
1696
|
+
return Se(t, n);
|
|
1689
1697
|
}
|
|
1690
1698
|
static fromStringSync(t, n = 0) {
|
|
1691
|
-
const { decimal: a, identifier: s } =
|
|
1699
|
+
const { decimal: a, identifier: s } = oe(
|
|
1692
1700
|
t
|
|
1693
|
-
);
|
|
1694
|
-
return s ? new v({ decimal: a, identifier: s, value:
|
|
1701
|
+
), r = z(n, a);
|
|
1702
|
+
return s ? new v({ decimal: a, identifier: s, value: r }) : void 0;
|
|
1695
1703
|
}
|
|
1696
1704
|
static async fromIdentifier(t, n = 0) {
|
|
1697
|
-
return
|
|
1705
|
+
return Se(t, n);
|
|
1698
1706
|
}
|
|
1699
1707
|
static fromIdentifierSync(t, n = 0) {
|
|
1700
|
-
const { decimal: a, identifier: s } =
|
|
1701
|
-
return new v({ decimal: a, identifier: s, value:
|
|
1708
|
+
const { decimal: a, identifier: s } = oe(t), r = z(n, a);
|
|
1709
|
+
return new v({ decimal: a, identifier: s, value: r });
|
|
1702
1710
|
}
|
|
1703
1711
|
static fromChainOrSignature(t, n = 0) {
|
|
1704
|
-
const { decimal: a, identifier: s } =
|
|
1705
|
-
return new v({ value:
|
|
1712
|
+
const { decimal: a, identifier: s } = wt(t), r = z(n, a);
|
|
1713
|
+
return new v({ value: r, decimal: a, identifier: s });
|
|
1706
1714
|
}
|
|
1707
1715
|
static async fromTCQuote(t, n = 0) {
|
|
1708
|
-
const a = await
|
|
1716
|
+
const a = await Be(_e(t)), s = this.shiftDecimals({ value: n, from: b.THOR, to: a });
|
|
1709
1717
|
return new v({ value: s, identifier: t, decimal: a });
|
|
1710
1718
|
}
|
|
1711
1719
|
static fromTCQuoteStatic(t, n = 0) {
|
|
1712
|
-
const a =
|
|
1720
|
+
const a = oe(t), s = this.shiftDecimals({
|
|
1713
1721
|
value: n,
|
|
1714
1722
|
from: b.THOR,
|
|
1715
1723
|
to: a.decimal
|
|
@@ -1727,7 +1735,7 @@ class v extends le {
|
|
|
1727
1735
|
NativeList: s,
|
|
1728
1736
|
...r
|
|
1729
1737
|
} = await import("@swapkit/tokens");
|
|
1730
|
-
|
|
1738
|
+
he = [s, ...Object.values(r)].reduce(
|
|
1731
1739
|
(o, { tokens: p }) => (p.forEach(({ identifier: u, chain: y, ...d }) => {
|
|
1732
1740
|
const c = "decimals" in d ? d.decimals : b[y];
|
|
1733
1741
|
o.set(u, { identifier: u, decimal: c });
|
|
@@ -1745,7 +1753,7 @@ class v extends le {
|
|
|
1745
1753
|
);
|
|
1746
1754
|
}
|
|
1747
1755
|
}
|
|
1748
|
-
const
|
|
1756
|
+
const ve = (e) => {
|
|
1749
1757
|
const t = v.fromChainOrSignature(e);
|
|
1750
1758
|
switch (e) {
|
|
1751
1759
|
case i.Bitcoin:
|
|
@@ -1763,12 +1771,12 @@ const Ie = (e) => {
|
|
|
1763
1771
|
default:
|
|
1764
1772
|
return t.add(1);
|
|
1765
1773
|
}
|
|
1766
|
-
},
|
|
1774
|
+
}, _e = (e) => {
|
|
1767
1775
|
const t = e.slice(0, 14).includes("/"), n = e.includes(".") ? e : `${i.THORChain}.${e}`, [a, s] = n.split("."), [r, o] = s.split("-");
|
|
1768
1776
|
return {
|
|
1769
1777
|
address: o == null ? void 0 : o.toLowerCase(),
|
|
1770
1778
|
chain: a,
|
|
1771
|
-
isGasAsset:
|
|
1779
|
+
isGasAsset: bt({ chain: a, symbol: s }),
|
|
1772
1780
|
isSynthetic: t,
|
|
1773
1781
|
symbol: o ? `${r}-${(o == null ? void 0 : o.toLowerCase()) ?? ""}` : s,
|
|
1774
1782
|
ticker: t ? s : r
|
|
@@ -1835,12 +1843,18 @@ class m extends Error {
|
|
|
1835
1843
|
console.error(n), super(t, { cause: { code: Wt[t], message: t } }), Object.setPrototypeOf(this, m.prototype);
|
|
1836
1844
|
}
|
|
1837
1845
|
}
|
|
1838
|
-
class
|
|
1846
|
+
class j extends me {
|
|
1839
1847
|
eq(t) {
|
|
1840
1848
|
return this.eqValue(t);
|
|
1841
1849
|
}
|
|
1850
|
+
static fromBigInt(t, n) {
|
|
1851
|
+
return new j({
|
|
1852
|
+
decimal: n,
|
|
1853
|
+
value: se({ value: t, bigIntDecimal: n, decimal: n })
|
|
1854
|
+
});
|
|
1855
|
+
}
|
|
1842
1856
|
}
|
|
1843
|
-
const
|
|
1857
|
+
const jt = [
|
|
1844
1858
|
{
|
|
1845
1859
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
1846
1860
|
stateMutability: "nonpayable",
|
|
@@ -1931,7 +1945,7 @@ const qt = [
|
|
|
1931
1945
|
type: "function"
|
|
1932
1946
|
},
|
|
1933
1947
|
{ stateMutability: "payable", type: "receive" }
|
|
1934
|
-
],
|
|
1948
|
+
], Kt = [
|
|
1935
1949
|
{
|
|
1936
1950
|
inputs: [
|
|
1937
1951
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2180,7 +2194,7 @@ const qt = [
|
|
|
2180
2194
|
type: "function"
|
|
2181
2195
|
},
|
|
2182
2196
|
{ stateMutability: "payable", type: "receive" }
|
|
2183
|
-
],
|
|
2197
|
+
], Xt = [
|
|
2184
2198
|
{
|
|
2185
2199
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2186
2200
|
stateMutability: "nonpayable",
|
|
@@ -2271,7 +2285,7 @@ const qt = [
|
|
|
2271
2285
|
type: "function"
|
|
2272
2286
|
},
|
|
2273
2287
|
{ stateMutability: "payable", type: "receive" }
|
|
2274
|
-
],
|
|
2288
|
+
], Jt = [
|
|
2275
2289
|
{
|
|
2276
2290
|
inputs: [
|
|
2277
2291
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2415,7 +2429,7 @@ const qt = [
|
|
|
2415
2429
|
type: "function"
|
|
2416
2430
|
},
|
|
2417
2431
|
{ stateMutability: "payable", type: "receive" }
|
|
2418
|
-
],
|
|
2432
|
+
], Qt = [
|
|
2419
2433
|
{
|
|
2420
2434
|
inputs: [
|
|
2421
2435
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2534,7 +2548,7 @@ const qt = [
|
|
|
2534
2548
|
type: "function"
|
|
2535
2549
|
},
|
|
2536
2550
|
{ stateMutability: "payable", type: "receive" }
|
|
2537
|
-
],
|
|
2551
|
+
], zt = [
|
|
2538
2552
|
{
|
|
2539
2553
|
inputs: [
|
|
2540
2554
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2653,7 +2667,7 @@ const qt = [
|
|
|
2653
2667
|
type: "function"
|
|
2654
2668
|
},
|
|
2655
2669
|
{ stateMutability: "payable", type: "receive" }
|
|
2656
|
-
],
|
|
2670
|
+
], Zt = [
|
|
2657
2671
|
{
|
|
2658
2672
|
inputs: [
|
|
2659
2673
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2772,7 +2786,7 @@ const qt = [
|
|
|
2772
2786
|
type: "function"
|
|
2773
2787
|
},
|
|
2774
2788
|
{ stateMutability: "payable", type: "receive" }
|
|
2775
|
-
],
|
|
2789
|
+
], en = [
|
|
2776
2790
|
{
|
|
2777
2791
|
inputs: [
|
|
2778
2792
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2891,7 +2905,7 @@ const qt = [
|
|
|
2891
2905
|
type: "function"
|
|
2892
2906
|
},
|
|
2893
2907
|
{ stateMutability: "payable", type: "receive" }
|
|
2894
|
-
],
|
|
2908
|
+
], tn = [
|
|
2895
2909
|
{
|
|
2896
2910
|
inputs: [
|
|
2897
2911
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3018,7 +3032,7 @@ const qt = [
|
|
|
3018
3032
|
type: "function"
|
|
3019
3033
|
},
|
|
3020
3034
|
{ stateMutability: "payable", type: "receive" }
|
|
3021
|
-
],
|
|
3035
|
+
], nn = [
|
|
3022
3036
|
{
|
|
3023
3037
|
inputs: [
|
|
3024
3038
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3145,7 +3159,7 @@ const qt = [
|
|
|
3145
3159
|
type: "function"
|
|
3146
3160
|
},
|
|
3147
3161
|
{ stateMutability: "payable", type: "receive" }
|
|
3148
|
-
],
|
|
3162
|
+
], an = [
|
|
3149
3163
|
{
|
|
3150
3164
|
inputs: [
|
|
3151
3165
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3272,7 +3286,7 @@ const qt = [
|
|
|
3272
3286
|
type: "function"
|
|
3273
3287
|
},
|
|
3274
3288
|
{ stateMutability: "payable", type: "receive" }
|
|
3275
|
-
],
|
|
3289
|
+
], sn = [
|
|
3276
3290
|
{
|
|
3277
3291
|
inputs: [
|
|
3278
3292
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3399,7 +3413,7 @@ const qt = [
|
|
|
3399
3413
|
type: "function"
|
|
3400
3414
|
},
|
|
3401
3415
|
{ stateMutability: "payable", type: "receive" }
|
|
3402
|
-
],
|
|
3416
|
+
], rn = [
|
|
3403
3417
|
{
|
|
3404
3418
|
inputs: [
|
|
3405
3419
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3526,27 +3540,27 @@ const qt = [
|
|
|
3526
3540
|
type: "function"
|
|
3527
3541
|
},
|
|
3528
3542
|
{ stateMutability: "payable", type: "receive" }
|
|
3529
|
-
],
|
|
3530
|
-
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]:
|
|
3543
|
+
], Fe = {
|
|
3544
|
+
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: jt,
|
|
3531
3545
|
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: Yt,
|
|
3532
|
-
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]:
|
|
3533
|
-
},
|
|
3534
|
-
...
|
|
3546
|
+
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: Xt
|
|
3547
|
+
}, on = {
|
|
3548
|
+
...Fe,
|
|
3535
3549
|
// AVAX
|
|
3536
|
-
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]:
|
|
3537
|
-
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]:
|
|
3538
|
-
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]:
|
|
3550
|
+
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: Qt,
|
|
3551
|
+
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: Kt,
|
|
3552
|
+
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: Zt,
|
|
3539
3553
|
// BSC
|
|
3540
|
-
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]:
|
|
3554
|
+
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: Jt,
|
|
3541
3555
|
// ETH
|
|
3542
|
-
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]:
|
|
3543
|
-
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]:
|
|
3544
|
-
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]:
|
|
3545
|
-
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]:
|
|
3546
|
-
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]:
|
|
3547
|
-
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]:
|
|
3548
|
-
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]:
|
|
3549
|
-
},
|
|
3556
|
+
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: zt,
|
|
3557
|
+
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: en,
|
|
3558
|
+
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: tn,
|
|
3559
|
+
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: nn,
|
|
3560
|
+
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: an,
|
|
3561
|
+
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: sn,
|
|
3562
|
+
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: rn
|
|
3563
|
+
}, pn = ({
|
|
3550
3564
|
streamSwap: e,
|
|
3551
3565
|
contractAddress: t,
|
|
3552
3566
|
recipient: n,
|
|
@@ -3566,7 +3580,7 @@ const qt = [
|
|
|
3566
3580
|
token: g
|
|
3567
3581
|
}
|
|
3568
3582
|
}) => {
|
|
3569
|
-
const E = !!
|
|
3583
|
+
const E = !!Fe[t.toLowerCase()];
|
|
3570
3584
|
if (E && !y)
|
|
3571
3585
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
3572
3586
|
const I = c || u, S = e && d || I;
|
|
@@ -3585,10 +3599,10 @@ const qt = [
|
|
|
3585
3599
|
S.replace("{recipientAddress}", n),
|
|
3586
3600
|
a(g),
|
|
3587
3601
|
s
|
|
3588
|
-
],
|
|
3589
|
-
return [...D, ...
|
|
3590
|
-
},
|
|
3591
|
-
const n =
|
|
3602
|
+
], Ge = E ? [a(y), o, p] : [r, p];
|
|
3603
|
+
return [...D, ...Ge];
|
|
3604
|
+
}, dn = ({ chain: e, txHash: t }) => {
|
|
3605
|
+
const n = De[e];
|
|
3592
3606
|
switch (e) {
|
|
3593
3607
|
case i.Binance:
|
|
3594
3608
|
case i.Bitcoin:
|
|
@@ -3613,8 +3627,8 @@ const qt = [
|
|
|
3613
3627
|
default:
|
|
3614
3628
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3615
3629
|
}
|
|
3616
|
-
},
|
|
3617
|
-
const n =
|
|
3630
|
+
}, un = ({ chain: e, address: t }) => {
|
|
3631
|
+
const n = De[e];
|
|
3618
3632
|
switch (e) {
|
|
3619
3633
|
case i.Arbitrum:
|
|
3620
3634
|
case i.Avalanche:
|
|
@@ -3637,29 +3651,29 @@ const qt = [
|
|
|
3637
3651
|
default:
|
|
3638
3652
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3639
3653
|
}
|
|
3640
|
-
}, un = (e) => {
|
|
3641
|
-
const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
|
|
3642
|
-
return be.get(`${t}/thorchain/inbound_addresses`);
|
|
3643
3654
|
}, ln = (e) => {
|
|
3644
|
-
const t = e ?
|
|
3645
|
-
return
|
|
3646
|
-
},
|
|
3655
|
+
const t = e ? q.ThornodeStagenet : q.ThornodeMainnet;
|
|
3656
|
+
return Ae.get(`${t}/thorchain/inbound_addresses`);
|
|
3657
|
+
}, yn = (e) => {
|
|
3658
|
+
const t = e ? q.ThornodeStagenet : q.ThornodeMainnet;
|
|
3659
|
+
return Ae.get(`${t}/thorchain/mimir`);
|
|
3660
|
+
}, Ce = () => Object.values(i).reduce(
|
|
3647
3661
|
(e, t) => (e[t] = null, e),
|
|
3648
3662
|
{}
|
|
3649
3663
|
);
|
|
3650
|
-
var B,
|
|
3651
|
-
class
|
|
3664
|
+
var B, ne, K, N, Y, X;
|
|
3665
|
+
class xn {
|
|
3652
3666
|
constructor({ stagenet: t } = {}) {
|
|
3653
|
-
T(this, "connectedChains",
|
|
3654
|
-
T(this, "connectedWallets",
|
|
3667
|
+
T(this, "connectedChains", Ce());
|
|
3668
|
+
T(this, "connectedWallets", Ce());
|
|
3655
3669
|
T(this, "stagenet", !1);
|
|
3656
3670
|
T(this, "getAddress", (t) => {
|
|
3657
3671
|
var n;
|
|
3658
3672
|
return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
|
|
3659
3673
|
});
|
|
3660
|
-
T(this, "getExplorerTxUrl", (t, n) =>
|
|
3674
|
+
T(this, "getExplorerTxUrl", (t, n) => dn({ chain: t, txHash: n }));
|
|
3661
3675
|
T(this, "getWallet", (t) => this.connectedWallets[t]);
|
|
3662
|
-
T(this, "getExplorerAddressUrl", (t, n) =>
|
|
3676
|
+
T(this, "getExplorerAddressUrl", (t, n) => un({ chain: t, address: n }));
|
|
3663
3677
|
T(this, "getBalance", async (t, n) => {
|
|
3664
3678
|
const a = await this.getWalletByChain(t, n);
|
|
3665
3679
|
return (a == null ? void 0 : a.balance) || [];
|
|
@@ -3670,7 +3684,7 @@ class Nn {
|
|
|
3670
3684
|
if (!a.complete)
|
|
3671
3685
|
throw new m("core_swap_route_not_complete");
|
|
3672
3686
|
try {
|
|
3673
|
-
if (
|
|
3687
|
+
if (Ze.includes(r)) {
|
|
3674
3688
|
const y = this.connectedWallets[o];
|
|
3675
3689
|
if (!(y != null && y.sendTransaction))
|
|
3676
3690
|
throw new m("core_wallet_connection_not_found");
|
|
@@ -3680,14 +3694,14 @@ class Nn {
|
|
|
3680
3694
|
data: A,
|
|
3681
3695
|
from: R,
|
|
3682
3696
|
to: g.toLowerCase(),
|
|
3683
|
-
chainId: BigInt(
|
|
3684
|
-
value: E ? new
|
|
3697
|
+
chainId: BigInt(ot[o]),
|
|
3698
|
+
value: E ? new j({
|
|
3685
3699
|
value: c(E) ? E : _(E, "wei").toString(16)
|
|
3686
3700
|
}).baseValueBigInt : 0n
|
|
3687
3701
|
};
|
|
3688
3702
|
return y.sendTransaction(I, s);
|
|
3689
3703
|
}
|
|
3690
|
-
if (
|
|
3704
|
+
if (tt.includes(r)) {
|
|
3691
3705
|
if (!a.calldata.fromAsset)
|
|
3692
3706
|
throw new m("core_swap_asset_not_recognized");
|
|
3693
3707
|
const y = await v.fromString(a.calldata.fromAsset);
|
|
@@ -3696,7 +3710,7 @@ class Nn {
|
|
|
3696
3710
|
const { address: d } = await f(this, B).call(this, y.chain), {
|
|
3697
3711
|
contract: c,
|
|
3698
3712
|
calldata: { expiration: _, amountIn: A, memo: R, memoStreamingSwap: g }
|
|
3699
|
-
} = a, E = y.add(
|
|
3713
|
+
} = a, E = y.add(j.fromBigInt(BigInt(A), y.decimal)), I = t && g || R;
|
|
3700
3714
|
return this.deposit({
|
|
3701
3715
|
expiration: _,
|
|
3702
3716
|
assetValue: E,
|
|
@@ -3706,18 +3720,18 @@ class Nn {
|
|
|
3706
3720
|
recipient: d
|
|
3707
3721
|
});
|
|
3708
3722
|
}
|
|
3709
|
-
if (
|
|
3723
|
+
if (et.includes(r)) {
|
|
3710
3724
|
const { calldata: y, contract: d } = a;
|
|
3711
3725
|
if (!d)
|
|
3712
3726
|
throw new m("core_swap_contract_not_found");
|
|
3713
3727
|
const c = this.connectedWallets[o], _ = this.getAddress(o);
|
|
3714
3728
|
if (!(c != null && c.sendTransaction) || !_)
|
|
3715
3729
|
throw new m("core_wallet_connection_not_found");
|
|
3716
|
-
const { getProvider: A, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), g = A(o), E =
|
|
3730
|
+
const { getProvider: A, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), g = A(o), E = on[d.toLowerCase()];
|
|
3717
3731
|
if (!E)
|
|
3718
3732
|
throw new m("core_swap_contract_not_supported", { contractAddress: d });
|
|
3719
3733
|
const S = await (await ((u = c.createContract) == null ? void 0 : u.call(c, d, E, g))).getFunction("swapIn").populateTransaction(
|
|
3720
|
-
...
|
|
3734
|
+
...pn({
|
|
3721
3735
|
streamSwap: t,
|
|
3722
3736
|
toChecksumAddress: R,
|
|
3723
3737
|
contractAddress: d,
|
|
@@ -3747,8 +3761,8 @@ class Nn {
|
|
|
3747
3761
|
walletType: (o = this.connectedChains[t]) == null ? void 0 : o.walletType
|
|
3748
3762
|
}, { ...this.connectedChains[t] };
|
|
3749
3763
|
});
|
|
3750
|
-
T(this, "approveAssetValue", (t, n) => f(this,
|
|
3751
|
-
T(this, "isAssetValueApproved", (t, n) => f(this,
|
|
3764
|
+
T(this, "approveAssetValue", (t, n) => f(this, K).call(this, { assetValue: t, type: "approve", contractAddress: n }));
|
|
3765
|
+
T(this, "isAssetValueApproved", (t, n) => f(this, K).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
|
|
3752
3766
|
T(this, "validateAddress", ({ address: t, chain: n }) => {
|
|
3753
3767
|
var a, s;
|
|
3754
3768
|
return (s = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : s.call(a, t);
|
|
@@ -3758,7 +3772,7 @@ class Nn {
|
|
|
3758
3772
|
if (!n)
|
|
3759
3773
|
throw new m("core_wallet_connection_not_found");
|
|
3760
3774
|
try {
|
|
3761
|
-
return await n.transfer(f(this,
|
|
3775
|
+
return await n.transfer(f(this, X).call(this, t));
|
|
3762
3776
|
} catch (a) {
|
|
3763
3777
|
throw new m("core_swap_transaction_error", a);
|
|
3764
3778
|
}
|
|
@@ -3772,7 +3786,7 @@ class Nn {
|
|
|
3772
3786
|
const { chain: r, symbol: o, ticker: p } = t, u = this.connectedWallets[r];
|
|
3773
3787
|
if (!u)
|
|
3774
3788
|
throw new m("core_wallet_connection_not_found");
|
|
3775
|
-
const y = f(this,
|
|
3789
|
+
const y = f(this, X).call(this, { assetValue: t, recipient: n, router: a, ...s });
|
|
3776
3790
|
try {
|
|
3777
3791
|
switch (r) {
|
|
3778
3792
|
case i.THORChain: {
|
|
@@ -3782,7 +3796,7 @@ class Nn {
|
|
|
3782
3796
|
case i.Ethereum:
|
|
3783
3797
|
case i.BinanceSmartChain:
|
|
3784
3798
|
case i.Avalanche: {
|
|
3785
|
-
const { getChecksumAddressFromAsset: d } = await import("@swapkit/toolbox-evm"), c = r === i.Avalanche ?
|
|
3799
|
+
const { getChecksumAddressFromAsset: d } = await import("@swapkit/toolbox-evm"), c = r === i.Avalanche ? Je : r === i.BinanceSmartChain ? Qe : Xe;
|
|
3786
3800
|
return await u.call({
|
|
3787
3801
|
abi: c,
|
|
3788
3802
|
contractAddress: a || (await f(this, B).call(this, r)).router,
|
|
@@ -3889,7 +3903,7 @@ class Nn {
|
|
|
3889
3903
|
const o = r === "rune" ? v.fromChainOrSignature(i.THORChain) : s === "sym" && r === "sym" || s === "rune" || s === "asset" ? void 0 : n;
|
|
3890
3904
|
try {
|
|
3891
3905
|
return await f(this, N).call(this, {
|
|
3892
|
-
assetValue:
|
|
3906
|
+
assetValue: ve(s === "asset" ? n.chain : i.THORChain),
|
|
3893
3907
|
memo: t || x(h.WITHDRAW, {
|
|
3894
3908
|
symbol: n.symbol,
|
|
3895
3909
|
chain: n.chain,
|
|
@@ -3942,7 +3956,7 @@ class Nn {
|
|
|
3942
3956
|
});
|
|
3943
3957
|
return f(this, Y).call(this, {
|
|
3944
3958
|
memo: r,
|
|
3945
|
-
assetValue: t === "bond" ? n :
|
|
3959
|
+
assetValue: t === "bond" ? n : ve(i.THORChain)
|
|
3946
3960
|
});
|
|
3947
3961
|
});
|
|
3948
3962
|
T(this, "registerThorname", ({
|
|
@@ -3953,7 +3967,7 @@ class Nn {
|
|
|
3953
3967
|
try {
|
|
3954
3968
|
t.forEach((r) => {
|
|
3955
3969
|
this[r.connectMethodName] = r.connect({
|
|
3956
|
-
addChain: f(this,
|
|
3970
|
+
addChain: f(this, ne),
|
|
3957
3971
|
config: n || {},
|
|
3958
3972
|
apis: a,
|
|
3959
3973
|
rpcUrls: s
|
|
@@ -4038,17 +4052,17 @@ class Nn {
|
|
|
4038
4052
|
halted: !1,
|
|
4039
4053
|
chain: i.THORChain
|
|
4040
4054
|
};
|
|
4041
|
-
const a = (await
|
|
4055
|
+
const a = (await ln(this.stagenet)).find((s) => s.chain === t);
|
|
4042
4056
|
if (!a)
|
|
4043
4057
|
throw new m("core_inbound_data_not_found");
|
|
4044
4058
|
if (a != null && a.halted)
|
|
4045
4059
|
throw new m("core_chain_halted");
|
|
4046
4060
|
return a;
|
|
4047
4061
|
});
|
|
4048
|
-
P(this,
|
|
4062
|
+
P(this, ne, ({ chain: t, wallet: n, walletMethods: a }) => {
|
|
4049
4063
|
this.connectedChains[t] = n, this.connectedWallets[t] = a;
|
|
4050
4064
|
});
|
|
4051
|
-
P(this,
|
|
4065
|
+
P(this, K, async ({
|
|
4052
4066
|
assetValue: { baseValueBigInt: t, address: n, chain: a, isGasAsset: s, isSynthetic: r },
|
|
4053
4067
|
type: o = "checkOnly",
|
|
4054
4068
|
contractAddress: p
|
|
@@ -4079,7 +4093,7 @@ class Nn {
|
|
|
4079
4093
|
gas_rate: s,
|
|
4080
4094
|
router: r,
|
|
4081
4095
|
address: o
|
|
4082
|
-
} = await f(this, B).call(this, t.chain), p = (parseInt(s) || 0) *
|
|
4096
|
+
} = await f(this, B).call(this, t.chain), p = (parseInt(s) || 0) * ft[a];
|
|
4083
4097
|
return this.deposit({
|
|
4084
4098
|
assetValue: t,
|
|
4085
4099
|
recipient: o,
|
|
@@ -4089,12 +4103,12 @@ class Nn {
|
|
|
4089
4103
|
});
|
|
4090
4104
|
});
|
|
4091
4105
|
P(this, Y, async ({ memo: t, assetValue: n }) => {
|
|
4092
|
-
const a = await
|
|
4106
|
+
const a = await yn(this.stagenet);
|
|
4093
4107
|
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
4094
4108
|
throw new m("core_chain_halted");
|
|
4095
4109
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
4096
4110
|
});
|
|
4097
|
-
P(this,
|
|
4111
|
+
P(this, X, ({ assetValue: t, ...n }) => ({
|
|
4098
4112
|
...n,
|
|
4099
4113
|
memo: n.memo || "",
|
|
4100
4114
|
from: this.getAddress(t.chain),
|
|
@@ -4103,65 +4117,65 @@ class Nn {
|
|
|
4103
4117
|
this.stagenet = !!t;
|
|
4104
4118
|
}
|
|
4105
4119
|
}
|
|
4106
|
-
B = new WeakMap(),
|
|
4120
|
+
B = new WeakMap(), ne = new WeakMap(), K = new WeakMap(), N = new WeakMap(), Y = new WeakMap(), X = new WeakMap();
|
|
4107
4121
|
export {
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4122
|
+
Ze as AGG_SWAP,
|
|
4123
|
+
Tn as ApiError,
|
|
4124
|
+
q as ApiUrl,
|
|
4111
4125
|
v as AssetValue,
|
|
4112
4126
|
b as BaseDecimal,
|
|
4113
|
-
|
|
4127
|
+
me as BigIntArithmetics,
|
|
4114
4128
|
i as Chain,
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4129
|
+
fe as ChainId,
|
|
4130
|
+
An as ChainIdToChain,
|
|
4131
|
+
ot as ChainToChainId,
|
|
4132
|
+
De as ChainToExplorerUrl,
|
|
4133
|
+
wn as ChainToHexChainId,
|
|
4134
|
+
pt as ChainToRPC,
|
|
4135
|
+
st as ContractAddress,
|
|
4136
|
+
bn as CosmosChainList,
|
|
4137
|
+
it as DerivationPath,
|
|
4124
4138
|
l as ERROR_CODE,
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4139
|
+
nt as ERROR_MODULE,
|
|
4140
|
+
Me as ERROR_TYPE,
|
|
4141
|
+
_n as EVMChainList,
|
|
4142
|
+
dt as ErrorCode,
|
|
4129
4143
|
k as FeeOption,
|
|
4130
4144
|
h as MemoType,
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4145
|
+
hn as NetworkDerivationPath,
|
|
4146
|
+
ze as QuoteMode,
|
|
4147
|
+
xe as RPCUrl,
|
|
4148
|
+
Ae as RequestClient,
|
|
4149
|
+
et as SWAP_IN,
|
|
4150
|
+
tt as SWAP_OUT,
|
|
4151
|
+
xn as SwapKitCore,
|
|
4138
4152
|
m as SwapKitError,
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4153
|
+
j as SwapKitNumber,
|
|
4154
|
+
Je as TCAvalancheDepositABI,
|
|
4155
|
+
Qe as TCBscDepositABI,
|
|
4156
|
+
Xe as TCEthereumVaultAbi,
|
|
4157
|
+
fn as UTXOChainList,
|
|
4158
|
+
ut as WalletOption,
|
|
4159
|
+
En as assetFromString,
|
|
4160
|
+
Nn as derivationPathToString,
|
|
4161
|
+
mn as erc20ABI,
|
|
4162
|
+
Rn as filterAssets,
|
|
4163
|
+
se as formatBigIntToSafeValue,
|
|
4164
|
+
ft as gasFeeMultiplier,
|
|
4165
|
+
At as getAssetType,
|
|
4166
|
+
gt as getAsymmetricAssetShare,
|
|
4167
|
+
On as getAsymmetricAssetWithdrawAmount,
|
|
4168
|
+
Rt as getAsymmetricRuneShare,
|
|
4169
|
+
gn as getAsymmetricRuneWithdrawAmount,
|
|
4170
|
+
wt as getCommonAssetInfo,
|
|
4171
|
+
Be as getDecimal,
|
|
4172
|
+
Sn as getEstimatedPoolShare,
|
|
4173
|
+
vn as getLiquiditySlippage,
|
|
4160
4174
|
x as getMemoFor,
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4175
|
+
ve as getMinAmountByChain,
|
|
4176
|
+
Ot as getSymmetricPoolShare,
|
|
4177
|
+
In as getSymmetricWithdraw,
|
|
4178
|
+
Cn as getTHORNameCost,
|
|
4179
|
+
bt as isGasAsset,
|
|
4180
|
+
Mn as validateTHORName
|
|
4167
4181
|
};
|