@swapkit/core 1.0.0-rc.68 → 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 +491 -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,29 +1472,31 @@ 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
|
}) {
|
|
1478
1501
|
if (n === 0)
|
|
1479
1502
|
return e.toString();
|
|
@@ -1488,17 +1511,17 @@ function se({
|
|
|
1488
1511
|
""
|
|
1489
1512
|
);
|
|
1490
1513
|
}
|
|
1491
|
-
var U, k, B, H,
|
|
1492
|
-
const
|
|
1514
|
+
var U, k, B, H, ce, Ve, z, de, te, me;
|
|
1515
|
+
const Wt = class Ue {
|
|
1493
1516
|
constructor(t) {
|
|
1494
|
-
$(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");
|
|
1495
1518
|
const n = Te(t), a = typeof t == "object";
|
|
1496
|
-
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);
|
|
1497
1520
|
}
|
|
1498
1521
|
static fromBigInt(t, n) {
|
|
1499
|
-
return new
|
|
1522
|
+
return new Ue({
|
|
1500
1523
|
decimal: n,
|
|
1501
|
-
value:
|
|
1524
|
+
value: ie({ value: t, bigIntDecimal: n, decimal: n })
|
|
1502
1525
|
});
|
|
1503
1526
|
}
|
|
1504
1527
|
static shiftDecimals({
|
|
@@ -1558,7 +1581,7 @@ const Kt = class $e {
|
|
|
1558
1581
|
}
|
|
1559
1582
|
// @ts-expect-error
|
|
1560
1583
|
getBaseValue(t) {
|
|
1561
|
-
const n = this.decimalMultiplier / L(this.decimal ||
|
|
1584
|
+
const n = this.decimalMultiplier / L(this.decimal || A.THOR), a = this.bigIntValue / n;
|
|
1562
1585
|
switch (t) {
|
|
1563
1586
|
case "number":
|
|
1564
1587
|
return Number(a);
|
|
@@ -1571,8 +1594,8 @@ const Kt = class $e {
|
|
|
1571
1594
|
getBigIntValue(t, n) {
|
|
1572
1595
|
if (!n && typeof t == "object")
|
|
1573
1596
|
return t.bigIntValue;
|
|
1574
|
-
const a = Te(t), s =
|
|
1575
|
-
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);
|
|
1576
1599
|
}
|
|
1577
1600
|
toSignificant(t = 6) {
|
|
1578
1601
|
const [n, a] = this.getValue("string").split("."), s = n || "", r = a || "";
|
|
@@ -1614,36 +1637,36 @@ const Kt = class $e {
|
|
|
1614
1637
|
decimalSeparator: s = ".",
|
|
1615
1638
|
thousandSeparator: r = ","
|
|
1616
1639
|
} = {}) {
|
|
1617
|
-
const o = this.getValue("number"), [p, d = ""] = o.toFixed(6).split("."),
|
|
1618
|
-
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 : ""}`;
|
|
1619
1642
|
}
|
|
1620
1643
|
formatBigIntToSafeValue(t, n) {
|
|
1621
|
-
const a = n || this.decimal ||
|
|
1644
|
+
const a = n || this.decimal || j, s = Math.max(
|
|
1622
1645
|
a,
|
|
1623
1646
|
G(this.decimalMultiplier)
|
|
1624
|
-
), r = t < 0n, o = t.toString().substring(r ? 1 : 0), p = s - (o.length - 1), d = p > 0 ? "0".repeat(p) + o : o,
|
|
1625
|
-
let
|
|
1626
|
-
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(
|
|
1627
1650
|
0,
|
|
1628
|
-
|
|
1629
|
-
)}.${
|
|
1651
|
+
l
|
|
1652
|
+
)}.${u}`.replace(/\.?0*$/, "");
|
|
1630
1653
|
}
|
|
1631
1654
|
};
|
|
1632
1655
|
U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
1633
|
-
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(
|
|
1634
1657
|
(p, d) => {
|
|
1635
|
-
const
|
|
1658
|
+
const l = this.getBigIntValue(d, a);
|
|
1636
1659
|
switch (e) {
|
|
1637
1660
|
case "add":
|
|
1638
|
-
return p +
|
|
1661
|
+
return p + l;
|
|
1639
1662
|
case "sub":
|
|
1640
|
-
return p -
|
|
1663
|
+
return p - l;
|
|
1641
1664
|
case "mul":
|
|
1642
|
-
return p *
|
|
1665
|
+
return p * l / s;
|
|
1643
1666
|
case "div": {
|
|
1644
|
-
if (
|
|
1667
|
+
if (l === 0n)
|
|
1645
1668
|
throw new RangeError("Division by zero");
|
|
1646
|
-
return p * s /
|
|
1669
|
+
return p * s / l;
|
|
1647
1670
|
}
|
|
1648
1671
|
default:
|
|
1649
1672
|
return p;
|
|
@@ -1651,7 +1674,7 @@ U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
|
1651
1674
|
},
|
|
1652
1675
|
//normalize is to precision multiplier base
|
|
1653
1676
|
this.bigIntValue * s / this.decimalMultiplier
|
|
1654
|
-
), o =
|
|
1677
|
+
), o = ie({
|
|
1655
1678
|
bigIntDecimal: a,
|
|
1656
1679
|
decimal: a,
|
|
1657
1680
|
value: r
|
|
@@ -1663,7 +1686,7 @@ U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
|
1663
1686
|
identifier: this.toString()
|
|
1664
1687
|
});
|
|
1665
1688
|
}, B = /* @__PURE__ */ new WeakSet(), H = function(e, ...t) {
|
|
1666
|
-
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);
|
|
1667
1690
|
switch (e) {
|
|
1668
1691
|
case "gt":
|
|
1669
1692
|
return s > a;
|
|
@@ -1676,52 +1699,46 @@ U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
|
1676
1699
|
case "eqValue":
|
|
1677
1700
|
return s === a;
|
|
1678
1701
|
}
|
|
1679
|
-
},
|
|
1680
|
-
const t =
|
|
1681
|
-
this.bigIntValue = R(this,
|
|
1682
|
-
},
|
|
1683
|
-
const t = e.map((n) => typeof n == "object" ? n.decimal || G(n.decimalMultiplier) :
|
|
1684
|
-
return Math.max(...t,
|
|
1685
|
-
},
|
|
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) {
|
|
1686
1709
|
const n = t ? L(t) : this.decimalMultiplier, a = G(n), [s = "", r = ""] = e.split(".");
|
|
1687
1710
|
return BigInt(`${s}${r.padEnd(a, "0")}`);
|
|
1688
1711
|
};
|
|
1689
|
-
let
|
|
1690
|
-
const
|
|
1712
|
+
let He = Wt;
|
|
1713
|
+
const jt = Intl.NumberFormat("fullwide", {
|
|
1691
1714
|
useGrouping: !1,
|
|
1692
1715
|
maximumFractionDigits: 20
|
|
1693
1716
|
});
|
|
1694
|
-
function
|
|
1695
|
-
const t = `${typeof e == "number" ?
|
|
1717
|
+
function ne(e) {
|
|
1718
|
+
const t = `${typeof e == "number" ? jt.format(e) : Te(e)}`.replaceAll(",", ".").split(".");
|
|
1696
1719
|
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1697
1720
|
}
|
|
1698
|
-
function
|
|
1721
|
+
function $e(e) {
|
|
1699
1722
|
var t;
|
|
1700
1723
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1701
|
-
return Math.max(n,
|
|
1724
|
+
return Math.max(n, j);
|
|
1702
1725
|
}
|
|
1703
1726
|
function Te(e) {
|
|
1704
1727
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1705
1728
|
}
|
|
1706
|
-
const
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
};
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`;
|
|
1720
|
-
super(
|
|
1721
|
-
t.value instanceof me ? t.value : { decimal: t.decimal, value: t.value }
|
|
1722
|
-
), 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");
|
|
1723
|
-
const a = _e(n);
|
|
1724
|
-
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;
|
|
1725
1742
|
}
|
|
1726
1743
|
toString() {
|
|
1727
1744
|
return this.isSynthetic ? this.symbol : `${this.chain}.${this.symbol}`;
|
|
@@ -1740,44 +1757,59 @@ class N extends me {
|
|
|
1740
1757
|
if (!a || !s)
|
|
1741
1758
|
throw new Error("Invalid asset url");
|
|
1742
1759
|
const o = a === i.THORChain && r ? `${a}.${s}/${r}` : t;
|
|
1743
|
-
return
|
|
1760
|
+
return le(o, n);
|
|
1744
1761
|
}
|
|
1745
1762
|
static fromString(t, n = 0) {
|
|
1746
|
-
return
|
|
1747
|
-
}
|
|
1748
|
-
static fromStringSync(t, n = 0) {
|
|
1749
|
-
const { isSynthetic: a } = _e(t), {
|
|
1750
|
-
tax: s,
|
|
1751
|
-
decimal: r,
|
|
1752
|
-
identifier: o
|
|
1753
|
-
} = Ie(t), p = z(n, r);
|
|
1754
|
-
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);
|
|
1755
1764
|
}
|
|
1756
1765
|
static fromIdentifier(t, n = 0) {
|
|
1757
|
-
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
|
+
});
|
|
1758
1783
|
}
|
|
1759
1784
|
static fromIdentifierSync(t, n = 0) {
|
|
1760
|
-
const
|
|
1761
|
-
|
|
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) });
|
|
1762
1794
|
}
|
|
1763
1795
|
static fromChainOrSignature(t, n = 0) {
|
|
1764
|
-
const { decimal: a, identifier: s } =
|
|
1765
|
-
return new
|
|
1796
|
+
const { decimal: a, identifier: s } = wt(t);
|
|
1797
|
+
return new x({ value: Z(n, a), decimal: a, identifier: s });
|
|
1766
1798
|
}
|
|
1767
1799
|
static loadStaticAssets() {
|
|
1768
1800
|
return new Promise(
|
|
1769
1801
|
async (t, n) => {
|
|
1770
1802
|
try {
|
|
1771
1803
|
const a = await import("@swapkit/tokens");
|
|
1772
|
-
|
|
1773
|
-
var
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
identifier:
|
|
1777
|
-
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]
|
|
1778
1810
|
});
|
|
1779
|
-
})
|
|
1780
|
-
}
|
|
1811
|
+
});
|
|
1812
|
+
}), t({ ok: !0 });
|
|
1781
1813
|
} catch (a) {
|
|
1782
1814
|
console.error(a), n({
|
|
1783
1815
|
ok: !1,
|
|
@@ -1789,8 +1821,8 @@ class N extends me {
|
|
|
1789
1821
|
);
|
|
1790
1822
|
}
|
|
1791
1823
|
}
|
|
1792
|
-
|
|
1793
|
-
const t =
|
|
1824
|
+
function ue(e) {
|
|
1825
|
+
const t = x.fromChainOrSignature(e);
|
|
1794
1826
|
switch (e) {
|
|
1795
1827
|
case i.Bitcoin:
|
|
1796
1828
|
case i.Litecoin:
|
|
@@ -1807,17 +1839,27 @@ const ue = (e) => {
|
|
|
1807
1839
|
default:
|
|
1808
1840
|
return t.set(1e-8);
|
|
1809
1841
|
}
|
|
1810
|
-
}
|
|
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) {
|
|
1811
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("-");
|
|
1812
1853
|
return {
|
|
1813
1854
|
address: d == null ? void 0 : d.toLowerCase(),
|
|
1814
1855
|
chain: r,
|
|
1815
|
-
isGasAsset:
|
|
1856
|
+
isGasAsset: Ne({ chain: r, symbol: o }),
|
|
1816
1857
|
isSynthetic: t,
|
|
1817
1858
|
symbol: (t ? `${n}/` : "") + (d ? `${p}-${(d == null ? void 0 : d.toLowerCase()) ?? ""}` : o),
|
|
1818
1859
|
ticker: p
|
|
1819
1860
|
};
|
|
1820
|
-
}
|
|
1861
|
+
}
|
|
1862
|
+
const Kt = {
|
|
1821
1863
|
/**
|
|
1822
1864
|
* Core
|
|
1823
1865
|
*/
|
|
@@ -1877,21 +1919,21 @@ const ue = (e) => {
|
|
|
1877
1919
|
};
|
|
1878
1920
|
class c extends Error {
|
|
1879
1921
|
constructor(t, n) {
|
|
1880
|
-
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);
|
|
1881
1923
|
}
|
|
1882
1924
|
}
|
|
1883
|
-
class
|
|
1925
|
+
class N extends He {
|
|
1884
1926
|
eq(t) {
|
|
1885
1927
|
return this.eqValue(t);
|
|
1886
1928
|
}
|
|
1887
1929
|
static fromBigInt(t, n) {
|
|
1888
|
-
return new
|
|
1930
|
+
return new N({
|
|
1889
1931
|
decimal: n,
|
|
1890
|
-
value:
|
|
1932
|
+
value: ie({ value: t, bigIntDecimal: n, decimal: n })
|
|
1891
1933
|
});
|
|
1892
1934
|
}
|
|
1893
1935
|
}
|
|
1894
|
-
const
|
|
1936
|
+
const Yt = [
|
|
1895
1937
|
{
|
|
1896
1938
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
1897
1939
|
stateMutability: "nonpayable",
|
|
@@ -1982,7 +2024,7 @@ const Jt = [
|
|
|
1982
2024
|
type: "function"
|
|
1983
2025
|
},
|
|
1984
2026
|
{ stateMutability: "payable", type: "receive" }
|
|
1985
|
-
],
|
|
2027
|
+
], Xt = [
|
|
1986
2028
|
{
|
|
1987
2029
|
inputs: [
|
|
1988
2030
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2126,7 +2168,7 @@ const Jt = [
|
|
|
2126
2168
|
type: "function"
|
|
2127
2169
|
},
|
|
2128
2170
|
{ stateMutability: "payable", type: "receive" }
|
|
2129
|
-
],
|
|
2171
|
+
], Jt = [
|
|
2130
2172
|
{
|
|
2131
2173
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2132
2174
|
stateMutability: "nonpayable",
|
|
@@ -2231,7 +2273,7 @@ const Jt = [
|
|
|
2231
2273
|
type: "function"
|
|
2232
2274
|
},
|
|
2233
2275
|
{ stateMutability: "payable", type: "receive" }
|
|
2234
|
-
],
|
|
2276
|
+
], Qt = [
|
|
2235
2277
|
{
|
|
2236
2278
|
inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
|
|
2237
2279
|
stateMutability: "nonpayable",
|
|
@@ -2322,7 +2364,7 @@ const Jt = [
|
|
|
2322
2364
|
type: "function"
|
|
2323
2365
|
},
|
|
2324
2366
|
{ stateMutability: "payable", type: "receive" }
|
|
2325
|
-
],
|
|
2367
|
+
], zt = [
|
|
2326
2368
|
{
|
|
2327
2369
|
inputs: [
|
|
2328
2370
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2466,7 +2508,7 @@ const Jt = [
|
|
|
2466
2508
|
type: "function"
|
|
2467
2509
|
},
|
|
2468
2510
|
{ stateMutability: "payable", type: "receive" }
|
|
2469
|
-
],
|
|
2511
|
+
], Zt = [
|
|
2470
2512
|
{
|
|
2471
2513
|
inputs: [
|
|
2472
2514
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2585,7 +2627,7 @@ const Jt = [
|
|
|
2585
2627
|
type: "function"
|
|
2586
2628
|
},
|
|
2587
2629
|
{ stateMutability: "payable", type: "receive" }
|
|
2588
|
-
],
|
|
2630
|
+
], en = [
|
|
2589
2631
|
{
|
|
2590
2632
|
inputs: [
|
|
2591
2633
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2704,7 +2746,7 @@ const Jt = [
|
|
|
2704
2746
|
type: "function"
|
|
2705
2747
|
},
|
|
2706
2748
|
{ stateMutability: "payable", type: "receive" }
|
|
2707
|
-
],
|
|
2749
|
+
], tn = [
|
|
2708
2750
|
{
|
|
2709
2751
|
inputs: [
|
|
2710
2752
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2823,7 +2865,7 @@ const Jt = [
|
|
|
2823
2865
|
type: "function"
|
|
2824
2866
|
},
|
|
2825
2867
|
{ stateMutability: "payable", type: "receive" }
|
|
2826
|
-
],
|
|
2868
|
+
], nn = [
|
|
2827
2869
|
{
|
|
2828
2870
|
inputs: [
|
|
2829
2871
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2942,7 +2984,7 @@ const Jt = [
|
|
|
2942
2984
|
type: "function"
|
|
2943
2985
|
},
|
|
2944
2986
|
{ stateMutability: "payable", type: "receive" }
|
|
2945
|
-
],
|
|
2987
|
+
], an = [
|
|
2946
2988
|
{
|
|
2947
2989
|
inputs: [
|
|
2948
2990
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3069,7 +3111,7 @@ const Jt = [
|
|
|
3069
3111
|
type: "function"
|
|
3070
3112
|
},
|
|
3071
3113
|
{ stateMutability: "payable", type: "receive" }
|
|
3072
|
-
],
|
|
3114
|
+
], sn = [
|
|
3073
3115
|
{
|
|
3074
3116
|
inputs: [
|
|
3075
3117
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3196,7 +3238,7 @@ const Jt = [
|
|
|
3196
3238
|
type: "function"
|
|
3197
3239
|
},
|
|
3198
3240
|
{ stateMutability: "payable", type: "receive" }
|
|
3199
|
-
],
|
|
3241
|
+
], rn = [
|
|
3200
3242
|
{
|
|
3201
3243
|
inputs: [
|
|
3202
3244
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3323,7 +3365,7 @@ const Jt = [
|
|
|
3323
3365
|
type: "function"
|
|
3324
3366
|
},
|
|
3325
3367
|
{ stateMutability: "payable", type: "receive" }
|
|
3326
|
-
],
|
|
3368
|
+
], on = [
|
|
3327
3369
|
{
|
|
3328
3370
|
inputs: [
|
|
3329
3371
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3450,7 +3492,7 @@ const Jt = [
|
|
|
3450
3492
|
type: "function"
|
|
3451
3493
|
},
|
|
3452
3494
|
{ stateMutability: "payable", type: "receive" }
|
|
3453
|
-
],
|
|
3495
|
+
], pn = [
|
|
3454
3496
|
{
|
|
3455
3497
|
inputs: [
|
|
3456
3498
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3577,27 +3619,27 @@ const Jt = [
|
|
|
3577
3619
|
type: "function"
|
|
3578
3620
|
},
|
|
3579
3621
|
{ stateMutability: "payable", type: "receive" }
|
|
3580
|
-
],
|
|
3581
|
-
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]:
|
|
3582
|
-
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]:
|
|
3583
|
-
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]:
|
|
3584
|
-
},
|
|
3585
|
-
...
|
|
3622
|
+
], ke = {
|
|
3623
|
+
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: Yt,
|
|
3624
|
+
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: Jt,
|
|
3625
|
+
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: Qt
|
|
3626
|
+
}, dn = {
|
|
3627
|
+
...ke,
|
|
3586
3628
|
// AVAX
|
|
3587
|
-
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]:
|
|
3588
|
-
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]:
|
|
3589
|
-
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]:
|
|
3629
|
+
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: Zt,
|
|
3630
|
+
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: Xt,
|
|
3631
|
+
["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: tn,
|
|
3590
3632
|
// BSC
|
|
3591
|
-
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]:
|
|
3633
|
+
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: zt,
|
|
3592
3634
|
// ETH
|
|
3593
|
-
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]:
|
|
3594
|
-
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]:
|
|
3595
|
-
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]:
|
|
3596
|
-
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]:
|
|
3597
|
-
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]:
|
|
3598
|
-
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]:
|
|
3599
|
-
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]:
|
|
3600
|
-
},
|
|
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 = ({
|
|
3601
3643
|
streamSwap: e,
|
|
3602
3644
|
contractAddress: t,
|
|
3603
3645
|
recipient: n,
|
|
@@ -3608,38 +3650,38 @@ const Jt = [
|
|
|
3608
3650
|
data: o = "",
|
|
3609
3651
|
deadline: p,
|
|
3610
3652
|
memo: d,
|
|
3611
|
-
router:
|
|
3612
|
-
memoStreamingSwap:
|
|
3653
|
+
router: l,
|
|
3654
|
+
memoStreamingSwap: u,
|
|
3613
3655
|
tcMemo: m,
|
|
3614
3656
|
tcRouter: _,
|
|
3615
3657
|
tcVault: b,
|
|
3616
|
-
vault:
|
|
3658
|
+
vault: w,
|
|
3617
3659
|
token: E
|
|
3618
3660
|
}
|
|
3619
3661
|
}) => {
|
|
3620
|
-
const O = !!
|
|
3621
|
-
if (O && !
|
|
3662
|
+
const O = !!ke[t.toLowerCase()];
|
|
3663
|
+
if (O && !l)
|
|
3622
3664
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
3623
|
-
const I = m || d, D = e &&
|
|
3624
|
-
if (!b && !
|
|
3665
|
+
const I = m || d, D = e && u || I;
|
|
3666
|
+
if (!b && !w)
|
|
3625
3667
|
throw new Error("TC Vault is required on calldata");
|
|
3626
|
-
if (!_ && !
|
|
3668
|
+
if (!_ && !l)
|
|
3627
3669
|
throw new Error("TC Router is required on calldata");
|
|
3628
3670
|
if (!D)
|
|
3629
3671
|
throw new Error("TC Memo is required on calldata");
|
|
3630
3672
|
if (!E)
|
|
3631
3673
|
throw new Error("Token is required on calldata");
|
|
3632
|
-
const
|
|
3674
|
+
const re = [
|
|
3633
3675
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
3634
|
-
a(_ ||
|
|
3635
|
-
a(b ||
|
|
3676
|
+
a(_ || l),
|
|
3677
|
+
a(b || w),
|
|
3636
3678
|
D.replace("{recipientAddress}", n),
|
|
3637
3679
|
a(E),
|
|
3638
3680
|
s
|
|
3639
|
-
],
|
|
3640
|
-
return [...
|
|
3641
|
-
},
|
|
3642
|
-
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];
|
|
3643
3685
|
switch (e) {
|
|
3644
3686
|
case i.Binance:
|
|
3645
3687
|
case i.Maya:
|
|
@@ -3663,8 +3705,8 @@ const Jt = [
|
|
|
3663
3705
|
default:
|
|
3664
3706
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3665
3707
|
}
|
|
3666
|
-
},
|
|
3667
|
-
const n =
|
|
3708
|
+
}, yn = ({ chain: e, address: t }) => {
|
|
3709
|
+
const n = Ce[e];
|
|
3668
3710
|
switch (e) {
|
|
3669
3711
|
case i.Arbitrum:
|
|
3670
3712
|
case i.Avalanche:
|
|
@@ -3686,16 +3728,16 @@ const Jt = [
|
|
|
3686
3728
|
default:
|
|
3687
3729
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3688
3730
|
}
|
|
3689
|
-
},
|
|
3690
|
-
const t = e ?
|
|
3691
|
-
return
|
|
3692
|
-
},
|
|
3693
|
-
const t = e ?
|
|
3694
|
-
return
|
|
3695
|
-
},
|
|
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(
|
|
3696
3738
|
(e, t) => (e[t] = null, e),
|
|
3697
3739
|
{}
|
|
3698
|
-
),
|
|
3740
|
+
), Tn = async ({ chain: e, address: t }) => {
|
|
3699
3741
|
if (!t)
|
|
3700
3742
|
return !1;
|
|
3701
3743
|
switch (e) {
|
|
@@ -3705,19 +3747,19 @@ const Jt = [
|
|
|
3705
3747
|
return !0;
|
|
3706
3748
|
}
|
|
3707
3749
|
};
|
|
3708
|
-
var V,
|
|
3709
|
-
class
|
|
3750
|
+
var V, ae, K, v, Y, X;
|
|
3751
|
+
class Pn {
|
|
3710
3752
|
constructor({ stagenet: t } = {}) {
|
|
3711
|
-
T(this, "connectedChains",
|
|
3712
|
-
T(this, "connectedWallets",
|
|
3753
|
+
T(this, "connectedChains", Oe());
|
|
3754
|
+
T(this, "connectedWallets", Oe());
|
|
3713
3755
|
T(this, "stagenet", !1);
|
|
3714
3756
|
T(this, "getAddress", (t) => {
|
|
3715
3757
|
var n;
|
|
3716
3758
|
return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
|
|
3717
3759
|
});
|
|
3718
|
-
T(this, "getExplorerTxUrl", (t, n) =>
|
|
3760
|
+
T(this, "getExplorerTxUrl", (t, n) => ln({ chain: t, txHash: n }));
|
|
3719
3761
|
T(this, "getWallet", (t) => this.connectedWallets[t]);
|
|
3720
|
-
T(this, "getExplorerAddressUrl", (t, n) =>
|
|
3762
|
+
T(this, "getExplorerAddressUrl", (t, n) => yn({ chain: t, address: n }));
|
|
3721
3763
|
T(this, "getBalance", async (t, n) => {
|
|
3722
3764
|
const a = await this.getWalletByChain(t, n);
|
|
3723
3765
|
return (a == null ? void 0 : a.balance) || [];
|
|
@@ -3728,65 +3770,65 @@ class Vn {
|
|
|
3728
3770
|
if (!a.complete)
|
|
3729
3771
|
throw new c("core_swap_route_not_complete");
|
|
3730
3772
|
try {
|
|
3731
|
-
if (
|
|
3732
|
-
const
|
|
3733
|
-
if (!(
|
|
3773
|
+
if (ze.includes(r)) {
|
|
3774
|
+
const l = this.connectedWallets[o];
|
|
3775
|
+
if (!(l != null && l.sendTransaction))
|
|
3734
3776
|
throw new c("core_wallet_connection_not_found");
|
|
3735
3777
|
if (!(t ? (p = a == null ? void 0 : a.streamingSwap) == null ? void 0 : p.transaction : a == null ? void 0 : a.transaction))
|
|
3736
3778
|
throw new c("core_swap_route_transaction_not_found");
|
|
3737
|
-
const { data: m, from: _, to: b, value:
|
|
3779
|
+
const { data: m, from: _, to: b, value: w } = a.transaction, E = {
|
|
3738
3780
|
data: m,
|
|
3739
3781
|
from: _,
|
|
3740
3782
|
to: b.toLowerCase(),
|
|
3741
|
-
chainId: BigInt(
|
|
3742
|
-
value:
|
|
3783
|
+
chainId: BigInt(ot[o]),
|
|
3784
|
+
value: w ? BigInt(w) : 0n
|
|
3743
3785
|
};
|
|
3744
|
-
return
|
|
3786
|
+
return l.sendTransaction(E, s);
|
|
3745
3787
|
}
|
|
3746
|
-
if (
|
|
3788
|
+
if (et.includes(r)) {
|
|
3747
3789
|
if (!a.calldata.fromAsset)
|
|
3748
3790
|
throw new c("core_swap_asset_not_recognized");
|
|
3749
|
-
const
|
|
3750
|
-
if (!
|
|
3791
|
+
const l = await x.fromString(a.calldata.fromAsset);
|
|
3792
|
+
if (!l)
|
|
3751
3793
|
throw new c("core_swap_asset_not_recognized");
|
|
3752
|
-
const { address:
|
|
3794
|
+
const { address: u } = await f(this, V).call(this, l.chain), {
|
|
3753
3795
|
contract: m,
|
|
3754
|
-
calldata: { expiration: _, amountIn: b, memo:
|
|
3755
|
-
} = 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;
|
|
3756
3798
|
return this.deposit({
|
|
3757
3799
|
expiration: _,
|
|
3758
3800
|
assetValue: O,
|
|
3759
3801
|
memo: I,
|
|
3760
3802
|
feeOptionKey: s,
|
|
3761
3803
|
router: m,
|
|
3762
|
-
recipient:
|
|
3804
|
+
recipient: u
|
|
3763
3805
|
});
|
|
3764
3806
|
}
|
|
3765
|
-
if (
|
|
3766
|
-
const { calldata:
|
|
3767
|
-
if (!
|
|
3807
|
+
if (Ze.includes(r)) {
|
|
3808
|
+
const { calldata: l, contract: u } = a;
|
|
3809
|
+
if (!u)
|
|
3768
3810
|
throw new c("core_swap_contract_not_found");
|
|
3769
3811
|
const m = this.connectedWallets[o], _ = this.getAddress(o);
|
|
3770
3812
|
if (!(m != null && m.sendTransaction) || !_)
|
|
3771
3813
|
throw new c("core_wallet_connection_not_found");
|
|
3772
|
-
const { getProvider: b, toChecksumAddress:
|
|
3814
|
+
const { getProvider: b, toChecksumAddress: w } = await import("@swapkit/toolbox-evm"), E = b(o), O = dn[u.toLowerCase()];
|
|
3773
3815
|
if (!O)
|
|
3774
|
-
throw new c("core_swap_contract_not_supported", { contractAddress:
|
|
3775
|
-
const D = await (await ((d = m.createContract) == null ? void 0 : d.call(m,
|
|
3776
|
-
...
|
|
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({
|
|
3777
3819
|
streamSwap: t,
|
|
3778
|
-
toChecksumAddress:
|
|
3779
|
-
contractAddress:
|
|
3820
|
+
toChecksumAddress: w,
|
|
3821
|
+
contractAddress: u,
|
|
3780
3822
|
recipient: n,
|
|
3781
|
-
calldata:
|
|
3823
|
+
calldata: l
|
|
3782
3824
|
}),
|
|
3783
3825
|
{ from: _ }
|
|
3784
3826
|
);
|
|
3785
3827
|
return m.sendTransaction(D, s);
|
|
3786
3828
|
}
|
|
3787
3829
|
throw new c("core_swap_quote_mode_not_supported", { quoteMode: r });
|
|
3788
|
-
} catch (
|
|
3789
|
-
throw new c("core_swap_transaction_error",
|
|
3830
|
+
} catch (l) {
|
|
3831
|
+
throw new c("core_swap_transaction_error", l);
|
|
3790
3832
|
}
|
|
3791
3833
|
});
|
|
3792
3834
|
T(this, "getWalletByChain", async (t, n) => {
|
|
@@ -3794,7 +3836,7 @@ class Vn {
|
|
|
3794
3836
|
const a = this.getAddress(t);
|
|
3795
3837
|
if (!a)
|
|
3796
3838
|
return null;
|
|
3797
|
-
const s = [
|
|
3839
|
+
const s = [x.fromChainOrSignature(t)], r = (o = this.connectedChains[t]) == null ? void 0 : o.walletType;
|
|
3798
3840
|
try {
|
|
3799
3841
|
const d = await ((p = this.getWallet(t)) == null ? void 0 : p.getBalance(a, n));
|
|
3800
3842
|
return this.connectedChains[t] = {
|
|
@@ -3806,8 +3848,8 @@ class Vn {
|
|
|
3806
3848
|
return console.error(d), { address: a, balance: s, walletType: r };
|
|
3807
3849
|
}
|
|
3808
3850
|
});
|
|
3809
|
-
T(this, "approveAssetValue", (t, n) => f(this,
|
|
3810
|
-
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" }));
|
|
3811
3853
|
T(this, "validateAddress", ({ address: t, chain: n }) => {
|
|
3812
3854
|
var a, s;
|
|
3813
3855
|
return (s = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : s.call(a, t);
|
|
@@ -3817,7 +3859,7 @@ class Vn {
|
|
|
3817
3859
|
if (!n)
|
|
3818
3860
|
throw new c("core_wallet_connection_not_found");
|
|
3819
3861
|
try {
|
|
3820
|
-
return await n.transfer(f(this,
|
|
3862
|
+
return await n.transfer(f(this, X).call(this, t));
|
|
3821
3863
|
} catch (a) {
|
|
3822
3864
|
throw new c("core_swap_transaction_error", a);
|
|
3823
3865
|
}
|
|
@@ -3829,44 +3871,44 @@ class Vn {
|
|
|
3829
3871
|
...s
|
|
3830
3872
|
}) => {
|
|
3831
3873
|
const { chain: r, symbol: o, ticker: p } = t, d = this.connectedWallets[r];
|
|
3832
|
-
if (!await
|
|
3874
|
+
if (!await Tn({ address: await (d == null ? void 0 : d.getAddress()), chain: r }))
|
|
3833
3875
|
throw new c("core_transaction_invalid_sender_address");
|
|
3834
3876
|
if (!d)
|
|
3835
3877
|
throw new c("core_wallet_connection_not_found");
|
|
3836
|
-
const
|
|
3878
|
+
const l = f(this, X).call(this, { assetValue: t, recipient: n, router: a, ...s });
|
|
3837
3879
|
try {
|
|
3838
3880
|
switch (r) {
|
|
3839
3881
|
case i.THORChain: {
|
|
3840
|
-
const
|
|
3841
|
-
return await (n === "" ?
|
|
3882
|
+
const u = d;
|
|
3883
|
+
return await (n === "" ? u.deposit(l) : u.transfer(l));
|
|
3842
3884
|
}
|
|
3843
3885
|
case i.Ethereum:
|
|
3844
3886
|
case i.BinanceSmartChain:
|
|
3845
3887
|
case i.Avalanche: {
|
|
3846
|
-
const { getChecksumAddressFromAsset:
|
|
3888
|
+
const { getChecksumAddressFromAsset: u } = await import("@swapkit/toolbox-evm"), m = r === i.Avalanche ? Xe : r === i.BinanceSmartChain ? Je : Ye;
|
|
3847
3889
|
return await d.call({
|
|
3848
3890
|
abi: m,
|
|
3849
3891
|
contractAddress: a || (await f(this, V).call(this, r)).router,
|
|
3850
3892
|
funcName: "depositWithExpiry",
|
|
3851
3893
|
funcParams: [
|
|
3852
3894
|
n,
|
|
3853
|
-
|
|
3895
|
+
u({ chain: r, symbol: o, ticker: p }, r),
|
|
3854
3896
|
t.getBaseValue("string"),
|
|
3855
|
-
|
|
3897
|
+
l.memo,
|
|
3856
3898
|
s.expiration || parseInt(`${((/* @__PURE__ */ new Date()).getTime() + 15 * 60 * 1e3) / 1e3}`)
|
|
3857
3899
|
],
|
|
3858
3900
|
txOverrides: {
|
|
3859
|
-
from:
|
|
3901
|
+
from: l.from,
|
|
3860
3902
|
value: t.isGasAsset ? t.getBaseValue("bigint") : void 0
|
|
3861
3903
|
}
|
|
3862
3904
|
});
|
|
3863
3905
|
}
|
|
3864
3906
|
default:
|
|
3865
|
-
return await d.transfer(
|
|
3907
|
+
return await d.transfer(l);
|
|
3866
3908
|
}
|
|
3867
|
-
} catch (
|
|
3868
|
-
const m = ((
|
|
3869
|
-
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);
|
|
3870
3912
|
}
|
|
3871
3913
|
});
|
|
3872
3914
|
/**
|
|
@@ -3911,17 +3953,17 @@ class Vn {
|
|
|
3911
3953
|
isPendingSymmAsset: r,
|
|
3912
3954
|
mode: o = "sym"
|
|
3913
3955
|
}) => {
|
|
3914
|
-
const { chain: p, symbol: d } = n,
|
|
3915
|
-
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)
|
|
3916
3958
|
throw new c("core_transaction_add_liquidity_invalid_params");
|
|
3917
3959
|
if (_ && !b)
|
|
3918
3960
|
throw new c("core_transaction_add_liquidity_no_rune_address");
|
|
3919
3961
|
let E, O;
|
|
3920
|
-
if (
|
|
3962
|
+
if (u && t)
|
|
3921
3963
|
try {
|
|
3922
3964
|
E = await f(this, v).call(this, {
|
|
3923
3965
|
assetValue: t,
|
|
3924
|
-
memo: M(h.DEPOSIT, { chain: p, symbol: d, address:
|
|
3966
|
+
memo: M(h.DEPOSIT, { chain: p, symbol: d, address: w })
|
|
3925
3967
|
});
|
|
3926
3968
|
} catch (I) {
|
|
3927
3969
|
throw new c("core_transaction_add_liquidity_rune_error", I);
|
|
@@ -3959,7 +4001,7 @@ class Vn {
|
|
|
3959
4001
|
from: s,
|
|
3960
4002
|
to: r
|
|
3961
4003
|
}) => {
|
|
3962
|
-
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, {
|
|
3963
4005
|
symbol: n.symbol,
|
|
3964
4006
|
chain: n.chain,
|
|
3965
4007
|
ticker: n.ticker,
|
|
@@ -4006,7 +4048,7 @@ class Vn {
|
|
|
4006
4048
|
address: a,
|
|
4007
4049
|
unbondAmount: t === "unbond" ? n.getBaseValue("number") : void 0
|
|
4008
4050
|
});
|
|
4009
|
-
return f(this,
|
|
4051
|
+
return f(this, Y).call(this, {
|
|
4010
4052
|
memo: r,
|
|
4011
4053
|
assetValue: t === "bond" ? n : ue(i.THORChain)
|
|
4012
4054
|
});
|
|
@@ -4014,12 +4056,12 @@ class Vn {
|
|
|
4014
4056
|
T(this, "registerThorname", ({
|
|
4015
4057
|
assetValue: t,
|
|
4016
4058
|
...n
|
|
4017
|
-
}) => f(this,
|
|
4059
|
+
}) => f(this, Y).call(this, { assetValue: t, memo: M(h.THORNAME_REGISTER, n) }));
|
|
4018
4060
|
T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: s = {} }) => {
|
|
4019
4061
|
try {
|
|
4020
4062
|
t.forEach((r) => {
|
|
4021
4063
|
this[r.connectMethodName] = r.connect({
|
|
4022
|
-
addChain: f(this,
|
|
4064
|
+
addChain: f(this, ae),
|
|
4023
4065
|
config: n || {},
|
|
4024
4066
|
apis: a,
|
|
4025
4067
|
rpcUrls: s
|
|
@@ -4104,17 +4146,17 @@ class Vn {
|
|
|
4104
4146
|
halted: !1,
|
|
4105
4147
|
chain: i.THORChain
|
|
4106
4148
|
};
|
|
4107
|
-
const a = (await
|
|
4149
|
+
const a = (await cn(this.stagenet)).find((s) => s.chain === t);
|
|
4108
4150
|
if (!a)
|
|
4109
4151
|
throw new c("core_inbound_data_not_found");
|
|
4110
4152
|
if (a != null && a.halted)
|
|
4111
4153
|
throw new c("core_chain_halted");
|
|
4112
4154
|
return a;
|
|
4113
4155
|
});
|
|
4114
|
-
P(this,
|
|
4156
|
+
P(this, ae, ({ chain: t, wallet: n, walletMethods: a }) => {
|
|
4115
4157
|
this.connectedChains[t] = n, this.connectedWallets[t] = a;
|
|
4116
4158
|
});
|
|
4117
|
-
P(this,
|
|
4159
|
+
P(this, K, async ({
|
|
4118
4160
|
assetValue: t,
|
|
4119
4161
|
type: n = "checkOnly",
|
|
4120
4162
|
contractAddress: a
|
|
@@ -4122,7 +4164,7 @@ class Vn {
|
|
|
4122
4164
|
const { address: s, chain: r, isGasAsset: o, isSynthetic: p } = t, d = [i.Ethereum, i.Avalanche, i.BinanceSmartChain].includes(r);
|
|
4123
4165
|
if (d && o || !d || p)
|
|
4124
4166
|
return !0;
|
|
4125
|
-
const
|
|
4167
|
+
const u = this.connectedWallets[r], m = n === "checkOnly" ? u == null ? void 0 : u.isApproved : u == null ? void 0 : u.approve;
|
|
4126
4168
|
if (!m)
|
|
4127
4169
|
throw new c("core_wallet_connection_not_found");
|
|
4128
4170
|
const _ = this.getAddress(r);
|
|
@@ -4145,7 +4187,7 @@ class Vn {
|
|
|
4145
4187
|
gas_rate: s,
|
|
4146
4188
|
router: r,
|
|
4147
4189
|
address: o
|
|
4148
|
-
} = 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];
|
|
4149
4191
|
return this.deposit({
|
|
4150
4192
|
assetValue: t,
|
|
4151
4193
|
recipient: o,
|
|
@@ -4154,13 +4196,13 @@ class Vn {
|
|
|
4154
4196
|
feeRate: p
|
|
4155
4197
|
});
|
|
4156
4198
|
});
|
|
4157
|
-
P(this,
|
|
4158
|
-
const a = await
|
|
4199
|
+
P(this, Y, async ({ memo: t, assetValue: n }) => {
|
|
4200
|
+
const a = await mn(this.stagenet);
|
|
4159
4201
|
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
4160
4202
|
throw new c("core_chain_halted");
|
|
4161
4203
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
4162
4204
|
});
|
|
4163
|
-
P(this,
|
|
4205
|
+
P(this, X, ({ assetValue: t, ...n }) => ({
|
|
4164
4206
|
...n,
|
|
4165
4207
|
memo: n.memo || "",
|
|
4166
4208
|
from: this.getAddress(t.chain),
|
|
@@ -4169,67 +4211,67 @@ class Vn {
|
|
|
4169
4211
|
this.stagenet = !!t;
|
|
4170
4212
|
}
|
|
4171
4213
|
}
|
|
4172
|
-
V = new WeakMap(),
|
|
4214
|
+
V = new WeakMap(), ae = new WeakMap(), K = new WeakMap(), v = new WeakMap(), Y = new WeakMap(), X = new WeakMap();
|
|
4173
4215
|
export {
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
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,
|
|
4180
4222
|
i as Chain,
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
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,
|
|
4190
4232
|
y as ERROR_CODE,
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4233
|
+
tt as ERROR_MODULE,
|
|
4234
|
+
Ie as ERROR_TYPE,
|
|
4235
|
+
it as EVMChainList,
|
|
4236
|
+
dt as ErrorCode,
|
|
4195
4237
|
F as FeeOption,
|
|
4196
4238
|
h as MemoType,
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
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,
|
|
4204
4246
|
c as SwapKitError,
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
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,
|
|
4227
4269
|
M as getMemoFor,
|
|
4228
4270
|
ue as getMinAmountByChain,
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4271
|
+
It as getSymmetricPoolShare,
|
|
4272
|
+
vn as getSymmetricWithdraw,
|
|
4273
|
+
Nn as getTHORNameCost,
|
|
4274
|
+
Ne as isGasAsset,
|
|
4275
|
+
xn as validateTHORName
|
|
4234
4276
|
};
|
|
4235
4277
|
//# sourceMappingURL=index.es.js.map
|