@swapkit/core 1.0.0-rc.22 → 1.0.0-rc.24
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 +313 -323
- package/package.json +8 -8
- package/src/client/index.ts +4 -4
package/dist/index.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var T = (e, t, n) => (
|
|
1
|
+
var Ge = Object.defineProperty;
|
|
2
|
+
var We = (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) => (We(e, typeof t != "symbol" ? t + "" : t, n), n), qe = (e, t, n) => {
|
|
4
4
|
if (!t.has(e))
|
|
5
5
|
throw TypeError("Cannot " + n);
|
|
6
6
|
};
|
|
7
|
-
var f = (e, t, n) => (
|
|
7
|
+
var f = (e, t, n) => (qe(e, t, "read from private field"), n ? n.call(e) : t.get(e)), B = (e, t, n) => {
|
|
8
8
|
if (t.has(e))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
10
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
11
11
|
};
|
|
12
|
-
var
|
|
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, v = (e, t, n) => (Ke(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
13
13
|
const Tn = [
|
|
14
14
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
15
15
|
{
|
|
@@ -108,7 +108,7 @@ const Tn = [
|
|
|
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 Tn = [
|
|
|
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 Tn = [
|
|
|
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 Tn = [
|
|
|
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 Ce = /* @__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))(Ce || {}), 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 || {}), 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 nt = {
|
|
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 at = {
|
|
|
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 = 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
|
-
let hn = class
|
|
685
|
+
let hn = class Me extends Error {
|
|
686
686
|
constructor({
|
|
687
687
|
status: t,
|
|
688
688
|
revision: n,
|
|
@@ -697,15 +697,15 @@ let hn = class Ne extends Error {
|
|
|
697
697
|
},
|
|
698
698
|
displayMessageParams: u
|
|
699
699
|
}) {
|
|
700
|
-
const c = r ||
|
|
701
|
-
super(c),
|
|
700
|
+
const c = r || ie(s, u || []) || "";
|
|
701
|
+
super(c), v(this, "status"), v(this, "revision"), v(this, "type"), v(this, "module"), v(this, "code"), v(this, "message"), v(this, "display"), v(this, "stack"), v(this, "options"), v(this, "displayMessageParams"), this.status = t, this.revision = n || "NO_REVISION", this.module = a, this.message = c, this.display = ie(s, u || []), this.code = s, this.type = o || Ce.UNHANDLED_ERROR, this.options = {
|
|
702
702
|
shouldLog: p || !0,
|
|
703
703
|
shouldTrace: y || !0,
|
|
704
704
|
shouldThrow: d || !1
|
|
705
705
|
}, this.displayMessageParams = u || [], this.options.shouldTrace && Error.captureStackTrace(this);
|
|
706
706
|
}
|
|
707
707
|
static fromErrorInfo(t) {
|
|
708
|
-
return new
|
|
708
|
+
return new Me(t);
|
|
709
709
|
}
|
|
710
710
|
toErrorInfo() {
|
|
711
711
|
return { ...this, identifier: this.identifier };
|
|
@@ -714,7 +714,7 @@ let hn = class Ne 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,7 +724,7 @@ let hn = class Ne 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 || {}),
|
|
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
728
|
const _n = {
|
|
729
729
|
ARB: [44, 60, 0, 0, 0],
|
|
730
730
|
AVAX: [44, 60, 0, 0, 0],
|
|
@@ -742,7 +742,7 @@ const _n = {
|
|
|
742
742
|
OP: [44, 60, 0, 0, 0],
|
|
743
743
|
THOR: [44, 931, 0, 0, 0]
|
|
744
744
|
};
|
|
745
|
-
var
|
|
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
746
|
const fn = [
|
|
747
747
|
"ETH",
|
|
748
748
|
"AVAX",
|
|
@@ -775,23 +775,23 @@ const fn = [
|
|
|
775
775
|
"THOR"
|
|
776
776
|
/* THORChain */
|
|
777
777
|
];
|
|
778
|
-
var
|
|
779
|
-
const
|
|
778
|
+
var he = /* @__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))(he || {}), Ne = /* @__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))(Ne || {}), q = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.finance", e.ThorswapStatic = "https://static.thorswap.net", e))(q || {});
|
|
779
|
+
const ae = Object.values(i), it = Object.keys(i), _e = ae.reduce(
|
|
780
780
|
(e, t) => {
|
|
781
|
-
const n =
|
|
781
|
+
const n = it.find((a) => i[a] === t);
|
|
782
782
|
return n && (e[t] = n), e;
|
|
783
783
|
},
|
|
784
784
|
{}
|
|
785
|
-
),
|
|
786
|
-
(e, t) => (e[t] =
|
|
785
|
+
), rt = ae.reduce(
|
|
786
|
+
(e, t) => (e[t] = he[_e[t]], e),
|
|
787
787
|
{}
|
|
788
|
-
),
|
|
789
|
-
(e, t) => (e[t] =
|
|
788
|
+
), ot = ae.reduce(
|
|
789
|
+
(e, t) => (e[t] = Ne[_e[t]], e),
|
|
790
790
|
{}
|
|
791
|
-
), En =
|
|
791
|
+
), En = ae.reduce(
|
|
792
792
|
(e, t) => {
|
|
793
|
-
const n = `${
|
|
794
|
-
return e[t] =
|
|
793
|
+
const n = `${_e[t]}Hex`;
|
|
794
|
+
return e[t] = he[n], e;
|
|
795
795
|
},
|
|
796
796
|
{}
|
|
797
797
|
), Rn = {
|
|
@@ -819,7 +819,7 @@ const se = Object.values(i), rt = Object.keys(i), be = se.reduce(
|
|
|
819
819
|
"thorchain-stagenet-v2": "THOR",
|
|
820
820
|
"thorchain-mainnet-v1": "THOR"
|
|
821
821
|
/* THORChain */
|
|
822
|
-
},
|
|
822
|
+
}, xe = {
|
|
823
823
|
ARB: "https://arbiscan.io",
|
|
824
824
|
AVAX: "https://snowtrace.io",
|
|
825
825
|
BSC: "https://bscscan.com",
|
|
@@ -836,17 +836,17 @@ const se = Object.values(i), rt = Object.keys(i), be = se.reduce(
|
|
|
836
836
|
MATIC: "https://polygonscan.com",
|
|
837
837
|
THOR: "https://viewblock.io/thorchain"
|
|
838
838
|
};
|
|
839
|
-
var
|
|
839
|
+
var pt = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(pt || {}), h = /* @__PURE__ */ ((e) => (e.BOND = "BOND", e.DEPOSIT = "+", e.LEAVE = "LEAVE", e.THORNAME_REGISTER = "~", e.UNBOND = "UNBOND", e.WITHDRAW = "-", e.OPEN_LOAN = "$+", e.CLOSE_LOAN = "$-", e))(h || {}), F = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(F || {}), dt = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", e.XDEFI = "XDEFI", e.METAMASK = "METAMASK", e.COINBASE_WEB = "COINBASE_WEB", e.TREZOR = "TREZOR", e.TRUSTWALLET_WEB = "TRUSTWALLET_WEB", e.LEDGER = "LEDGER", e.KEPLR = "KEPLR", e.OKX = "OKX", e.BRAVE = "BRAVE", e.WALLETCONNECT = "WALLETCONNECT", e))(dt || {}), ut = Object.defineProperty, lt = (e, t, n) => t in e ? ut(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (lt(e, typeof t != "symbol" ? t + "" : t, n), n), yt = (e, t, n) => {
|
|
840
840
|
if (!t.has(e))
|
|
841
841
|
throw TypeError("Cannot " + n);
|
|
842
|
-
},
|
|
842
|
+
}, L = (e, t, n) => {
|
|
843
843
|
if (t.has(e))
|
|
844
844
|
throw TypeError("Cannot add the same private member more than once");
|
|
845
845
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
846
|
-
},
|
|
847
|
-
const
|
|
846
|
+
}, g = (e, t, n) => (yt(e, t, "access private method"), n);
|
|
847
|
+
const ct = "0x313ce567", De = async ({ chain: e, to: t }) => {
|
|
848
848
|
try {
|
|
849
|
-
const { result: n } = await
|
|
849
|
+
const { result: n } = await be.post(ot[e], {
|
|
850
850
|
headers: {
|
|
851
851
|
accept: "*/*",
|
|
852
852
|
"content-type": "application/json",
|
|
@@ -856,36 +856,36 @@ const mt = "0x313ce567", Pe = async ({ chain: e, to: t }) => {
|
|
|
856
856
|
id: 44,
|
|
857
857
|
jsonrpc: "2.0",
|
|
858
858
|
method: "eth_call",
|
|
859
|
-
params: [{ to: t.toLowerCase(), data:
|
|
859
|
+
params: [{ to: t.toLowerCase(), data: ct }, "latest"]
|
|
860
860
|
})
|
|
861
861
|
});
|
|
862
862
|
return parseInt(BigInt(n).toString());
|
|
863
863
|
} catch (n) {
|
|
864
|
-
return console.error(n),
|
|
864
|
+
return console.error(n), A[e];
|
|
865
865
|
}
|
|
866
|
-
},
|
|
866
|
+
}, mt = 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") ? De({ chain: i.Ethereum, to: t }) : A.ETH;
|
|
871
|
+
}, Tt = async (e) => {
|
|
872
872
|
const [, t] = e.split("-");
|
|
873
|
-
return t != null && t.startsWith("0x") ?
|
|
874
|
-
},
|
|
873
|
+
return t != null && t.startsWith("0x") ? De({ chain: i.Avalanche, to: t.toLowerCase() }) : A.AVAX;
|
|
874
|
+
}, ht = async (e) => (e === i.BinanceSmartChain, A.BSC), _t = async ({ chain: e, symbol: t }) => {
|
|
875
875
|
switch (e) {
|
|
876
876
|
case i.Ethereum:
|
|
877
|
-
return
|
|
877
|
+
return mt(t);
|
|
878
878
|
case i.Avalanche:
|
|
879
|
-
return
|
|
879
|
+
return Tt(t);
|
|
880
880
|
case i.BinanceSmartChain:
|
|
881
|
-
return
|
|
881
|
+
return ht(t);
|
|
882
882
|
default:
|
|
883
|
-
return
|
|
883
|
+
return A[e];
|
|
884
884
|
}
|
|
885
885
|
}, ft = {
|
|
886
|
-
[
|
|
887
|
-
[
|
|
888
|
-
[
|
|
886
|
+
[F.Average]: 1.2,
|
|
887
|
+
[F.Fast]: 1.5,
|
|
888
|
+
[F.Fastest]: 2
|
|
889
889
|
}, bt = ({ chain: e, symbol: t }) => {
|
|
890
890
|
switch (e) {
|
|
891
891
|
case i.Bitcoin:
|
|
@@ -919,13 +919,13 @@ const mt = "0x313ce567", Pe = async ({ chain: e, to: t }) => {
|
|
|
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,7 +939,7 @@ const mt = "0x313ce567", Pe = 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("/"))
|
|
@@ -985,14 +985,14 @@ const mt = "0x313ce567", Pe = async ({ chain: e, to: t }) => {
|
|
|
985
985
|
poolUnits: t,
|
|
986
986
|
runeDepth: n
|
|
987
987
|
}) => {
|
|
988
|
-
const a =
|
|
988
|
+
const a = I(e), s = I(t), r = I(n), o = a.mul(r), p = s.mul(s).mul(2), d = s.mul(a).mul(2), y = a.mul(a), u = s.mul(s).mul(s);
|
|
989
989
|
return o.mul(p.sub(d).add(y)).div(u);
|
|
990
990
|
}, gt = ({
|
|
991
991
|
liquidityUnits: e,
|
|
992
992
|
poolUnits: t,
|
|
993
993
|
assetDepth: n
|
|
994
994
|
}) => {
|
|
995
|
-
const a =
|
|
995
|
+
const a = I(e), s = I(t), r = I(n), o = a.mul(r), p = s.mul(s).mul(2), d = s.mul(a).mul(2), y = a.mul(a), u = o.mul(p.sub(d).add(y)), c = s.mul(s).mul(s);
|
|
996
996
|
return u.div(c);
|
|
997
997
|
}, In = ({
|
|
998
998
|
percent: e,
|
|
@@ -1004,14 +1004,14 @@ const mt = "0x313ce567", Pe = async ({ chain: e, to: t }) => {
|
|
|
1004
1004
|
assetDepth: t,
|
|
1005
1005
|
liquidityUnits: n,
|
|
1006
1006
|
poolUnits: a
|
|
1007
|
-
}) => gt({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e),
|
|
1007
|
+
}) => gt({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), I = (e) => N.fromBigInt(BigInt(e), A.THOR), Ot = ({
|
|
1008
1008
|
liquidityUnits: e,
|
|
1009
1009
|
poolUnits: t,
|
|
1010
1010
|
runeDepth: n,
|
|
1011
1011
|
assetDepth: a
|
|
1012
1012
|
}) => ({
|
|
1013
|
-
assetAmount:
|
|
1014
|
-
runeAmount:
|
|
1013
|
+
assetAmount: I(a).mul(e).div(t),
|
|
1014
|
+
runeAmount: I(n).mul(e).div(t)
|
|
1015
1015
|
}), vn = ({
|
|
1016
1016
|
liquidityUnits: e,
|
|
1017
1017
|
poolUnits: t,
|
|
@@ -1030,24 +1030,26 @@ const mt = "0x313ce567", Pe = async ({ chain: e, to: t }) => {
|
|
|
1030
1030
|
runeAmount: s,
|
|
1031
1031
|
assetAmount: r
|
|
1032
1032
|
}) => {
|
|
1033
|
-
const o =
|
|
1034
|
-
if (
|
|
1035
|
-
return
|
|
1036
|
-
const
|
|
1037
|
-
return
|
|
1033
|
+
const o = new N({ value: e, decimal: 8 }), p = new N({ value: n, decimal: 8 }), d = new N({ value: t, decimal: 8 }), y = new N({ value: s, decimal: 8 }), u = new N({ value: r, decimal: 8 }), c = y.mul(p), _ = u.mul(o), b = y.mul(u), E = o.mul(p), R = d.mul(c.add(_.add(b.mul(2)))), w = c.add(_.add(E.mul(2))), O = R.div(w), S = I(a).add(O);
|
|
1034
|
+
if (O.getBaseValue("number") === 0)
|
|
1035
|
+
return S.div(d).getBaseValue("number");
|
|
1036
|
+
const P = d.add(S);
|
|
1037
|
+
return S.div(P).getBaseValue("number");
|
|
1038
1038
|
}, Mn = ({
|
|
1039
1039
|
runeAmount: e,
|
|
1040
1040
|
assetAmount: t,
|
|
1041
1041
|
runeDepth: n,
|
|
1042
1042
|
assetDepth: a
|
|
1043
1043
|
}) => {
|
|
1044
|
-
|
|
1045
|
-
|
|
1044
|
+
if (e === "0" || t === "0" || n === "0" || a === "0")
|
|
1045
|
+
return 0;
|
|
1046
|
+
const s = I(n), r = I(a), o = I(t), p = I(e), d = o.mul(s).sub(r.mul(p)), y = r.mul(p).add(s.mul(r));
|
|
1047
|
+
return Math.abs(d.div(y).getBaseValue("number"));
|
|
1046
1048
|
}, It = ({
|
|
1047
1049
|
symbol: e,
|
|
1048
1050
|
ticker: t,
|
|
1049
1051
|
chain: n
|
|
1050
|
-
}) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e,
|
|
1052
|
+
}) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e, D = (e, t) => {
|
|
1051
1053
|
switch (e) {
|
|
1052
1054
|
case h.LEAVE:
|
|
1053
1055
|
case h.BOND: {
|
|
@@ -1088,7 +1090,7 @@ const mt = "0x313ce567", Pe = async ({ chain: e, to: t }) => {
|
|
|
1088
1090
|
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
1089
1091
|
return !!e.match(t);
|
|
1090
1092
|
}, Dn = ([e, t, n, a, s]) => `${e}'/${t}'/${n}'/${a}${typeof s != "number" ? "" : `/${s}`}`;
|
|
1091
|
-
class
|
|
1093
|
+
class we extends Error {
|
|
1092
1094
|
constructor(t, n, a) {
|
|
1093
1095
|
const s = t.status || t.status === 0 ? t.status : "", r = t.statusText || "", o = `${s} ${r}`.trim(), p = o ? `status code ${o}` : "an unknown error";
|
|
1094
1096
|
super(`Request failed with ${p}`), Object.defineProperty(this, "response", {
|
|
@@ -1109,7 +1111,7 @@ class Ee extends Error {
|
|
|
1109
1111
|
}), this.name = "HTTPError", this.response = t, this.request = n, this.options = a;
|
|
1110
1112
|
}
|
|
1111
1113
|
}
|
|
1112
|
-
class
|
|
1114
|
+
class Pe extends Error {
|
|
1113
1115
|
constructor(t) {
|
|
1114
1116
|
super("Request timed out"), Object.defineProperty(this, "request", {
|
|
1115
1117
|
enumerable: !0,
|
|
@@ -1123,21 +1125,21 @@ const Q = (e) => e !== null && typeof e == "object", J = (...e) => {
|
|
|
1123
1125
|
for (const t of e)
|
|
1124
1126
|
if ((!Q(t) || Array.isArray(t)) && t !== void 0)
|
|
1125
1127
|
throw new TypeError("The `options` argument must be an object");
|
|
1126
|
-
return
|
|
1127
|
-
},
|
|
1128
|
+
return fe({}, ...e);
|
|
1129
|
+
}, Be = (e = {}, t = {}) => {
|
|
1128
1130
|
const n = new globalThis.Headers(e), a = t instanceof globalThis.Headers, s = new globalThis.Headers(t);
|
|
1129
1131
|
for (const [r, o] of s.entries())
|
|
1130
1132
|
a && o === "undefined" || o === void 0 ? n.delete(r) : n.set(r, o);
|
|
1131
1133
|
return n;
|
|
1132
|
-
},
|
|
1134
|
+
}, fe = (...e) => {
|
|
1133
1135
|
let t = {}, n = {};
|
|
1134
1136
|
for (const a of e)
|
|
1135
1137
|
if (Array.isArray(a))
|
|
1136
1138
|
Array.isArray(t) || (t = []), t = [...t, ...a];
|
|
1137
1139
|
else if (Q(a)) {
|
|
1138
1140
|
for (let [s, r] of Object.entries(a))
|
|
1139
|
-
Q(r) && s in t && (r =
|
|
1140
|
-
Q(a.headers) && (n =
|
|
1141
|
+
Q(r) && s in t && (r = fe(t[s], r)), t = { ...t, [s]: r };
|
|
1142
|
+
Q(a.headers) && (n = Be(n, a.headers), t.headers = n);
|
|
1141
1143
|
}
|
|
1142
1144
|
return t;
|
|
1143
1145
|
}, St = (() => {
|
|
@@ -1151,13 +1153,13 @@ const Q = (e) => e !== null && typeof e == "object", J = (...e) => {
|
|
|
1151
1153
|
return e = !0, "half";
|
|
1152
1154
|
}
|
|
1153
1155
|
}).headers.has("Content-Type")), e && !t;
|
|
1154
|
-
})(), vt = typeof globalThis.AbortController == "function", Ct = typeof globalThis.ReadableStream == "function", Mt = typeof globalThis.FormData == "function",
|
|
1156
|
+
})(), vt = typeof globalThis.AbortController == "function", Ct = typeof globalThis.ReadableStream == "function", Mt = typeof globalThis.FormData == "function", Ve = ["get", "post", "put", "patch", "head", "delete"], Nt = {
|
|
1155
1157
|
json: "application/json",
|
|
1156
1158
|
text: "text/*",
|
|
1157
1159
|
formData: "multipart/form-data",
|
|
1158
1160
|
arrayBuffer: "*/*",
|
|
1159
1161
|
blob: "*/*"
|
|
1160
|
-
},
|
|
1162
|
+
}, re = 2147483647, Le = Symbol("stop"), xt = {
|
|
1161
1163
|
json: !0,
|
|
1162
1164
|
parseJson: !0,
|
|
1163
1165
|
searchParams: !0,
|
|
@@ -1184,18 +1186,18 @@ const Q = (e) => e !== null && typeof e == "object", J = (...e) => {
|
|
|
1184
1186
|
window: !0,
|
|
1185
1187
|
dispatcher: !0,
|
|
1186
1188
|
duplex: !0
|
|
1187
|
-
}, Pt = (e) =>
|
|
1189
|
+
}, Pt = (e) => Ve.includes(e) ? e.toUpperCase() : e, Bt = ["get", "put", "head", "delete", "options", "trace"], Vt = [408, 413, 429, 500, 502, 503, 504], Ue = [413, 429, 503], Ae = {
|
|
1188
1190
|
limit: 2,
|
|
1189
1191
|
methods: Bt,
|
|
1190
1192
|
statusCodes: Vt,
|
|
1191
|
-
afterStatusCodes:
|
|
1193
|
+
afterStatusCodes: Ue,
|
|
1192
1194
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
1193
1195
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
1194
1196
|
delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
|
|
1195
1197
|
}, Lt = (e = {}) => {
|
|
1196
1198
|
if (typeof e == "number")
|
|
1197
1199
|
return {
|
|
1198
|
-
...
|
|
1200
|
+
...Ae,
|
|
1199
1201
|
limit: e
|
|
1200
1202
|
};
|
|
1201
1203
|
if (e.methods && !Array.isArray(e.methods))
|
|
@@ -1203,15 +1205,15 @@ const Q = (e) => e !== null && typeof e == "object", J = (...e) => {
|
|
|
1203
1205
|
if (e.statusCodes && !Array.isArray(e.statusCodes))
|
|
1204
1206
|
throw new Error("retry.statusCodes must be an array");
|
|
1205
1207
|
return {
|
|
1206
|
-
...
|
|
1208
|
+
...Ae,
|
|
1207
1209
|
...e,
|
|
1208
|
-
afterStatusCodes:
|
|
1210
|
+
afterStatusCodes: Ue
|
|
1209
1211
|
};
|
|
1210
1212
|
};
|
|
1211
1213
|
async function Ut(e, t, n, a) {
|
|
1212
1214
|
return new Promise((s, r) => {
|
|
1213
1215
|
const o = setTimeout(() => {
|
|
1214
|
-
n && n.abort(), r(new
|
|
1216
|
+
n && n.abort(), r(new Pe(e));
|
|
1215
1217
|
}, a.timeout);
|
|
1216
1218
|
a.fetch(e, t).then(s).catch(r).then(() => {
|
|
1217
1219
|
clearTimeout(o);
|
|
@@ -1235,11 +1237,11 @@ const $t = (e, t) => {
|
|
|
1235
1237
|
!(a in Dt) && !(a in xt) && !(a in e) && (n[a] = t[a]);
|
|
1236
1238
|
return n;
|
|
1237
1239
|
};
|
|
1238
|
-
class
|
|
1240
|
+
class Z {
|
|
1239
1241
|
static create(t, n) {
|
|
1240
|
-
const a = new
|
|
1241
|
-
if (typeof a._options.timeout == "number" && a._options.timeout >
|
|
1242
|
-
throw new RangeError(`The \`timeout\` option cannot be greater than ${
|
|
1242
|
+
const a = new Z(t, n), s = async () => {
|
|
1243
|
+
if (typeof a._options.timeout == "number" && a._options.timeout > re)
|
|
1244
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${re}`);
|
|
1243
1245
|
await Promise.resolve();
|
|
1244
1246
|
let o = await a._fetch();
|
|
1245
1247
|
for (const p of a._options.hooks.afterResponse) {
|
|
@@ -1247,7 +1249,7 @@ class ee {
|
|
|
1247
1249
|
d instanceof globalThis.Response && (o = d);
|
|
1248
1250
|
}
|
|
1249
1251
|
if (a._decorateResponse(o), !o.ok && a._options.throwHttpErrors) {
|
|
1250
|
-
let p = new
|
|
1252
|
+
let p = new we(o, a.request, a._options);
|
|
1251
1253
|
for (const d of a._options.hooks.beforeError)
|
|
1252
1254
|
p = await d(p);
|
|
1253
1255
|
throw p;
|
|
@@ -1306,8 +1308,8 @@ class ee {
|
|
|
1306
1308
|
// TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
|
|
1307
1309
|
credentials: this._input.credentials || "same-origin",
|
|
1308
1310
|
...n,
|
|
1309
|
-
headers:
|
|
1310
|
-
hooks:
|
|
1311
|
+
headers: Be(this._input.headers, n.headers),
|
|
1312
|
+
hooks: fe({
|
|
1311
1313
|
beforeRequest: [],
|
|
1312
1314
|
beforeRetry: [],
|
|
1313
1315
|
beforeError: [],
|
|
@@ -1343,8 +1345,8 @@ class ee {
|
|
|
1343
1345
|
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 }));
|
|
1344
1346
|
}
|
|
1345
1347
|
_calculateRetryDelay(t) {
|
|
1346
|
-
if (this._retryCount++, this._retryCount < this._options.retry.limit && !(t instanceof
|
|
1347
|
-
if (t instanceof
|
|
1348
|
+
if (this._retryCount++, this._retryCount < this._options.retry.limit && !(t instanceof Pe)) {
|
|
1349
|
+
if (t instanceof we) {
|
|
1348
1350
|
if (!this._options.retry.statusCodes.includes(t.response.status))
|
|
1349
1351
|
return 0;
|
|
1350
1352
|
const a = t.response.headers.get("Retry-After");
|
|
@@ -1367,7 +1369,7 @@ class ee {
|
|
|
1367
1369
|
try {
|
|
1368
1370
|
return await t();
|
|
1369
1371
|
} catch (n) {
|
|
1370
|
-
const a = Math.min(this._calculateRetryDelay(n),
|
|
1372
|
+
const a = Math.min(this._calculateRetryDelay(n), re);
|
|
1371
1373
|
if (a !== 0 && this._retryCount > 0) {
|
|
1372
1374
|
await Ht(a, { signal: this._options.signal });
|
|
1373
1375
|
for (const s of this._options.hooks.beforeRetry)
|
|
@@ -1376,7 +1378,7 @@ class ee {
|
|
|
1376
1378
|
options: this._options,
|
|
1377
1379
|
error: n,
|
|
1378
1380
|
retryCount: this._retryCount
|
|
1379
|
-
}) ===
|
|
1381
|
+
}) === Le)
|
|
1380
1382
|
return;
|
|
1381
1383
|
return this._retry(t);
|
|
1382
1384
|
}
|
|
@@ -1431,29 +1433,29 @@ class ee {
|
|
|
1431
1433
|
}
|
|
1432
1434
|
}
|
|
1433
1435
|
/*! MIT License © Sindre Sorhus */
|
|
1434
|
-
const
|
|
1435
|
-
const t = (n, a) =>
|
|
1436
|
-
for (const n of
|
|
1437
|
-
t[n] = (a, s) =>
|
|
1438
|
-
return t.create = (n) =>
|
|
1439
|
-
}, kt =
|
|
1440
|
-
get: (e, t) =>
|
|
1441
|
-
post: (e, t) =>
|
|
1442
|
-
},
|
|
1436
|
+
const oe = (e) => {
|
|
1437
|
+
const t = (n, a) => Z.create(n, J(e, a));
|
|
1438
|
+
for (const n of Ve)
|
|
1439
|
+
t[n] = (a, s) => Z.create(a, J(e, s, { method: n }));
|
|
1440
|
+
return t.create = (n) => oe(J(n)), t.extend = (n) => oe(J(e, n)), t.stop = Le, t;
|
|
1441
|
+
}, kt = oe(), Ft = kt, Gt = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, Ee = Ft.create({ headers: Gt }), be = {
|
|
1442
|
+
get: (e, t) => Ee.get(e, t).json(),
|
|
1443
|
+
post: (e, t) => Ee.post(e, t).json()
|
|
1444
|
+
}, Re = Object.values(i), Wt = (e = "") => {
|
|
1443
1445
|
const t = e.toUpperCase(), [n] = t.split(".");
|
|
1444
|
-
if (
|
|
1446
|
+
if (Re.includes(n))
|
|
1445
1447
|
return !0;
|
|
1446
1448
|
const [a] = t.split("/");
|
|
1447
|
-
if (
|
|
1449
|
+
if (Re.includes(a))
|
|
1448
1450
|
return !0;
|
|
1449
1451
|
throw new Error(
|
|
1450
1452
|
`Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
|
|
1451
1453
|
);
|
|
1452
|
-
},
|
|
1453
|
-
function
|
|
1454
|
+
}, j = 8, H = (e) => 10n ** BigInt(e), G = (e) => Math.log10(parseFloat(e.toString()));
|
|
1455
|
+
function se({
|
|
1454
1456
|
value: e,
|
|
1455
|
-
bigIntDecimal: t =
|
|
1456
|
-
decimal: n =
|
|
1457
|
+
bigIntDecimal: t = j,
|
|
1458
|
+
decimal: n = j
|
|
1457
1459
|
}) {
|
|
1458
1460
|
const a = e < 0n;
|
|
1459
1461
|
let s = e.toString().substring(a ? 1 : 0);
|
|
@@ -1466,19 +1468,19 @@ function ie({
|
|
|
1466
1468
|
""
|
|
1467
1469
|
);
|
|
1468
1470
|
}
|
|
1469
|
-
var
|
|
1470
|
-
const qt = class
|
|
1471
|
+
var U, k, pe, He, de, ge, ee, ue, $, W, te, le;
|
|
1472
|
+
const qt = class $e {
|
|
1471
1473
|
constructor(t) {
|
|
1472
|
-
|
|
1473
|
-
const n =
|
|
1474
|
-
this.decimal = typeof t == "object" ? t.decimal : void 0, this.decimalMultiplier =
|
|
1475
|
-
Math.max(
|
|
1476
|
-
),
|
|
1474
|
+
L(this, U), L(this, pe), L(this, de), L(this, ee), L(this, $), L(this, te), C(this, "decimalMultiplier", 10n ** 8n), C(this, "bigIntValue", 0n), C(this, "decimal");
|
|
1475
|
+
const n = ce(t);
|
|
1476
|
+
this.decimal = typeof t == "object" ? t.decimal : void 0, this.decimalMultiplier = H(
|
|
1477
|
+
Math.max(g(this, te, le).call(this, g(this, $, W).call(this, n)), this.decimal || 0)
|
|
1478
|
+
), g(this, pe, He).call(this, n);
|
|
1477
1479
|
}
|
|
1478
1480
|
static fromBigInt(t, n) {
|
|
1479
|
-
return new
|
|
1481
|
+
return new $e({
|
|
1480
1482
|
decimal: n,
|
|
1481
|
-
value:
|
|
1483
|
+
value: se({ value: t, bigIntDecimal: n, decimal: n })
|
|
1482
1484
|
});
|
|
1483
1485
|
}
|
|
1484
1486
|
static shiftDecimals({
|
|
@@ -1487,7 +1489,7 @@ const qt = class me {
|
|
|
1487
1489
|
to: a
|
|
1488
1490
|
}) {
|
|
1489
1491
|
return this.fromBigInt(
|
|
1490
|
-
|
|
1492
|
+
t.getBaseValue("bigint") * H(a) / H(n),
|
|
1491
1493
|
a
|
|
1492
1494
|
);
|
|
1493
1495
|
}
|
|
@@ -1513,16 +1515,16 @@ const qt = class me {
|
|
|
1513
1515
|
return new this.constructor({ decimal: this.decimal, value: t, identifier: this.toString() });
|
|
1514
1516
|
}
|
|
1515
1517
|
add(...t) {
|
|
1516
|
-
return
|
|
1518
|
+
return g(this, U, k).call(this, "add", ...t);
|
|
1517
1519
|
}
|
|
1518
1520
|
sub(...t) {
|
|
1519
|
-
return
|
|
1521
|
+
return g(this, U, k).call(this, "sub", ...t);
|
|
1520
1522
|
}
|
|
1521
1523
|
mul(...t) {
|
|
1522
|
-
return
|
|
1524
|
+
return g(this, U, k).call(this, "mul", ...t);
|
|
1523
1525
|
}
|
|
1524
1526
|
div(...t) {
|
|
1525
|
-
return
|
|
1527
|
+
return g(this, U, k).call(this, "div", ...t);
|
|
1526
1528
|
}
|
|
1527
1529
|
gt(t) {
|
|
1528
1530
|
return this.bigIntValue > this.getBigIntValue(t);
|
|
@@ -1542,7 +1544,7 @@ const qt = class me {
|
|
|
1542
1544
|
getValue(t) {
|
|
1543
1545
|
const n = this.formatBigIntToSafeValue(
|
|
1544
1546
|
this.bigIntValue,
|
|
1545
|
-
this.decimal ||
|
|
1547
|
+
this.decimal || G(this.decimalMultiplier)
|
|
1546
1548
|
);
|
|
1547
1549
|
switch (t) {
|
|
1548
1550
|
case "number":
|
|
@@ -1554,7 +1556,7 @@ const qt = class me {
|
|
|
1554
1556
|
}
|
|
1555
1557
|
}
|
|
1556
1558
|
getBaseValue(t) {
|
|
1557
|
-
const n = this.decimalMultiplier /
|
|
1559
|
+
const n = this.decimalMultiplier / H(this.decimal || A.THOR), a = this.bigIntValue / n;
|
|
1558
1560
|
switch (t) {
|
|
1559
1561
|
case "number":
|
|
1560
1562
|
return Number(a);
|
|
@@ -1567,13 +1569,13 @@ const qt = class me {
|
|
|
1567
1569
|
getBigIntValue(t, n) {
|
|
1568
1570
|
if (!n && typeof t == "object")
|
|
1569
1571
|
return t.bigIntValue;
|
|
1570
|
-
const a =
|
|
1571
|
-
return s === "0" || s === "undefined" ? 0n :
|
|
1572
|
+
const a = ce(t), s = g(this, $, W).call(this, a);
|
|
1573
|
+
return s === "0" || s === "undefined" ? 0n : g(this, ee, ue).call(this, s, n);
|
|
1572
1574
|
}
|
|
1573
1575
|
formatBigIntToSafeValue(t, n) {
|
|
1574
|
-
const a = n || this.decimal ||
|
|
1576
|
+
const a = n || this.decimal || j, s = Math.max(
|
|
1575
1577
|
a,
|
|
1576
|
-
|
|
1578
|
+
G(this.decimalMultiplier)
|
|
1577
1579
|
), r = t < 0n, o = t.toString().substring(r ? 1 : 0), p = s - (o.length - 1), d = p > 0 ? "0".repeat(p) + o : o, y = d.length - s;
|
|
1578
1580
|
let u = d.slice(-s);
|
|
1579
1581
|
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(
|
|
@@ -1582,19 +1584,19 @@ const qt = class me {
|
|
|
1582
1584
|
)}.${u}`.replace(/\.?0*$/, "");
|
|
1583
1585
|
}
|
|
1584
1586
|
toSignificant(t = 6) {
|
|
1585
|
-
const [n, a] = this.getValue("string").split("."), s = n || "", r = a || ""
|
|
1586
|
-
if (
|
|
1587
|
+
const [n, a] = this.getValue("string").split("."), s = n || "", r = a || "";
|
|
1588
|
+
if ((parseInt(s) ? s.length + r.length : r.length) <= t)
|
|
1587
1589
|
return this.getValue("string");
|
|
1588
1590
|
if (s.length >= t)
|
|
1589
1591
|
return s.slice(0, t).padEnd(s.length, "0");
|
|
1590
1592
|
if (parseInt(s))
|
|
1591
1593
|
return `${s}.${r.slice(0, t - s.length)}`.padEnd(
|
|
1592
|
-
|
|
1594
|
+
t - s.length,
|
|
1593
1595
|
"0"
|
|
1594
1596
|
);
|
|
1595
|
-
const
|
|
1596
|
-
return `0.${
|
|
1597
|
-
r.length - `${
|
|
1597
|
+
const o = parseInt(r), p = `${o}`.slice(0, t);
|
|
1598
|
+
return `0.${p.padStart(
|
|
1599
|
+
r.length - `${o}`.length + p.length,
|
|
1598
1600
|
"0"
|
|
1599
1601
|
)}`;
|
|
1600
1602
|
}
|
|
@@ -1616,8 +1618,8 @@ const qt = class me {
|
|
|
1616
1618
|
return `${(n / o).toFixed(t)}${r}`;
|
|
1617
1619
|
}
|
|
1618
1620
|
};
|
|
1619
|
-
|
|
1620
|
-
const n =
|
|
1621
|
+
U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
|
|
1622
|
+
const n = g(this, de, ge).call(this, this, ...t), a = H(n), s = t.reduce(
|
|
1621
1623
|
(o, p) => {
|
|
1622
1624
|
const d = this.getBigIntValue(p, n);
|
|
1623
1625
|
switch (e) {
|
|
@@ -1638,55 +1640,55 @@ L = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
|
|
|
1638
1640
|
},
|
|
1639
1641
|
//normalize is to precision multiplier base
|
|
1640
1642
|
this.bigIntValue * a / this.decimalMultiplier
|
|
1641
|
-
), r =
|
|
1643
|
+
), r = se({
|
|
1642
1644
|
bigIntDecimal: n,
|
|
1643
|
-
decimal: Math.max(n,
|
|
1645
|
+
decimal: Math.max(n, G(this.decimalMultiplier)),
|
|
1644
1646
|
value: s
|
|
1645
1647
|
});
|
|
1646
1648
|
return new this.constructor({ decimal: this.decimal, value: r, identifier: this.toString() });
|
|
1647
|
-
},
|
|
1648
|
-
const t =
|
|
1649
|
-
this.bigIntValue =
|
|
1650
|
-
},
|
|
1649
|
+
}, pe = /* @__PURE__ */ new WeakSet(), He = function(e) {
|
|
1650
|
+
const t = g(this, $, W).call(this, e) || "0";
|
|
1651
|
+
this.bigIntValue = g(this, ee, ue).call(this, t);
|
|
1652
|
+
}, de = /* @__PURE__ */ new WeakSet(), ge = function(...e) {
|
|
1651
1653
|
const t = e.map(
|
|
1652
|
-
(n) => typeof n == "object" ? n.decimal ||
|
|
1654
|
+
(n) => typeof n == "object" ? n.decimal || G(n.decimalMultiplier) : g(this, te, le).call(this, g(this, $, W).call(this, n))
|
|
1653
1655
|
).filter(Boolean);
|
|
1654
|
-
return Math.max(...t,
|
|
1655
|
-
},
|
|
1656
|
-
const n = t ?
|
|
1656
|
+
return Math.max(...t, j);
|
|
1657
|
+
}, ee = /* @__PURE__ */ new WeakSet(), ue = function(e, t) {
|
|
1658
|
+
const n = t ? H(t) : this.decimalMultiplier, a = G(n), [s = "", r = ""] = e.split(".");
|
|
1657
1659
|
return BigInt(`${s}${r.padEnd(a, "0")}`);
|
|
1658
|
-
},
|
|
1660
|
+
}, $ = /* @__PURE__ */ new WeakSet(), W = function(e) {
|
|
1659
1661
|
const t = `${typeof e == "number" ? Number(e).toLocaleString("fullwide", {
|
|
1660
1662
|
useGrouping: !1,
|
|
1661
1663
|
maximumFractionDigits: 20
|
|
1662
|
-
}) :
|
|
1664
|
+
}) : ce(e)}`.replaceAll(",", ".").split(".");
|
|
1663
1665
|
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1664
|
-
},
|
|
1666
|
+
}, te = /* @__PURE__ */ new WeakSet(), le = function(e) {
|
|
1665
1667
|
var t;
|
|
1666
1668
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1667
|
-
return Math.max(n,
|
|
1669
|
+
return Math.max(n, j);
|
|
1668
1670
|
};
|
|
1669
|
-
let
|
|
1670
|
-
function
|
|
1671
|
+
let ye = qt;
|
|
1672
|
+
function ce(e) {
|
|
1671
1673
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1672
1674
|
}
|
|
1673
|
-
const z = (e, t) => typeof e == "bigint" ?
|
|
1674
|
-
let
|
|
1675
|
-
const
|
|
1676
|
-
if (!
|
|
1675
|
+
const z = (e, t) => typeof e == "bigint" ? se({ value: e, bigIntDecimal: t, decimal: t }) : e;
|
|
1676
|
+
let me;
|
|
1677
|
+
const Oe = (e) => {
|
|
1678
|
+
if (!me)
|
|
1677
1679
|
throw new Error("Static assets not loaded, call await AssetValue.loadStaticAssets() first");
|
|
1678
|
-
return
|
|
1679
|
-
},
|
|
1680
|
+
return me.get(e.toUpperCase()) || { decimal: A.THOR, identifier: "" };
|
|
1681
|
+
}, Ie = async (e, t = 0) => {
|
|
1680
1682
|
Wt(e);
|
|
1681
|
-
const n = await
|
|
1682
|
-
return new
|
|
1683
|
+
const n = await _t(Te(e)), a = z(t, n);
|
|
1684
|
+
return new x({ decimal: n, value: a, identifier: e });
|
|
1683
1685
|
};
|
|
1684
|
-
class
|
|
1686
|
+
class x extends ye {
|
|
1685
1687
|
constructor(t) {
|
|
1686
1688
|
super(
|
|
1687
|
-
t.value instanceof
|
|
1688
|
-
),
|
|
1689
|
-
const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a =
|
|
1689
|
+
t.value instanceof ye ? t.value : { decimal: t.decimal, value: t.value }
|
|
1690
|
+
), C(this, "address"), C(this, "chain"), C(this, "isSynthetic", !1), C(this, "isGasAsset", !1), C(this, "symbol"), C(this, "ticker"), C(this, "type");
|
|
1691
|
+
const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a = Te(n);
|
|
1690
1692
|
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;
|
|
1691
1693
|
}
|
|
1692
1694
|
get assetValue() {
|
|
@@ -1703,36 +1705,24 @@ class S extends Te {
|
|
|
1703
1705
|
return this.chain === t && this.symbol === n;
|
|
1704
1706
|
}
|
|
1705
1707
|
static async fromString(t, n = 0) {
|
|
1706
|
-
return
|
|
1708
|
+
return Ie(t, n);
|
|
1707
1709
|
}
|
|
1708
1710
|
static fromStringSync(t, n = 0) {
|
|
1709
|
-
const { isSynthetic: a } =
|
|
1711
|
+
const { isSynthetic: a } = Te(t), { decimal: s, identifier: r } = Oe(
|
|
1710
1712
|
t
|
|
1711
1713
|
), o = z(n, s);
|
|
1712
|
-
return r ? new
|
|
1714
|
+
return r ? new x({ decimal: s, identifier: r, value: o }) : a ? new x({ decimal: 8, identifier: t, value: o }) : void 0;
|
|
1713
1715
|
}
|
|
1714
1716
|
static async fromIdentifier(t, n = 0) {
|
|
1715
|
-
return
|
|
1717
|
+
return Ie(t, n);
|
|
1716
1718
|
}
|
|
1717
1719
|
static fromIdentifierSync(t, n = 0) {
|
|
1718
|
-
const { decimal: a, identifier: s } =
|
|
1719
|
-
return new
|
|
1720
|
+
const { decimal: a, identifier: s } = Oe(t), r = z(n, a);
|
|
1721
|
+
return new x({ decimal: a, identifier: s, value: r });
|
|
1720
1722
|
}
|
|
1721
1723
|
static fromChainOrSignature(t, n = 0) {
|
|
1722
1724
|
const { decimal: a, identifier: s } = wt(t), r = z(n, a);
|
|
1723
|
-
return new
|
|
1724
|
-
}
|
|
1725
|
-
static async fromTCQuote(t, n = 0) {
|
|
1726
|
-
const a = await Be(Z(t)), s = this.shiftDecimals({ value: n, from: b.THOR, to: a });
|
|
1727
|
-
return new S({ value: s, identifier: t, decimal: a });
|
|
1728
|
-
}
|
|
1729
|
-
static fromTCQuoteStatic(t, n = 0) {
|
|
1730
|
-
const a = pe(t), s = this.shiftDecimals({
|
|
1731
|
-
value: n,
|
|
1732
|
-
from: b.THOR,
|
|
1733
|
-
to: a.decimal
|
|
1734
|
-
});
|
|
1735
|
-
return new S({ ...a, value: s });
|
|
1725
|
+
return new x({ value: r, decimal: a, identifier: s });
|
|
1736
1726
|
}
|
|
1737
1727
|
static async loadStaticAssets() {
|
|
1738
1728
|
return new Promise(
|
|
@@ -1745,9 +1735,9 @@ class S extends Te {
|
|
|
1745
1735
|
NativeList: s,
|
|
1746
1736
|
...r
|
|
1747
1737
|
} = await import("@swapkit/tokens");
|
|
1748
|
-
|
|
1738
|
+
me = [s, ...Object.values(r)].reduce(
|
|
1749
1739
|
(o, { tokens: p }) => (p.forEach(({ identifier: d, chain: y, ...u }) => {
|
|
1750
|
-
const c = "decimals" in u ? u.decimals :
|
|
1740
|
+
const c = "decimals" in u ? u.decimals : A[y];
|
|
1751
1741
|
o.set(d, { identifier: d, decimal: c });
|
|
1752
1742
|
}), o),
|
|
1753
1743
|
/* @__PURE__ */ new Map()
|
|
@@ -1763,8 +1753,8 @@ class S extends Te {
|
|
|
1763
1753
|
);
|
|
1764
1754
|
}
|
|
1765
1755
|
}
|
|
1766
|
-
const
|
|
1767
|
-
const t =
|
|
1756
|
+
const Se = (e) => {
|
|
1757
|
+
const t = x.fromChainOrSignature(e);
|
|
1768
1758
|
switch (e) {
|
|
1769
1759
|
case i.Bitcoin:
|
|
1770
1760
|
case i.Litecoin:
|
|
@@ -1781,7 +1771,7 @@ const ve = (e) => {
|
|
|
1781
1771
|
default:
|
|
1782
1772
|
return t.add(1);
|
|
1783
1773
|
}
|
|
1784
|
-
},
|
|
1774
|
+
}, Te = (e) => {
|
|
1785
1775
|
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("-");
|
|
1786
1776
|
return {
|
|
1787
1777
|
address: d == null ? void 0 : d.toLowerCase(),
|
|
@@ -1853,14 +1843,14 @@ class m extends Error {
|
|
|
1853
1843
|
console.error(n), super(t, { cause: { code: jt[t], message: t } }), Object.setPrototypeOf(this, m.prototype);
|
|
1854
1844
|
}
|
|
1855
1845
|
}
|
|
1856
|
-
class
|
|
1846
|
+
class N extends ye {
|
|
1857
1847
|
eq(t) {
|
|
1858
1848
|
return this.eqValue(t);
|
|
1859
1849
|
}
|
|
1860
1850
|
static fromBigInt(t, n) {
|
|
1861
|
-
return new
|
|
1851
|
+
return new N({
|
|
1862
1852
|
decimal: n,
|
|
1863
|
-
value:
|
|
1853
|
+
value: se({ value: t, bigIntDecimal: n, decimal: n })
|
|
1864
1854
|
});
|
|
1865
1855
|
}
|
|
1866
1856
|
}
|
|
@@ -3550,12 +3540,12 @@ const Kt = [
|
|
|
3550
3540
|
type: "function"
|
|
3551
3541
|
},
|
|
3552
3542
|
{ stateMutability: "payable", type: "receive" }
|
|
3553
|
-
],
|
|
3543
|
+
], ke = {
|
|
3554
3544
|
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: Kt,
|
|
3555
3545
|
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: Xt,
|
|
3556
3546
|
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: Jt
|
|
3557
3547
|
}, pn = {
|
|
3558
|
-
...
|
|
3548
|
+
...ke,
|
|
3559
3549
|
// AVAX
|
|
3560
3550
|
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: zt,
|
|
3561
3551
|
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: Yt,
|
|
@@ -3585,34 +3575,34 @@ const Kt = [
|
|
|
3585
3575
|
memoStreamingSwap: u,
|
|
3586
3576
|
tcMemo: c,
|
|
3587
3577
|
tcRouter: _,
|
|
3588
|
-
tcVault:
|
|
3589
|
-
vault:
|
|
3590
|
-
token:
|
|
3578
|
+
tcVault: b,
|
|
3579
|
+
vault: E,
|
|
3580
|
+
token: R
|
|
3591
3581
|
}
|
|
3592
3582
|
}) => {
|
|
3593
|
-
const
|
|
3594
|
-
if (
|
|
3583
|
+
const w = !!ke[t.toLowerCase()];
|
|
3584
|
+
if (w && !y)
|
|
3595
3585
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
3596
|
-
const
|
|
3597
|
-
if (!
|
|
3586
|
+
const O = c || d, S = e && u || O;
|
|
3587
|
+
if (!b && !E)
|
|
3598
3588
|
throw new Error("TC Vault is required on calldata");
|
|
3599
3589
|
if (!_ && !y)
|
|
3600
3590
|
throw new Error("TC Router is required on calldata");
|
|
3601
|
-
if (!
|
|
3591
|
+
if (!S)
|
|
3602
3592
|
throw new Error("TC Memo is required on calldata");
|
|
3603
|
-
if (!
|
|
3593
|
+
if (!R)
|
|
3604
3594
|
throw new Error("Token is required on calldata");
|
|
3605
|
-
const
|
|
3595
|
+
const P = [
|
|
3606
3596
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
3607
3597
|
a(_ || y),
|
|
3608
|
-
a(
|
|
3609
|
-
|
|
3610
|
-
a(
|
|
3598
|
+
a(b || E),
|
|
3599
|
+
S.replace("{recipientAddress}", n),
|
|
3600
|
+
a(R),
|
|
3611
3601
|
s
|
|
3612
|
-
],
|
|
3613
|
-
return [...
|
|
3602
|
+
], Fe = w ? [a(y), o, p] : [r, p];
|
|
3603
|
+
return [...P, ...Fe];
|
|
3614
3604
|
}, un = ({ chain: e, txHash: t }) => {
|
|
3615
|
-
const n =
|
|
3605
|
+
const n = xe[e];
|
|
3616
3606
|
switch (e) {
|
|
3617
3607
|
case i.Binance:
|
|
3618
3608
|
case i.Bitcoin:
|
|
@@ -3638,7 +3628,7 @@ const Kt = [
|
|
|
3638
3628
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3639
3629
|
}
|
|
3640
3630
|
}, ln = ({ chain: e, address: t }) => {
|
|
3641
|
-
const n =
|
|
3631
|
+
const n = xe[e];
|
|
3642
3632
|
switch (e) {
|
|
3643
3633
|
case i.Arbitrum:
|
|
3644
3634
|
case i.Avalanche:
|
|
@@ -3662,20 +3652,20 @@ const Kt = [
|
|
|
3662
3652
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3663
3653
|
}
|
|
3664
3654
|
}, yn = (e) => {
|
|
3665
|
-
const t = e ?
|
|
3666
|
-
return
|
|
3655
|
+
const t = e ? q.ThornodeStagenet : q.ThornodeMainnet;
|
|
3656
|
+
return be.get(`${t}/thorchain/inbound_addresses`);
|
|
3667
3657
|
}, cn = (e) => {
|
|
3668
|
-
const t = e ?
|
|
3669
|
-
return
|
|
3670
|
-
},
|
|
3658
|
+
const t = e ? q.ThornodeStagenet : q.ThornodeMainnet;
|
|
3659
|
+
return be.get(`${t}/thorchain/mimir`);
|
|
3660
|
+
}, ve = () => Object.values(i).reduce(
|
|
3671
3661
|
(e, t) => (e[t] = null, e),
|
|
3672
3662
|
{}
|
|
3673
3663
|
);
|
|
3674
|
-
var
|
|
3664
|
+
var V, ne, K, M, Y, X;
|
|
3675
3665
|
class Pn {
|
|
3676
3666
|
constructor({ stagenet: t } = {}) {
|
|
3677
|
-
T(this, "connectedChains",
|
|
3678
|
-
T(this, "connectedWallets",
|
|
3667
|
+
T(this, "connectedChains", ve());
|
|
3668
|
+
T(this, "connectedWallets", ve());
|
|
3679
3669
|
T(this, "stagenet", !1);
|
|
3680
3670
|
T(this, "getAddress", (t) => {
|
|
3681
3671
|
var n;
|
|
@@ -3694,63 +3684,63 @@ class Pn {
|
|
|
3694
3684
|
if (!a.complete)
|
|
3695
3685
|
throw new m("core_swap_route_not_complete");
|
|
3696
3686
|
try {
|
|
3697
|
-
if (
|
|
3687
|
+
if (ze.includes(r)) {
|
|
3698
3688
|
const y = this.connectedWallets[o];
|
|
3699
3689
|
if (!(y != null && y.sendTransaction))
|
|
3700
3690
|
throw new m("core_wallet_connection_not_found");
|
|
3701
3691
|
if (!(t ? (p = a == null ? void 0 : a.streamingSwap) == null ? void 0 : p.transaction : a == null ? void 0 : a.transaction))
|
|
3702
3692
|
throw new m("core_swap_route_transaction_not_found");
|
|
3703
|
-
const { isHexString: c, parseUnits: _ } = await import("./index-cf1865cd.js"), { data:
|
|
3704
|
-
data:
|
|
3705
|
-
from:
|
|
3706
|
-
to:
|
|
3707
|
-
chainId: BigInt(
|
|
3708
|
-
value:
|
|
3709
|
-
value: c(
|
|
3710
|
-
}).
|
|
3693
|
+
const { isHexString: c, parseUnits: _ } = await import("./index-cf1865cd.js"), { data: b, from: E, to: R, value: w } = a.transaction, O = {
|
|
3694
|
+
data: b,
|
|
3695
|
+
from: E,
|
|
3696
|
+
to: R.toLowerCase(),
|
|
3697
|
+
chainId: BigInt(rt[o]),
|
|
3698
|
+
value: w ? new N({
|
|
3699
|
+
value: c(w) ? w : _(w, "wei").toString(16)
|
|
3700
|
+
}).getBaseValue("bigint") : 0n
|
|
3711
3701
|
};
|
|
3712
|
-
return y.sendTransaction(
|
|
3702
|
+
return y.sendTransaction(O, s);
|
|
3713
3703
|
}
|
|
3714
|
-
if (
|
|
3704
|
+
if (et.includes(r)) {
|
|
3715
3705
|
if (!a.calldata.fromAsset)
|
|
3716
3706
|
throw new m("core_swap_asset_not_recognized");
|
|
3717
|
-
const y = await
|
|
3707
|
+
const y = await x.fromString(a.calldata.fromAsset);
|
|
3718
3708
|
if (!y)
|
|
3719
3709
|
throw new m("core_swap_asset_not_recognized");
|
|
3720
|
-
const { address: u } = await f(this,
|
|
3710
|
+
const { address: u } = await f(this, V).call(this, y.chain), {
|
|
3721
3711
|
contract: c,
|
|
3722
|
-
calldata: { expiration: _, amountIn:
|
|
3723
|
-
} = a,
|
|
3712
|
+
calldata: { expiration: _, amountIn: b, memo: E, memoStreamingSwap: R }
|
|
3713
|
+
} = a, w = y.add(N.fromBigInt(BigInt(b), y.decimal)), O = t && R || E;
|
|
3724
3714
|
return this.deposit({
|
|
3725
3715
|
expiration: _,
|
|
3726
|
-
assetValue:
|
|
3727
|
-
memo:
|
|
3716
|
+
assetValue: w,
|
|
3717
|
+
memo: O,
|
|
3728
3718
|
feeOptionKey: s,
|
|
3729
3719
|
router: c,
|
|
3730
3720
|
recipient: u
|
|
3731
3721
|
});
|
|
3732
3722
|
}
|
|
3733
|
-
if (
|
|
3723
|
+
if (Ze.includes(r)) {
|
|
3734
3724
|
const { calldata: y, contract: u } = a;
|
|
3735
3725
|
if (!u)
|
|
3736
3726
|
throw new m("core_swap_contract_not_found");
|
|
3737
3727
|
const c = this.connectedWallets[o], _ = this.getAddress(o);
|
|
3738
3728
|
if (!(c != null && c.sendTransaction) || !_)
|
|
3739
3729
|
throw new m("core_wallet_connection_not_found");
|
|
3740
|
-
const { getProvider:
|
|
3741
|
-
if (!
|
|
3730
|
+
const { getProvider: b, toChecksumAddress: E } = await import("@swapkit/toolbox-evm"), R = b(o), w = pn[u.toLowerCase()];
|
|
3731
|
+
if (!w)
|
|
3742
3732
|
throw new m("core_swap_contract_not_supported", { contractAddress: u });
|
|
3743
|
-
const
|
|
3733
|
+
const S = await (await ((d = c.createContract) == null ? void 0 : d.call(c, u, w, R))).getFunction("swapIn").populateTransaction(
|
|
3744
3734
|
...dn({
|
|
3745
3735
|
streamSwap: t,
|
|
3746
|
-
toChecksumAddress:
|
|
3736
|
+
toChecksumAddress: E,
|
|
3747
3737
|
contractAddress: u,
|
|
3748
3738
|
recipient: n,
|
|
3749
3739
|
calldata: y
|
|
3750
3740
|
}),
|
|
3751
3741
|
{ from: _ }
|
|
3752
3742
|
);
|
|
3753
|
-
return c.sendTransaction(
|
|
3743
|
+
return c.sendTransaction(S, s);
|
|
3754
3744
|
}
|
|
3755
3745
|
throw new m("core_swap_quote_mode_not_supported", { quoteMode: r });
|
|
3756
3746
|
} catch (y) {
|
|
@@ -3762,7 +3752,7 @@ class Pn {
|
|
|
3762
3752
|
const a = this.getAddress(t);
|
|
3763
3753
|
if (!a)
|
|
3764
3754
|
return null;
|
|
3765
|
-
const s = [
|
|
3755
|
+
const s = [x.fromChainOrSignature(t)], r = (o = this.connectedChains[t]) == null ? void 0 : o.walletType;
|
|
3766
3756
|
try {
|
|
3767
3757
|
const d = await ((p = this.getWallet(t)) == null ? void 0 : p.getBalance(a, n));
|
|
3768
3758
|
return this.connectedChains[t] = {
|
|
@@ -3809,10 +3799,10 @@ class Pn {
|
|
|
3809
3799
|
case i.Ethereum:
|
|
3810
3800
|
case i.BinanceSmartChain:
|
|
3811
3801
|
case i.Avalanche: {
|
|
3812
|
-
const { getChecksumAddressFromAsset: u } = await import("@swapkit/toolbox-evm"), c = r === i.Avalanche ?
|
|
3802
|
+
const { getChecksumAddressFromAsset: u } = await import("@swapkit/toolbox-evm"), c = r === i.Avalanche ? Xe : r === i.BinanceSmartChain ? Je : Ye;
|
|
3813
3803
|
return await d.call({
|
|
3814
3804
|
abi: c,
|
|
3815
|
-
contractAddress: a || (await f(this,
|
|
3805
|
+
contractAddress: a || (await f(this, V).call(this, r)).router,
|
|
3816
3806
|
funcName: "depositWithExpiry",
|
|
3817
3807
|
funcParams: [
|
|
3818
3808
|
n,
|
|
@@ -3832,8 +3822,8 @@ class Pn {
|
|
|
3832
3822
|
return await d.transfer(y);
|
|
3833
3823
|
}
|
|
3834
3824
|
} catch (u) {
|
|
3835
|
-
const c = ((u == null ? void 0 : u.message) || (u == null ? void 0 : u.toString())).toLowerCase(), _ = c == null ? void 0 : c.includes("insufficient funds"),
|
|
3836
|
-
throw new m(
|
|
3825
|
+
const c = ((u == null ? void 0 : u.message) || (u == null ? void 0 : u.toString())).toLowerCase(), _ = c == null ? void 0 : c.includes("insufficient funds"), b = c == null ? void 0 : c.includes("gas"), E = c == null ? void 0 : c.includes("server"), R = _ ? "core_transaction_deposit_insufficient_funds_error" : b ? "core_transaction_deposit_gas_error" : E ? "core_transaction_deposit_server_error" : "core_transaction_deposit_error";
|
|
3826
|
+
throw new m(R, u);
|
|
3837
3827
|
}
|
|
3838
3828
|
});
|
|
3839
3829
|
/**
|
|
@@ -3847,9 +3837,9 @@ class Pn {
|
|
|
3847
3837
|
throw new m("core_transaction_create_liquidity_invalid_params");
|
|
3848
3838
|
let a = "", s = "";
|
|
3849
3839
|
try {
|
|
3850
|
-
a = await f(this,
|
|
3840
|
+
a = await f(this, M).call(this, {
|
|
3851
3841
|
assetValue: t,
|
|
3852
|
-
memo:
|
|
3842
|
+
memo: D(h.DEPOSIT, {
|
|
3853
3843
|
...n,
|
|
3854
3844
|
address: this.getAddress(n.chain)
|
|
3855
3845
|
})
|
|
@@ -3858,9 +3848,9 @@ class Pn {
|
|
|
3858
3848
|
throw new m("core_transaction_create_liquidity_rune_error", r);
|
|
3859
3849
|
}
|
|
3860
3850
|
try {
|
|
3861
|
-
s = await f(this,
|
|
3851
|
+
s = await f(this, M).call(this, {
|
|
3862
3852
|
assetValue: n,
|
|
3863
|
-
memo:
|
|
3853
|
+
memo: D(h.DEPOSIT, {
|
|
3864
3854
|
...n,
|
|
3865
3855
|
address: this.getAddress(i.THORChain)
|
|
3866
3856
|
})
|
|
@@ -3879,32 +3869,32 @@ class Pn {
|
|
|
3879
3869
|
isPendingSymmAsset: o,
|
|
3880
3870
|
mode: p = "sym"
|
|
3881
3871
|
}) => {
|
|
3882
|
-
const [d, ...y] = t.split("."), u = p === "sym", c = (n == null ? void 0 : n.gt(0)) && (u || p === "rune"), _ = (a == null ? void 0 : a.gt(0)) && (u || p === "asset"),
|
|
3872
|
+
const [d, ...y] = t.split("."), u = p === "sym", c = (n == null ? void 0 : n.gt(0)) && (u || p === "rune"), _ = (a == null ? void 0 : a.gt(0)) && (u || p === "asset"), b = o || c, E = b ? s || this.getAddress(i.THORChain) : "", R = u || p === "asset" ? r || this.getAddress(d) : "";
|
|
3883
3873
|
if (!c && !_)
|
|
3884
3874
|
throw new m("core_transaction_add_liquidity_invalid_params");
|
|
3885
|
-
if (
|
|
3875
|
+
if (b && !E)
|
|
3886
3876
|
throw new m("core_transaction_add_liquidity_no_rune_address");
|
|
3887
|
-
let
|
|
3888
|
-
const
|
|
3877
|
+
let w, O;
|
|
3878
|
+
const S = { chain: d, symbol: y.join(".") };
|
|
3889
3879
|
if (c && n)
|
|
3890
3880
|
try {
|
|
3891
|
-
|
|
3881
|
+
w = await f(this, M).call(this, {
|
|
3892
3882
|
assetValue: n,
|
|
3893
|
-
memo:
|
|
3883
|
+
memo: D(h.DEPOSIT, { ...S, address: R })
|
|
3894
3884
|
});
|
|
3895
|
-
} catch (
|
|
3896
|
-
throw new m("core_transaction_add_liquidity_rune_error",
|
|
3885
|
+
} catch (P) {
|
|
3886
|
+
throw new m("core_transaction_add_liquidity_rune_error", P);
|
|
3897
3887
|
}
|
|
3898
3888
|
if (_ && a)
|
|
3899
3889
|
try {
|
|
3900
|
-
|
|
3890
|
+
O = await f(this, M).call(this, {
|
|
3901
3891
|
assetValue: a,
|
|
3902
|
-
memo:
|
|
3892
|
+
memo: D(h.DEPOSIT, { ...S, address: E })
|
|
3903
3893
|
});
|
|
3904
|
-
} catch (
|
|
3905
|
-
throw new m("core_transaction_add_liquidity_asset_error",
|
|
3894
|
+
} catch (P) {
|
|
3895
|
+
throw new m("core_transaction_add_liquidity_asset_error", P);
|
|
3906
3896
|
}
|
|
3907
|
-
return { runeTx:
|
|
3897
|
+
return { runeTx: w, assetTx: O };
|
|
3908
3898
|
});
|
|
3909
3899
|
T(this, "withdraw", async ({
|
|
3910
3900
|
memo: t,
|
|
@@ -3913,11 +3903,11 @@ class Pn {
|
|
|
3913
3903
|
from: s,
|
|
3914
3904
|
to: r
|
|
3915
3905
|
}) => {
|
|
3916
|
-
const o = r === "rune" ?
|
|
3906
|
+
const o = r === "rune" ? x.fromChainOrSignature(i.THORChain) : s === "sym" && r === "sym" || s === "rune" || s === "asset" ? void 0 : n;
|
|
3917
3907
|
try {
|
|
3918
|
-
return await f(this,
|
|
3919
|
-
assetValue:
|
|
3920
|
-
memo: t ||
|
|
3908
|
+
return await f(this, M).call(this, {
|
|
3909
|
+
assetValue: Se(s === "asset" ? n.chain : i.THORChain),
|
|
3910
|
+
memo: t || D(h.WITHDRAW, {
|
|
3921
3911
|
symbol: n.symbol,
|
|
3922
3912
|
chain: n.chain,
|
|
3923
3913
|
ticker: n.ticker,
|
|
@@ -3936,23 +3926,23 @@ class Pn {
|
|
|
3936
3926
|
percent: a,
|
|
3937
3927
|
type: s
|
|
3938
3928
|
}) => {
|
|
3939
|
-
const r = s === "add" ? h.DEPOSIT : h.WITHDRAW, o = n ||
|
|
3929
|
+
const r = s === "add" ? h.DEPOSIT : h.WITHDRAW, o = n || D(r, {
|
|
3940
3930
|
ticker: t.ticker,
|
|
3941
3931
|
symbol: t.symbol,
|
|
3942
3932
|
chain: t.chain,
|
|
3943
3933
|
singleSide: !0,
|
|
3944
3934
|
basisPoints: a ? Math.max(1e4, Math.round(a * 100)) : void 0
|
|
3945
3935
|
});
|
|
3946
|
-
return f(this,
|
|
3936
|
+
return f(this, M).call(this, { assetValue: t, memo: o });
|
|
3947
3937
|
});
|
|
3948
3938
|
T(this, "loan", ({
|
|
3949
3939
|
assetValue: t,
|
|
3950
3940
|
memo: n,
|
|
3951
3941
|
minAmount: a,
|
|
3952
3942
|
type: s
|
|
3953
|
-
}) => f(this,
|
|
3943
|
+
}) => f(this, M).call(this, {
|
|
3954
3944
|
assetValue: t,
|
|
3955
|
-
memo: n ||
|
|
3945
|
+
memo: n || D(s === "open" ? h.OPEN_LOAN : h.CLOSE_LOAN, {
|
|
3956
3946
|
asset: t.toString(),
|
|
3957
3947
|
minAmount: a.toString(),
|
|
3958
3948
|
address: this.getAddress(t.chain)
|
|
@@ -3963,24 +3953,24 @@ class Pn {
|
|
|
3963
3953
|
assetValue: n,
|
|
3964
3954
|
address: a
|
|
3965
3955
|
}) => {
|
|
3966
|
-
const s = t === "bond" ? h.BOND : t === "unbond" ? h.UNBOND : h.LEAVE, r =
|
|
3956
|
+
const s = t === "bond" ? h.BOND : t === "unbond" ? h.UNBOND : h.LEAVE, r = D(s, {
|
|
3967
3957
|
address: a,
|
|
3968
|
-
unbondAmount: t === "unbond" ? n.
|
|
3958
|
+
unbondAmount: t === "unbond" ? n.getBaseValue("number") : void 0
|
|
3969
3959
|
});
|
|
3970
3960
|
return f(this, Y).call(this, {
|
|
3971
3961
|
memo: r,
|
|
3972
|
-
assetValue: t === "bond" ? n :
|
|
3962
|
+
assetValue: t === "bond" ? n : Se(i.THORChain)
|
|
3973
3963
|
});
|
|
3974
3964
|
});
|
|
3975
3965
|
T(this, "registerThorname", ({
|
|
3976
3966
|
assetValue: t,
|
|
3977
3967
|
...n
|
|
3978
|
-
}) => f(this, Y).call(this, { assetValue: t, memo:
|
|
3968
|
+
}) => f(this, Y).call(this, { assetValue: t, memo: D(h.THORNAME_REGISTER, n) }));
|
|
3979
3969
|
T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: s = {} }) => {
|
|
3980
3970
|
try {
|
|
3981
3971
|
t.forEach((r) => {
|
|
3982
3972
|
this[r.connectMethodName] = r.connect({
|
|
3983
|
-
addChain: f(this,
|
|
3973
|
+
addChain: f(this, ne),
|
|
3984
3974
|
config: n || {},
|
|
3985
3975
|
apis: a,
|
|
3986
3976
|
rpcUrls: s
|
|
@@ -4056,7 +4046,7 @@ class Pn {
|
|
|
4056
4046
|
T(this, "disconnectChain", (t) => {
|
|
4057
4047
|
this.connectedChains[t] = null, this.connectedWallets[t] = null;
|
|
4058
4048
|
});
|
|
4059
|
-
|
|
4049
|
+
B(this, V, async (t) => {
|
|
4060
4050
|
if (t === i.THORChain)
|
|
4061
4051
|
return {
|
|
4062
4052
|
gas_rate: "0",
|
|
@@ -4072,11 +4062,11 @@ class Pn {
|
|
|
4072
4062
|
throw new m("core_chain_halted");
|
|
4073
4063
|
return a;
|
|
4074
4064
|
});
|
|
4075
|
-
|
|
4065
|
+
B(this, ne, ({ chain: t, wallet: n, walletMethods: a }) => {
|
|
4076
4066
|
this.connectedChains[t] = n, this.connectedWallets[t] = a;
|
|
4077
4067
|
});
|
|
4078
|
-
|
|
4079
|
-
assetValue: {
|
|
4068
|
+
B(this, K, async ({
|
|
4069
|
+
assetValue: { getBaseValue: t, address: n, chain: a, isGasAsset: s, isSynthetic: r },
|
|
4080
4070
|
type: o = "checkOnly",
|
|
4081
4071
|
contractAddress: p
|
|
4082
4072
|
}) => {
|
|
@@ -4089,24 +4079,24 @@ class Pn {
|
|
|
4089
4079
|
const _ = this.getAddress(a);
|
|
4090
4080
|
if (!n || !_)
|
|
4091
4081
|
throw new m("core_approve_asset_address_or_from_not_found");
|
|
4092
|
-
const
|
|
4082
|
+
const b = p || (await f(this, V).call(this, a)).router;
|
|
4093
4083
|
return c({
|
|
4094
|
-
amount: t,
|
|
4084
|
+
amount: t("bigint"),
|
|
4095
4085
|
assetAddress: n,
|
|
4096
4086
|
from: _,
|
|
4097
|
-
spenderAddress:
|
|
4087
|
+
spenderAddress: b
|
|
4098
4088
|
});
|
|
4099
4089
|
});
|
|
4100
|
-
|
|
4090
|
+
B(this, M, async ({
|
|
4101
4091
|
assetValue: t,
|
|
4102
4092
|
memo: n,
|
|
4103
|
-
feeOptionKey: a =
|
|
4093
|
+
feeOptionKey: a = F.Fast
|
|
4104
4094
|
}) => {
|
|
4105
4095
|
const {
|
|
4106
4096
|
gas_rate: s,
|
|
4107
4097
|
router: r,
|
|
4108
4098
|
address: o
|
|
4109
|
-
} = await f(this,
|
|
4099
|
+
} = await f(this, V).call(this, t.chain), p = (parseInt(s) || 0) * ft[a];
|
|
4110
4100
|
return this.deposit({
|
|
4111
4101
|
assetValue: t,
|
|
4112
4102
|
recipient: o,
|
|
@@ -4115,13 +4105,13 @@ class Pn {
|
|
|
4115
4105
|
feeRate: p
|
|
4116
4106
|
});
|
|
4117
4107
|
});
|
|
4118
|
-
|
|
4108
|
+
B(this, Y, async ({ memo: t, assetValue: n }) => {
|
|
4119
4109
|
const a = await cn(this.stagenet);
|
|
4120
4110
|
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
4121
4111
|
throw new m("core_chain_halted");
|
|
4122
4112
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
4123
4113
|
});
|
|
4124
|
-
|
|
4114
|
+
B(this, X, ({ assetValue: t, ...n }) => ({
|
|
4125
4115
|
...n,
|
|
4126
4116
|
memo: n.memo || "",
|
|
4127
4117
|
from: this.getAddress(t.chain),
|
|
@@ -4130,51 +4120,51 @@ class Pn {
|
|
|
4130
4120
|
this.stagenet = !!t;
|
|
4131
4121
|
}
|
|
4132
4122
|
}
|
|
4133
|
-
|
|
4123
|
+
V = new WeakMap(), ne = new WeakMap(), K = new WeakMap(), M = new WeakMap(), Y = new WeakMap(), X = new WeakMap();
|
|
4134
4124
|
export {
|
|
4135
|
-
|
|
4125
|
+
ze as AGG_SWAP,
|
|
4136
4126
|
hn as ApiError,
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4127
|
+
q as ApiUrl,
|
|
4128
|
+
x as AssetValue,
|
|
4129
|
+
A as BaseDecimal,
|
|
4130
|
+
ye as BigIntArithmetics,
|
|
4141
4131
|
i as Chain,
|
|
4142
|
-
|
|
4132
|
+
he as ChainId,
|
|
4143
4133
|
Rn as ChainIdToChain,
|
|
4144
|
-
|
|
4145
|
-
|
|
4134
|
+
rt as ChainToChainId,
|
|
4135
|
+
xe as ChainToExplorerUrl,
|
|
4146
4136
|
En as ChainToHexChainId,
|
|
4147
|
-
|
|
4148
|
-
|
|
4137
|
+
ot as ChainToRPC,
|
|
4138
|
+
at as ContractAddress,
|
|
4149
4139
|
wn as CosmosChainList,
|
|
4150
|
-
|
|
4140
|
+
st as DerivationPath,
|
|
4151
4141
|
l as ERROR_CODE,
|
|
4152
|
-
|
|
4153
|
-
|
|
4142
|
+
tt as ERROR_MODULE,
|
|
4143
|
+
Ce as ERROR_TYPE,
|
|
4154
4144
|
fn as EVMChainList,
|
|
4155
|
-
|
|
4156
|
-
|
|
4145
|
+
pt as ErrorCode,
|
|
4146
|
+
F as FeeOption,
|
|
4157
4147
|
h as MemoType,
|
|
4158
4148
|
_n as NetworkDerivationPath,
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4149
|
+
Qe as QuoteMode,
|
|
4150
|
+
Ne as RPCUrl,
|
|
4151
|
+
be as RequestClient,
|
|
4152
|
+
Ze as SWAP_IN,
|
|
4153
|
+
et as SWAP_OUT,
|
|
4164
4154
|
Pn as SwapKitCore,
|
|
4165
4155
|
m as SwapKitError,
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4156
|
+
N as SwapKitNumber,
|
|
4157
|
+
Xe as TCAvalancheDepositABI,
|
|
4158
|
+
Je as TCBscDepositABI,
|
|
4159
|
+
Ye as TCEthereumVaultAbi,
|
|
4170
4160
|
An as TCSupportedChainList,
|
|
4171
4161
|
bn as UTXOChainList,
|
|
4172
|
-
|
|
4162
|
+
dt as WalletOption,
|
|
4173
4163
|
gn as assetFromString,
|
|
4174
4164
|
Dn as derivationPathToString,
|
|
4175
4165
|
Tn as erc20ABI,
|
|
4176
4166
|
On as filterAssets,
|
|
4177
|
-
|
|
4167
|
+
se as formatBigIntToSafeValue,
|
|
4178
4168
|
ft as gasFeeMultiplier,
|
|
4179
4169
|
At as getAssetType,
|
|
4180
4170
|
gt as getAsymmetricAssetShare,
|
|
@@ -4182,11 +4172,11 @@ export {
|
|
|
4182
4172
|
Rt as getAsymmetricRuneShare,
|
|
4183
4173
|
In as getAsymmetricRuneWithdrawAmount,
|
|
4184
4174
|
wt as getCommonAssetInfo,
|
|
4185
|
-
|
|
4175
|
+
_t as getDecimal,
|
|
4186
4176
|
Cn as getEstimatedPoolShare,
|
|
4187
4177
|
Mn as getLiquiditySlippage,
|
|
4188
|
-
|
|
4189
|
-
|
|
4178
|
+
D as getMemoFor,
|
|
4179
|
+
Se as getMinAmountByChain,
|
|
4190
4180
|
Ot as getSymmetricPoolShare,
|
|
4191
4181
|
vn as getSymmetricWithdraw,
|
|
4192
4182
|
Nn as getTHORNameCost,
|