@swapkit/core 1.0.0-rc.11 → 1.0.0-rc.13
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 +399 -385
- package/package.json +8 -8
- package/src/client/index.ts +19 -9
package/dist/index.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var Me = Object.defineProperty;
|
|
2
2
|
var Ce = (e, t, n) => t in e ? Me(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
-
var
|
|
3
|
+
var T = (e, t, n) => (Ce(e, typeof t != "symbol" ? t + "" : t, n), n), Ne = (e, t, n) => {
|
|
4
4
|
if (!t.has(e))
|
|
5
5
|
throw TypeError("Cannot " + n);
|
|
6
6
|
};
|
|
7
|
-
var
|
|
7
|
+
var f = (e, t, n) => (Ne(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 xe = Object.defineProperty, De = (e, t, n) => t in e ? xe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n,
|
|
12
|
+
var xe = Object.defineProperty, De = (e, t, n) => t in e ? xe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, M = (e, t, n) => (De(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
13
13
|
const Lt = [
|
|
14
14
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
15
15
|
{
|
|
@@ -108,7 +108,7 @@ const Lt = [
|
|
|
108
108
|
stateMutability: "nonpayable",
|
|
109
109
|
type: "function"
|
|
110
110
|
}
|
|
111
|
-
],
|
|
111
|
+
], Be = [
|
|
112
112
|
{
|
|
113
113
|
inputs: [{ internalType: "address", name: "rune", type: "address" }],
|
|
114
114
|
stateMutability: "nonpayable",
|
|
@@ -283,7 +283,7 @@ const Lt = [
|
|
|
283
283
|
stateMutability: "view",
|
|
284
284
|
type: "function"
|
|
285
285
|
}
|
|
286
|
-
],
|
|
286
|
+
], Pe = [
|
|
287
287
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
288
288
|
{
|
|
289
289
|
anonymous: !1,
|
|
@@ -624,65 +624,65 @@ const Ue = [
|
|
|
624
624
|
"TC-BEP20"
|
|
625
625
|
/* TC_SUPPORTED_TO_BSC */
|
|
626
626
|
];
|
|
627
|
-
var
|
|
627
|
+
var fe = /* @__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))(fe || {}), ke = /* @__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))(ke || {}), u = /* @__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))(u || {});
|
|
628
628
|
const Fe = {
|
|
629
|
-
[
|
|
630
|
-
[
|
|
631
|
-
[
|
|
632
|
-
[
|
|
633
|
-
[
|
|
634
|
-
[
|
|
635
|
-
[
|
|
636
|
-
[
|
|
637
|
-
[
|
|
638
|
-
[
|
|
639
|
-
[
|
|
640
|
-
[
|
|
641
|
-
[
|
|
642
|
-
[
|
|
643
|
-
[
|
|
644
|
-
[
|
|
645
|
-
[
|
|
646
|
-
[
|
|
647
|
-
[
|
|
648
|
-
[
|
|
649
|
-
[
|
|
650
|
-
[
|
|
651
|
-
[
|
|
652
|
-
[
|
|
653
|
-
[
|
|
654
|
-
[
|
|
655
|
-
[
|
|
656
|
-
[
|
|
657
|
-
[
|
|
658
|
-
[
|
|
659
|
-
[
|
|
660
|
-
[
|
|
661
|
-
[
|
|
662
|
-
[
|
|
663
|
-
[
|
|
664
|
-
[
|
|
665
|
-
[
|
|
666
|
-
[
|
|
667
|
-
[
|
|
668
|
-
[
|
|
669
|
-
[
|
|
670
|
-
[
|
|
671
|
-
[
|
|
672
|
-
[
|
|
673
|
-
[
|
|
674
|
-
[
|
|
675
|
-
[
|
|
676
|
-
[
|
|
677
|
-
[
|
|
678
|
-
[
|
|
679
|
-
},
|
|
629
|
+
[u.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
|
|
630
|
+
[u.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
|
|
631
|
+
[u.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
|
|
632
|
+
[u.NO_INBOUND_ADDRESSES]: "No inbound addresses.",
|
|
633
|
+
[u.CHAIN_HALTED_OR_UNSUPPORTED]: "Chain {0} halted or unsupported.",
|
|
634
|
+
[u.MISSING_INPUT_PARAMETER]: "Missing input parameter: {0}.",
|
|
635
|
+
[u.INVALID_TYPE_GENERIC]: "Invalid type",
|
|
636
|
+
[u.INVALID_NUMBER_STRING]: "Invalid number string.",
|
|
637
|
+
[u.INVALID_NUMBER]: "Invalid number.",
|
|
638
|
+
[u.INVALID_BOOLEAN]: "Invalid boolean.",
|
|
639
|
+
[u.INVALID_OBJECT]: "Invalid object.",
|
|
640
|
+
[u.INVALID_ARRAY]: "Invalid array.",
|
|
641
|
+
[u.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Sell amount must be a positive integer.",
|
|
642
|
+
[u.SELL_BUY_ASSETS_ARE_THE_SAME]: "Sell and buy assets are the same.",
|
|
643
|
+
[u.MISSING_SOURCE_ADDRESS_FOR_SYNTH]: "Source address is required for synth quote.",
|
|
644
|
+
[u.AFF_ADDRESS_AND_BPS_OR_NEITHER]: "Must provide affiliateAddress and affiliateBasisPoints params, or neither.",
|
|
645
|
+
[u.AFF_ADDRESS_TOO_LONG]: "affiliateAddress too long: 3 characters max.",
|
|
646
|
+
[u.AFF_BPS_INTEGER_0_100]: "affiliateBasisPoints must be an integer between 0 and 100.",
|
|
647
|
+
[u.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN]: "Source address {0} invalid for sell chain.",
|
|
648
|
+
[u.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN]: "Destination address {0} invalid for buy chain.",
|
|
649
|
+
[u.PREFERRED_PROFVIDER_NOT_SUPPORTED]: "Preferred provider not supported.",
|
|
650
|
+
[u.DESTINATION_ADDRESS_SMART_CONTRACT]: "Destination address is a smart contract.",
|
|
651
|
+
[u.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Buy amount must be a positive integer.",
|
|
652
|
+
[u.INVALID_PROVIDER]: "Invalid provider {0}.",
|
|
653
|
+
[u.MISSING_CROSS_CHAIN_PROVIDER]: "Missing cross-chain provider.",
|
|
654
|
+
[u.MISSING_AVAX_PROVIDER]: "Missing AVAX provider.",
|
|
655
|
+
[u.MISSING_BSC_PROVIDER]: "Missing BSC provider.",
|
|
656
|
+
[u.MISSING_ETH_PROVIDER]: "Missing ETH provider.",
|
|
657
|
+
[u.MISSING_ARB_PROVIDER]: "Missing ARB provider.",
|
|
658
|
+
[u.INVALID_PROVIDER_FOR_SWAP_OUT]: "Invalid provider for swap out.",
|
|
659
|
+
[u.INVALID_CHAIN]: "Invalid chain {0}.",
|
|
660
|
+
[u.INVALID_ASSET]: "Invalid asset {0}.",
|
|
661
|
+
[u.UNSUPPORTED_CHAIN]: "Unsupported chain {0}.",
|
|
662
|
+
[u.UNSUPPORTED_ASSET]: "Unsupported asset {0}.",
|
|
663
|
+
[u.UNSUPPORTED_ASSET_FOR_SWAPOUT]: "Unsupported asset {0} for swap out.",
|
|
664
|
+
[u.THORNODE_QUOTE_GENERIC_ERROR]: "ThorNode quote generic error.",
|
|
665
|
+
[u.INVALID_SOURCE_ADDRESS]: "Invalid source address {0}",
|
|
666
|
+
[u.INVALID_DESTINATION_ADDRESS]: "Invalid destination address {0}",
|
|
667
|
+
[u.NOT_ENOUGH_SYNTH_BALANCE]: "Source address doesn't have enough synth balance for this quote.",
|
|
668
|
+
[u.SYNTH_MINTING_CAP_REACHED]: "Synth minting cap reached.",
|
|
669
|
+
[u.INVALID_QUOTE_MODE]: "Invalid quote mode.",
|
|
670
|
+
[u.NO_QUOTES]: "No quotes to service this request.",
|
|
671
|
+
[u.SERVICE_UNAVAILABLE_GENERIC]: "Service unavailable.",
|
|
672
|
+
[u.MISSING_GAS_DATA_GENERIC]: "Missing gas data.",
|
|
673
|
+
[u.MISSING_TOKEN_INFO_GENERIC]: "Missing token info.",
|
|
674
|
+
[u.CANT_FIND_TOKEN_LIST]: "Can't find tokenlist {0}.",
|
|
675
|
+
[u.NO_PRICE]: "No price for asset {0}.",
|
|
676
|
+
[u.PRICE_IS_STALE]: "Price is stale for asset {0}.",
|
|
677
|
+
[u.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
|
|
678
|
+
[u.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
|
|
679
|
+
}, ee = (e, t) => {
|
|
680
680
|
let n = Fe[e];
|
|
681
681
|
for (let a = 0; a < t.length; a++)
|
|
682
682
|
n = n.replace(`{${a}}`, t[a]);
|
|
683
683
|
return t.length === 0 ? n.replace("{0}", "") : n;
|
|
684
684
|
};
|
|
685
|
-
class
|
|
685
|
+
class be extends Error {
|
|
686
686
|
constructor({
|
|
687
687
|
status: t,
|
|
688
688
|
revision: n,
|
|
@@ -690,22 +690,22 @@ class Ae extends Error {
|
|
|
690
690
|
code: i,
|
|
691
691
|
message: r,
|
|
692
692
|
type: p,
|
|
693
|
-
options: { shouldLog:
|
|
693
|
+
options: { shouldLog: d, shouldThrow: y, shouldTrace: l } = {
|
|
694
694
|
shouldLog: !0,
|
|
695
695
|
shouldThrow: !0,
|
|
696
696
|
shouldTrace: !0
|
|
697
697
|
},
|
|
698
|
-
displayMessageParams:
|
|
698
|
+
displayMessageParams: o
|
|
699
699
|
}) {
|
|
700
|
-
const
|
|
701
|
-
super(
|
|
702
|
-
shouldLog:
|
|
703
|
-
shouldTrace:
|
|
700
|
+
const c = r || ee(i, o || []) || "";
|
|
701
|
+
super(c), M(this, "status"), M(this, "revision"), M(this, "type"), M(this, "module"), M(this, "code"), M(this, "message"), M(this, "display"), M(this, "stack"), M(this, "options"), M(this, "displayMessageParams"), this.status = t, this.revision = n || "NO_REVISION", this.module = a, this.message = c, this.display = ee(i, o || []), this.code = i, this.type = p || fe.UNHANDLED_ERROR, this.options = {
|
|
702
|
+
shouldLog: d || !0,
|
|
703
|
+
shouldTrace: l || !0,
|
|
704
704
|
shouldThrow: y || !1
|
|
705
|
-
}, this.displayMessageParams =
|
|
705
|
+
}, this.displayMessageParams = o || [], this.options.shouldTrace && Error.captureStackTrace(this);
|
|
706
706
|
}
|
|
707
707
|
static fromErrorInfo(t) {
|
|
708
|
-
return new
|
|
708
|
+
return new be(t);
|
|
709
709
|
}
|
|
710
710
|
toErrorInfo() {
|
|
711
711
|
return { ...this, identifier: this.identifier };
|
|
@@ -714,7 +714,7 @@ class Ae 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 ee(this.code, this.displayMessageParams || []);
|
|
718
718
|
}
|
|
719
719
|
handle() {
|
|
720
720
|
const t = `[${this.identifier}]: ${this.message}`;
|
|
@@ -742,7 +742,7 @@ const Ut = {
|
|
|
742
742
|
OP: [44, 60, 0, 0, 0],
|
|
743
743
|
THOR: [44, 931, 0, 0, 0]
|
|
744
744
|
};
|
|
745
|
-
var
|
|
745
|
+
var b = /* @__PURE__ */ ((e) => (e[e.ARB = 18] = "ARB", e[e.AVAX = 18] = "AVAX", e[e.BCH = 8] = "BCH", e[e.BNB = 8] = "BNB", e[e.BSC = 18] = "BSC", e[e.BTC = 8] = "BTC", e[e.DASH = 8] = "DASH", e[e.DOGE = 8] = "DOGE", e[e.ETH = 18] = "ETH", e[e.GAIA = 6] = "GAIA", e[e.KUJI = 6] = "KUJI", e[e.LTC = 8] = "LTC", e[e.MATIC = 18] = "MATIC", e[e.MAYA = 10] = "MAYA", e[e.OP = 18] = "OP", e[e.THOR = 8] = "THOR", e))(b || {});
|
|
746
746
|
const Ht = [
|
|
747
747
|
"ETH",
|
|
748
748
|
"AVAX",
|
|
@@ -763,23 +763,23 @@ const Ht = [
|
|
|
763
763
|
"BNB"
|
|
764
764
|
/* Binance */
|
|
765
765
|
];
|
|
766
|
-
var
|
|
767
|
-
const Z = Object.values(s), qe = Object.keys(s),
|
|
766
|
+
var ye = /* @__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))(ye || {}), Ae = /* @__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))(Ae || {}), 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.finance", e.ThorswapStatic = "https://static.thorswap.net", e))(W || {});
|
|
767
|
+
const Z = Object.values(s), qe = Object.keys(s), le = Z.reduce(
|
|
768
768
|
(e, t) => {
|
|
769
769
|
const n = qe.find((a) => s[a] === t);
|
|
770
770
|
return n && (e[t] = n), e;
|
|
771
771
|
},
|
|
772
772
|
{}
|
|
773
773
|
), Ke = Z.reduce(
|
|
774
|
-
(e, t) => (e[t] = le[
|
|
774
|
+
(e, t) => (e[t] = ye[le[t]], e),
|
|
775
775
|
{}
|
|
776
776
|
), Ye = Z.reduce(
|
|
777
|
-
(e, t) => (e[t] =
|
|
777
|
+
(e, t) => (e[t] = Ae[le[t]], e),
|
|
778
778
|
{}
|
|
779
779
|
), Ft = Z.reduce(
|
|
780
780
|
(e, t) => {
|
|
781
|
-
const n = `${
|
|
782
|
-
return e[t] =
|
|
781
|
+
const n = `${le[t]}Hex`;
|
|
782
|
+
return e[t] = ye[n], e;
|
|
783
783
|
},
|
|
784
784
|
{}
|
|
785
785
|
), Gt = {
|
|
@@ -807,7 +807,7 @@ const Z = Object.values(s), qe = Object.keys(s), ce = Z.reduce(
|
|
|
807
807
|
"thorchain-stagenet-v2": "THOR",
|
|
808
808
|
"thorchain-mainnet-v1": "THOR"
|
|
809
809
|
/* THORChain */
|
|
810
|
-
},
|
|
810
|
+
}, we = {
|
|
811
811
|
ARB: "https://arbiscan.io",
|
|
812
812
|
AVAX: "https://snowtrace.io",
|
|
813
813
|
BSC: "https://bscscan.com",
|
|
@@ -824,7 +824,7 @@ const Z = Object.values(s), qe = Object.keys(s), ce = Z.reduce(
|
|
|
824
824
|
MATIC: "https://polygonscan.com",
|
|
825
825
|
THOR: "https://viewblock.io/thorchain"
|
|
826
826
|
};
|
|
827
|
-
var Xe = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(Xe || {}),
|
|
827
|
+
var Xe = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(Xe || {}), _ = /* @__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))(_ || {}), k = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(k || {}), je = /* @__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))(je || {}), Qe = Object.defineProperty, Je = (e, t, n) => t in e ? Qe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (Je(e, typeof t != "symbol" ? t + "" : t, n), n), ze = (e, t, n) => {
|
|
828
828
|
if (!t.has(e))
|
|
829
829
|
throw TypeError("Cannot " + n);
|
|
830
830
|
}, V = (e, t, n) => {
|
|
@@ -841,7 +841,7 @@ const Wt = (e) => {
|
|
|
841
841
|
return !1;
|
|
842
842
|
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
843
843
|
return !!e.match(t);
|
|
844
|
-
}, Kt = ([e, t, n, a, i]) => `${e}'/${t}'/${n}'/${a}${typeof i != "number" ? "" : `/${i}`}`,
|
|
844
|
+
}, Kt = ([e, t, n, a, i]) => `${e}'/${t}'/${n}'/${a}${typeof i != "number" ? "" : `/${i}`}`, Ee = async (e, t) => {
|
|
845
845
|
try {
|
|
846
846
|
const n = Object.entries(t || {}).reduce(
|
|
847
847
|
(a, [i, r]) => (r && (a[i] = r), a),
|
|
@@ -866,7 +866,7 @@ const Wt = (e) => {
|
|
|
866
866
|
} catch {
|
|
867
867
|
return {};
|
|
868
868
|
}
|
|
869
|
-
}, et = "0x313ce567",
|
|
869
|
+
}, et = "0x313ce567", Re = async ({ chain: e, to: t }) => {
|
|
870
870
|
try {
|
|
871
871
|
const n = await Ze(
|
|
872
872
|
Ye[e],
|
|
@@ -881,17 +881,17 @@ const Wt = (e) => {
|
|
|
881
881
|
), { result: a } = JSON.parse(n);
|
|
882
882
|
return parseInt(BigInt(a).toString());
|
|
883
883
|
} catch (n) {
|
|
884
|
-
return console.error(n),
|
|
884
|
+
return console.error(n), b[e];
|
|
885
885
|
}
|
|
886
886
|
}, tt = async (e) => {
|
|
887
887
|
if (e === s.Ethereum)
|
|
888
|
-
return
|
|
888
|
+
return b.ETH;
|
|
889
889
|
const [, t] = e.split("-");
|
|
890
|
-
return t != null && t.startsWith("0x") ?
|
|
890
|
+
return t != null && t.startsWith("0x") ? Re({ chain: s.Ethereum, to: t }) : b.ETH;
|
|
891
891
|
}, nt = async (e) => {
|
|
892
892
|
const [, t] = e.split("-");
|
|
893
|
-
return t != null && t.startsWith("0x") ?
|
|
894
|
-
}, at = async (e) => (e === s.BinanceSmartChain,
|
|
893
|
+
return t != null && t.startsWith("0x") ? Re({ chain: s.Avalanche, to: t.toLowerCase() }) : b.AVAX;
|
|
894
|
+
}, at = async (e) => (e === s.BinanceSmartChain, b.BSC), Oe = async ({ chain: e, symbol: t }) => {
|
|
895
895
|
switch (e) {
|
|
896
896
|
case s.Ethereum:
|
|
897
897
|
return tt(t);
|
|
@@ -900,7 +900,7 @@ const Wt = (e) => {
|
|
|
900
900
|
case s.BinanceSmartChain:
|
|
901
901
|
return at(t);
|
|
902
902
|
default:
|
|
903
|
-
return
|
|
903
|
+
return b[e];
|
|
904
904
|
}
|
|
905
905
|
}, st = {
|
|
906
906
|
[k.Average]: 1.2,
|
|
@@ -939,13 +939,13 @@ const Wt = (e) => {
|
|
|
939
939
|
case "ETH.vTHOR":
|
|
940
940
|
return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
|
|
941
941
|
case s.Cosmos:
|
|
942
|
-
return { identifier: "GAIA.ATOM", decimal:
|
|
942
|
+
return { identifier: "GAIA.ATOM", decimal: b[e] };
|
|
943
943
|
case s.THORChain:
|
|
944
|
-
return { identifier: "THOR.RUNE", decimal:
|
|
944
|
+
return { identifier: "THOR.RUNE", decimal: b[e] };
|
|
945
945
|
case s.BinanceSmartChain:
|
|
946
|
-
return { identifier: "BSC.BNB", decimal:
|
|
946
|
+
return { identifier: "BSC.BNB", decimal: b[e] };
|
|
947
947
|
case s.Maya:
|
|
948
|
-
return { identifier: "MAYA.CACAO", decimal:
|
|
948
|
+
return { identifier: "MAYA.CACAO", decimal: b.MAYA };
|
|
949
949
|
case "MAYA.MAYA":
|
|
950
950
|
return { identifier: "MAYA.MAYA", decimal: 4 };
|
|
951
951
|
case s.Kujira:
|
|
@@ -959,7 +959,7 @@ const Wt = (e) => {
|
|
|
959
959
|
case s.Polygon:
|
|
960
960
|
case s.Bitcoin:
|
|
961
961
|
case s.Ethereum:
|
|
962
|
-
return { identifier: `${e}.${e}`, decimal:
|
|
962
|
+
return { identifier: `${e}.${e}`, decimal: b[e] };
|
|
963
963
|
}
|
|
964
964
|
}, pt = ({ chain: e, symbol: t }) => {
|
|
965
965
|
if (t.includes("/"))
|
|
@@ -973,9 +973,9 @@ const Wt = (e) => {
|
|
|
973
973
|
case s.THORChain:
|
|
974
974
|
return "Native";
|
|
975
975
|
case s.Cosmos:
|
|
976
|
-
return t === "ATOM" ? "Native" :
|
|
976
|
+
return t === "ATOM" ? "Native" : s.Cosmos;
|
|
977
977
|
case s.Kujira:
|
|
978
|
-
return t ===
|
|
978
|
+
return t === s.Kujira ? "Native" : s.Kujira;
|
|
979
979
|
case s.Binance:
|
|
980
980
|
return t === s.Binance ? "Native" : "BEP2";
|
|
981
981
|
case s.BinanceSmartChain:
|
|
@@ -983,7 +983,7 @@ const Wt = (e) => {
|
|
|
983
983
|
case s.Ethereum:
|
|
984
984
|
return t === s.Ethereum ? "Native" : "ERC20";
|
|
985
985
|
case s.Avalanche:
|
|
986
|
-
return t === s.Avalanche ? "Native" :
|
|
986
|
+
return t === s.Avalanche ? "Native" : s.Avalanche;
|
|
987
987
|
case s.Polygon:
|
|
988
988
|
return t === s.Polygon ? "Native" : "POLYGON";
|
|
989
989
|
case s.Arbitrum:
|
|
@@ -998,20 +998,22 @@ const Wt = (e) => {
|
|
|
998
998
|
}, ot = new RegExp(
|
|
999
999
|
/(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
|
|
1000
1000
|
"gmi"
|
|
1001
|
-
), Xt = (e) => e.filter(
|
|
1001
|
+
), Xt = (e) => e.filter(
|
|
1002
|
+
(t) => !ot.test(t.toString()) && !t.toString().includes("undefined")
|
|
1003
|
+
), dt = ({
|
|
1002
1004
|
liquidityUnits: e,
|
|
1003
1005
|
poolUnits: t,
|
|
1004
1006
|
runeDepth: n
|
|
1005
1007
|
}) => {
|
|
1006
|
-
const a =
|
|
1007
|
-
return p.mul(
|
|
1008
|
+
const a = A(e), i = A(t), r = A(n), p = a.mul(r), d = i.mul(i).mul(2), y = i.mul(a).mul(2), l = a.mul(a), o = i.mul(i).mul(i);
|
|
1009
|
+
return p.mul(d.sub(y).add(l)).div(o);
|
|
1008
1010
|
}, ut = ({
|
|
1009
1011
|
liquidityUnits: e,
|
|
1010
1012
|
poolUnits: t,
|
|
1011
1013
|
assetDepth: n
|
|
1012
1014
|
}) => {
|
|
1013
|
-
const a =
|
|
1014
|
-
return
|
|
1015
|
+
const a = A(e), i = A(t), r = A(n), p = a.mul(r), d = i.mul(i).mul(2), y = i.mul(a).mul(2), l = a.mul(a), o = p.mul(d.sub(y).add(l)), c = i.mul(i).mul(i);
|
|
1016
|
+
return o.div(c);
|
|
1015
1017
|
}, jt = ({
|
|
1016
1018
|
percent: e,
|
|
1017
1019
|
runeDepth: t,
|
|
@@ -1022,14 +1024,14 @@ const Wt = (e) => {
|
|
|
1022
1024
|
assetDepth: t,
|
|
1023
1025
|
liquidityUnits: n,
|
|
1024
1026
|
poolUnits: a
|
|
1025
|
-
}) => ut({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e),
|
|
1027
|
+
}) => ut({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), A = (e) => new ue({ value: e, decimal: b.THOR }), yt = ({
|
|
1026
1028
|
liquidityUnits: e,
|
|
1027
1029
|
poolUnits: t,
|
|
1028
1030
|
runeDepth: n,
|
|
1029
1031
|
assetDepth: a
|
|
1030
1032
|
}) => ({
|
|
1031
|
-
assetAmount:
|
|
1032
|
-
runeAmount:
|
|
1033
|
+
assetAmount: A(a).mul(e).div(t),
|
|
1034
|
+
runeAmount: A(n).mul(e).div(t)
|
|
1033
1035
|
}), Jt = ({
|
|
1034
1036
|
liquidityUnits: e,
|
|
1035
1037
|
poolUnits: t,
|
|
@@ -1048,60 +1050,60 @@ const Wt = (e) => {
|
|
|
1048
1050
|
runeAmount: i,
|
|
1049
1051
|
assetAmount: r
|
|
1050
1052
|
}) => {
|
|
1051
|
-
const p =
|
|
1053
|
+
const p = A(e), d = A(n), y = A(t), l = A(i), o = A(r), c = l.mul(d), h = o.mul(p), w = l.mul(o), R = p.mul(d), O = y.mul(c.add(h.add(w.mul(2)))), E = c.add(h.add(R.mul(2))), I = O.div(E), S = A(a).add(I);
|
|
1052
1054
|
if (I.baseValueNumber === 0)
|
|
1053
|
-
return
|
|
1054
|
-
const
|
|
1055
|
-
return
|
|
1055
|
+
return S.div(y).baseValueNumber;
|
|
1056
|
+
const D = y.add(S);
|
|
1057
|
+
return S.div(D).baseValueNumber;
|
|
1056
1058
|
}, Zt = ({
|
|
1057
1059
|
runeAmount: e,
|
|
1058
1060
|
assetAmount: t,
|
|
1059
1061
|
runeDepth: n,
|
|
1060
1062
|
assetDepth: a
|
|
1061
1063
|
}) => {
|
|
1062
|
-
const i =
|
|
1063
|
-
return Math.abs(y.div(
|
|
1064
|
+
const i = A(n), r = A(a), p = A(t), d = A(e), y = p.mul(i).sub(r.mul(d)), l = r.mul(d).add(i.mul(r));
|
|
1065
|
+
return Math.abs(y.div(l).baseValueNumber);
|
|
1064
1066
|
}, lt = ({
|
|
1065
1067
|
symbol: e,
|
|
1066
1068
|
ticker: t,
|
|
1067
1069
|
chain: n
|
|
1068
|
-
}) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e,
|
|
1070
|
+
}) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e, x = (e, t) => {
|
|
1069
1071
|
switch (e) {
|
|
1070
|
-
case
|
|
1071
|
-
case
|
|
1072
|
+
case _.LEAVE:
|
|
1073
|
+
case _.BOND: {
|
|
1072
1074
|
const { address: n } = t;
|
|
1073
1075
|
return `${e}:${n}`;
|
|
1074
1076
|
}
|
|
1075
|
-
case
|
|
1077
|
+
case _.UNBOND: {
|
|
1076
1078
|
const { address: n, unbondAmount: a } = t;
|
|
1077
1079
|
return `${e}:${n}:${a * 10 ** 8}`;
|
|
1078
1080
|
}
|
|
1079
|
-
case
|
|
1081
|
+
case _.THORNAME_REGISTER: {
|
|
1080
1082
|
const { name: n, chain: a, address: i, owner: r } = t;
|
|
1081
1083
|
return `${e}:${n}:${a}:${i}${r ? `:${r}` : ""}`;
|
|
1082
1084
|
}
|
|
1083
|
-
case
|
|
1085
|
+
case _.DEPOSIT: {
|
|
1084
1086
|
const { chain: n, symbol: a, address: i, singleSide: r } = t;
|
|
1085
1087
|
return r ? `${e}:${n}/${a}::t:0` : `${e}:${n}.${a}:${i || ""}:t:0`;
|
|
1086
1088
|
}
|
|
1087
|
-
case
|
|
1088
|
-
const { chain: n, ticker: a, symbol: i, basisPoints: r, targetAssetString: p, singleSide:
|
|
1089
|
-
return `${e}:${n}${
|
|
1089
|
+
case _.WITHDRAW: {
|
|
1090
|
+
const { chain: n, ticker: a, symbol: i, basisPoints: r, targetAssetString: p, singleSide: d } = t, y = !d && p ? `:${p}` : "", l = lt({ chain: n, symbol: i, ticker: a });
|
|
1091
|
+
return `${e}:${n}${d ? "/" : "."}${l}:${r}${y}`;
|
|
1090
1092
|
}
|
|
1091
|
-
case
|
|
1092
|
-
case
|
|
1093
|
+
case _.OPEN_LOAN:
|
|
1094
|
+
case _.CLOSE_LOAN: {
|
|
1093
1095
|
const { asset: n, address: a } = t;
|
|
1094
1096
|
return `${e}:${n}:${a}`;
|
|
1095
1097
|
}
|
|
1096
1098
|
default:
|
|
1097
1099
|
return "";
|
|
1098
1100
|
}
|
|
1099
|
-
},
|
|
1101
|
+
}, ce = Object.values(s), ct = (e = "") => {
|
|
1100
1102
|
const t = e.toUpperCase(), [n] = t.split(".");
|
|
1101
|
-
if (
|
|
1103
|
+
if (ce.includes(n))
|
|
1102
1104
|
return !0;
|
|
1103
1105
|
const [a] = t.split("/");
|
|
1104
|
-
if (
|
|
1106
|
+
if (ce.includes(a))
|
|
1105
1107
|
return !0;
|
|
1106
1108
|
throw new Error(
|
|
1107
1109
|
`Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
|
|
@@ -1117,20 +1119,20 @@ function ge({
|
|
|
1117
1119
|
const r = n - (i.length - 1);
|
|
1118
1120
|
r > 0 && (i = "0".repeat(r) + i);
|
|
1119
1121
|
const p = i.length - n;
|
|
1120
|
-
let
|
|
1121
|
-
return parseInt(
|
|
1122
|
+
let d = i.slice(-n);
|
|
1123
|
+
return parseInt(d[t]) >= 5 ? d = `${d.substring(0, t - 1)}${(parseInt(d[t - 1]) + 1).toString()}` : d = d.substring(0, t), `${a ? "-" : ""}${i.slice(0, p)}.${d}`.replace(
|
|
1122
1124
|
/\.?0*$/,
|
|
1123
1125
|
""
|
|
1124
1126
|
);
|
|
1125
1127
|
}
|
|
1126
|
-
var L, $,
|
|
1128
|
+
var L, $, ne, Ie, ae, me, Q, se, H, G, J, ie;
|
|
1127
1129
|
const mt = class j {
|
|
1128
1130
|
constructor(t) {
|
|
1129
|
-
V(this, L), V(this,
|
|
1130
|
-
const n =
|
|
1131
|
+
V(this, L), V(this, ne), V(this, ae), V(this, Q), V(this, H), V(this, J), C(this, "decimalMultiplier", 10n ** 8n), C(this, "bigIntValue", 0n), C(this, "decimal");
|
|
1132
|
+
const n = pe(t);
|
|
1131
1133
|
this.decimal = typeof t == "object" ? t.decimal : void 0, this.decimalMultiplier = U(
|
|
1132
|
-
Math.max(g(this, J,
|
|
1133
|
-
), g(this,
|
|
1134
|
+
Math.max(g(this, J, ie).call(this, g(this, H, G).call(this, n)), this.decimal || 0)
|
|
1135
|
+
), g(this, ne, Ie).call(this, n);
|
|
1134
1136
|
}
|
|
1135
1137
|
static fromBigInt(t, n) {
|
|
1136
1138
|
return new j({
|
|
@@ -1207,33 +1209,36 @@ const mt = class j {
|
|
|
1207
1209
|
case "string":
|
|
1208
1210
|
return n;
|
|
1209
1211
|
default:
|
|
1210
|
-
return this.bigIntValue;
|
|
1212
|
+
return this.bigIntValue * BigInt(this.decimal || 8n) / this.decimalMultiplier;
|
|
1211
1213
|
}
|
|
1212
1214
|
}
|
|
1213
1215
|
getBaseValue(t) {
|
|
1214
|
-
const n = this.decimalMultiplier / U(this.decimal ||
|
|
1216
|
+
const n = this.decimalMultiplier / U(this.decimal || b.THOR), a = this.bigIntValue / n;
|
|
1215
1217
|
switch (t) {
|
|
1216
1218
|
case "number":
|
|
1217
1219
|
return Number(a);
|
|
1218
1220
|
case "string":
|
|
1219
1221
|
return a.toString();
|
|
1220
1222
|
default:
|
|
1221
|
-
return
|
|
1223
|
+
return a;
|
|
1222
1224
|
}
|
|
1223
1225
|
}
|
|
1224
1226
|
getBigIntValue(t, n) {
|
|
1225
|
-
|
|
1227
|
+
if (!n && typeof t == "object")
|
|
1228
|
+
return t.bigIntValue;
|
|
1229
|
+
const a = pe(t), i = g(this, H, G).call(this, a);
|
|
1230
|
+
return i === "0" || i === "undefined" ? 0n : g(this, Q, se).call(this, i, n);
|
|
1226
1231
|
}
|
|
1227
1232
|
formatBigIntToSafeValue(t, n) {
|
|
1228
1233
|
const a = n || this.decimal || q, i = Math.max(
|
|
1229
1234
|
a,
|
|
1230
1235
|
F(this.decimalMultiplier)
|
|
1231
|
-
), r = t < 0n, p = t.toString().substring(r ? 1 : 0),
|
|
1232
|
-
let
|
|
1233
|
-
return parseInt(
|
|
1236
|
+
), r = t < 0n, p = t.toString().substring(r ? 1 : 0), d = i - (p.length - 1), y = d > 0 ? "0".repeat(d) + p : p, l = y.length - i;
|
|
1237
|
+
let o = y.slice(-i);
|
|
1238
|
+
return parseInt(o[a]) >= 5 ? o = `${o.substring(0, a - 1)}${(parseInt(o[a - 1]) + 1).toString()}` : o = o.substring(0, a), `${r ? "-" : ""}${y.slice(
|
|
1234
1239
|
0,
|
|
1235
|
-
|
|
1236
|
-
)}.${
|
|
1240
|
+
l
|
|
1241
|
+
)}.${o}`.replace(/\.?0*$/, "");
|
|
1237
1242
|
}
|
|
1238
1243
|
toSignificant(t = 6) {
|
|
1239
1244
|
const [n, a] = this.getValue("string").split("."), i = n || "", r = a || "", p = parseInt(i) ? i.length + r.length : r.length;
|
|
@@ -1246,17 +1251,17 @@ const mt = class j {
|
|
|
1246
1251
|
p - t,
|
|
1247
1252
|
"0"
|
|
1248
1253
|
);
|
|
1249
|
-
const
|
|
1254
|
+
const d = parseInt(r), y = `${d}`.slice(0, t);
|
|
1250
1255
|
return `0.${y.padStart(
|
|
1251
|
-
r.length - `${
|
|
1256
|
+
r.length - `${d}`.length + y.length,
|
|
1252
1257
|
"0"
|
|
1253
1258
|
)}`;
|
|
1254
1259
|
}
|
|
1255
1260
|
};
|
|
1256
1261
|
L = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
|
|
1257
|
-
const n = g(this,
|
|
1258
|
-
(p,
|
|
1259
|
-
const y = this.getBigIntValue(
|
|
1262
|
+
const n = g(this, ae, me).call(this, this, ...t), a = U(n), i = t.reduce(
|
|
1263
|
+
(p, d) => {
|
|
1264
|
+
const y = this.getBigIntValue(d, n);
|
|
1260
1265
|
switch (e) {
|
|
1261
1266
|
case "add":
|
|
1262
1267
|
return p + y;
|
|
@@ -1281,48 +1286,48 @@ L = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
|
|
|
1281
1286
|
value: i
|
|
1282
1287
|
});
|
|
1283
1288
|
return new this.constructor({ decimal: this.decimal, value: r, identifier: this.toString() });
|
|
1284
|
-
},
|
|
1289
|
+
}, ne = /* @__PURE__ */ new WeakSet(), Ie = function(e) {
|
|
1285
1290
|
const t = g(this, H, G).call(this, e) || "0";
|
|
1286
|
-
this.bigIntValue = g(this, Q,
|
|
1287
|
-
},
|
|
1291
|
+
this.bigIntValue = g(this, Q, se).call(this, t);
|
|
1292
|
+
}, ae = /* @__PURE__ */ new WeakSet(), me = function(...e) {
|
|
1288
1293
|
const t = e.map(
|
|
1289
|
-
(n) => typeof n == "object" ? n.decimal || F(n.decimalMultiplier) : g(this, J,
|
|
1294
|
+
(n) => typeof n == "object" ? n.decimal || F(n.decimalMultiplier) : g(this, J, ie).call(this, g(this, H, G).call(this, n))
|
|
1290
1295
|
).filter(Boolean);
|
|
1291
1296
|
return Math.max(...t, q);
|
|
1292
|
-
}, Q = /* @__PURE__ */ new WeakSet(),
|
|
1293
|
-
const n = t ? U(t) : this.decimalMultiplier, a = F(n), [i, r = ""] = e.split(".");
|
|
1297
|
+
}, Q = /* @__PURE__ */ new WeakSet(), se = function(e, t) {
|
|
1298
|
+
const n = t ? U(t) : this.decimalMultiplier, a = F(n), [i = "", r = ""] = e.split(".");
|
|
1294
1299
|
return BigInt(`${i}${r.padEnd(a, "0")}`);
|
|
1295
1300
|
}, H = /* @__PURE__ */ new WeakSet(), G = function(e) {
|
|
1296
1301
|
const t = `${typeof e == "number" ? Number(e).toLocaleString("fullwide", {
|
|
1297
1302
|
useGrouping: !1,
|
|
1298
1303
|
maximumFractionDigits: 20
|
|
1299
|
-
}) :
|
|
1304
|
+
}) : pe(e)}`.replaceAll(",", ".").split(".");
|
|
1300
1305
|
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1301
|
-
}, J = /* @__PURE__ */ new WeakSet(),
|
|
1306
|
+
}, J = /* @__PURE__ */ new WeakSet(), ie = function(e) {
|
|
1302
1307
|
var t;
|
|
1303
1308
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1304
1309
|
return Math.max(n, q);
|
|
1305
1310
|
};
|
|
1306
|
-
let
|
|
1307
|
-
function
|
|
1311
|
+
let re = mt;
|
|
1312
|
+
function pe(e) {
|
|
1308
1313
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1309
1314
|
}
|
|
1310
|
-
let
|
|
1311
|
-
const
|
|
1312
|
-
if (!
|
|
1315
|
+
let oe;
|
|
1316
|
+
const te = (e) => {
|
|
1317
|
+
if (!oe)
|
|
1313
1318
|
throw new Error("Static assets not loaded, call await AssetValue.loadStaticAssets() first");
|
|
1314
|
-
return
|
|
1315
|
-
},
|
|
1319
|
+
return oe.get(e.toUpperCase()) || { decimal: b.THOR, identifier: "" };
|
|
1320
|
+
}, Te = async (e, t = 0) => {
|
|
1316
1321
|
ct(e);
|
|
1317
|
-
const n = await
|
|
1322
|
+
const n = await Oe(de(e));
|
|
1318
1323
|
return new v({ decimal: n, value: t, identifier: e });
|
|
1319
1324
|
};
|
|
1320
|
-
class v extends
|
|
1325
|
+
class v extends re {
|
|
1321
1326
|
constructor(t) {
|
|
1322
1327
|
super(
|
|
1323
|
-
t.value instanceof
|
|
1324
|
-
),
|
|
1325
|
-
const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a =
|
|
1328
|
+
t.value instanceof re ? t.value : { decimal: t.decimal, value: t.value }
|
|
1329
|
+
), C(this, "address"), C(this, "chain"), C(this, "isSynthetic", !1), C(this, "isGasAsset", !1), C(this, "symbol"), C(this, "ticker"), C(this, "type");
|
|
1330
|
+
const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a = de(n);
|
|
1326
1331
|
this.type = pt(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;
|
|
1327
1332
|
}
|
|
1328
1333
|
get assetValue() {
|
|
@@ -1339,19 +1344,19 @@ class v extends pe {
|
|
|
1339
1344
|
return this.chain === t && this.symbol === n;
|
|
1340
1345
|
}
|
|
1341
1346
|
static async fromString(t, n = 0) {
|
|
1342
|
-
return
|
|
1347
|
+
return Te(t, n);
|
|
1343
1348
|
}
|
|
1344
1349
|
static fromStringSync(t, n = 0) {
|
|
1345
|
-
const { decimal: a, identifier: i } =
|
|
1350
|
+
const { decimal: a, identifier: i } = te(
|
|
1346
1351
|
t
|
|
1347
1352
|
);
|
|
1348
1353
|
return i ? new v({ decimal: a, identifier: i, value: n }) : void 0;
|
|
1349
1354
|
}
|
|
1350
1355
|
static async fromIdentifier(t, n = 0) {
|
|
1351
|
-
return
|
|
1356
|
+
return Te(t, n);
|
|
1352
1357
|
}
|
|
1353
1358
|
static fromIdentifierSync(t, n = 0) {
|
|
1354
|
-
const { decimal: a, identifier: i } =
|
|
1359
|
+
const { decimal: a, identifier: i } = te(t);
|
|
1355
1360
|
return new v({ decimal: a, identifier: i, value: n });
|
|
1356
1361
|
}
|
|
1357
1362
|
static fromChainOrSignature(t, n = 0) {
|
|
@@ -1359,13 +1364,13 @@ class v extends pe {
|
|
|
1359
1364
|
return new v({ value: n, decimal: a, identifier: i });
|
|
1360
1365
|
}
|
|
1361
1366
|
static async fromTCQuote(t, n = 0) {
|
|
1362
|
-
const a = await
|
|
1367
|
+
const a = await Oe(de(t)), i = this.shiftDecimals({ value: n, from: b.THOR, to: a });
|
|
1363
1368
|
return new v({ value: i, identifier: t, decimal: a });
|
|
1364
1369
|
}
|
|
1365
1370
|
static fromTCQuoteStatic(t, n = 0) {
|
|
1366
|
-
const a =
|
|
1371
|
+
const a = te(t), i = this.shiftDecimals({
|
|
1367
1372
|
value: n,
|
|
1368
|
-
from:
|
|
1373
|
+
from: b.THOR,
|
|
1369
1374
|
to: a.decimal
|
|
1370
1375
|
});
|
|
1371
1376
|
return new v({ ...a, value: i });
|
|
@@ -1381,10 +1386,10 @@ class v extends pe {
|
|
|
1381
1386
|
NativeList: i,
|
|
1382
1387
|
...r
|
|
1383
1388
|
} = await import("@swapkit/tokens");
|
|
1384
|
-
|
|
1385
|
-
(p, { tokens:
|
|
1386
|
-
const
|
|
1387
|
-
p.set(y, { identifier: y, decimal:
|
|
1389
|
+
oe = [i, ...Object.values(r)].reduce(
|
|
1390
|
+
(p, { tokens: d }) => (d.forEach(({ identifier: y, chain: l, ...o }) => {
|
|
1391
|
+
const c = "decimals" in o ? o.decimals : b[l];
|
|
1392
|
+
p.set(y, { identifier: y, decimal: c });
|
|
1388
1393
|
}), p),
|
|
1389
1394
|
/* @__PURE__ */ new Map()
|
|
1390
1395
|
), t({ ok: !0 });
|
|
@@ -1399,7 +1404,7 @@ class v extends pe {
|
|
|
1399
1404
|
);
|
|
1400
1405
|
}
|
|
1401
1406
|
}
|
|
1402
|
-
const
|
|
1407
|
+
const _e = (e) => {
|
|
1403
1408
|
const t = v.fromChainOrSignature(e);
|
|
1404
1409
|
switch (e) {
|
|
1405
1410
|
case s.Bitcoin:
|
|
@@ -1417,7 +1422,7 @@ const he = (e) => {
|
|
|
1417
1422
|
default:
|
|
1418
1423
|
return t.add(1);
|
|
1419
1424
|
}
|
|
1420
|
-
},
|
|
1425
|
+
}, de = (e) => {
|
|
1421
1426
|
const t = e.slice(0, 14).includes("/"), n = e.includes(".") ? e : `${s.THORChain}.${e}`, [a, i] = n.split("."), [r, p] = i.split("-");
|
|
1422
1427
|
return {
|
|
1423
1428
|
address: p == null ? void 0 : p.toLowerCase(),
|
|
@@ -1484,12 +1489,12 @@ const he = (e) => {
|
|
|
1484
1489
|
*/
|
|
1485
1490
|
helpers_number_different_decimals: 99101
|
|
1486
1491
|
};
|
|
1487
|
-
class
|
|
1492
|
+
class m extends Error {
|
|
1488
1493
|
constructor(t, n) {
|
|
1489
|
-
console.error(n), super(t, { cause: { code: Tt[t], message: t } }), Object.setPrototypeOf(this,
|
|
1494
|
+
console.error(n), super(t, { cause: { code: Tt[t], message: t } }), Object.setPrototypeOf(this, m.prototype);
|
|
1490
1495
|
}
|
|
1491
1496
|
}
|
|
1492
|
-
class
|
|
1497
|
+
class ue extends re {
|
|
1493
1498
|
eq(t) {
|
|
1494
1499
|
return this.eqValue(t);
|
|
1495
1500
|
}
|
|
@@ -2545,7 +2550,7 @@ const _t = [
|
|
|
2545
2550
|
type: "function"
|
|
2546
2551
|
},
|
|
2547
2552
|
{ stateMutability: "payable", type: "receive" }
|
|
2548
|
-
],
|
|
2553
|
+
], gt = [
|
|
2549
2554
|
{
|
|
2550
2555
|
inputs: [
|
|
2551
2556
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -2672,7 +2677,7 @@ const _t = [
|
|
|
2672
2677
|
type: "function"
|
|
2673
2678
|
},
|
|
2674
2679
|
{ stateMutability: "payable", type: "receive" }
|
|
2675
|
-
],
|
|
2680
|
+
], It = [
|
|
2676
2681
|
{
|
|
2677
2682
|
inputs: [
|
|
2678
2683
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -3180,12 +3185,12 @@ const _t = [
|
|
|
3180
3185
|
type: "function"
|
|
3181
3186
|
},
|
|
3182
3187
|
{ stateMutability: "payable", type: "receive" }
|
|
3183
|
-
],
|
|
3188
|
+
], Se = {
|
|
3184
3189
|
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: _t,
|
|
3185
3190
|
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: ft,
|
|
3186
3191
|
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: bt
|
|
3187
3192
|
}, Ct = {
|
|
3188
|
-
...
|
|
3193
|
+
...Se,
|
|
3189
3194
|
// AVAX
|
|
3190
3195
|
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: wt,
|
|
3191
3196
|
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: ht,
|
|
@@ -3195,8 +3200,8 @@ const _t = [
|
|
|
3195
3200
|
// ETH
|
|
3196
3201
|
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: Et,
|
|
3197
3202
|
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: Ot,
|
|
3198
|
-
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]:
|
|
3199
|
-
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]:
|
|
3203
|
+
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: gt,
|
|
3204
|
+
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: It,
|
|
3200
3205
|
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: St,
|
|
3201
3206
|
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: vt,
|
|
3202
3207
|
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: Mt
|
|
@@ -3209,40 +3214,40 @@ const _t = [
|
|
|
3209
3214
|
amount: i,
|
|
3210
3215
|
amountOutMin: r = "",
|
|
3211
3216
|
data: p = "",
|
|
3212
|
-
deadline:
|
|
3217
|
+
deadline: d,
|
|
3213
3218
|
memo: y,
|
|
3214
|
-
router:
|
|
3215
|
-
memoStreamingSwap:
|
|
3216
|
-
tcMemo:
|
|
3219
|
+
router: l,
|
|
3220
|
+
memoStreamingSwap: o,
|
|
3221
|
+
tcMemo: c,
|
|
3217
3222
|
tcRouter: h,
|
|
3218
|
-
tcVault:
|
|
3223
|
+
tcVault: w,
|
|
3219
3224
|
vault: R,
|
|
3220
3225
|
token: O
|
|
3221
3226
|
}
|
|
3222
3227
|
}) => {
|
|
3223
|
-
const
|
|
3224
|
-
if (
|
|
3228
|
+
const E = !!Se[t.toLowerCase()];
|
|
3229
|
+
if (E && !l)
|
|
3225
3230
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
3226
|
-
const I =
|
|
3227
|
-
if (!
|
|
3231
|
+
const I = c || y, S = e && o || I;
|
|
3232
|
+
if (!w && !R)
|
|
3228
3233
|
throw new Error("TC Vault is required on calldata");
|
|
3229
|
-
if (!h && !
|
|
3234
|
+
if (!h && !l)
|
|
3230
3235
|
throw new Error("TC Router is required on calldata");
|
|
3231
|
-
if (!
|
|
3236
|
+
if (!S)
|
|
3232
3237
|
throw new Error("TC Memo is required on calldata");
|
|
3233
3238
|
if (!O)
|
|
3234
3239
|
throw new Error("Token is required on calldata");
|
|
3235
|
-
const
|
|
3240
|
+
const D = [
|
|
3236
3241
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
3237
|
-
a(h ||
|
|
3238
|
-
a(
|
|
3239
|
-
|
|
3242
|
+
a(h || l),
|
|
3243
|
+
a(w || R),
|
|
3244
|
+
S.replace("{recipientAddress}", n),
|
|
3240
3245
|
a(O),
|
|
3241
3246
|
i
|
|
3242
|
-
],
|
|
3243
|
-
return [...
|
|
3247
|
+
], ve = E ? [a(l), p, d] : [r, d];
|
|
3248
|
+
return [...D, ...ve];
|
|
3244
3249
|
}, xt = ({ chain: e, txHash: t }) => {
|
|
3245
|
-
const n =
|
|
3250
|
+
const n = we[e];
|
|
3246
3251
|
switch (e) {
|
|
3247
3252
|
case s.Binance:
|
|
3248
3253
|
case s.Bitcoin:
|
|
@@ -3268,7 +3273,7 @@ const _t = [
|
|
|
3268
3273
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3269
3274
|
}
|
|
3270
3275
|
}, Dt = ({ chain: e, address: t }) => {
|
|
3271
|
-
const n =
|
|
3276
|
+
const n = we[e];
|
|
3272
3277
|
switch (e) {
|
|
3273
3278
|
case s.Arbitrum:
|
|
3274
3279
|
case s.Avalanche:
|
|
@@ -3291,97 +3296,103 @@ const _t = [
|
|
|
3291
3296
|
default:
|
|
3292
3297
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3293
3298
|
}
|
|
3294
|
-
}, Pt = (e) => {
|
|
3295
|
-
const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
|
|
3296
|
-
return Re(`${t}/thorchain/inbound_addresses`);
|
|
3297
3299
|
}, Bt = (e) => {
|
|
3298
3300
|
const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
|
|
3299
|
-
return
|
|
3300
|
-
},
|
|
3301
|
+
return Ee(`${t}/thorchain/inbound_addresses`);
|
|
3302
|
+
}, Pt = (e) => {
|
|
3303
|
+
const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
|
|
3304
|
+
return Ee(`${t}/thorchain/mimir`);
|
|
3305
|
+
}, he = () => Object.values(s).reduce(
|
|
3301
3306
|
(e, t) => (e[t] = null, e),
|
|
3302
3307
|
{}
|
|
3303
3308
|
);
|
|
3304
|
-
var
|
|
3309
|
+
var P, z, K, N, Y, X;
|
|
3305
3310
|
class en {
|
|
3306
3311
|
constructor({ stagenet: t } = {}) {
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3312
|
+
T(this, "connectedChains", he());
|
|
3313
|
+
T(this, "connectedWallets", he());
|
|
3314
|
+
T(this, "stagenet", !1);
|
|
3315
|
+
T(this, "getAddress", (t) => {
|
|
3311
3316
|
var n;
|
|
3312
3317
|
return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
|
|
3313
3318
|
});
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3319
|
+
T(this, "getExplorerTxUrl", (t, n) => xt({ chain: t, txHash: n }));
|
|
3320
|
+
T(this, "getWallet", (t) => this.connectedWallets[t]);
|
|
3321
|
+
T(this, "getExplorerAddressUrl", (t, n) => Dt({ chain: t, address: n }));
|
|
3322
|
+
T(this, "getBalance", async (t, n) => {
|
|
3318
3323
|
const a = await this.getWalletByChain(t, n);
|
|
3319
3324
|
return (a == null ? void 0 : a.balance) || [];
|
|
3320
3325
|
});
|
|
3321
|
-
|
|
3322
|
-
var
|
|
3326
|
+
T(this, "swap", async ({ streamSwap: t, recipient: n, route: a, feeOptionKey: i }) => {
|
|
3327
|
+
var d, y;
|
|
3323
3328
|
const { quoteMode: r } = a.meta, p = r.startsWith("ERC20-") ? s.Ethereum : r.startsWith("ARC20-") ? s.Avalanche : s.BinanceSmartChain;
|
|
3324
3329
|
if (!a.complete)
|
|
3325
|
-
throw new
|
|
3330
|
+
throw new m("core_swap_route_not_complete");
|
|
3326
3331
|
try {
|
|
3327
3332
|
if (Ue.includes(r)) {
|
|
3328
3333
|
const l = this.connectedWallets[p];
|
|
3329
3334
|
if (!(l != null && l.sendTransaction))
|
|
3330
|
-
throw new
|
|
3331
|
-
if (!(t ? (
|
|
3332
|
-
throw new
|
|
3333
|
-
const { isHexString:
|
|
3334
|
-
data:
|
|
3335
|
-
from:
|
|
3336
|
-
to:
|
|
3335
|
+
throw new m("core_wallet_connection_not_found");
|
|
3336
|
+
if (!(t ? (d = a == null ? void 0 : a.streamingSwap) == null ? void 0 : d.transaction : a == null ? void 0 : a.transaction))
|
|
3337
|
+
throw new m("core_swap_route_transaction_not_found");
|
|
3338
|
+
const { isHexString: c, parseUnits: h } = await import("./index-cf1865cd.js"), { data: w, from: R, to: O, value: E } = a.transaction, I = {
|
|
3339
|
+
data: w,
|
|
3340
|
+
from: R,
|
|
3341
|
+
to: O.toLowerCase(),
|
|
3337
3342
|
chainId: BigInt(Ke[p]),
|
|
3338
|
-
value:
|
|
3339
|
-
value:
|
|
3343
|
+
value: E ? new ue({
|
|
3344
|
+
value: c(E) ? E : h(E, "wei").toString(16)
|
|
3340
3345
|
}).baseValueBigInt : 0n
|
|
3341
3346
|
};
|
|
3342
|
-
return l.sendTransaction(
|
|
3347
|
+
return l.sendTransaction(I, i);
|
|
3343
3348
|
}
|
|
3344
3349
|
if ($e.includes(r)) {
|
|
3345
3350
|
if (!a.calldata.fromAsset)
|
|
3346
|
-
throw new
|
|
3351
|
+
throw new m("core_swap_asset_not_recognized");
|
|
3347
3352
|
const l = await v.fromString(a.calldata.fromAsset);
|
|
3348
3353
|
if (!l)
|
|
3349
|
-
throw new
|
|
3350
|
-
const { address:
|
|
3351
|
-
contract:
|
|
3352
|
-
calldata: { amountIn:
|
|
3353
|
-
} = a,
|
|
3354
|
-
return this.deposit({
|
|
3354
|
+
throw new m("core_swap_asset_not_recognized");
|
|
3355
|
+
const { address: o } = await f(this, P).call(this, l.chain), {
|
|
3356
|
+
contract: c,
|
|
3357
|
+
calldata: { expiration: h, amountIn: w, memo: R, memoStreamingSwap: O }
|
|
3358
|
+
} = a, E = l.add(ue.fromBigInt(BigInt(w), l.decimal)), I = t && O || R;
|
|
3359
|
+
return this.deposit({
|
|
3360
|
+
expiration: h,
|
|
3361
|
+
assetValue: E,
|
|
3362
|
+
memo: I,
|
|
3363
|
+
feeOptionKey: i,
|
|
3364
|
+
router: c,
|
|
3365
|
+
recipient: o
|
|
3366
|
+
});
|
|
3355
3367
|
}
|
|
3356
3368
|
if (He.includes(r)) {
|
|
3357
|
-
const { calldata: l, contract:
|
|
3358
|
-
if (!
|
|
3359
|
-
throw new
|
|
3360
|
-
const
|
|
3361
|
-
if (!(
|
|
3362
|
-
throw new
|
|
3363
|
-
const { getProvider:
|
|
3364
|
-
if (!
|
|
3365
|
-
throw new
|
|
3366
|
-
const
|
|
3367
|
-
T,
|
|
3369
|
+
const { calldata: l, contract: o } = a;
|
|
3370
|
+
if (!o)
|
|
3371
|
+
throw new m("core_swap_contract_not_found");
|
|
3372
|
+
const c = this.connectedWallets[p], h = this.getAddress(p);
|
|
3373
|
+
if (!(c != null && c.sendTransaction) || !h)
|
|
3374
|
+
throw new m("core_wallet_connection_not_found");
|
|
3375
|
+
const { getProvider: w, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), O = w(p), E = Ct[o.toLowerCase()];
|
|
3376
|
+
if (!E)
|
|
3377
|
+
throw new m("core_swap_contract_not_supported", { contractAddress: o });
|
|
3378
|
+
const S = await (await ((y = c.createContract) == null ? void 0 : y.call(c, o, E, O))).getFunction("swapIn").populateTransaction(
|
|
3368
3379
|
...Nt({
|
|
3369
3380
|
streamSwap: t,
|
|
3370
|
-
toChecksumAddress:
|
|
3371
|
-
contractAddress:
|
|
3381
|
+
toChecksumAddress: R,
|
|
3382
|
+
contractAddress: o,
|
|
3372
3383
|
recipient: n,
|
|
3373
3384
|
calldata: l
|
|
3374
3385
|
}),
|
|
3375
|
-
{ from:
|
|
3376
|
-
)
|
|
3377
|
-
return
|
|
3386
|
+
{ from: h }
|
|
3387
|
+
);
|
|
3388
|
+
return c.sendTransaction(S, i);
|
|
3378
3389
|
}
|
|
3379
|
-
throw new
|
|
3390
|
+
throw new m("core_swap_quote_mode_not_supported", { quoteMode: r });
|
|
3380
3391
|
} catch (l) {
|
|
3381
|
-
throw new
|
|
3392
|
+
throw new m("core_swap_transaction_error", l);
|
|
3382
3393
|
}
|
|
3383
3394
|
});
|
|
3384
|
-
|
|
3395
|
+
T(this, "getWalletByChain", async (t, n) => {
|
|
3385
3396
|
var r, p;
|
|
3386
3397
|
const a = this.getAddress(t);
|
|
3387
3398
|
if (!a)
|
|
@@ -3395,136 +3406,139 @@ class en {
|
|
|
3395
3406
|
walletType: (p = this.connectedChains[t]) == null ? void 0 : p.walletType
|
|
3396
3407
|
}, { ...this.connectedChains[t] };
|
|
3397
3408
|
});
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3409
|
+
T(this, "approveAssetValue", (t, n) => f(this, K).call(this, { assetValue: t, type: "approve", contractAddress: n }));
|
|
3410
|
+
T(this, "isAssetValueApproved", (t, n) => f(this, K).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
|
|
3411
|
+
T(this, "validateAddress", ({ address: t, chain: n }) => {
|
|
3401
3412
|
var a, i;
|
|
3402
3413
|
return (i = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : i.call(a, t);
|
|
3403
3414
|
});
|
|
3404
|
-
|
|
3415
|
+
T(this, "transfer", async (t) => {
|
|
3405
3416
|
const n = this.connectedWallets[t.assetValue.chain];
|
|
3406
3417
|
if (!n)
|
|
3407
|
-
throw new
|
|
3418
|
+
throw new m("core_wallet_connection_not_found");
|
|
3408
3419
|
try {
|
|
3409
|
-
return await n.transfer(
|
|
3420
|
+
return await n.transfer(f(this, X).call(this, t));
|
|
3410
3421
|
} catch (a) {
|
|
3411
|
-
throw new
|
|
3422
|
+
throw new m("core_swap_transaction_error", a);
|
|
3412
3423
|
}
|
|
3413
3424
|
});
|
|
3414
|
-
|
|
3425
|
+
T(this, "deposit", async ({
|
|
3415
3426
|
assetValue: t,
|
|
3416
3427
|
recipient: n,
|
|
3417
3428
|
router: a,
|
|
3418
3429
|
...i
|
|
3419
3430
|
}) => {
|
|
3420
|
-
const { chain: r, symbol: p, ticker:
|
|
3431
|
+
const { chain: r, symbol: p, ticker: d } = t, y = this.connectedWallets[r];
|
|
3421
3432
|
if (!y)
|
|
3422
|
-
throw new
|
|
3423
|
-
const
|
|
3433
|
+
throw new m("core_wallet_connection_not_found");
|
|
3434
|
+
const l = f(this, X).call(this, { assetValue: t, recipient: n, router: a, ...i });
|
|
3424
3435
|
try {
|
|
3425
3436
|
switch (r) {
|
|
3426
3437
|
case s.THORChain: {
|
|
3427
|
-
const
|
|
3428
|
-
return await (n === "" ?
|
|
3438
|
+
const o = y;
|
|
3439
|
+
return await (n === "" ? o.deposit(l) : o.transfer(l));
|
|
3429
3440
|
}
|
|
3430
3441
|
case s.Ethereum:
|
|
3431
3442
|
case s.BinanceSmartChain:
|
|
3432
3443
|
case s.Avalanche: {
|
|
3433
|
-
const { getChecksumAddressFromAsset:
|
|
3444
|
+
const { getChecksumAddressFromAsset: o } = await import("@swapkit/toolbox-evm"), c = r === s.Avalanche ? Pe : r === s.BinanceSmartChain ? Ve : Be;
|
|
3434
3445
|
return await y.call({
|
|
3435
|
-
abi:
|
|
3436
|
-
contractAddress: a || (await
|
|
3446
|
+
abi: c,
|
|
3447
|
+
contractAddress: a || (await f(this, P).call(this, r)).router,
|
|
3437
3448
|
funcName: "depositWithExpiry",
|
|
3438
3449
|
funcParams: [
|
|
3439
3450
|
n,
|
|
3440
|
-
|
|
3451
|
+
o({ chain: r, symbol: p, ticker: d }, r),
|
|
3441
3452
|
// TODO: (@Towan) Re-Check on that conversion 🙏
|
|
3442
|
-
t.
|
|
3443
|
-
|
|
3453
|
+
t.getBaseValue("bigint").toString(),
|
|
3454
|
+
l.memo,
|
|
3444
3455
|
i.expiration
|
|
3445
3456
|
],
|
|
3446
|
-
txOverrides: {
|
|
3457
|
+
txOverrides: {
|
|
3458
|
+
from: l.from,
|
|
3459
|
+
value: t.isGasAsset ? t.getBaseValue("bigint") : void 0
|
|
3460
|
+
}
|
|
3447
3461
|
});
|
|
3448
3462
|
}
|
|
3449
3463
|
default:
|
|
3450
|
-
return await y.transfer(
|
|
3464
|
+
return await y.transfer(l);
|
|
3451
3465
|
}
|
|
3452
|
-
} catch (
|
|
3453
|
-
const
|
|
3454
|
-
throw new
|
|
3466
|
+
} catch (o) {
|
|
3467
|
+
const c = ((o == null ? void 0 : o.message) || (o == null ? void 0 : o.toString())).toLowerCase(), h = c == null ? void 0 : c.includes("insufficient funds"), w = c == null ? void 0 : c.includes("gas"), R = c == null ? void 0 : c.includes("server"), O = h ? "core_transaction_deposit_insufficient_funds_error" : w ? "core_transaction_deposit_gas_error" : R ? "core_transaction_deposit_server_error" : "core_transaction_deposit_error";
|
|
3468
|
+
throw new m(O, o);
|
|
3455
3469
|
}
|
|
3456
3470
|
});
|
|
3457
3471
|
/**
|
|
3458
3472
|
* TC related Methods
|
|
3459
3473
|
*/
|
|
3460
|
-
|
|
3474
|
+
T(this, "createLiquidity", async ({
|
|
3461
3475
|
runeAssetValue: t,
|
|
3462
3476
|
assetValue: n
|
|
3463
3477
|
}) => {
|
|
3464
3478
|
if (t.lte(0) || n.lte(0))
|
|
3465
|
-
throw new
|
|
3479
|
+
throw new m("core_transaction_create_liquidity_invalid_params");
|
|
3466
3480
|
let a = "", i = "";
|
|
3467
3481
|
try {
|
|
3468
|
-
a = await
|
|
3482
|
+
a = await f(this, N).call(this, {
|
|
3469
3483
|
assetValue: t,
|
|
3470
|
-
memo:
|
|
3484
|
+
memo: x(_.DEPOSIT, {
|
|
3471
3485
|
...n,
|
|
3472
3486
|
address: this.getAddress(n.chain)
|
|
3473
3487
|
})
|
|
3474
3488
|
});
|
|
3475
3489
|
} catch (r) {
|
|
3476
|
-
throw new
|
|
3490
|
+
throw new m("core_transaction_create_liquidity_rune_error", r);
|
|
3477
3491
|
}
|
|
3478
3492
|
try {
|
|
3479
|
-
i = await
|
|
3493
|
+
i = await f(this, N).call(this, {
|
|
3480
3494
|
assetValue: n,
|
|
3481
|
-
memo:
|
|
3495
|
+
memo: x(_.DEPOSIT, {
|
|
3482
3496
|
...n,
|
|
3483
3497
|
address: this.getAddress(s.THORChain)
|
|
3484
3498
|
})
|
|
3485
3499
|
});
|
|
3486
3500
|
} catch (r) {
|
|
3487
|
-
throw new
|
|
3501
|
+
throw new m("core_transaction_create_liquidity_asset_error", r);
|
|
3488
3502
|
}
|
|
3489
3503
|
return { runeTx: a, assetTx: i };
|
|
3490
3504
|
});
|
|
3491
|
-
|
|
3505
|
+
T(this, "addLiquidity", async ({
|
|
3492
3506
|
poolIdentifier: t,
|
|
3493
3507
|
runeAssetValue: n,
|
|
3494
3508
|
assetValue: a,
|
|
3495
3509
|
runeAddr: i,
|
|
3496
3510
|
assetAddr: r,
|
|
3497
3511
|
isPendingSymmAsset: p,
|
|
3498
|
-
mode:
|
|
3512
|
+
mode: d = "sym"
|
|
3499
3513
|
}) => {
|
|
3500
|
-
const [y, ...
|
|
3501
|
-
if (!
|
|
3502
|
-
throw new
|
|
3503
|
-
if (
|
|
3504
|
-
throw new
|
|
3505
|
-
let
|
|
3506
|
-
const
|
|
3507
|
-
if (
|
|
3514
|
+
const [y, ...l] = t.split("."), o = d === "sym", c = (n == null ? void 0 : n.gt(0)) && (o || d === "rune"), h = (a == null ? void 0 : a.gt(0)) && (o || d === "asset"), w = p || c, R = w ? i || this.getAddress(s.THORChain) : "", O = o || d === "asset" ? r || this.getAddress(y) : "";
|
|
3515
|
+
if (!c && !h)
|
|
3516
|
+
throw new m("core_transaction_add_liquidity_invalid_params");
|
|
3517
|
+
if (w && !R)
|
|
3518
|
+
throw new m("core_transaction_add_liquidity_no_rune_address");
|
|
3519
|
+
let E, I;
|
|
3520
|
+
const S = { chain: y, symbol: l.join(".") };
|
|
3521
|
+
if (c && n)
|
|
3508
3522
|
try {
|
|
3509
|
-
|
|
3523
|
+
E = await f(this, N).call(this, {
|
|
3510
3524
|
assetValue: n,
|
|
3511
|
-
memo:
|
|
3525
|
+
memo: x(_.DEPOSIT, { ...S, address: O })
|
|
3512
3526
|
});
|
|
3513
|
-
} catch (
|
|
3514
|
-
throw new
|
|
3527
|
+
} catch (D) {
|
|
3528
|
+
throw new m("core_transaction_add_liquidity_rune_error", D);
|
|
3515
3529
|
}
|
|
3516
3530
|
if (h && a)
|
|
3517
3531
|
try {
|
|
3518
|
-
I = await
|
|
3532
|
+
I = await f(this, N).call(this, {
|
|
3519
3533
|
assetValue: a,
|
|
3520
|
-
memo:
|
|
3534
|
+
memo: x(_.DEPOSIT, { ...S, address: R })
|
|
3521
3535
|
});
|
|
3522
|
-
} catch (
|
|
3523
|
-
throw new
|
|
3536
|
+
} catch (D) {
|
|
3537
|
+
throw new m("core_transaction_add_liquidity_asset_error", D);
|
|
3524
3538
|
}
|
|
3525
|
-
return { runeTx:
|
|
3539
|
+
return { runeTx: E, assetTx: I };
|
|
3526
3540
|
});
|
|
3527
|
-
|
|
3541
|
+
T(this, "withdraw", async ({
|
|
3528
3542
|
memo: t,
|
|
3529
3543
|
assetValue: n,
|
|
3530
3544
|
percent: a,
|
|
@@ -3533,9 +3547,9 @@ class en {
|
|
|
3533
3547
|
}) => {
|
|
3534
3548
|
const p = r === "rune" ? v.fromChainOrSignature(s.THORChain) : i === "sym" && r === "sym" || i === "rune" || i === "asset" ? void 0 : n;
|
|
3535
3549
|
try {
|
|
3536
|
-
return await
|
|
3537
|
-
assetValue:
|
|
3538
|
-
memo: t ||
|
|
3550
|
+
return await f(this, N).call(this, {
|
|
3551
|
+
assetValue: _e(i === "asset" ? n.chain : s.THORChain),
|
|
3552
|
+
memo: t || x(_.WITHDRAW, {
|
|
3539
3553
|
symbol: n.symbol,
|
|
3540
3554
|
chain: n.chain,
|
|
3541
3555
|
ticker: n.ticker,
|
|
@@ -3544,71 +3558,71 @@ class en {
|
|
|
3544
3558
|
singleSide: !1
|
|
3545
3559
|
})
|
|
3546
3560
|
});
|
|
3547
|
-
} catch (
|
|
3548
|
-
throw new
|
|
3561
|
+
} catch (d) {
|
|
3562
|
+
throw new m("core_transaction_withdraw_error", d);
|
|
3549
3563
|
}
|
|
3550
3564
|
});
|
|
3551
|
-
|
|
3565
|
+
T(this, "savings", async ({
|
|
3552
3566
|
assetValue: t,
|
|
3553
3567
|
memo: n,
|
|
3554
3568
|
percent: a,
|
|
3555
3569
|
type: i
|
|
3556
3570
|
}) => {
|
|
3557
|
-
const r = i === "add" ?
|
|
3571
|
+
const r = i === "add" ? _.DEPOSIT : _.WITHDRAW, p = n || x(r, {
|
|
3558
3572
|
ticker: t.ticker,
|
|
3559
3573
|
symbol: t.symbol,
|
|
3560
3574
|
chain: t.chain,
|
|
3561
3575
|
singleSide: !0,
|
|
3562
3576
|
basisPoints: a ? Math.max(1e4, Math.round(a * 100)) : void 0
|
|
3563
3577
|
});
|
|
3564
|
-
return
|
|
3578
|
+
return f(this, N).call(this, { assetValue: t, memo: p });
|
|
3565
3579
|
});
|
|
3566
|
-
|
|
3580
|
+
T(this, "loan", ({
|
|
3567
3581
|
assetValue: t,
|
|
3568
3582
|
memo: n,
|
|
3569
3583
|
minAmount: a,
|
|
3570
3584
|
type: i
|
|
3571
|
-
}) =>
|
|
3585
|
+
}) => f(this, N).call(this, {
|
|
3572
3586
|
assetValue: t,
|
|
3573
|
-
memo: n ||
|
|
3587
|
+
memo: n || x(i === "open" ? _.OPEN_LOAN : _.CLOSE_LOAN, {
|
|
3574
3588
|
asset: t.toString(),
|
|
3575
3589
|
minAmount: a.toString(),
|
|
3576
3590
|
address: this.getAddress(t.chain)
|
|
3577
3591
|
})
|
|
3578
3592
|
}));
|
|
3579
|
-
|
|
3593
|
+
T(this, "nodeAction", ({
|
|
3580
3594
|
type: t,
|
|
3581
3595
|
assetValue: n,
|
|
3582
3596
|
address: a
|
|
3583
3597
|
}) => {
|
|
3584
|
-
const i = t === "bond" ?
|
|
3598
|
+
const i = t === "bond" ? _.BOND : t === "unbond" ? _.UNBOND : _.LEAVE, r = x(i, {
|
|
3585
3599
|
address: a,
|
|
3586
3600
|
unbondAmount: t === "unbond" ? n.baseValueNumber : void 0
|
|
3587
3601
|
});
|
|
3588
|
-
return
|
|
3602
|
+
return f(this, Y).call(this, {
|
|
3589
3603
|
memo: r,
|
|
3590
|
-
assetValue: t === "bond" ? n :
|
|
3604
|
+
assetValue: t === "bond" ? n : _e(s.THORChain)
|
|
3591
3605
|
});
|
|
3592
3606
|
});
|
|
3593
|
-
|
|
3607
|
+
T(this, "registerThorname", ({
|
|
3594
3608
|
assetValue: t,
|
|
3595
3609
|
...n
|
|
3596
|
-
}) =>
|
|
3597
|
-
|
|
3610
|
+
}) => f(this, Y).call(this, { assetValue: t, memo: x(_.THORNAME_REGISTER, n) }));
|
|
3611
|
+
T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: i = {} }) => {
|
|
3598
3612
|
try {
|
|
3599
3613
|
t.forEach((r) => {
|
|
3600
3614
|
this[r.connectMethodName] = r.connect({
|
|
3601
|
-
addChain:
|
|
3615
|
+
addChain: f(this, z),
|
|
3602
3616
|
config: n || {},
|
|
3603
3617
|
apis: a,
|
|
3604
3618
|
rpcUrls: i
|
|
3605
3619
|
});
|
|
3606
3620
|
});
|
|
3607
3621
|
} catch (r) {
|
|
3608
|
-
throw new
|
|
3622
|
+
throw new m("core_extend_error", r);
|
|
3609
3623
|
}
|
|
3610
3624
|
});
|
|
3611
|
-
|
|
3625
|
+
T(this, "estimateMaxSendableAmount", async ({
|
|
3612
3626
|
chain: t,
|
|
3613
3627
|
params: n
|
|
3614
3628
|
}) => {
|
|
@@ -3641,40 +3655,40 @@ class en {
|
|
|
3641
3655
|
});
|
|
3642
3656
|
}
|
|
3643
3657
|
default:
|
|
3644
|
-
throw new
|
|
3658
|
+
throw new m("core_estimated_max_spendable_chain_not_supported");
|
|
3645
3659
|
}
|
|
3646
3660
|
});
|
|
3647
3661
|
/**
|
|
3648
3662
|
* Wallet connection methods
|
|
3649
3663
|
*/
|
|
3650
|
-
|
|
3651
|
-
throw new
|
|
3664
|
+
T(this, "connectXDEFI", async (t) => {
|
|
3665
|
+
throw new m("core_wallet_xdefi_not_installed");
|
|
3652
3666
|
});
|
|
3653
|
-
|
|
3654
|
-
throw new
|
|
3667
|
+
T(this, "connectEVMWallet", async (t, n) => {
|
|
3668
|
+
throw new m("core_wallet_evmwallet_not_installed");
|
|
3655
3669
|
});
|
|
3656
|
-
|
|
3657
|
-
throw new
|
|
3670
|
+
T(this, "connectWalletconnect", async (t, n) => {
|
|
3671
|
+
throw new m("core_wallet_walletconnect_not_installed");
|
|
3658
3672
|
});
|
|
3659
|
-
|
|
3660
|
-
throw new
|
|
3673
|
+
T(this, "connectKeystore", async (t, n) => {
|
|
3674
|
+
throw new m("core_wallet_keystore_not_installed");
|
|
3661
3675
|
});
|
|
3662
|
-
|
|
3663
|
-
throw new
|
|
3676
|
+
T(this, "connectLedger", async (t, n) => {
|
|
3677
|
+
throw new m("core_wallet_ledger_not_installed");
|
|
3664
3678
|
});
|
|
3665
|
-
|
|
3666
|
-
throw new
|
|
3679
|
+
T(this, "connectTrezor", async (t, n) => {
|
|
3680
|
+
throw new m("core_wallet_trezor_not_installed");
|
|
3667
3681
|
});
|
|
3668
|
-
|
|
3669
|
-
throw new
|
|
3682
|
+
T(this, "connectKeplr", async (t) => {
|
|
3683
|
+
throw new m("core_wallet_keplr_not_installed");
|
|
3670
3684
|
});
|
|
3671
|
-
|
|
3672
|
-
throw new
|
|
3685
|
+
T(this, "connectOkx", async (t) => {
|
|
3686
|
+
throw new m("core_wallet_okx_not_installed");
|
|
3673
3687
|
});
|
|
3674
|
-
|
|
3688
|
+
T(this, "disconnectChain", (t) => {
|
|
3675
3689
|
this.connectedChains[t] = null, this.connectedWallets[t] = null;
|
|
3676
3690
|
});
|
|
3677
|
-
|
|
3691
|
+
B(this, P, async (t) => {
|
|
3678
3692
|
if (t === s.THORChain)
|
|
3679
3693
|
return {
|
|
3680
3694
|
gas_rate: "0",
|
|
@@ -3683,39 +3697,39 @@ class en {
|
|
|
3683
3697
|
halted: !1,
|
|
3684
3698
|
chain: s.THORChain
|
|
3685
3699
|
};
|
|
3686
|
-
const a = (await
|
|
3700
|
+
const a = (await Bt(this.stagenet)).find((i) => i.chain === t);
|
|
3687
3701
|
if (!a)
|
|
3688
|
-
throw new
|
|
3702
|
+
throw new m("core_inbound_data_not_found");
|
|
3689
3703
|
if (a != null && a.halted)
|
|
3690
|
-
throw new
|
|
3704
|
+
throw new m("core_chain_halted");
|
|
3691
3705
|
return a;
|
|
3692
3706
|
});
|
|
3693
|
-
|
|
3707
|
+
B(this, z, ({ chain: t, wallet: n, walletMethods: a }) => {
|
|
3694
3708
|
this.connectedChains[t] = n, this.connectedWallets[t] = a;
|
|
3695
3709
|
});
|
|
3696
|
-
|
|
3710
|
+
B(this, K, async ({
|
|
3697
3711
|
assetValue: { baseValueBigInt: t, address: n, chain: a, isGasAsset: i, isSynthetic: r },
|
|
3698
3712
|
type: p = "checkOnly",
|
|
3699
|
-
contractAddress:
|
|
3713
|
+
contractAddress: d
|
|
3700
3714
|
}) => {
|
|
3701
3715
|
const y = [s.Ethereum, s.Avalanche, s.BinanceSmartChain].includes(a);
|
|
3702
3716
|
if (y && i || !y || r)
|
|
3703
3717
|
return !0;
|
|
3704
|
-
const
|
|
3705
|
-
if (!
|
|
3706
|
-
throw new
|
|
3718
|
+
const o = this.connectedWallets[a], c = p === "checkOnly" ? o == null ? void 0 : o.isApproved : o == null ? void 0 : o.approve;
|
|
3719
|
+
if (!c)
|
|
3720
|
+
throw new m("core_wallet_connection_not_found");
|
|
3707
3721
|
const h = this.getAddress(a);
|
|
3708
3722
|
if (!n || !h)
|
|
3709
|
-
throw new
|
|
3710
|
-
const
|
|
3711
|
-
return
|
|
3723
|
+
throw new m("core_approve_asset_address_or_from_not_found");
|
|
3724
|
+
const w = d || (await f(this, P).call(this, a)).router;
|
|
3725
|
+
return c({
|
|
3712
3726
|
amount: t,
|
|
3713
3727
|
assetAddress: n,
|
|
3714
3728
|
from: h,
|
|
3715
|
-
spenderAddress:
|
|
3729
|
+
spenderAddress: w
|
|
3716
3730
|
});
|
|
3717
3731
|
});
|
|
3718
|
-
|
|
3732
|
+
B(this, N, async ({
|
|
3719
3733
|
assetValue: t,
|
|
3720
3734
|
memo: n,
|
|
3721
3735
|
feeOptionKey: a = k.Fast
|
|
@@ -3724,22 +3738,22 @@ class en {
|
|
|
3724
3738
|
gas_rate: i,
|
|
3725
3739
|
router: r,
|
|
3726
3740
|
address: p
|
|
3727
|
-
} = await
|
|
3741
|
+
} = await f(this, P).call(this, t.chain), d = (parseInt(i) || 0) * st[a];
|
|
3728
3742
|
return this.deposit({
|
|
3729
3743
|
assetValue: t,
|
|
3730
3744
|
recipient: p,
|
|
3731
3745
|
memo: n,
|
|
3732
3746
|
router: r,
|
|
3733
|
-
feeRate:
|
|
3747
|
+
feeRate: d
|
|
3734
3748
|
});
|
|
3735
3749
|
});
|
|
3736
|
-
|
|
3737
|
-
const a = await
|
|
3750
|
+
B(this, Y, async ({ memo: t, assetValue: n }) => {
|
|
3751
|
+
const a = await Pt(this.stagenet);
|
|
3738
3752
|
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
3739
|
-
throw new
|
|
3753
|
+
throw new m("core_chain_halted");
|
|
3740
3754
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
3741
3755
|
});
|
|
3742
|
-
|
|
3756
|
+
B(this, X, ({ assetValue: t, ...n }) => ({
|
|
3743
3757
|
...n,
|
|
3744
3758
|
memo: n.memo || "",
|
|
3745
3759
|
from: this.getAddress(t.chain),
|
|
@@ -3748,42 +3762,42 @@ class en {
|
|
|
3748
3762
|
this.stagenet = !!t;
|
|
3749
3763
|
}
|
|
3750
3764
|
}
|
|
3751
|
-
|
|
3765
|
+
P = new WeakMap(), z = new WeakMap(), K = new WeakMap(), N = new WeakMap(), Y = new WeakMap(), X = new WeakMap();
|
|
3752
3766
|
export {
|
|
3753
3767
|
Ue as AGG_SWAP,
|
|
3754
|
-
|
|
3768
|
+
be as ApiError,
|
|
3755
3769
|
W as ApiUrl,
|
|
3756
3770
|
v as AssetValue,
|
|
3757
|
-
|
|
3758
|
-
|
|
3771
|
+
b as BaseDecimal,
|
|
3772
|
+
re as BigIntArithmetics,
|
|
3759
3773
|
s as Chain,
|
|
3760
|
-
|
|
3774
|
+
ye as ChainId,
|
|
3761
3775
|
Gt as ChainIdToChain,
|
|
3762
3776
|
Ke as ChainToChainId,
|
|
3763
|
-
|
|
3777
|
+
we as ChainToExplorerUrl,
|
|
3764
3778
|
Ft as ChainToHexChainId,
|
|
3765
3779
|
Ye as ChainToRPC,
|
|
3766
3780
|
Ge as ContractAddress,
|
|
3767
3781
|
kt as CosmosChainList,
|
|
3768
3782
|
We as DerivationPath,
|
|
3769
|
-
|
|
3783
|
+
u as ERROR_CODE,
|
|
3770
3784
|
ke as ERROR_MODULE,
|
|
3771
|
-
|
|
3785
|
+
fe as ERROR_TYPE,
|
|
3772
3786
|
Ht as EVMChainList,
|
|
3773
3787
|
Xe as ErrorCode,
|
|
3774
3788
|
k as FeeOption,
|
|
3775
|
-
|
|
3789
|
+
_ as MemoType,
|
|
3776
3790
|
Ut as NetworkDerivationPath,
|
|
3777
3791
|
Le as QuoteMode,
|
|
3778
|
-
|
|
3792
|
+
Ae as RPCUrl,
|
|
3779
3793
|
He as SWAP_IN,
|
|
3780
3794
|
$e as SWAP_OUT,
|
|
3781
3795
|
en as SwapKitCore,
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3796
|
+
m as SwapKitError,
|
|
3797
|
+
ue as SwapKitNumber,
|
|
3798
|
+
Pe as TCAvalancheDepositABI,
|
|
3785
3799
|
Ve as TCBscDepositABI,
|
|
3786
|
-
|
|
3800
|
+
Be as TCEthereumVaultAbi,
|
|
3787
3801
|
$t as UTXOChainList,
|
|
3788
3802
|
je as WalletOption,
|
|
3789
3803
|
Yt as assetFromString,
|
|
@@ -3798,12 +3812,12 @@ export {
|
|
|
3798
3812
|
dt as getAsymmetricRuneShare,
|
|
3799
3813
|
jt as getAsymmetricRuneWithdrawAmount,
|
|
3800
3814
|
rt as getCommonAssetInfo,
|
|
3801
|
-
|
|
3815
|
+
Oe as getDecimal,
|
|
3802
3816
|
zt as getEstimatedPoolShare,
|
|
3803
3817
|
Zt as getLiquiditySlippage,
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3818
|
+
x as getMemoFor,
|
|
3819
|
+
_e as getMinAmountByChain,
|
|
3820
|
+
Ee as getRequest,
|
|
3807
3821
|
yt as getSymmetricPoolShare,
|
|
3808
3822
|
Jt as getSymmetricWithdraw,
|
|
3809
3823
|
Wt as getTHORNameCost,
|