@swapkit/core 1.0.0-rc.12 → 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 +397 -388
- 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,14 +824,14 @@ 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) => {
|
|
831
831
|
if (t.has(e))
|
|
832
832
|
throw TypeError("Cannot add the same private member more than once");
|
|
833
833
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
834
|
-
},
|
|
834
|
+
}, g = (e, t, n) => (ze(e, t, "access private method"), n);
|
|
835
835
|
const Wt = (e) => {
|
|
836
836
|
if (e < 0)
|
|
837
837
|
throw new Error("Invalid number of year");
|
|
@@ -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("/"))
|
|
@@ -1005,15 +1005,15 @@ const Wt = (e) => {
|
|
|
1005
1005
|
poolUnits: t,
|
|
1006
1006
|
runeDepth: n
|
|
1007
1007
|
}) => {
|
|
1008
|
-
const a =
|
|
1009
|
-
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);
|
|
1010
1010
|
}, ut = ({
|
|
1011
1011
|
liquidityUnits: e,
|
|
1012
1012
|
poolUnits: t,
|
|
1013
1013
|
assetDepth: n
|
|
1014
1014
|
}) => {
|
|
1015
|
-
const a =
|
|
1016
|
-
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);
|
|
1017
1017
|
}, jt = ({
|
|
1018
1018
|
percent: e,
|
|
1019
1019
|
runeDepth: t,
|
|
@@ -1024,14 +1024,14 @@ const Wt = (e) => {
|
|
|
1024
1024
|
assetDepth: t,
|
|
1025
1025
|
liquidityUnits: n,
|
|
1026
1026
|
poolUnits: a
|
|
1027
|
-
}) => 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 = ({
|
|
1028
1028
|
liquidityUnits: e,
|
|
1029
1029
|
poolUnits: t,
|
|
1030
1030
|
runeDepth: n,
|
|
1031
1031
|
assetDepth: a
|
|
1032
1032
|
}) => ({
|
|
1033
|
-
assetAmount:
|
|
1034
|
-
runeAmount:
|
|
1033
|
+
assetAmount: A(a).mul(e).div(t),
|
|
1034
|
+
runeAmount: A(n).mul(e).div(t)
|
|
1035
1035
|
}), Jt = ({
|
|
1036
1036
|
liquidityUnits: e,
|
|
1037
1037
|
poolUnits: t,
|
|
@@ -1050,66 +1050,66 @@ const Wt = (e) => {
|
|
|
1050
1050
|
runeAmount: i,
|
|
1051
1051
|
assetAmount: r
|
|
1052
1052
|
}) => {
|
|
1053
|
-
const p =
|
|
1054
|
-
if (
|
|
1055
|
-
return
|
|
1056
|
-
const
|
|
1057
|
-
return
|
|
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);
|
|
1054
|
+
if (I.baseValueNumber === 0)
|
|
1055
|
+
return S.div(y).baseValueNumber;
|
|
1056
|
+
const D = y.add(S);
|
|
1057
|
+
return S.div(D).baseValueNumber;
|
|
1058
1058
|
}, Zt = ({
|
|
1059
1059
|
runeAmount: e,
|
|
1060
1060
|
assetAmount: t,
|
|
1061
1061
|
runeDepth: n,
|
|
1062
1062
|
assetDepth: a
|
|
1063
1063
|
}) => {
|
|
1064
|
-
const i =
|
|
1065
|
-
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);
|
|
1066
1066
|
}, lt = ({
|
|
1067
1067
|
symbol: e,
|
|
1068
1068
|
ticker: t,
|
|
1069
1069
|
chain: n
|
|
1070
|
-
}) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e,
|
|
1070
|
+
}) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e, x = (e, t) => {
|
|
1071
1071
|
switch (e) {
|
|
1072
|
-
case
|
|
1073
|
-
case
|
|
1072
|
+
case _.LEAVE:
|
|
1073
|
+
case _.BOND: {
|
|
1074
1074
|
const { address: n } = t;
|
|
1075
1075
|
return `${e}:${n}`;
|
|
1076
1076
|
}
|
|
1077
|
-
case
|
|
1077
|
+
case _.UNBOND: {
|
|
1078
1078
|
const { address: n, unbondAmount: a } = t;
|
|
1079
1079
|
return `${e}:${n}:${a * 10 ** 8}`;
|
|
1080
1080
|
}
|
|
1081
|
-
case
|
|
1081
|
+
case _.THORNAME_REGISTER: {
|
|
1082
1082
|
const { name: n, chain: a, address: i, owner: r } = t;
|
|
1083
1083
|
return `${e}:${n}:${a}:${i}${r ? `:${r}` : ""}`;
|
|
1084
1084
|
}
|
|
1085
|
-
case
|
|
1085
|
+
case _.DEPOSIT: {
|
|
1086
1086
|
const { chain: n, symbol: a, address: i, singleSide: r } = t;
|
|
1087
1087
|
return r ? `${e}:${n}/${a}::t:0` : `${e}:${n}.${a}:${i || ""}:t:0`;
|
|
1088
1088
|
}
|
|
1089
|
-
case
|
|
1090
|
-
const { chain: n, ticker: a, symbol: i, basisPoints: r, targetAssetString: p, singleSide:
|
|
1091
|
-
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}`;
|
|
1092
1092
|
}
|
|
1093
|
-
case
|
|
1094
|
-
case
|
|
1093
|
+
case _.OPEN_LOAN:
|
|
1094
|
+
case _.CLOSE_LOAN: {
|
|
1095
1095
|
const { asset: n, address: a } = t;
|
|
1096
1096
|
return `${e}:${n}:${a}`;
|
|
1097
1097
|
}
|
|
1098
1098
|
default:
|
|
1099
1099
|
return "";
|
|
1100
1100
|
}
|
|
1101
|
-
},
|
|
1101
|
+
}, ce = Object.values(s), ct = (e = "") => {
|
|
1102
1102
|
const t = e.toUpperCase(), [n] = t.split(".");
|
|
1103
|
-
if (
|
|
1103
|
+
if (ce.includes(n))
|
|
1104
1104
|
return !0;
|
|
1105
1105
|
const [a] = t.split("/");
|
|
1106
|
-
if (
|
|
1106
|
+
if (ce.includes(a))
|
|
1107
1107
|
return !0;
|
|
1108
1108
|
throw new Error(
|
|
1109
1109
|
`Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
|
|
1110
1110
|
);
|
|
1111
1111
|
}, q = 8, U = (e) => 10n ** BigInt(e), F = (e) => Math.log10(parseFloat(e.toString()));
|
|
1112
|
-
function
|
|
1112
|
+
function ge({
|
|
1113
1113
|
value: e,
|
|
1114
1114
|
bigIntDecimal: t = q,
|
|
1115
1115
|
decimal: n = q
|
|
@@ -1119,25 +1119,25 @@ function Ie({
|
|
|
1119
1119
|
const r = n - (i.length - 1);
|
|
1120
1120
|
r > 0 && (i = "0".repeat(r) + i);
|
|
1121
1121
|
const p = i.length - n;
|
|
1122
|
-
let
|
|
1123
|
-
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(
|
|
1124
1124
|
/\.?0*$/,
|
|
1125
1125
|
""
|
|
1126
1126
|
);
|
|
1127
1127
|
}
|
|
1128
|
-
var L, $,
|
|
1128
|
+
var L, $, ne, Ie, ae, me, Q, se, H, G, J, ie;
|
|
1129
1129
|
const mt = class j {
|
|
1130
1130
|
constructor(t) {
|
|
1131
|
-
V(this, L), V(this,
|
|
1132
|
-
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);
|
|
1133
1133
|
this.decimal = typeof t == "object" ? t.decimal : void 0, this.decimalMultiplier = U(
|
|
1134
|
-
Math.max(
|
|
1135
|
-
),
|
|
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);
|
|
1136
1136
|
}
|
|
1137
1137
|
static fromBigInt(t, n) {
|
|
1138
1138
|
return new j({
|
|
1139
1139
|
decimal: n,
|
|
1140
|
-
value:
|
|
1140
|
+
value: ge({ value: t, bigIntDecimal: n, decimal: n })
|
|
1141
1141
|
});
|
|
1142
1142
|
}
|
|
1143
1143
|
static shiftDecimals({
|
|
@@ -1172,16 +1172,16 @@ const mt = class j {
|
|
|
1172
1172
|
return new this.constructor({ decimal: this.decimal, value: t, identifier: this.toString() });
|
|
1173
1173
|
}
|
|
1174
1174
|
add(...t) {
|
|
1175
|
-
return
|
|
1175
|
+
return g(this, L, $).call(this, "add", ...t);
|
|
1176
1176
|
}
|
|
1177
1177
|
sub(...t) {
|
|
1178
|
-
return
|
|
1178
|
+
return g(this, L, $).call(this, "sub", ...t);
|
|
1179
1179
|
}
|
|
1180
1180
|
mul(...t) {
|
|
1181
|
-
return
|
|
1181
|
+
return g(this, L, $).call(this, "mul", ...t);
|
|
1182
1182
|
}
|
|
1183
1183
|
div(...t) {
|
|
1184
|
-
return
|
|
1184
|
+
return g(this, L, $).call(this, "div", ...t);
|
|
1185
1185
|
}
|
|
1186
1186
|
gt(t) {
|
|
1187
1187
|
return this.bigIntValue > this.getBigIntValue(t);
|
|
@@ -1209,36 +1209,36 @@ const mt = class j {
|
|
|
1209
1209
|
case "string":
|
|
1210
1210
|
return n;
|
|
1211
1211
|
default:
|
|
1212
|
-
return this.bigIntValue;
|
|
1212
|
+
return this.bigIntValue * BigInt(this.decimal || 8n) / this.decimalMultiplier;
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
1215
|
getBaseValue(t) {
|
|
1216
|
-
const n = this.decimalMultiplier / U(this.decimal ||
|
|
1216
|
+
const n = this.decimalMultiplier / U(this.decimal || b.THOR), a = this.bigIntValue / n;
|
|
1217
1217
|
switch (t) {
|
|
1218
1218
|
case "number":
|
|
1219
1219
|
return Number(a);
|
|
1220
1220
|
case "string":
|
|
1221
1221
|
return a.toString();
|
|
1222
1222
|
default:
|
|
1223
|
-
return
|
|
1223
|
+
return a;
|
|
1224
1224
|
}
|
|
1225
1225
|
}
|
|
1226
1226
|
getBigIntValue(t, n) {
|
|
1227
1227
|
if (!n && typeof t == "object")
|
|
1228
1228
|
return t.bigIntValue;
|
|
1229
|
-
const a =
|
|
1230
|
-
return i === "0" || i === "undefined" ? 0n :
|
|
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);
|
|
1231
1231
|
}
|
|
1232
1232
|
formatBigIntToSafeValue(t, n) {
|
|
1233
1233
|
const a = n || this.decimal || q, i = Math.max(
|
|
1234
1234
|
a,
|
|
1235
1235
|
F(this.decimalMultiplier)
|
|
1236
|
-
), r = t < 0n, p = t.toString().substring(r ? 1 : 0),
|
|
1237
|
-
let
|
|
1238
|
-
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(
|
|
1239
1239
|
0,
|
|
1240
|
-
|
|
1241
|
-
)}.${
|
|
1240
|
+
l
|
|
1241
|
+
)}.${o}`.replace(/\.?0*$/, "");
|
|
1242
1242
|
}
|
|
1243
1243
|
toSignificant(t = 6) {
|
|
1244
1244
|
const [n, a] = this.getValue("string").split("."), i = n || "", r = a || "", p = parseInt(i) ? i.length + r.length : r.length;
|
|
@@ -1251,17 +1251,17 @@ const mt = class j {
|
|
|
1251
1251
|
p - t,
|
|
1252
1252
|
"0"
|
|
1253
1253
|
);
|
|
1254
|
-
const
|
|
1254
|
+
const d = parseInt(r), y = `${d}`.slice(0, t);
|
|
1255
1255
|
return `0.${y.padStart(
|
|
1256
|
-
r.length - `${
|
|
1256
|
+
r.length - `${d}`.length + y.length,
|
|
1257
1257
|
"0"
|
|
1258
1258
|
)}`;
|
|
1259
1259
|
}
|
|
1260
1260
|
};
|
|
1261
1261
|
L = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
|
|
1262
|
-
const n =
|
|
1263
|
-
(p,
|
|
1264
|
-
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);
|
|
1265
1265
|
switch (e) {
|
|
1266
1266
|
case "add":
|
|
1267
1267
|
return p + y;
|
|
@@ -1280,54 +1280,54 @@ L = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
|
|
|
1280
1280
|
},
|
|
1281
1281
|
//normalize is to precision multiplier base
|
|
1282
1282
|
this.bigIntValue * a / this.decimalMultiplier
|
|
1283
|
-
), r =
|
|
1283
|
+
), r = ge({
|
|
1284
1284
|
bigIntDecimal: n,
|
|
1285
1285
|
decimal: Math.max(n, F(this.decimalMultiplier)),
|
|
1286
1286
|
value: i
|
|
1287
1287
|
});
|
|
1288
1288
|
return new this.constructor({ decimal: this.decimal, value: r, identifier: this.toString() });
|
|
1289
|
-
},
|
|
1290
|
-
const t =
|
|
1291
|
-
this.bigIntValue =
|
|
1292
|
-
},
|
|
1289
|
+
}, ne = /* @__PURE__ */ new WeakSet(), Ie = function(e) {
|
|
1290
|
+
const t = g(this, H, G).call(this, e) || "0";
|
|
1291
|
+
this.bigIntValue = g(this, Q, se).call(this, t);
|
|
1292
|
+
}, ae = /* @__PURE__ */ new WeakSet(), me = function(...e) {
|
|
1293
1293
|
const t = e.map(
|
|
1294
|
-
(n) => typeof n == "object" ? n.decimal || F(n.decimalMultiplier) :
|
|
1294
|
+
(n) => typeof n == "object" ? n.decimal || F(n.decimalMultiplier) : g(this, J, ie).call(this, g(this, H, G).call(this, n))
|
|
1295
1295
|
).filter(Boolean);
|
|
1296
1296
|
return Math.max(...t, q);
|
|
1297
|
-
}, Q = /* @__PURE__ */ new WeakSet(),
|
|
1297
|
+
}, Q = /* @__PURE__ */ new WeakSet(), se = function(e, t) {
|
|
1298
1298
|
const n = t ? U(t) : this.decimalMultiplier, a = F(n), [i = "", r = ""] = e.split(".");
|
|
1299
1299
|
return BigInt(`${i}${r.padEnd(a, "0")}`);
|
|
1300
1300
|
}, H = /* @__PURE__ */ new WeakSet(), G = function(e) {
|
|
1301
1301
|
const t = `${typeof e == "number" ? Number(e).toLocaleString("fullwide", {
|
|
1302
1302
|
useGrouping: !1,
|
|
1303
1303
|
maximumFractionDigits: 20
|
|
1304
|
-
}) :
|
|
1304
|
+
}) : pe(e)}`.replaceAll(",", ".").split(".");
|
|
1305
1305
|
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1306
|
-
}, J = /* @__PURE__ */ new WeakSet(),
|
|
1306
|
+
}, J = /* @__PURE__ */ new WeakSet(), ie = function(e) {
|
|
1307
1307
|
var t;
|
|
1308
1308
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1309
1309
|
return Math.max(n, q);
|
|
1310
1310
|
};
|
|
1311
|
-
let
|
|
1312
|
-
function
|
|
1311
|
+
let re = mt;
|
|
1312
|
+
function pe(e) {
|
|
1313
1313
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1314
1314
|
}
|
|
1315
|
-
let
|
|
1316
|
-
const
|
|
1317
|
-
if (!
|
|
1315
|
+
let oe;
|
|
1316
|
+
const te = (e) => {
|
|
1317
|
+
if (!oe)
|
|
1318
1318
|
throw new Error("Static assets not loaded, call await AssetValue.loadStaticAssets() first");
|
|
1319
|
-
return
|
|
1320
|
-
},
|
|
1319
|
+
return oe.get(e.toUpperCase()) || { decimal: b.THOR, identifier: "" };
|
|
1320
|
+
}, Te = async (e, t = 0) => {
|
|
1321
1321
|
ct(e);
|
|
1322
|
-
const n = await
|
|
1322
|
+
const n = await Oe(de(e));
|
|
1323
1323
|
return new v({ decimal: n, value: t, identifier: e });
|
|
1324
1324
|
};
|
|
1325
|
-
class v extends
|
|
1325
|
+
class v extends re {
|
|
1326
1326
|
constructor(t) {
|
|
1327
1327
|
super(
|
|
1328
|
-
t.value instanceof
|
|
1329
|
-
),
|
|
1330
|
-
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);
|
|
1331
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;
|
|
1332
1332
|
}
|
|
1333
1333
|
get assetValue() {
|
|
@@ -1344,19 +1344,19 @@ class v extends pe {
|
|
|
1344
1344
|
return this.chain === t && this.symbol === n;
|
|
1345
1345
|
}
|
|
1346
1346
|
static async fromString(t, n = 0) {
|
|
1347
|
-
return
|
|
1347
|
+
return Te(t, n);
|
|
1348
1348
|
}
|
|
1349
1349
|
static fromStringSync(t, n = 0) {
|
|
1350
|
-
const { decimal: a, identifier: i } =
|
|
1350
|
+
const { decimal: a, identifier: i } = te(
|
|
1351
1351
|
t
|
|
1352
1352
|
);
|
|
1353
1353
|
return i ? new v({ decimal: a, identifier: i, value: n }) : void 0;
|
|
1354
1354
|
}
|
|
1355
1355
|
static async fromIdentifier(t, n = 0) {
|
|
1356
|
-
return
|
|
1356
|
+
return Te(t, n);
|
|
1357
1357
|
}
|
|
1358
1358
|
static fromIdentifierSync(t, n = 0) {
|
|
1359
|
-
const { decimal: a, identifier: i } =
|
|
1359
|
+
const { decimal: a, identifier: i } = te(t);
|
|
1360
1360
|
return new v({ decimal: a, identifier: i, value: n });
|
|
1361
1361
|
}
|
|
1362
1362
|
static fromChainOrSignature(t, n = 0) {
|
|
@@ -1364,13 +1364,13 @@ class v extends pe {
|
|
|
1364
1364
|
return new v({ value: n, decimal: a, identifier: i });
|
|
1365
1365
|
}
|
|
1366
1366
|
static async fromTCQuote(t, n = 0) {
|
|
1367
|
-
const a = await
|
|
1367
|
+
const a = await Oe(de(t)), i = this.shiftDecimals({ value: n, from: b.THOR, to: a });
|
|
1368
1368
|
return new v({ value: i, identifier: t, decimal: a });
|
|
1369
1369
|
}
|
|
1370
1370
|
static fromTCQuoteStatic(t, n = 0) {
|
|
1371
|
-
const a =
|
|
1371
|
+
const a = te(t), i = this.shiftDecimals({
|
|
1372
1372
|
value: n,
|
|
1373
|
-
from:
|
|
1373
|
+
from: b.THOR,
|
|
1374
1374
|
to: a.decimal
|
|
1375
1375
|
});
|
|
1376
1376
|
return new v({ ...a, value: i });
|
|
@@ -1386,10 +1386,10 @@ class v extends pe {
|
|
|
1386
1386
|
NativeList: i,
|
|
1387
1387
|
...r
|
|
1388
1388
|
} = await import("@swapkit/tokens");
|
|
1389
|
-
|
|
1390
|
-
(p, { tokens:
|
|
1391
|
-
const
|
|
1392
|
-
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 });
|
|
1393
1393
|
}), p),
|
|
1394
1394
|
/* @__PURE__ */ new Map()
|
|
1395
1395
|
), t({ ok: !0 });
|
|
@@ -1404,7 +1404,7 @@ class v extends pe {
|
|
|
1404
1404
|
);
|
|
1405
1405
|
}
|
|
1406
1406
|
}
|
|
1407
|
-
const
|
|
1407
|
+
const _e = (e) => {
|
|
1408
1408
|
const t = v.fromChainOrSignature(e);
|
|
1409
1409
|
switch (e) {
|
|
1410
1410
|
case s.Bitcoin:
|
|
@@ -1422,7 +1422,7 @@ const he = (e) => {
|
|
|
1422
1422
|
default:
|
|
1423
1423
|
return t.add(1);
|
|
1424
1424
|
}
|
|
1425
|
-
},
|
|
1425
|
+
}, de = (e) => {
|
|
1426
1426
|
const t = e.slice(0, 14).includes("/"), n = e.includes(".") ? e : `${s.THORChain}.${e}`, [a, i] = n.split("."), [r, p] = i.split("-");
|
|
1427
1427
|
return {
|
|
1428
1428
|
address: p == null ? void 0 : p.toLowerCase(),
|
|
@@ -1489,12 +1489,12 @@ const he = (e) => {
|
|
|
1489
1489
|
*/
|
|
1490
1490
|
helpers_number_different_decimals: 99101
|
|
1491
1491
|
};
|
|
1492
|
-
class
|
|
1492
|
+
class m extends Error {
|
|
1493
1493
|
constructor(t, n) {
|
|
1494
|
-
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);
|
|
1495
1495
|
}
|
|
1496
1496
|
}
|
|
1497
|
-
class
|
|
1497
|
+
class ue extends re {
|
|
1498
1498
|
eq(t) {
|
|
1499
1499
|
return this.eqValue(t);
|
|
1500
1500
|
}
|
|
@@ -3185,12 +3185,12 @@ const _t = [
|
|
|
3185
3185
|
type: "function"
|
|
3186
3186
|
},
|
|
3187
3187
|
{ stateMutability: "payable", type: "receive" }
|
|
3188
|
-
],
|
|
3188
|
+
], Se = {
|
|
3189
3189
|
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: _t,
|
|
3190
3190
|
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: ft,
|
|
3191
3191
|
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: bt
|
|
3192
3192
|
}, Ct = {
|
|
3193
|
-
...
|
|
3193
|
+
...Se,
|
|
3194
3194
|
// AVAX
|
|
3195
3195
|
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: wt,
|
|
3196
3196
|
["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: ht,
|
|
@@ -3214,40 +3214,40 @@ const _t = [
|
|
|
3214
3214
|
amount: i,
|
|
3215
3215
|
amountOutMin: r = "",
|
|
3216
3216
|
data: p = "",
|
|
3217
|
-
deadline:
|
|
3217
|
+
deadline: d,
|
|
3218
3218
|
memo: y,
|
|
3219
|
-
router:
|
|
3220
|
-
memoStreamingSwap:
|
|
3221
|
-
tcMemo:
|
|
3219
|
+
router: l,
|
|
3220
|
+
memoStreamingSwap: o,
|
|
3221
|
+
tcMemo: c,
|
|
3222
3222
|
tcRouter: h,
|
|
3223
|
-
tcVault:
|
|
3223
|
+
tcVault: w,
|
|
3224
3224
|
vault: R,
|
|
3225
3225
|
token: O
|
|
3226
3226
|
}
|
|
3227
3227
|
}) => {
|
|
3228
|
-
const
|
|
3229
|
-
if (
|
|
3228
|
+
const E = !!Se[t.toLowerCase()];
|
|
3229
|
+
if (E && !l)
|
|
3230
3230
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
3231
|
-
const
|
|
3232
|
-
if (!
|
|
3231
|
+
const I = c || y, S = e && o || I;
|
|
3232
|
+
if (!w && !R)
|
|
3233
3233
|
throw new Error("TC Vault is required on calldata");
|
|
3234
|
-
if (!h && !
|
|
3234
|
+
if (!h && !l)
|
|
3235
3235
|
throw new Error("TC Router is required on calldata");
|
|
3236
|
-
if (!
|
|
3236
|
+
if (!S)
|
|
3237
3237
|
throw new Error("TC Memo is required on calldata");
|
|
3238
3238
|
if (!O)
|
|
3239
3239
|
throw new Error("Token is required on calldata");
|
|
3240
|
-
const
|
|
3240
|
+
const D = [
|
|
3241
3241
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
3242
|
-
a(h ||
|
|
3243
|
-
a(
|
|
3244
|
-
|
|
3242
|
+
a(h || l),
|
|
3243
|
+
a(w || R),
|
|
3244
|
+
S.replace("{recipientAddress}", n),
|
|
3245
3245
|
a(O),
|
|
3246
3246
|
i
|
|
3247
|
-
],
|
|
3248
|
-
return [...
|
|
3247
|
+
], ve = E ? [a(l), p, d] : [r, d];
|
|
3248
|
+
return [...D, ...ve];
|
|
3249
3249
|
}, xt = ({ chain: e, txHash: t }) => {
|
|
3250
|
-
const n =
|
|
3250
|
+
const n = we[e];
|
|
3251
3251
|
switch (e) {
|
|
3252
3252
|
case s.Binance:
|
|
3253
3253
|
case s.Bitcoin:
|
|
@@ -3273,7 +3273,7 @@ const _t = [
|
|
|
3273
3273
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3274
3274
|
}
|
|
3275
3275
|
}, Dt = ({ chain: e, address: t }) => {
|
|
3276
|
-
const n =
|
|
3276
|
+
const n = we[e];
|
|
3277
3277
|
switch (e) {
|
|
3278
3278
|
case s.Arbitrum:
|
|
3279
3279
|
case s.Avalanche:
|
|
@@ -3296,97 +3296,103 @@ const _t = [
|
|
|
3296
3296
|
default:
|
|
3297
3297
|
throw new Error(`Unsupported chain: ${e}`);
|
|
3298
3298
|
}
|
|
3299
|
-
}, Pt = (e) => {
|
|
3300
|
-
const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
|
|
3301
|
-
return Re(`${t}/thorchain/inbound_addresses`);
|
|
3302
3299
|
}, Bt = (e) => {
|
|
3303
3300
|
const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
|
|
3304
|
-
return
|
|
3305
|
-
},
|
|
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(
|
|
3306
3306
|
(e, t) => (e[t] = null, e),
|
|
3307
3307
|
{}
|
|
3308
3308
|
);
|
|
3309
|
-
var
|
|
3309
|
+
var P, z, K, N, Y, X;
|
|
3310
3310
|
class en {
|
|
3311
3311
|
constructor({ stagenet: t } = {}) {
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3312
|
+
T(this, "connectedChains", he());
|
|
3313
|
+
T(this, "connectedWallets", he());
|
|
3314
|
+
T(this, "stagenet", !1);
|
|
3315
|
+
T(this, "getAddress", (t) => {
|
|
3316
3316
|
var n;
|
|
3317
3317
|
return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
|
|
3318
3318
|
});
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
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) => {
|
|
3323
3323
|
const a = await this.getWalletByChain(t, n);
|
|
3324
3324
|
return (a == null ? void 0 : a.balance) || [];
|
|
3325
3325
|
});
|
|
3326
|
-
|
|
3327
|
-
var
|
|
3326
|
+
T(this, "swap", async ({ streamSwap: t, recipient: n, route: a, feeOptionKey: i }) => {
|
|
3327
|
+
var d, y;
|
|
3328
3328
|
const { quoteMode: r } = a.meta, p = r.startsWith("ERC20-") ? s.Ethereum : r.startsWith("ARC20-") ? s.Avalanche : s.BinanceSmartChain;
|
|
3329
3329
|
if (!a.complete)
|
|
3330
|
-
throw new
|
|
3330
|
+
throw new m("core_swap_route_not_complete");
|
|
3331
3331
|
try {
|
|
3332
3332
|
if (Ue.includes(r)) {
|
|
3333
3333
|
const l = this.connectedWallets[p];
|
|
3334
3334
|
if (!(l != null && l.sendTransaction))
|
|
3335
|
-
throw new
|
|
3336
|
-
if (!(t ? (
|
|
3337
|
-
throw new
|
|
3338
|
-
const { isHexString:
|
|
3339
|
-
data:
|
|
3340
|
-
from:
|
|
3341
|
-
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(),
|
|
3342
3342
|
chainId: BigInt(Ke[p]),
|
|
3343
|
-
value:
|
|
3344
|
-
value:
|
|
3343
|
+
value: E ? new ue({
|
|
3344
|
+
value: c(E) ? E : h(E, "wei").toString(16)
|
|
3345
3345
|
}).baseValueBigInt : 0n
|
|
3346
3346
|
};
|
|
3347
|
-
return l.sendTransaction(
|
|
3347
|
+
return l.sendTransaction(I, i);
|
|
3348
3348
|
}
|
|
3349
3349
|
if ($e.includes(r)) {
|
|
3350
3350
|
if (!a.calldata.fromAsset)
|
|
3351
|
-
throw new
|
|
3351
|
+
throw new m("core_swap_asset_not_recognized");
|
|
3352
3352
|
const l = await v.fromString(a.calldata.fromAsset);
|
|
3353
3353
|
if (!l)
|
|
3354
|
-
throw new
|
|
3355
|
-
const { address:
|
|
3356
|
-
contract:
|
|
3357
|
-
calldata: { amountIn:
|
|
3358
|
-
} = a,
|
|
3359
|
-
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
|
+
});
|
|
3360
3367
|
}
|
|
3361
3368
|
if (He.includes(r)) {
|
|
3362
|
-
const { calldata: l, contract:
|
|
3363
|
-
if (!
|
|
3364
|
-
throw new
|
|
3365
|
-
const
|
|
3366
|
-
if (!(
|
|
3367
|
-
throw new
|
|
3368
|
-
const { getProvider:
|
|
3369
|
-
if (!
|
|
3370
|
-
throw new
|
|
3371
|
-
const
|
|
3372
|
-
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(
|
|
3373
3379
|
...Nt({
|
|
3374
3380
|
streamSwap: t,
|
|
3375
|
-
toChecksumAddress:
|
|
3376
|
-
contractAddress:
|
|
3381
|
+
toChecksumAddress: R,
|
|
3382
|
+
contractAddress: o,
|
|
3377
3383
|
recipient: n,
|
|
3378
3384
|
calldata: l
|
|
3379
3385
|
}),
|
|
3380
|
-
{ from:
|
|
3381
|
-
)
|
|
3382
|
-
return
|
|
3386
|
+
{ from: h }
|
|
3387
|
+
);
|
|
3388
|
+
return c.sendTransaction(S, i);
|
|
3383
3389
|
}
|
|
3384
|
-
throw new
|
|
3390
|
+
throw new m("core_swap_quote_mode_not_supported", { quoteMode: r });
|
|
3385
3391
|
} catch (l) {
|
|
3386
|
-
throw new
|
|
3392
|
+
throw new m("core_swap_transaction_error", l);
|
|
3387
3393
|
}
|
|
3388
3394
|
});
|
|
3389
|
-
|
|
3395
|
+
T(this, "getWalletByChain", async (t, n) => {
|
|
3390
3396
|
var r, p;
|
|
3391
3397
|
const a = this.getAddress(t);
|
|
3392
3398
|
if (!a)
|
|
@@ -3400,136 +3406,139 @@ class en {
|
|
|
3400
3406
|
walletType: (p = this.connectedChains[t]) == null ? void 0 : p.walletType
|
|
3401
3407
|
}, { ...this.connectedChains[t] };
|
|
3402
3408
|
});
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
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 }) => {
|
|
3406
3412
|
var a, i;
|
|
3407
3413
|
return (i = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : i.call(a, t);
|
|
3408
3414
|
});
|
|
3409
|
-
|
|
3415
|
+
T(this, "transfer", async (t) => {
|
|
3410
3416
|
const n = this.connectedWallets[t.assetValue.chain];
|
|
3411
3417
|
if (!n)
|
|
3412
|
-
throw new
|
|
3418
|
+
throw new m("core_wallet_connection_not_found");
|
|
3413
3419
|
try {
|
|
3414
|
-
return await n.transfer(
|
|
3420
|
+
return await n.transfer(f(this, X).call(this, t));
|
|
3415
3421
|
} catch (a) {
|
|
3416
|
-
throw new
|
|
3422
|
+
throw new m("core_swap_transaction_error", a);
|
|
3417
3423
|
}
|
|
3418
3424
|
});
|
|
3419
|
-
|
|
3425
|
+
T(this, "deposit", async ({
|
|
3420
3426
|
assetValue: t,
|
|
3421
3427
|
recipient: n,
|
|
3422
3428
|
router: a,
|
|
3423
3429
|
...i
|
|
3424
3430
|
}) => {
|
|
3425
|
-
const { chain: r, symbol: p, ticker:
|
|
3431
|
+
const { chain: r, symbol: p, ticker: d } = t, y = this.connectedWallets[r];
|
|
3426
3432
|
if (!y)
|
|
3427
|
-
throw new
|
|
3428
|
-
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 });
|
|
3429
3435
|
try {
|
|
3430
3436
|
switch (r) {
|
|
3431
3437
|
case s.THORChain: {
|
|
3432
|
-
const
|
|
3433
|
-
return await (n === "" ?
|
|
3438
|
+
const o = y;
|
|
3439
|
+
return await (n === "" ? o.deposit(l) : o.transfer(l));
|
|
3434
3440
|
}
|
|
3435
3441
|
case s.Ethereum:
|
|
3436
3442
|
case s.BinanceSmartChain:
|
|
3437
3443
|
case s.Avalanche: {
|
|
3438
|
-
const { getChecksumAddressFromAsset:
|
|
3444
|
+
const { getChecksumAddressFromAsset: o } = await import("@swapkit/toolbox-evm"), c = r === s.Avalanche ? Pe : r === s.BinanceSmartChain ? Ve : Be;
|
|
3439
3445
|
return await y.call({
|
|
3440
|
-
abi:
|
|
3441
|
-
contractAddress: a || (await
|
|
3446
|
+
abi: c,
|
|
3447
|
+
contractAddress: a || (await f(this, P).call(this, r)).router,
|
|
3442
3448
|
funcName: "depositWithExpiry",
|
|
3443
3449
|
funcParams: [
|
|
3444
3450
|
n,
|
|
3445
|
-
|
|
3451
|
+
o({ chain: r, symbol: p, ticker: d }, r),
|
|
3446
3452
|
// TODO: (@Towan) Re-Check on that conversion 🙏
|
|
3447
|
-
t.
|
|
3448
|
-
|
|
3453
|
+
t.getBaseValue("bigint").toString(),
|
|
3454
|
+
l.memo,
|
|
3449
3455
|
i.expiration
|
|
3450
3456
|
],
|
|
3451
|
-
txOverrides: {
|
|
3457
|
+
txOverrides: {
|
|
3458
|
+
from: l.from,
|
|
3459
|
+
value: t.isGasAsset ? t.getBaseValue("bigint") : void 0
|
|
3460
|
+
}
|
|
3452
3461
|
});
|
|
3453
3462
|
}
|
|
3454
3463
|
default:
|
|
3455
|
-
return await y.transfer(
|
|
3464
|
+
return await y.transfer(l);
|
|
3456
3465
|
}
|
|
3457
|
-
} catch (
|
|
3458
|
-
const
|
|
3459
|
-
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);
|
|
3460
3469
|
}
|
|
3461
3470
|
});
|
|
3462
3471
|
/**
|
|
3463
3472
|
* TC related Methods
|
|
3464
3473
|
*/
|
|
3465
|
-
|
|
3474
|
+
T(this, "createLiquidity", async ({
|
|
3466
3475
|
runeAssetValue: t,
|
|
3467
3476
|
assetValue: n
|
|
3468
3477
|
}) => {
|
|
3469
3478
|
if (t.lte(0) || n.lte(0))
|
|
3470
|
-
throw new
|
|
3479
|
+
throw new m("core_transaction_create_liquidity_invalid_params");
|
|
3471
3480
|
let a = "", i = "";
|
|
3472
3481
|
try {
|
|
3473
|
-
a = await
|
|
3482
|
+
a = await f(this, N).call(this, {
|
|
3474
3483
|
assetValue: t,
|
|
3475
|
-
memo:
|
|
3484
|
+
memo: x(_.DEPOSIT, {
|
|
3476
3485
|
...n,
|
|
3477
3486
|
address: this.getAddress(n.chain)
|
|
3478
3487
|
})
|
|
3479
3488
|
});
|
|
3480
3489
|
} catch (r) {
|
|
3481
|
-
throw new
|
|
3490
|
+
throw new m("core_transaction_create_liquidity_rune_error", r);
|
|
3482
3491
|
}
|
|
3483
3492
|
try {
|
|
3484
|
-
i = await
|
|
3493
|
+
i = await f(this, N).call(this, {
|
|
3485
3494
|
assetValue: n,
|
|
3486
|
-
memo:
|
|
3495
|
+
memo: x(_.DEPOSIT, {
|
|
3487
3496
|
...n,
|
|
3488
3497
|
address: this.getAddress(s.THORChain)
|
|
3489
3498
|
})
|
|
3490
3499
|
});
|
|
3491
3500
|
} catch (r) {
|
|
3492
|
-
throw new
|
|
3501
|
+
throw new m("core_transaction_create_liquidity_asset_error", r);
|
|
3493
3502
|
}
|
|
3494
3503
|
return { runeTx: a, assetTx: i };
|
|
3495
3504
|
});
|
|
3496
|
-
|
|
3505
|
+
T(this, "addLiquidity", async ({
|
|
3497
3506
|
poolIdentifier: t,
|
|
3498
3507
|
runeAssetValue: n,
|
|
3499
3508
|
assetValue: a,
|
|
3500
3509
|
runeAddr: i,
|
|
3501
3510
|
assetAddr: r,
|
|
3502
3511
|
isPendingSymmAsset: p,
|
|
3503
|
-
mode:
|
|
3512
|
+
mode: d = "sym"
|
|
3504
3513
|
}) => {
|
|
3505
|
-
const [y, ...
|
|
3506
|
-
if (!
|
|
3507
|
-
throw new
|
|
3508
|
-
if (
|
|
3509
|
-
throw new
|
|
3510
|
-
let
|
|
3511
|
-
const
|
|
3512
|
-
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)
|
|
3513
3522
|
try {
|
|
3514
|
-
|
|
3523
|
+
E = await f(this, N).call(this, {
|
|
3515
3524
|
assetValue: n,
|
|
3516
|
-
memo:
|
|
3525
|
+
memo: x(_.DEPOSIT, { ...S, address: O })
|
|
3517
3526
|
});
|
|
3518
|
-
} catch (
|
|
3519
|
-
throw new
|
|
3527
|
+
} catch (D) {
|
|
3528
|
+
throw new m("core_transaction_add_liquidity_rune_error", D);
|
|
3520
3529
|
}
|
|
3521
3530
|
if (h && a)
|
|
3522
3531
|
try {
|
|
3523
|
-
|
|
3532
|
+
I = await f(this, N).call(this, {
|
|
3524
3533
|
assetValue: a,
|
|
3525
|
-
memo:
|
|
3534
|
+
memo: x(_.DEPOSIT, { ...S, address: R })
|
|
3526
3535
|
});
|
|
3527
|
-
} catch (
|
|
3528
|
-
throw new
|
|
3536
|
+
} catch (D) {
|
|
3537
|
+
throw new m("core_transaction_add_liquidity_asset_error", D);
|
|
3529
3538
|
}
|
|
3530
|
-
return { runeTx:
|
|
3539
|
+
return { runeTx: E, assetTx: I };
|
|
3531
3540
|
});
|
|
3532
|
-
|
|
3541
|
+
T(this, "withdraw", async ({
|
|
3533
3542
|
memo: t,
|
|
3534
3543
|
assetValue: n,
|
|
3535
3544
|
percent: a,
|
|
@@ -3538,9 +3547,9 @@ class en {
|
|
|
3538
3547
|
}) => {
|
|
3539
3548
|
const p = r === "rune" ? v.fromChainOrSignature(s.THORChain) : i === "sym" && r === "sym" || i === "rune" || i === "asset" ? void 0 : n;
|
|
3540
3549
|
try {
|
|
3541
|
-
return await
|
|
3542
|
-
assetValue:
|
|
3543
|
-
memo: t ||
|
|
3550
|
+
return await f(this, N).call(this, {
|
|
3551
|
+
assetValue: _e(i === "asset" ? n.chain : s.THORChain),
|
|
3552
|
+
memo: t || x(_.WITHDRAW, {
|
|
3544
3553
|
symbol: n.symbol,
|
|
3545
3554
|
chain: n.chain,
|
|
3546
3555
|
ticker: n.ticker,
|
|
@@ -3549,71 +3558,71 @@ class en {
|
|
|
3549
3558
|
singleSide: !1
|
|
3550
3559
|
})
|
|
3551
3560
|
});
|
|
3552
|
-
} catch (
|
|
3553
|
-
throw new
|
|
3561
|
+
} catch (d) {
|
|
3562
|
+
throw new m("core_transaction_withdraw_error", d);
|
|
3554
3563
|
}
|
|
3555
3564
|
});
|
|
3556
|
-
|
|
3565
|
+
T(this, "savings", async ({
|
|
3557
3566
|
assetValue: t,
|
|
3558
3567
|
memo: n,
|
|
3559
3568
|
percent: a,
|
|
3560
3569
|
type: i
|
|
3561
3570
|
}) => {
|
|
3562
|
-
const r = i === "add" ?
|
|
3571
|
+
const r = i === "add" ? _.DEPOSIT : _.WITHDRAW, p = n || x(r, {
|
|
3563
3572
|
ticker: t.ticker,
|
|
3564
3573
|
symbol: t.symbol,
|
|
3565
3574
|
chain: t.chain,
|
|
3566
3575
|
singleSide: !0,
|
|
3567
3576
|
basisPoints: a ? Math.max(1e4, Math.round(a * 100)) : void 0
|
|
3568
3577
|
});
|
|
3569
|
-
return
|
|
3578
|
+
return f(this, N).call(this, { assetValue: t, memo: p });
|
|
3570
3579
|
});
|
|
3571
|
-
|
|
3580
|
+
T(this, "loan", ({
|
|
3572
3581
|
assetValue: t,
|
|
3573
3582
|
memo: n,
|
|
3574
3583
|
minAmount: a,
|
|
3575
3584
|
type: i
|
|
3576
|
-
}) =>
|
|
3585
|
+
}) => f(this, N).call(this, {
|
|
3577
3586
|
assetValue: t,
|
|
3578
|
-
memo: n ||
|
|
3587
|
+
memo: n || x(i === "open" ? _.OPEN_LOAN : _.CLOSE_LOAN, {
|
|
3579
3588
|
asset: t.toString(),
|
|
3580
3589
|
minAmount: a.toString(),
|
|
3581
3590
|
address: this.getAddress(t.chain)
|
|
3582
3591
|
})
|
|
3583
3592
|
}));
|
|
3584
|
-
|
|
3593
|
+
T(this, "nodeAction", ({
|
|
3585
3594
|
type: t,
|
|
3586
3595
|
assetValue: n,
|
|
3587
3596
|
address: a
|
|
3588
3597
|
}) => {
|
|
3589
|
-
const i = t === "bond" ?
|
|
3598
|
+
const i = t === "bond" ? _.BOND : t === "unbond" ? _.UNBOND : _.LEAVE, r = x(i, {
|
|
3590
3599
|
address: a,
|
|
3591
3600
|
unbondAmount: t === "unbond" ? n.baseValueNumber : void 0
|
|
3592
3601
|
});
|
|
3593
|
-
return
|
|
3602
|
+
return f(this, Y).call(this, {
|
|
3594
3603
|
memo: r,
|
|
3595
|
-
assetValue: t === "bond" ? n :
|
|
3604
|
+
assetValue: t === "bond" ? n : _e(s.THORChain)
|
|
3596
3605
|
});
|
|
3597
3606
|
});
|
|
3598
|
-
|
|
3607
|
+
T(this, "registerThorname", ({
|
|
3599
3608
|
assetValue: t,
|
|
3600
3609
|
...n
|
|
3601
|
-
}) =>
|
|
3602
|
-
|
|
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 = {} }) => {
|
|
3603
3612
|
try {
|
|
3604
3613
|
t.forEach((r) => {
|
|
3605
3614
|
this[r.connectMethodName] = r.connect({
|
|
3606
|
-
addChain:
|
|
3615
|
+
addChain: f(this, z),
|
|
3607
3616
|
config: n || {},
|
|
3608
3617
|
apis: a,
|
|
3609
3618
|
rpcUrls: i
|
|
3610
3619
|
});
|
|
3611
3620
|
});
|
|
3612
3621
|
} catch (r) {
|
|
3613
|
-
throw new
|
|
3622
|
+
throw new m("core_extend_error", r);
|
|
3614
3623
|
}
|
|
3615
3624
|
});
|
|
3616
|
-
|
|
3625
|
+
T(this, "estimateMaxSendableAmount", async ({
|
|
3617
3626
|
chain: t,
|
|
3618
3627
|
params: n
|
|
3619
3628
|
}) => {
|
|
@@ -3646,40 +3655,40 @@ class en {
|
|
|
3646
3655
|
});
|
|
3647
3656
|
}
|
|
3648
3657
|
default:
|
|
3649
|
-
throw new
|
|
3658
|
+
throw new m("core_estimated_max_spendable_chain_not_supported");
|
|
3650
3659
|
}
|
|
3651
3660
|
});
|
|
3652
3661
|
/**
|
|
3653
3662
|
* Wallet connection methods
|
|
3654
3663
|
*/
|
|
3655
|
-
|
|
3656
|
-
throw new
|
|
3664
|
+
T(this, "connectXDEFI", async (t) => {
|
|
3665
|
+
throw new m("core_wallet_xdefi_not_installed");
|
|
3657
3666
|
});
|
|
3658
|
-
|
|
3659
|
-
throw new
|
|
3667
|
+
T(this, "connectEVMWallet", async (t, n) => {
|
|
3668
|
+
throw new m("core_wallet_evmwallet_not_installed");
|
|
3660
3669
|
});
|
|
3661
|
-
|
|
3662
|
-
throw new
|
|
3670
|
+
T(this, "connectWalletconnect", async (t, n) => {
|
|
3671
|
+
throw new m("core_wallet_walletconnect_not_installed");
|
|
3663
3672
|
});
|
|
3664
|
-
|
|
3665
|
-
throw new
|
|
3673
|
+
T(this, "connectKeystore", async (t, n) => {
|
|
3674
|
+
throw new m("core_wallet_keystore_not_installed");
|
|
3666
3675
|
});
|
|
3667
|
-
|
|
3668
|
-
throw new
|
|
3676
|
+
T(this, "connectLedger", async (t, n) => {
|
|
3677
|
+
throw new m("core_wallet_ledger_not_installed");
|
|
3669
3678
|
});
|
|
3670
|
-
|
|
3671
|
-
throw new
|
|
3679
|
+
T(this, "connectTrezor", async (t, n) => {
|
|
3680
|
+
throw new m("core_wallet_trezor_not_installed");
|
|
3672
3681
|
});
|
|
3673
|
-
|
|
3674
|
-
throw new
|
|
3682
|
+
T(this, "connectKeplr", async (t) => {
|
|
3683
|
+
throw new m("core_wallet_keplr_not_installed");
|
|
3675
3684
|
});
|
|
3676
|
-
|
|
3677
|
-
throw new
|
|
3685
|
+
T(this, "connectOkx", async (t) => {
|
|
3686
|
+
throw new m("core_wallet_okx_not_installed");
|
|
3678
3687
|
});
|
|
3679
|
-
|
|
3688
|
+
T(this, "disconnectChain", (t) => {
|
|
3680
3689
|
this.connectedChains[t] = null, this.connectedWallets[t] = null;
|
|
3681
3690
|
});
|
|
3682
|
-
|
|
3691
|
+
B(this, P, async (t) => {
|
|
3683
3692
|
if (t === s.THORChain)
|
|
3684
3693
|
return {
|
|
3685
3694
|
gas_rate: "0",
|
|
@@ -3688,39 +3697,39 @@ class en {
|
|
|
3688
3697
|
halted: !1,
|
|
3689
3698
|
chain: s.THORChain
|
|
3690
3699
|
};
|
|
3691
|
-
const a = (await
|
|
3700
|
+
const a = (await Bt(this.stagenet)).find((i) => i.chain === t);
|
|
3692
3701
|
if (!a)
|
|
3693
|
-
throw new
|
|
3702
|
+
throw new m("core_inbound_data_not_found");
|
|
3694
3703
|
if (a != null && a.halted)
|
|
3695
|
-
throw new
|
|
3704
|
+
throw new m("core_chain_halted");
|
|
3696
3705
|
return a;
|
|
3697
3706
|
});
|
|
3698
|
-
|
|
3707
|
+
B(this, z, ({ chain: t, wallet: n, walletMethods: a }) => {
|
|
3699
3708
|
this.connectedChains[t] = n, this.connectedWallets[t] = a;
|
|
3700
3709
|
});
|
|
3701
|
-
|
|
3710
|
+
B(this, K, async ({
|
|
3702
3711
|
assetValue: { baseValueBigInt: t, address: n, chain: a, isGasAsset: i, isSynthetic: r },
|
|
3703
3712
|
type: p = "checkOnly",
|
|
3704
|
-
contractAddress:
|
|
3713
|
+
contractAddress: d
|
|
3705
3714
|
}) => {
|
|
3706
3715
|
const y = [s.Ethereum, s.Avalanche, s.BinanceSmartChain].includes(a);
|
|
3707
3716
|
if (y && i || !y || r)
|
|
3708
3717
|
return !0;
|
|
3709
|
-
const
|
|
3710
|
-
if (!
|
|
3711
|
-
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");
|
|
3712
3721
|
const h = this.getAddress(a);
|
|
3713
3722
|
if (!n || !h)
|
|
3714
|
-
throw new
|
|
3715
|
-
const
|
|
3716
|
-
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({
|
|
3717
3726
|
amount: t,
|
|
3718
3727
|
assetAddress: n,
|
|
3719
3728
|
from: h,
|
|
3720
|
-
spenderAddress:
|
|
3729
|
+
spenderAddress: w
|
|
3721
3730
|
});
|
|
3722
3731
|
});
|
|
3723
|
-
|
|
3732
|
+
B(this, N, async ({
|
|
3724
3733
|
assetValue: t,
|
|
3725
3734
|
memo: n,
|
|
3726
3735
|
feeOptionKey: a = k.Fast
|
|
@@ -3729,22 +3738,22 @@ class en {
|
|
|
3729
3738
|
gas_rate: i,
|
|
3730
3739
|
router: r,
|
|
3731
3740
|
address: p
|
|
3732
|
-
} = await
|
|
3741
|
+
} = await f(this, P).call(this, t.chain), d = (parseInt(i) || 0) * st[a];
|
|
3733
3742
|
return this.deposit({
|
|
3734
3743
|
assetValue: t,
|
|
3735
3744
|
recipient: p,
|
|
3736
3745
|
memo: n,
|
|
3737
3746
|
router: r,
|
|
3738
|
-
feeRate:
|
|
3747
|
+
feeRate: d
|
|
3739
3748
|
});
|
|
3740
3749
|
});
|
|
3741
|
-
|
|
3742
|
-
const a = await
|
|
3750
|
+
B(this, Y, async ({ memo: t, assetValue: n }) => {
|
|
3751
|
+
const a = await Pt(this.stagenet);
|
|
3743
3752
|
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
3744
|
-
throw new
|
|
3753
|
+
throw new m("core_chain_halted");
|
|
3745
3754
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
3746
3755
|
});
|
|
3747
|
-
|
|
3756
|
+
B(this, X, ({ assetValue: t, ...n }) => ({
|
|
3748
3757
|
...n,
|
|
3749
3758
|
memo: n.memo || "",
|
|
3750
3759
|
from: this.getAddress(t.chain),
|
|
@@ -3753,49 +3762,49 @@ class en {
|
|
|
3753
3762
|
this.stagenet = !!t;
|
|
3754
3763
|
}
|
|
3755
3764
|
}
|
|
3756
|
-
|
|
3765
|
+
P = new WeakMap(), z = new WeakMap(), K = new WeakMap(), N = new WeakMap(), Y = new WeakMap(), X = new WeakMap();
|
|
3757
3766
|
export {
|
|
3758
3767
|
Ue as AGG_SWAP,
|
|
3759
|
-
|
|
3768
|
+
be as ApiError,
|
|
3760
3769
|
W as ApiUrl,
|
|
3761
3770
|
v as AssetValue,
|
|
3762
|
-
|
|
3763
|
-
|
|
3771
|
+
b as BaseDecimal,
|
|
3772
|
+
re as BigIntArithmetics,
|
|
3764
3773
|
s as Chain,
|
|
3765
|
-
|
|
3774
|
+
ye as ChainId,
|
|
3766
3775
|
Gt as ChainIdToChain,
|
|
3767
3776
|
Ke as ChainToChainId,
|
|
3768
|
-
|
|
3777
|
+
we as ChainToExplorerUrl,
|
|
3769
3778
|
Ft as ChainToHexChainId,
|
|
3770
3779
|
Ye as ChainToRPC,
|
|
3771
3780
|
Ge as ContractAddress,
|
|
3772
3781
|
kt as CosmosChainList,
|
|
3773
3782
|
We as DerivationPath,
|
|
3774
|
-
|
|
3783
|
+
u as ERROR_CODE,
|
|
3775
3784
|
ke as ERROR_MODULE,
|
|
3776
|
-
|
|
3785
|
+
fe as ERROR_TYPE,
|
|
3777
3786
|
Ht as EVMChainList,
|
|
3778
3787
|
Xe as ErrorCode,
|
|
3779
3788
|
k as FeeOption,
|
|
3780
|
-
|
|
3789
|
+
_ as MemoType,
|
|
3781
3790
|
Ut as NetworkDerivationPath,
|
|
3782
3791
|
Le as QuoteMode,
|
|
3783
|
-
|
|
3792
|
+
Ae as RPCUrl,
|
|
3784
3793
|
He as SWAP_IN,
|
|
3785
3794
|
$e as SWAP_OUT,
|
|
3786
3795
|
en as SwapKitCore,
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3796
|
+
m as SwapKitError,
|
|
3797
|
+
ue as SwapKitNumber,
|
|
3798
|
+
Pe as TCAvalancheDepositABI,
|
|
3790
3799
|
Ve as TCBscDepositABI,
|
|
3791
|
-
|
|
3800
|
+
Be as TCEthereumVaultAbi,
|
|
3792
3801
|
$t as UTXOChainList,
|
|
3793
3802
|
je as WalletOption,
|
|
3794
3803
|
Yt as assetFromString,
|
|
3795
3804
|
Kt as derivationPathToString,
|
|
3796
3805
|
Lt as erc20ABI,
|
|
3797
3806
|
Xt as filterAssets,
|
|
3798
|
-
|
|
3807
|
+
ge as formatBigIntToSafeValue,
|
|
3799
3808
|
st as gasFeeMultiplier,
|
|
3800
3809
|
pt as getAssetType,
|
|
3801
3810
|
ut as getAsymmetricAssetShare,
|
|
@@ -3803,12 +3812,12 @@ export {
|
|
|
3803
3812
|
dt as getAsymmetricRuneShare,
|
|
3804
3813
|
jt as getAsymmetricRuneWithdrawAmount,
|
|
3805
3814
|
rt as getCommonAssetInfo,
|
|
3806
|
-
|
|
3815
|
+
Oe as getDecimal,
|
|
3807
3816
|
zt as getEstimatedPoolShare,
|
|
3808
3817
|
Zt as getLiquiditySlippage,
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3818
|
+
x as getMemoFor,
|
|
3819
|
+
_e as getMinAmountByChain,
|
|
3820
|
+
Ee as getRequest,
|
|
3812
3821
|
yt as getSymmetricPoolShare,
|
|
3813
3822
|
Jt as getSymmetricWithdraw,
|
|
3814
3823
|
Wt as getTHORNameCost,
|