@swapkit/core 1.0.0-rc.90 → 1.0.0-rc.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +178 -177
- package/dist/index.es.js.map +1 -1
- package/package.json +9 -9
package/dist/index.es.js
CHANGED
|
@@ -4,13 +4,13 @@ var b = (e, t, n) => (rt(e, typeof t != "symbol" ? t + "" : t, n), n), pt = (e,
|
|
|
4
4
|
if (!t.has(e))
|
|
5
5
|
throw TypeError("Cannot " + n);
|
|
6
6
|
};
|
|
7
|
-
var
|
|
7
|
+
var f = (e, t, n) => (pt(e, t, "read from private field"), n ? n.call(e) : t.get(e)), V = (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
12
|
var ut = Object.defineProperty, yt = (e, t, n) => t in e ? ut(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, N = (e, t, n) => (yt(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
13
|
-
const
|
|
13
|
+
const Fn = [
|
|
14
14
|
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
15
15
|
{
|
|
16
16
|
anonymous: !1,
|
|
@@ -624,8 +624,8 @@ const Tt = [
|
|
|
624
624
|
"TC-BEP20"
|
|
625
625
|
/* TC_SUPPORTED_TO_BSC */
|
|
626
626
|
];
|
|
627
|
-
var Ve = /* @__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))(Ve || {}), _t = /* @__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))(_t || {}), o = /* @__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_MAX_500 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROVIDER_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))(o || {});
|
|
628
|
-
const
|
|
627
|
+
var Ve = /* @__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))(Ve || {}), _t = /* @__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))(_t || {}), o = /* @__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_MAX_500 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROVIDER_NOT_SUPPORTED = "2008", e.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", e.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", e.SOURCE_ADDRESS_SMART_CONTRACT = "2011", e.SWAP_AMOUNT_TOO_LOW = "2012", 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))(o || {});
|
|
628
|
+
const At = {
|
|
629
629
|
[o.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
|
|
630
630
|
[o.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
|
|
631
631
|
[o.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
|
|
@@ -642,12 +642,13 @@ const ft = {
|
|
|
642
642
|
[o.SELL_BUY_ASSETS_ARE_THE_SAME]: "Sell and buy assets are the same.",
|
|
643
643
|
[o.MISSING_SOURCE_ADDRESS_FOR_SYNTH]: "Source address is required for synth quote.",
|
|
644
644
|
[o.AFF_ADDRESS_AND_BPS_OR_NEITHER]: "Must provide affiliateAddress and affiliateBasisPoints params, or neither.",
|
|
645
|
-
[o.AFF_ADDRESS_TOO_LONG]: "affiliateAddress too long:
|
|
645
|
+
[o.AFF_ADDRESS_TOO_LONG]: "affiliateAddress too long: 4 characters max.",
|
|
646
646
|
[o.AFF_BPS_INTEGER_MAX_500]: "affiliateBasisPoints must be an integer between 0 and 100.",
|
|
647
647
|
[o.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN]: "Source address {0} invalid for sell chain.",
|
|
648
648
|
[o.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN]: "Destination address {0} invalid for buy chain.",
|
|
649
649
|
[o.PREFERRED_PROVIDER_NOT_SUPPORTED]: "Preferred provider not supported.",
|
|
650
650
|
[o.SOURCE_ADDRESS_SMART_CONTRACT]: "Source address is a smart contract.",
|
|
651
|
+
[o.SWAP_AMOUNT_TOO_LOW]: "Swap amount too low for this pair.",
|
|
651
652
|
[o.DESTINATION_ADDRESS_SMART_CONTRACT]: "Destination address is a smart contract.",
|
|
652
653
|
[o.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Buy amount must be a positive integer.",
|
|
653
654
|
[o.INVALID_PROVIDER]: "Invalid provider {0}.",
|
|
@@ -678,7 +679,7 @@ const ft = {
|
|
|
678
679
|
[o.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
|
|
679
680
|
[o.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
|
|
680
681
|
}, ce = (e, t) => {
|
|
681
|
-
let n =
|
|
682
|
+
let n = At[e];
|
|
682
683
|
if (!n)
|
|
683
684
|
return "";
|
|
684
685
|
for (let a = 0; a < t.length; a++)
|
|
@@ -693,19 +694,19 @@ let Wn = class He extends Error {
|
|
|
693
694
|
code: i,
|
|
694
695
|
message: r,
|
|
695
696
|
type: p,
|
|
696
|
-
options: { shouldLog: u, shouldThrow: y, shouldTrace:
|
|
697
|
+
options: { shouldLog: u, shouldThrow: y, shouldTrace: l } = {
|
|
697
698
|
shouldLog: !0,
|
|
698
699
|
shouldThrow: !0,
|
|
699
700
|
shouldTrace: !0
|
|
700
701
|
},
|
|
701
|
-
displayMessageParams:
|
|
702
|
+
displayMessageParams: m
|
|
702
703
|
}) {
|
|
703
|
-
const T = r || ce(i,
|
|
704
|
-
super(T), N(this, "status"), N(this, "revision"), N(this, "type"), N(this, "module"), N(this, "code"), N(this, "message"), N(this, "display"), N(this, "stack"), N(this, "options"), N(this, "displayMessageParams"), this.status = t, this.revision = n || "NO_REVISION", this.module = a, this.message = T, this.display = ce(i,
|
|
704
|
+
const T = r || ce(i, m || []) || "";
|
|
705
|
+
super(T), N(this, "status"), N(this, "revision"), N(this, "type"), N(this, "module"), N(this, "code"), N(this, "message"), N(this, "display"), N(this, "stack"), N(this, "options"), N(this, "displayMessageParams"), this.status = t, this.revision = n || "NO_REVISION", this.module = a, this.message = T, this.display = ce(i, m || []), this.code = i, this.type = p || Ve.UNHANDLED_ERROR, this.options = {
|
|
705
706
|
shouldLog: u || !0,
|
|
706
|
-
shouldTrace:
|
|
707
|
+
shouldTrace: l || !0,
|
|
707
708
|
shouldThrow: y || !1
|
|
708
|
-
}, this.displayMessageParams =
|
|
709
|
+
}, this.displayMessageParams = m || [], this.options.shouldTrace && Error.captureStackTrace(this);
|
|
709
710
|
}
|
|
710
711
|
static fromErrorInfo(t) {
|
|
711
712
|
return new He(t);
|
|
@@ -727,7 +728,7 @@ let Wn = class He extends Error {
|
|
|
727
728
|
return this.toErrorInfo();
|
|
728
729
|
}
|
|
729
730
|
};
|
|
730
|
-
var s = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(s || {}),
|
|
731
|
+
var s = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(s || {}), ft = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(ft || {}), ht = /* @__PURE__ */ ((e) => (e.ARB = "m/44'/60'/0'/0", e.AVAX = "m/44'/60'/0'/0", e.BCH = "m/44'/145'/0'/0", e.BNB = "m/44'/714'/0'/0", e.BSC = "m/44'/60'/0'/0", e.BTC = "m/84'/0'/0'/0", e.DOGE = "m/44'/3'/0'/0", e.ETH = "m/44'/60'/0'/0", e.GAIA = "m/44'/118'/0'/0", e.KUJI = "m/44'/118'/0'/0", e.LTC = "m/84'/2'/0'/0", e.MATIC = "m/44'/60'/0'/0", e.MAYA = "m/44'/931'/0'/0", e.OP = "m/44'/60'/0'/0", e.THOR = "m/44'/931'/0'/0", e))(ht || {});
|
|
731
732
|
const $n = {
|
|
732
733
|
ARB: [44, 60, 0, 0, 0],
|
|
733
734
|
AVAX: [44, 60, 0, 0, 0],
|
|
@@ -778,22 +779,22 @@ const Et = [
|
|
|
778
779
|
"THOR"
|
|
779
780
|
/* THORChain */
|
|
780
781
|
];
|
|
781
|
-
var Se = /* @__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))(Se || {}),
|
|
782
|
-
const oe = Object.values(s), Rt = Object.keys(s),
|
|
782
|
+
var Se = /* @__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))(Se || {}), Ue = /* @__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))(Ue || {}), Q = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.net", e.ThorswapStatic = "https://static.thorswap.net", e))(Q || {});
|
|
783
|
+
const oe = Object.values(s), Rt = Object.keys(s), we = oe.reduce(
|
|
783
784
|
(e, t) => {
|
|
784
785
|
const n = Rt.find((a) => s[a] === t);
|
|
785
786
|
return n && (e[t] = n), e;
|
|
786
787
|
},
|
|
787
788
|
{}
|
|
788
|
-
),
|
|
789
|
-
(e, t) => (e[t] = Se[
|
|
789
|
+
), Fe = oe.reduce(
|
|
790
|
+
(e, t) => (e[t] = Se[we[t]], e),
|
|
790
791
|
{}
|
|
791
|
-
),
|
|
792
|
-
(e, t) => (e[t] =
|
|
792
|
+
), Ot = oe.reduce(
|
|
793
|
+
(e, t) => (e[t] = Ue[we[t]], e),
|
|
793
794
|
{}
|
|
794
795
|
), jn = oe.reduce(
|
|
795
796
|
(e, t) => {
|
|
796
|
-
const n = `${
|
|
797
|
+
const n = `${we[t]}Hex`;
|
|
797
798
|
return e[t] = Se[n], e;
|
|
798
799
|
},
|
|
799
800
|
{}
|
|
@@ -839,15 +840,15 @@ const oe = Object.values(s), Rt = Object.keys(s), Oe = oe.reduce(
|
|
|
839
840
|
MATIC: "https://polygonscan.com",
|
|
840
841
|
THOR: "https://runescan.io"
|
|
841
842
|
};
|
|
842
|
-
var
|
|
843
|
+
var A = /* @__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))(A || {}), X = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(X || {}), St = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", e.KEEPKEY = "KEEPKEY", e.XDEFI = "XDEFI", e.METAMASK = "METAMASK", e.COINBASE_WEB = "COINBASE_WEB", e.TREZOR = "TREZOR", e.TRUSTWALLET_WEB = "TRUSTWALLET_WEB", e.LEDGER = "LEDGER", e.KEPLR = "KEPLR", e.OKX = "OKX", e.OKX_MOBILE = "OKX_MOBILE", e.BRAVE = "BRAVE", e.WALLETCONNECT = "WALLETCONNECT", e))(St || {}), wt = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e[e.LockedDevice = 21781] = "LockedDevice", e[e.TC_NotFound = 65535] = "TC_NotFound", e))(wt || {}), Mt = Object.defineProperty, It = (e, t, n) => t in e ? Mt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (It(e, typeof t != "symbol" ? t + "" : t, n), n), gt = (e, t, n) => {
|
|
843
844
|
if (!t.has(e))
|
|
844
845
|
throw TypeError("Cannot " + n);
|
|
845
846
|
}, q = (e, t, n) => {
|
|
846
847
|
if (t.has(e))
|
|
847
848
|
throw TypeError("Cannot add the same private member more than once");
|
|
848
849
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
849
|
-
}, M = (e, t, n) => (gt(e, t, "access private method"), n), d = /* @__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_MAX_500 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROVIDER_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))(d || {});
|
|
850
|
-
d.INVALID_INPUT_PARAMETERS + "", d.UNKNOWN_PROVIDERS + "", d.CANNOT_FIND_INBOUND_ADDRESS + "", d.NO_INBOUND_ADDRESSES + "", d.CHAIN_HALTED_OR_UNSUPPORTED + "", d.MISSING_INPUT_PARAMETER + "", d.INVALID_TYPE_GENERIC + "", d.INVALID_NUMBER_STRING + "", d.INVALID_NUMBER + "", d.INVALID_BOOLEAN + "", d.INVALID_OBJECT + "", d.INVALID_ARRAY + "", d.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", d.SELL_BUY_ASSETS_ARE_THE_SAME + "", d.MISSING_SOURCE_ADDRESS_FOR_SYNTH + "", d.AFF_ADDRESS_AND_BPS_OR_NEITHER + "", d.AFF_ADDRESS_TOO_LONG + "", d.AFF_BPS_INTEGER_MAX_500 + "", d.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN + "", d.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN + "", d.PREFERRED_PROVIDER_NOT_SUPPORTED + "", d.SOURCE_ADDRESS_SMART_CONTRACT + "", d.DESTINATION_ADDRESS_SMART_CONTRACT + "", d.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", d.INVALID_PROVIDER + "", d.MISSING_CROSS_CHAIN_PROVIDER + "", d.MISSING_AVAX_PROVIDER + "", d.MISSING_BSC_PROVIDER + "", d.MISSING_ETH_PROVIDER + "", d.MISSING_ARB_PROVIDER + "", d.INVALID_PROVIDER_FOR_SWAP_OUT + "", d.INVALID_CHAIN + "", d.INVALID_ASSET + "", d.UNSUPPORTED_CHAIN + "", d.UNSUPPORTED_ASSET + "", d.UNSUPPORTED_ASSET_FOR_SWAPOUT + "", d.THORNODE_QUOTE_GENERIC_ERROR + "", d.INVALID_SOURCE_ADDRESS + "", d.INVALID_DESTINATION_ADDRESS + "", d.NOT_ENOUGH_SYNTH_BALANCE + "", d.SYNTH_MINTING_CAP_REACHED + "", d.INVALID_QUOTE_MODE + "", d.NO_QUOTES + "", d.SERVICE_UNAVAILABLE_GENERIC + "", d.MISSING_GAS_DATA_GENERIC + "", d.MISSING_TOKEN_INFO_GENERIC + "", d.CANT_FIND_TOKEN_LIST + "", d.NO_PRICE + "", d.PRICE_IS_STALE + "", d.ADDRESS_NOT_WHITELISTED + "", d.ADDRESS_ALREADY_CLAIMED + "";
|
|
850
|
+
}, M = (e, t, n) => (gt(e, t, "access private method"), n), d = /* @__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_MAX_500 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROVIDER_NOT_SUPPORTED = "2008", e.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", e.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", e.SOURCE_ADDRESS_SMART_CONTRACT = "2011", e.SWAP_AMOUNT_TOO_LOW = "2012", 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))(d || {});
|
|
851
|
+
d.INVALID_INPUT_PARAMETERS + "", d.UNKNOWN_PROVIDERS + "", d.CANNOT_FIND_INBOUND_ADDRESS + "", d.NO_INBOUND_ADDRESSES + "", d.CHAIN_HALTED_OR_UNSUPPORTED + "", d.MISSING_INPUT_PARAMETER + "", d.INVALID_TYPE_GENERIC + "", d.INVALID_NUMBER_STRING + "", d.INVALID_NUMBER + "", d.INVALID_BOOLEAN + "", d.INVALID_OBJECT + "", d.INVALID_ARRAY + "", d.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", d.SELL_BUY_ASSETS_ARE_THE_SAME + "", d.MISSING_SOURCE_ADDRESS_FOR_SYNTH + "", d.AFF_ADDRESS_AND_BPS_OR_NEITHER + "", d.AFF_ADDRESS_TOO_LONG + "", d.AFF_BPS_INTEGER_MAX_500 + "", d.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN + "", d.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN + "", d.PREFERRED_PROVIDER_NOT_SUPPORTED + "", d.SOURCE_ADDRESS_SMART_CONTRACT + "", d.SWAP_AMOUNT_TOO_LOW + "", d.DESTINATION_ADDRESS_SMART_CONTRACT + "", d.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER + "", d.INVALID_PROVIDER + "", d.MISSING_CROSS_CHAIN_PROVIDER + "", d.MISSING_AVAX_PROVIDER + "", d.MISSING_BSC_PROVIDER + "", d.MISSING_ETH_PROVIDER + "", d.MISSING_ARB_PROVIDER + "", d.INVALID_PROVIDER_FOR_SWAP_OUT + "", d.INVALID_CHAIN + "", d.INVALID_ASSET + "", d.UNSUPPORTED_CHAIN + "", d.UNSUPPORTED_ASSET + "", d.UNSUPPORTED_ASSET_FOR_SWAPOUT + "", d.THORNODE_QUOTE_GENERIC_ERROR + "", d.INVALID_SOURCE_ADDRESS + "", d.INVALID_DESTINATION_ADDRESS + "", d.NOT_ENOUGH_SYNTH_BALANCE + "", d.SYNTH_MINTING_CAP_REACHED + "", d.INVALID_QUOTE_MODE + "", d.NO_QUOTES + "", d.SERVICE_UNAVAILABLE_GENERIC + "", d.MISSING_GAS_DATA_GENERIC + "", d.MISSING_TOKEN_INFO_GENERIC + "", d.CANT_FIND_TOKEN_LIST + "", d.NO_PRICE + "", d.PRICE_IS_STALE + "", d.ADDRESS_NOT_WHITELISTED + "", d.ADDRESS_ALREADY_CLAIMED + "";
|
|
851
852
|
var de = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(de || {}), Me = /* @__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))(Me || {}), $e = /* @__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))($e || {}), L = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.net", e.ThorswapStatic = "https://static.thorswap.net", e))(L || {});
|
|
852
853
|
const le = Object.values(de), Ct = Object.keys(de), Ie = le.reduce(
|
|
853
854
|
(e, t) => {
|
|
@@ -975,7 +976,7 @@ const ne = (e) => e !== null && typeof e == "object", te = (...e) => {
|
|
|
975
976
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
976
977
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
977
978
|
delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
|
|
978
|
-
},
|
|
979
|
+
}, Ut = (e = {}) => {
|
|
979
980
|
if (typeof e == "number")
|
|
980
981
|
return {
|
|
981
982
|
...ve,
|
|
@@ -991,7 +992,7 @@ const ne = (e) => e !== null && typeof e == "object", te = (...e) => {
|
|
|
991
992
|
afterStatusCodes: Ke
|
|
992
993
|
};
|
|
993
994
|
};
|
|
994
|
-
async function
|
|
995
|
+
async function Ft(e, t, n, a) {
|
|
995
996
|
return new Promise((i, r) => {
|
|
996
997
|
const p = setTimeout(() => {
|
|
997
998
|
n && n.abort(), r(new qe(e));
|
|
@@ -1099,7 +1100,7 @@ class re {
|
|
|
1099
1100
|
method: Lt(n.method ?? this._input.method),
|
|
1100
1101
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
1101
1102
|
prefixUrl: String(n.prefixUrl || ""),
|
|
1102
|
-
retry:
|
|
1103
|
+
retry: Ut(n.retry),
|
|
1103
1104
|
throwHttpErrors: n.throwHttpErrors !== !1,
|
|
1104
1105
|
timeout: n.timeout ?? 1e4,
|
|
1105
1106
|
fetch: n.fetch ?? globalThis.fetch.bind(globalThis)
|
|
@@ -1177,7 +1178,7 @@ class re {
|
|
|
1177
1178
|
return a;
|
|
1178
1179
|
}
|
|
1179
1180
|
const t = $t(this.request, this._options);
|
|
1180
|
-
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) :
|
|
1181
|
+
return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Ft(this.request.clone(), t, this.abortController, this._options);
|
|
1181
1182
|
}
|
|
1182
1183
|
/* istanbul ignore next */
|
|
1183
1184
|
_stream(t, n) {
|
|
@@ -1192,17 +1193,17 @@ class re {
|
|
|
1192
1193
|
const p = t.body.getReader();
|
|
1193
1194
|
n && n({ percent: 0, transferredBytes: 0, totalBytes: a }, new Uint8Array());
|
|
1194
1195
|
async function u() {
|
|
1195
|
-
const { done: y, value:
|
|
1196
|
+
const { done: y, value: l } = await p.read();
|
|
1196
1197
|
if (y) {
|
|
1197
1198
|
r.close();
|
|
1198
1199
|
return;
|
|
1199
1200
|
}
|
|
1200
1201
|
if (n) {
|
|
1201
|
-
i +=
|
|
1202
|
-
const
|
|
1203
|
-
n({ percent:
|
|
1202
|
+
i += l.byteLength;
|
|
1203
|
+
const m = a === 0 ? 0 : i / a;
|
|
1204
|
+
n({ percent: m, transferredBytes: i, totalBytes: a }, l);
|
|
1204
1205
|
}
|
|
1205
|
-
r.enqueue(
|
|
1206
|
+
r.enqueue(l), await u();
|
|
1206
1207
|
}
|
|
1207
1208
|
await u();
|
|
1208
1209
|
}
|
|
@@ -1257,7 +1258,7 @@ const P = {
|
|
|
1257
1258
|
var Gt = /* @__PURE__ */ ((e) => (e.SWAP_TC_TO_TC = "SWAP:TC-TC", e.SWAP_ETH_TO_TC = "SWAP:ERC20-TC", e.SWAP_TC_TO_ETH = "SWAP:TC-ERC20", e.SWAP_ETH_TO_ETH = "SWAP:ERC20-ERC20", e.SWAP_AVAX_TO_TC = "SWAP:AVAX-TC", e.SWAP_TC_TO_AVAX = "SWAP:TC-AVAX", e.SWAP_AVAX_TO_AVAX = "SWAP:AVAX-AVAX", e.SWAP_ETH_TO_AVAX = "SWAP:ETH-AVAX", e.SWAP_AVAX_TO_ETH = "SWAP:AVAX-ETH", e.SWAP_TC_TO_GAIA = "SWAP:TC-GAIA", e.SWAP_GAIA_TO_TC = "SWAP:GAIA-TC", e.SWAP_TC_TO_BNB = "SWAP:TC-BNB", e.SWAP_BNB_TO_TC = "SWAP:BNB-TC", e.SWAP_TC_TO_BTC = "SWAP:TC-BTC", e.SWAP_BTC_TO_TC = "SWAP:BTC-TC", e.SWAP_TC_TO_BCH = "SWAP:TC-BCH", e.SWAP_BCH_TO_TC = "SWAP:BCH-TC", e.SWAP_TC_TO_LTC = "SWAP:TC-LTC", e.SWAP_LTC_TO_TC = "SWAP:LTC-TC", e.SWAP_TC_TO_DOGE = "SWAP:TC-DOGE", e.SWAP_DOGE_TO_TC = "SWAP:DOGE-TC", e.TC_STATUS = "TC:STATUS", e.TC_TRANSFER = "TC:TRANSFER", e.TC_DEPOSIT = "TC:DEPOSIT", e.TC_SEND = "TC:SEND", e.TC_SWITCH = "TC:SWITCH", e.TC_LP_ADD = "TC:ADDLIQUIDITY", e.TC_LP_WITHDRAW = "TC:WITHDRAW", e.TC_TNS_CREATE = "TC:TNS-CREATE", e.TC_TNS_EXTEND = "TC:TNS-EXTEND", e.TC_TNS_UPDATE = "TC:TNS-UPDATE", e.TC_SAVINGS_ADD = "TC:ADDSAVINGS", e.TC_SAVINGS_WITHDRAW = "TC:WITHDRAWSAVINGS", e.TC_LENDING_OPEN = "TC:LENDINGOPEN", e.TC_LENDING_CLOSE = "TC:LENDINGCLOSE", e.ETH_APPROVAL = "ETH:APPROVAL", e.ETH_STATUS = "ETH:STATUS", e.ETH_TRANSFER_TO_TC = "ETH:TRANSFER:IN", e.ETH_TRANSFER_FROM_TC = "ETH:TRANSFER:OUT", e.AVAX_APPROVAL = "AVAX:APPROVAL", e.AVAX_STATUS = "AVAX:STATUS", e.AVAX_TRANSFER_TO_TC = "AVAX:TRANSFER:IN", e.AVAX_TRANSFER_FROM_TC = "AVAX:TRANSFER:OUT", e.BSC_APPROVAL = "BSC:APPROVAL", e.BSC_STATUS = "BSC:STATUS", e.BSC_TRANSFER_TO_TC = "BSC:TRANSFER:IN", e.BSC_TRANSFER_FROM_TC = "BSC:TRANSFER:OUT", e.APPROVAL = "APPROVAL", e.STATUS = "STATUS", e.TRANSFER_TO_TC = "TRANSFER:IN", e.TRANSFER_FROM_TC = "TRANSFER:OUT", e.UNSUPPORTED = "UNSUPPORTED", e.TC_LENDING = "TC:LENDING", e))(Gt || {}), Xt = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.SUCCESS = "success", e.CANCELLED = "cancelled", e.REFUNDED = "refunded", e.REPLACED = "replaced", e.ERROR = "error", e.UNKNOWN = "unknown", e.NOT_STARTED = "not_started", e.NOT_FOUND = "not_found", e.RETRIES_EXCEEDED = "retries_exceeded", e.STREAMING = "streaming", e))(Xt || {}), jt = /* @__PURE__ */ ((e) => (e[e.NOT_STARTED = 0] = "NOT_STARTED", e[e.SUCCESS = 1] = "SUCCESS", e[e.REFUNDED = 2] = "REFUNDED", e))(jt || {});
|
|
1258
1259
|
const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
1259
1260
|
try {
|
|
1260
|
-
const { result: n } = await g.post(
|
|
1261
|
+
const { result: n } = await g.post(Ot[e], {
|
|
1261
1262
|
headers: {
|
|
1262
1263
|
accept: "*/*",
|
|
1263
1264
|
"content-type": "application/json",
|
|
@@ -1406,16 +1407,16 @@ function sn({
|
|
|
1406
1407
|
poolUnits: t,
|
|
1407
1408
|
runeDepth: n
|
|
1408
1409
|
}) {
|
|
1409
|
-
const a = I(e), i = I(t), r = I(n), p = a.mul(r), u = i.mul(i).mul(2), y = i.mul(a).mul(2),
|
|
1410
|
-
return p.mul(u.sub(y).add(
|
|
1410
|
+
const a = I(e), i = I(t), r = I(n), p = a.mul(r), u = i.mul(i).mul(2), y = i.mul(a).mul(2), l = a.mul(a), m = i.mul(i).mul(i);
|
|
1411
|
+
return p.mul(u.sub(y).add(l)).div(m);
|
|
1411
1412
|
}
|
|
1412
1413
|
function rn({
|
|
1413
1414
|
liquidityUnits: e,
|
|
1414
1415
|
poolUnits: t,
|
|
1415
1416
|
assetDepth: n
|
|
1416
1417
|
}) {
|
|
1417
|
-
const a = I(e), i = I(t), r = I(n), p = a.mul(r), u = i.mul(i).mul(2), y = i.mul(a).mul(2),
|
|
1418
|
-
return
|
|
1418
|
+
const a = I(e), i = I(t), r = I(n), p = a.mul(r), u = i.mul(i).mul(2), y = i.mul(a).mul(2), l = a.mul(a), m = p.mul(u.sub(y).add(l)), T = i.mul(i).mul(i);
|
|
1419
|
+
return m.div(T);
|
|
1419
1420
|
}
|
|
1420
1421
|
function zn({
|
|
1421
1422
|
percent: e,
|
|
@@ -1468,8 +1469,8 @@ function na({
|
|
|
1468
1469
|
runeAmount: i,
|
|
1469
1470
|
assetAmount: r
|
|
1470
1471
|
}) {
|
|
1471
|
-
const p = new k({ value: e, decimal: 8 }), u = new k({ value: n, decimal: 8 }), y = new k({ value: t, decimal: 8 }),
|
|
1472
|
-
if (
|
|
1472
|
+
const p = new k({ value: e, decimal: 8 }), u = new k({ value: n, decimal: 8 }), y = new k({ value: t, decimal: 8 }), l = new k({ value: i, decimal: 8 }), m = new k({ value: r, decimal: 8 }), T = l.mul(u), _ = m.mul(p), h = l.mul(m), R = p.mul(u), O = y.mul(T.add(_.add(h.mul(2)))), S = T.add(_.add(R.mul(2))), w = O.div(S), B = I(a).add(w);
|
|
1473
|
+
if (w.getBaseValue("number") === 0)
|
|
1473
1474
|
return B.div(y).getBaseValue("number");
|
|
1474
1475
|
const Te = y.add(B);
|
|
1475
1476
|
return B.div(Te).getBaseValue("number");
|
|
@@ -1482,25 +1483,25 @@ function aa({
|
|
|
1482
1483
|
}) {
|
|
1483
1484
|
if (e === "0" || t === "0" || n === "0" || a === "0")
|
|
1484
1485
|
return 0;
|
|
1485
|
-
const i = I(n), r = I(a), p = I(t), u = I(e), y = p.mul(i).sub(r.mul(u)),
|
|
1486
|
-
return Math.abs(y.div(
|
|
1486
|
+
const i = I(n), r = I(a), p = I(t), u = I(e), y = p.mul(i).sub(r.mul(u)), l = r.mul(u).add(i.mul(r));
|
|
1487
|
+
return Math.abs(y.div(l).getBaseValue("number"));
|
|
1487
1488
|
}
|
|
1488
1489
|
const D = (e, t) => {
|
|
1489
1490
|
switch (e) {
|
|
1490
|
-
case
|
|
1491
|
-
case
|
|
1491
|
+
case A.LEAVE:
|
|
1492
|
+
case A.BOND: {
|
|
1492
1493
|
const { address: n } = t;
|
|
1493
1494
|
return `${e}:${n}`;
|
|
1494
1495
|
}
|
|
1495
|
-
case
|
|
1496
|
+
case A.UNBOND: {
|
|
1496
1497
|
const { address: n, unbondAmount: a } = t;
|
|
1497
1498
|
return `${e}:${n}:${a}`;
|
|
1498
1499
|
}
|
|
1499
|
-
case
|
|
1500
|
+
case A.THORNAME_REGISTER: {
|
|
1500
1501
|
const { name: n, chain: a, address: i, owner: r } = t;
|
|
1501
1502
|
return `${e}:${n}:${a}:${i}${r ? `:${r}` : ""}`;
|
|
1502
1503
|
}
|
|
1503
|
-
case
|
|
1504
|
+
case A.DEPOSIT: {
|
|
1504
1505
|
const { chain: n, symbol: a, address: i, singleSide: r } = t;
|
|
1505
1506
|
return r ? `${e}:${n}/${a}::t:0` : `${e}:${((p, u) => {
|
|
1506
1507
|
switch (p) {
|
|
@@ -1515,12 +1516,12 @@ const D = (e, t) => {
|
|
|
1515
1516
|
}
|
|
1516
1517
|
})(n, a)}:${i || ""}:t:0`;
|
|
1517
1518
|
}
|
|
1518
|
-
case
|
|
1519
|
-
const { chain: n, ticker: a, symbol: i, basisPoints: r, targetAssetString: p, singleSide: u } = t, y = n === "ETH" && a !== "ETH" ? `${a}-${i.slice(-3)}` : i,
|
|
1520
|
-
return `${e}:${n}${u ? "/" : "."}${y}:${r}${
|
|
1519
|
+
case A.WITHDRAW: {
|
|
1520
|
+
const { chain: n, ticker: a, symbol: i, basisPoints: r, targetAssetString: p, singleSide: u } = t, y = n === "ETH" && a !== "ETH" ? `${a}-${i.slice(-3)}` : i, l = !u && p ? `:${p}` : "";
|
|
1521
|
+
return `${e}:${n}${u ? "/" : "."}${y}:${r}${l}`;
|
|
1521
1522
|
}
|
|
1522
|
-
case
|
|
1523
|
-
case
|
|
1523
|
+
case A.OPEN_LOAN:
|
|
1524
|
+
case A.CLOSE_LOAN: {
|
|
1524
1525
|
const { asset: n, address: a } = t;
|
|
1525
1526
|
return `${e}:${n}:${a}`;
|
|
1526
1527
|
}
|
|
@@ -1554,7 +1555,7 @@ function un(e = "") {
|
|
|
1554
1555
|
`Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
|
|
1555
1556
|
);
|
|
1556
1557
|
}
|
|
1557
|
-
const J = 8,
|
|
1558
|
+
const J = 8, U = (e) => 10n ** BigInt(e), j = (e) => Math.log10(parseFloat(e.toString()));
|
|
1558
1559
|
function me({
|
|
1559
1560
|
value: e,
|
|
1560
1561
|
bigIntDecimal: t = J,
|
|
@@ -1577,8 +1578,8 @@ var W, G, H, $, Ee, ze, ie, _e, pe, Re;
|
|
|
1577
1578
|
const yn = class et {
|
|
1578
1579
|
constructor(t) {
|
|
1579
1580
|
q(this, W), q(this, H), q(this, Ee), q(this, ie), q(this, pe), C(this, "decimalMultiplier", 10n ** 8n), C(this, "bigIntValue", 0n), C(this, "decimal");
|
|
1580
|
-
const n =
|
|
1581
|
-
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier :
|
|
1581
|
+
const n = Oe(t), a = typeof t == "object";
|
|
1582
|
+
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier : U(Math.max(nt(ue(n)), this.decimal || 0)), M(this, Ee, ze).call(this, n);
|
|
1582
1583
|
}
|
|
1583
1584
|
static fromBigInt(t, n) {
|
|
1584
1585
|
return new et({
|
|
@@ -1592,7 +1593,7 @@ const yn = class et {
|
|
|
1592
1593
|
to: a
|
|
1593
1594
|
}) {
|
|
1594
1595
|
return this.fromBigInt(
|
|
1595
|
-
t.getBaseValue("bigint") *
|
|
1596
|
+
t.getBaseValue("bigint") * U(a) / U(n),
|
|
1596
1597
|
a
|
|
1597
1598
|
);
|
|
1598
1599
|
}
|
|
@@ -1643,7 +1644,7 @@ const yn = class et {
|
|
|
1643
1644
|
}
|
|
1644
1645
|
// @ts-expect-error
|
|
1645
1646
|
getBaseValue(t) {
|
|
1646
|
-
const n = this.decimalMultiplier /
|
|
1647
|
+
const n = this.decimalMultiplier / U(this.decimal || E.THOR), a = this.bigIntValue / n;
|
|
1647
1648
|
switch (t) {
|
|
1648
1649
|
case "number":
|
|
1649
1650
|
return Number(a);
|
|
@@ -1656,7 +1657,7 @@ const yn = class et {
|
|
|
1656
1657
|
getBigIntValue(t, n) {
|
|
1657
1658
|
if (!n && typeof t == "object")
|
|
1658
1659
|
return t.bigIntValue;
|
|
1659
|
-
const a =
|
|
1660
|
+
const a = Oe(t), i = ue(a);
|
|
1660
1661
|
return i === "0" || i === "undefined" ? 0n : M(this, pe, Re).call(this, i, n);
|
|
1661
1662
|
}
|
|
1662
1663
|
toSignificant(t = 6) {
|
|
@@ -1699,36 +1700,36 @@ const yn = class et {
|
|
|
1699
1700
|
decimalSeparator: i = ".",
|
|
1700
1701
|
thousandSeparator: r = ","
|
|
1701
1702
|
} = {}) {
|
|
1702
|
-
const p = this.getValue("number"), [u, y = ""] = p.toFixed(6).split("."),
|
|
1703
|
-
return `${n === "start" ? t : ""}${
|
|
1703
|
+
const p = this.getValue("number"), [u, y = ""] = p.toFixed(6).split("."), l = u.replace(/\B(?=(\d{3})+(?!\d))/g, r), m = !u && !y ? "0.00" : u === "0" ? `${parseFloat(`0.${y}`)}`.replace(".", i) : `${l}${parseInt(y) ? `${i}${y.slice(0, a)}` : ""}`;
|
|
1704
|
+
return `${n === "start" ? t : ""}${m}${n === "end" ? t : ""}`;
|
|
1704
1705
|
}
|
|
1705
1706
|
formatBigIntToSafeValue(t, n) {
|
|
1706
1707
|
const a = n || this.decimal || J, i = Math.max(
|
|
1707
1708
|
a,
|
|
1708
1709
|
j(this.decimalMultiplier)
|
|
1709
|
-
), r = t < 0n, p = t.toString().substring(r ? 1 : 0), u = i - (p.length - 1), y = u > 0 ? "0".repeat(u) + p : p,
|
|
1710
|
-
let
|
|
1711
|
-
return parseInt(
|
|
1710
|
+
), r = t < 0n, p = t.toString().substring(r ? 1 : 0), u = i - (p.length - 1), y = u > 0 ? "0".repeat(u) + p : p, l = y.length - i;
|
|
1711
|
+
let m = y.slice(-i);
|
|
1712
|
+
return parseInt(m[a]) >= 5 ? m = `${m.substring(0, a - 1)}${(parseInt(m[a - 1]) + 1).toString()}` : m = m.substring(0, a), `${r ? "-" : ""}${y.slice(
|
|
1712
1713
|
0,
|
|
1713
|
-
|
|
1714
|
-
)}.${
|
|
1714
|
+
l
|
|
1715
|
+
)}.${m}`.replace(/\.?0*$/, "");
|
|
1715
1716
|
}
|
|
1716
1717
|
};
|
|
1717
1718
|
W = /* @__PURE__ */ new WeakSet(), G = function(e, ...t) {
|
|
1718
|
-
const n = M(this, ie, _e).call(this, this, ...t), a = Math.max(n, j(this.decimalMultiplier)), i =
|
|
1719
|
+
const n = M(this, ie, _e).call(this, this, ...t), a = Math.max(n, j(this.decimalMultiplier)), i = U(a), r = t.reduce(
|
|
1719
1720
|
(u, y) => {
|
|
1720
|
-
const
|
|
1721
|
+
const l = this.getBigIntValue(y, a);
|
|
1721
1722
|
switch (e) {
|
|
1722
1723
|
case "add":
|
|
1723
|
-
return u +
|
|
1724
|
+
return u + l;
|
|
1724
1725
|
case "sub":
|
|
1725
|
-
return u -
|
|
1726
|
+
return u - l;
|
|
1726
1727
|
case "mul":
|
|
1727
|
-
return u *
|
|
1728
|
+
return u * l / i;
|
|
1728
1729
|
case "div": {
|
|
1729
|
-
if (
|
|
1730
|
+
if (l === 0n)
|
|
1730
1731
|
throw new RangeError("Division by zero");
|
|
1731
|
-
return u * i /
|
|
1732
|
+
return u * i / l;
|
|
1732
1733
|
}
|
|
1733
1734
|
default:
|
|
1734
1735
|
return u;
|
|
@@ -1742,7 +1743,7 @@ W = /* @__PURE__ */ new WeakSet(), G = function(e, ...t) {
|
|
|
1742
1743
|
value: r
|
|
1743
1744
|
});
|
|
1744
1745
|
return new this.constructor({
|
|
1745
|
-
decimalMultiplier:
|
|
1746
|
+
decimalMultiplier: U(a),
|
|
1746
1747
|
decimal: this.decimal,
|
|
1747
1748
|
value: p,
|
|
1748
1749
|
identifier: this.toString()
|
|
@@ -1768,7 +1769,7 @@ W = /* @__PURE__ */ new WeakSet(), G = function(e, ...t) {
|
|
|
1768
1769
|
const t = e.map((n) => typeof n == "object" ? n.decimal || j(n.decimalMultiplier) : nt(ue(n))).filter(Boolean);
|
|
1769
1770
|
return Math.max(...t, J);
|
|
1770
1771
|
}, pe = /* @__PURE__ */ new WeakSet(), Re = function(e, t) {
|
|
1771
|
-
const n = t ?
|
|
1772
|
+
const n = t ? U(t) : this.decimalMultiplier, a = j(n), [i = "", r = ""] = e.split(".");
|
|
1772
1773
|
return BigInt(`${i}${r.padEnd(a, "0")}`);
|
|
1773
1774
|
};
|
|
1774
1775
|
let tt = yn;
|
|
@@ -1777,7 +1778,7 @@ const on = Intl.NumberFormat("fullwide", {
|
|
|
1777
1778
|
maximumFractionDigits: 20
|
|
1778
1779
|
});
|
|
1779
1780
|
function ue(e) {
|
|
1780
|
-
const t = `${typeof e == "number" ? on.format(e) :
|
|
1781
|
+
const t = `${typeof e == "number" ? on.format(e) : Oe(e)}`.replaceAll(",", ".").split(".");
|
|
1781
1782
|
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1782
1783
|
}
|
|
1783
1784
|
function nt(e) {
|
|
@@ -1785,7 +1786,7 @@ function nt(e) {
|
|
|
1785
1786
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1786
1787
|
return Math.max(n, J);
|
|
1787
1788
|
}
|
|
1788
|
-
function
|
|
1789
|
+
function Oe(e) {
|
|
1789
1790
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1790
1791
|
}
|
|
1791
1792
|
const K = /* @__PURE__ */ new Map();
|
|
@@ -1812,7 +1813,7 @@ class x extends tt {
|
|
|
1812
1813
|
return this.chain === t && this.symbol === n;
|
|
1813
1814
|
}
|
|
1814
1815
|
chainId() {
|
|
1815
|
-
return
|
|
1816
|
+
return Fe[this.chain];
|
|
1816
1817
|
}
|
|
1817
1818
|
// THOR.RUNE
|
|
1818
1819
|
// THOR.ETH.ETH
|
|
@@ -1822,13 +1823,13 @@ class x extends tt {
|
|
|
1822
1823
|
if (!a || !i)
|
|
1823
1824
|
throw new Error("Invalid asset url");
|
|
1824
1825
|
const p = a === s.THORChain && r ? `${a}.${i}/${r}` : t;
|
|
1825
|
-
return
|
|
1826
|
+
return fe(p, n);
|
|
1826
1827
|
}
|
|
1827
1828
|
static fromString(t, n = 0) {
|
|
1828
|
-
return
|
|
1829
|
+
return fe(t, n);
|
|
1829
1830
|
}
|
|
1830
1831
|
static fromIdentifier(t, n = 0) {
|
|
1831
|
-
return
|
|
1832
|
+
return fe(t, n);
|
|
1832
1833
|
}
|
|
1833
1834
|
static fromStringSync(t, n = 0) {
|
|
1834
1835
|
const { chain: a, isSynthetic: i } = se(t), r = K.get(t.toUpperCase());
|
|
@@ -1884,7 +1885,7 @@ class x extends tt {
|
|
|
1884
1885
|
);
|
|
1885
1886
|
}
|
|
1886
1887
|
}
|
|
1887
|
-
function
|
|
1888
|
+
function Ae(e) {
|
|
1888
1889
|
const t = x.fromChainOrSignature(e);
|
|
1889
1890
|
switch (e) {
|
|
1890
1891
|
case s.Bitcoin:
|
|
@@ -1905,7 +1906,7 @@ function fe(e) {
|
|
|
1905
1906
|
return t.set(1e-8);
|
|
1906
1907
|
}
|
|
1907
1908
|
}
|
|
1908
|
-
async function
|
|
1909
|
+
async function fe(e, t = 0) {
|
|
1909
1910
|
un(e);
|
|
1910
1911
|
const n = K.get(e.toUpperCase()), a = (n == null ? void 0 : n.decimal) || await Zt(se(e));
|
|
1911
1912
|
return n || K.set(e.toUpperCase(), { identifier: e, decimal: a }), new x({ decimal: a, value: Y(t, a), identifier: e });
|
|
@@ -1927,13 +1928,13 @@ function se(e) {
|
|
|
1927
1928
|
const t = e.slice(0, 14).includes("/"), [n, a] = e.split(".")[0].toUpperCase() === s.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
|
|
1928
1929
|
if (t && (!n || !a))
|
|
1929
1930
|
throw new Error("Invalid asset identifier");
|
|
1930
|
-
const i = e.includes(".") && !t ? e : `${s.THORChain}.${a}`, [r, p] = i.split("."), [u, y] = (t ? a : p).split("-");
|
|
1931
|
+
const i = e.includes(".") && !t ? e : `${s.THORChain}.${a}`, [r, ...p] = i.split("."), [u, y] = (t ? a : p.join(".")).split("-"), l = t ? a : p.join(".");
|
|
1931
1932
|
return {
|
|
1932
1933
|
address: y == null ? void 0 : y.toLowerCase(),
|
|
1933
1934
|
chain: r,
|
|
1934
|
-
isGasAsset: Ze({ chain: r, symbol:
|
|
1935
|
+
isGasAsset: Ze({ chain: r, symbol: l }),
|
|
1935
1936
|
isSynthetic: t,
|
|
1936
|
-
symbol: (t ? `${n}/` : "") + (y ? `${u}-${(y == null ? void 0 : y.toLowerCase()) ?? ""}` :
|
|
1937
|
+
symbol: (t ? `${n}/` : "") + (y ? `${u}-${(y == null ? void 0 : y.toLowerCase()) ?? ""}` : l),
|
|
1937
1938
|
ticker: u
|
|
1938
1939
|
};
|
|
1939
1940
|
}
|
|
@@ -5638,7 +5639,7 @@ const ln = [
|
|
|
5638
5639
|
type: "function"
|
|
5639
5640
|
},
|
|
5640
5641
|
{ stateMutability: "payable", type: "receive" }
|
|
5641
|
-
],
|
|
5642
|
+
], An = [
|
|
5642
5643
|
{
|
|
5643
5644
|
inputs: [
|
|
5644
5645
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -5977,7 +5978,7 @@ const ln = [
|
|
|
5977
5978
|
type: "function"
|
|
5978
5979
|
},
|
|
5979
5980
|
{ stateMutability: "payable", type: "receive" }
|
|
5980
|
-
],
|
|
5981
|
+
], fn = [
|
|
5981
5982
|
{
|
|
5982
5983
|
inputs: [
|
|
5983
5984
|
{ internalType: "address", name: "_factory", type: "address" },
|
|
@@ -7247,7 +7248,7 @@ const ln = [
|
|
|
7247
7248
|
type: "function"
|
|
7248
7249
|
},
|
|
7249
7250
|
{ stateMutability: "payable", type: "receive" }
|
|
7250
|
-
],
|
|
7251
|
+
], On = [
|
|
7251
7252
|
{
|
|
7252
7253
|
inputs: [
|
|
7253
7254
|
{ internalType: "address", name: "_weth", type: "address" },
|
|
@@ -7419,8 +7420,8 @@ const ln = [
|
|
|
7419
7420
|
{ stateMutability: "payable", type: "receive" }
|
|
7420
7421
|
], Sn = {
|
|
7421
7422
|
// AVAX
|
|
7422
|
-
["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106".toLowerCase()]:
|
|
7423
|
-
["0xC22FBb3133dF781E6C25ea6acebe2D2Bb8CeA2f9".toLowerCase()]:
|
|
7423
|
+
["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106".toLowerCase()]: An,
|
|
7424
|
+
["0xC22FBb3133dF781E6C25ea6acebe2D2Bb8CeA2f9".toLowerCase()]: On,
|
|
7424
7425
|
["0x60aE616a2155Ee3d9A68541Ba4544862310933d4".toLowerCase()]: hn,
|
|
7425
7426
|
["0x1111111254fb6c44bAC0beD2854e76F90643097d".toLowerCase()]: ke,
|
|
7426
7427
|
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: Pe,
|
|
@@ -7428,12 +7429,12 @@ const ln = [
|
|
|
7428
7429
|
["0x10ED43C718714eb63d5aA57B78B54704E256024E".toLowerCase()]: Be,
|
|
7429
7430
|
// ETH
|
|
7430
7431
|
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: Pe,
|
|
7431
|
-
["0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f".toLowerCase()]:
|
|
7432
|
+
["0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f".toLowerCase()]: fn,
|
|
7432
7433
|
["0xEfF92A263d31888d860bD50809A8D171709b7b1c".toLowerCase()]: Be,
|
|
7433
7434
|
["0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D".toLowerCase()]: En,
|
|
7434
7435
|
["0xE592427A0AEce92De3Edee1F18E0157C05861564".toLowerCase()]: Rn,
|
|
7435
7436
|
["0x1111111254fb6c44bac0bed2854e76f90643097d".toLowerCase()]: ke
|
|
7436
|
-
},
|
|
7437
|
+
}, wn = [
|
|
7437
7438
|
{
|
|
7438
7439
|
inputs: [
|
|
7439
7440
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -8439,7 +8440,7 @@ const ln = [
|
|
|
8439
8440
|
// BSC
|
|
8440
8441
|
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: bn,
|
|
8441
8442
|
// ETH
|
|
8442
|
-
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]:
|
|
8443
|
+
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: wn,
|
|
8443
8444
|
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: In,
|
|
8444
8445
|
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: gn,
|
|
8445
8446
|
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: Cn,
|
|
@@ -8457,35 +8458,35 @@ const ln = [
|
|
|
8457
8458
|
data: p = "",
|
|
8458
8459
|
deadline: u,
|
|
8459
8460
|
memo: y,
|
|
8460
|
-
router:
|
|
8461
|
-
memoStreamingSwap:
|
|
8461
|
+
router: l,
|
|
8462
|
+
memoStreamingSwap: m,
|
|
8462
8463
|
tcMemo: T,
|
|
8463
8464
|
tcRouter: _,
|
|
8464
8465
|
tcVault: h,
|
|
8465
8466
|
vault: R,
|
|
8466
|
-
token:
|
|
8467
|
+
token: O
|
|
8467
8468
|
}
|
|
8468
8469
|
}) => {
|
|
8469
8470
|
const S = !!at[t.toLowerCase()];
|
|
8470
|
-
if (S && !
|
|
8471
|
+
if (S && !l)
|
|
8471
8472
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
8472
|
-
const
|
|
8473
|
+
const w = T || y, B = e && m || w;
|
|
8473
8474
|
if (!h && !R)
|
|
8474
8475
|
throw new Error("TC Vault is required on calldata");
|
|
8475
|
-
if (!_ && !
|
|
8476
|
+
if (!_ && !l)
|
|
8476
8477
|
throw new Error("TC Router is required on calldata");
|
|
8477
8478
|
if (!B)
|
|
8478
8479
|
throw new Error("TC Memo is required on calldata");
|
|
8479
|
-
if (!
|
|
8480
|
+
if (!O)
|
|
8480
8481
|
throw new Error("Token is required on calldata");
|
|
8481
8482
|
const Te = [
|
|
8482
8483
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
8483
|
-
a(_ ||
|
|
8484
|
+
a(_ || l),
|
|
8484
8485
|
a(h || R),
|
|
8485
8486
|
B.replace("{recipientAddress}", n),
|
|
8486
|
-
a(
|
|
8487
|
+
a(O),
|
|
8487
8488
|
i
|
|
8488
|
-
], it = S ? [a(
|
|
8489
|
+
], it = S ? [a(l), p, u] : [r, u];
|
|
8489
8490
|
return [...Te, ...it];
|
|
8490
8491
|
}, kn = ({ chain: e, txHash: t }) => {
|
|
8491
8492
|
const n = We[e];
|
|
@@ -8554,7 +8555,7 @@ const ln = [
|
|
|
8554
8555
|
return !0;
|
|
8555
8556
|
}
|
|
8556
8557
|
};
|
|
8557
|
-
var
|
|
8558
|
+
var F, ye, Z, v, z, ee;
|
|
8558
8559
|
class pa {
|
|
8559
8560
|
constructor({ stagenet: t } = {}) {
|
|
8560
8561
|
b(this, "connectedChains", Le());
|
|
@@ -8580,56 +8581,56 @@ class pa {
|
|
|
8580
8581
|
if (!a.complete)
|
|
8581
8582
|
throw new c("core_swap_route_not_complete");
|
|
8582
8583
|
if (Tt.includes(r) && p) {
|
|
8583
|
-
const
|
|
8584
|
-
if (!(
|
|
8584
|
+
const l = this.connectedWallets[p];
|
|
8585
|
+
if (!(l != null && l.sendTransaction))
|
|
8585
8586
|
throw new c("core_wallet_connection_not_found");
|
|
8586
8587
|
if (!(t ? (u = a == null ? void 0 : a.streamingSwap) == null ? void 0 : u.transaction : a == null ? void 0 : a.transaction))
|
|
8587
8588
|
throw new c("core_swap_route_transaction_not_found");
|
|
8588
|
-
const { data: T, from: _, to: h, value: R } = a.transaction,
|
|
8589
|
+
const { data: T, from: _, to: h, value: R } = a.transaction, O = {
|
|
8589
8590
|
data: T,
|
|
8590
8591
|
from: _,
|
|
8591
8592
|
to: h.toLowerCase(),
|
|
8592
|
-
chainId: BigInt(
|
|
8593
|
+
chainId: BigInt(Fe[p]),
|
|
8593
8594
|
value: R ? BigInt(R) : 0n
|
|
8594
8595
|
};
|
|
8595
|
-
return
|
|
8596
|
+
return l.sendTransaction(O, i);
|
|
8596
8597
|
}
|
|
8597
8598
|
if (bt.includes(r)) {
|
|
8598
8599
|
if (!a.calldata.fromAsset)
|
|
8599
8600
|
throw new c("core_swap_asset_not_recognized");
|
|
8600
|
-
const
|
|
8601
|
-
if (!
|
|
8601
|
+
const l = await x.fromString(a.calldata.fromAsset);
|
|
8602
|
+
if (!l)
|
|
8602
8603
|
throw new c("core_swap_asset_not_recognized");
|
|
8603
|
-
const { address:
|
|
8604
|
+
const { address: m } = await f(this, F).call(this, l.chain), {
|
|
8604
8605
|
contract: T,
|
|
8605
|
-
calldata: { expiration: _, amountIn: h, memo: R, memoStreamingSwap:
|
|
8606
|
-
} = a, S =
|
|
8606
|
+
calldata: { expiration: _, amountIn: h, memo: R, memoStreamingSwap: O }
|
|
8607
|
+
} = a, S = l.add(k.fromBigInt(BigInt(h), l.decimal)), w = t && O || R;
|
|
8607
8608
|
return this.deposit({
|
|
8608
8609
|
expiration: _,
|
|
8609
8610
|
assetValue: S,
|
|
8610
|
-
memo:
|
|
8611
|
+
memo: w,
|
|
8611
8612
|
feeOptionKey: i,
|
|
8612
8613
|
router: T,
|
|
8613
|
-
recipient:
|
|
8614
|
+
recipient: m
|
|
8614
8615
|
});
|
|
8615
8616
|
}
|
|
8616
8617
|
if (ct.includes(r) && p) {
|
|
8617
|
-
const { calldata:
|
|
8618
|
-
if (!
|
|
8618
|
+
const { calldata: l, contract: m } = a;
|
|
8619
|
+
if (!m)
|
|
8619
8620
|
throw new c("core_swap_contract_not_found");
|
|
8620
8621
|
const T = this.connectedWallets[p], _ = this.getAddress(p);
|
|
8621
8622
|
if (!(T != null && T.sendTransaction) || !_)
|
|
8622
8623
|
throw new c("core_wallet_connection_not_found");
|
|
8623
|
-
const { getProvider: h, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"),
|
|
8624
|
+
const { getProvider: h, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), O = h(p), S = xn[m.toLowerCase()];
|
|
8624
8625
|
if (!S)
|
|
8625
|
-
throw new c("core_swap_contract_not_supported", { contractAddress:
|
|
8626
|
-
const B = await (await ((y = T.createContract) == null ? void 0 : y.call(T,
|
|
8626
|
+
throw new c("core_swap_contract_not_supported", { contractAddress: m });
|
|
8627
|
+
const B = await (await ((y = T.createContract) == null ? void 0 : y.call(T, m, S, O))).getFunction("swapIn").populateTransaction(
|
|
8627
8628
|
...Pn({
|
|
8628
8629
|
streamSwap: t,
|
|
8629
8630
|
toChecksumAddress: R,
|
|
8630
|
-
contractAddress:
|
|
8631
|
+
contractAddress: m,
|
|
8631
8632
|
recipient: n,
|
|
8632
|
-
calldata:
|
|
8633
|
+
calldata: l
|
|
8633
8634
|
}),
|
|
8634
8635
|
{ from: _ }
|
|
8635
8636
|
);
|
|
@@ -8654,8 +8655,8 @@ class pa {
|
|
|
8654
8655
|
return console.error(y), { address: a, balance: i, walletType: r };
|
|
8655
8656
|
}
|
|
8656
8657
|
});
|
|
8657
|
-
b(this, "approveAssetValue", (t, n) =>
|
|
8658
|
-
b(this, "isAssetValueApproved", (t, n) =>
|
|
8658
|
+
b(this, "approveAssetValue", (t, n) => f(this, Z).call(this, { assetValue: t, type: "approve", contractAddress: n }));
|
|
8659
|
+
b(this, "isAssetValueApproved", (t, n) => f(this, Z).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
|
|
8659
8660
|
b(this, "validateAddress", ({ address: t, chain: n }) => {
|
|
8660
8661
|
var a, i;
|
|
8661
8662
|
return (i = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : i.call(a, t);
|
|
@@ -8665,7 +8666,7 @@ class pa {
|
|
|
8665
8666
|
if (!n)
|
|
8666
8667
|
throw new c("core_wallet_connection_not_found");
|
|
8667
8668
|
try {
|
|
8668
|
-
return await n.transfer(
|
|
8669
|
+
return await n.transfer(f(this, ee).call(this, t));
|
|
8669
8670
|
} catch (a) {
|
|
8670
8671
|
throw new c("core_swap_transaction_error", a);
|
|
8671
8672
|
}
|
|
@@ -8684,13 +8685,13 @@ class pa {
|
|
|
8684
8685
|
throw new c("core_transaction_invalid_sender_address");
|
|
8685
8686
|
if (!y)
|
|
8686
8687
|
throw new c("core_wallet_connection_not_found");
|
|
8687
|
-
const
|
|
8688
|
+
const m = f(this, ee).call(this, { assetValue: t, recipient: n, router: a, ...i });
|
|
8688
8689
|
try {
|
|
8689
8690
|
switch (r) {
|
|
8690
8691
|
case s.THORChain:
|
|
8691
8692
|
case s.Maya: {
|
|
8692
8693
|
const T = y;
|
|
8693
|
-
return await (n === "" ? T.deposit(
|
|
8694
|
+
return await (n === "" ? T.deposit(m) : T.transfer(m));
|
|
8694
8695
|
}
|
|
8695
8696
|
case s.Ethereum:
|
|
8696
8697
|
case s.BinanceSmartChain:
|
|
@@ -8698,27 +8699,27 @@ class pa {
|
|
|
8698
8699
|
const { getChecksumAddressFromAsset: T } = await import("@swapkit/toolbox-evm"), _ = r === s.Avalanche ? dt : r === s.BinanceSmartChain ? lt : ot;
|
|
8699
8700
|
return await y.call({
|
|
8700
8701
|
abi: _,
|
|
8701
|
-
contractAddress: a || (await
|
|
8702
|
+
contractAddress: a || (await f(this, F).call(this, r)).router,
|
|
8702
8703
|
funcName: "depositWithExpiry",
|
|
8703
8704
|
funcParams: [
|
|
8704
8705
|
n,
|
|
8705
8706
|
T({ chain: r, symbol: p, ticker: u }, r),
|
|
8706
8707
|
t.getBaseValue("string"),
|
|
8707
|
-
|
|
8708
|
+
m.memo,
|
|
8708
8709
|
i.expiration || parseInt(`${((/* @__PURE__ */ new Date()).getTime() + 15 * 60 * 1e3) / 1e3}`)
|
|
8709
8710
|
],
|
|
8710
8711
|
txOverrides: {
|
|
8711
|
-
from:
|
|
8712
|
+
from: m.from,
|
|
8712
8713
|
value: t.isGasAsset ? t.getBaseValue("bigint") : void 0
|
|
8713
8714
|
}
|
|
8714
8715
|
});
|
|
8715
8716
|
}
|
|
8716
8717
|
default:
|
|
8717
|
-
return await y.transfer(
|
|
8718
|
+
return await y.transfer(m);
|
|
8718
8719
|
}
|
|
8719
8720
|
} catch (T) {
|
|
8720
|
-
const _ = ((T == null ? void 0 : T.message) || (T == null ? void 0 : T.toString())).toLowerCase(), h = _ == null ? void 0 : _.includes("insufficient funds"), R = _ == null ? void 0 : _.includes("gas"),
|
|
8721
|
-
throw new c(
|
|
8721
|
+
const _ = ((T == null ? void 0 : T.message) || (T == null ? void 0 : T.toString())).toLowerCase(), h = _ == null ? void 0 : _.includes("insufficient funds"), R = _ == null ? void 0 : _.includes("gas"), O = _ == null ? void 0 : _.includes("server"), S = _ == null ? void 0 : _.includes("user rejected"), w = h ? "core_transaction_deposit_insufficient_funds_error" : R ? "core_transaction_deposit_gas_error" : O ? "core_transaction_deposit_server_error" : S ? "core_transaction_user_rejected" : "core_transaction_deposit_error";
|
|
8722
|
+
throw new c(w, T);
|
|
8722
8723
|
}
|
|
8723
8724
|
});
|
|
8724
8725
|
/**
|
|
@@ -8732,9 +8733,9 @@ class pa {
|
|
|
8732
8733
|
throw new c("core_transaction_create_liquidity_invalid_params");
|
|
8733
8734
|
let a = "", i = "";
|
|
8734
8735
|
try {
|
|
8735
|
-
a = await
|
|
8736
|
+
a = await f(this, v).call(this, {
|
|
8736
8737
|
assetValue: t,
|
|
8737
|
-
memo: D(
|
|
8738
|
+
memo: D(A.DEPOSIT, {
|
|
8738
8739
|
...n,
|
|
8739
8740
|
address: this.getAddress(n.chain)
|
|
8740
8741
|
})
|
|
@@ -8743,9 +8744,9 @@ class pa {
|
|
|
8743
8744
|
throw new c("core_transaction_create_liquidity_rune_error", r);
|
|
8744
8745
|
}
|
|
8745
8746
|
try {
|
|
8746
|
-
i = await
|
|
8747
|
+
i = await f(this, v).call(this, {
|
|
8747
8748
|
assetValue: n,
|
|
8748
|
-
memo: D(
|
|
8749
|
+
memo: D(A.DEPOSIT, {
|
|
8749
8750
|
...n,
|
|
8750
8751
|
address: this.getAddress(s.THORChain)
|
|
8751
8752
|
})
|
|
@@ -8763,31 +8764,31 @@ class pa {
|
|
|
8763
8764
|
isPendingSymmAsset: r,
|
|
8764
8765
|
mode: p = "sym"
|
|
8765
8766
|
}) => {
|
|
8766
|
-
const { chain: u, symbol: y } = n,
|
|
8767
|
-
if (!
|
|
8767
|
+
const { chain: u, symbol: y } = n, l = p === "sym", m = (t == null ? void 0 : t.gt(0)) && (l || p === "rune"), T = (n == null ? void 0 : n.gt(0)) && (l || p === "asset"), _ = r || m, h = _ ? a || this.getAddress(s.THORChain) : "", R = l || p === "asset" ? i || this.getAddress(u) : "";
|
|
8768
|
+
if (!m && !T)
|
|
8768
8769
|
throw new c("core_transaction_add_liquidity_invalid_params");
|
|
8769
8770
|
if (_ && !h)
|
|
8770
8771
|
throw new c("core_transaction_add_liquidity_no_rune_address");
|
|
8771
|
-
let
|
|
8772
|
-
if (
|
|
8772
|
+
let O, S;
|
|
8773
|
+
if (m && t)
|
|
8773
8774
|
try {
|
|
8774
|
-
|
|
8775
|
+
O = await f(this, v).call(this, {
|
|
8775
8776
|
assetValue: t,
|
|
8776
|
-
memo: D(
|
|
8777
|
+
memo: D(A.DEPOSIT, { chain: u, symbol: y, address: R })
|
|
8777
8778
|
});
|
|
8778
|
-
} catch (
|
|
8779
|
-
throw new c("core_transaction_add_liquidity_rune_error",
|
|
8779
|
+
} catch (w) {
|
|
8780
|
+
throw new c("core_transaction_add_liquidity_rune_error", w);
|
|
8780
8781
|
}
|
|
8781
8782
|
if (T && n)
|
|
8782
8783
|
try {
|
|
8783
|
-
S = await
|
|
8784
|
+
S = await f(this, v).call(this, {
|
|
8784
8785
|
assetValue: n,
|
|
8785
|
-
memo: D(
|
|
8786
|
+
memo: D(A.DEPOSIT, { chain: u, symbol: y, address: h })
|
|
8786
8787
|
});
|
|
8787
|
-
} catch (
|
|
8788
|
-
throw new c("core_transaction_add_liquidity_asset_error",
|
|
8788
|
+
} catch (w) {
|
|
8789
|
+
throw new c("core_transaction_add_liquidity_asset_error", w);
|
|
8789
8790
|
}
|
|
8790
|
-
return { runeTx:
|
|
8791
|
+
return { runeTx: O, assetTx: S };
|
|
8791
8792
|
});
|
|
8792
8793
|
b(this, "addLiquidityPart", ({
|
|
8793
8794
|
assetValue: t,
|
|
@@ -8797,12 +8798,12 @@ class pa {
|
|
|
8797
8798
|
}) => {
|
|
8798
8799
|
if (i && !a)
|
|
8799
8800
|
throw new c("core_transaction_add_liquidity_invalid_params");
|
|
8800
|
-
const r = D(
|
|
8801
|
+
const r = D(A.DEPOSIT, {
|
|
8801
8802
|
chain: n.split(".")[0],
|
|
8802
8803
|
symbol: n.split(".")[1],
|
|
8803
8804
|
address: i ? a : ""
|
|
8804
8805
|
});
|
|
8805
|
-
return
|
|
8806
|
+
return f(this, v).call(this, { assetValue: t, memo: r });
|
|
8806
8807
|
});
|
|
8807
8808
|
b(this, "withdraw", async ({
|
|
8808
8809
|
memo: t,
|
|
@@ -8811,7 +8812,7 @@ class pa {
|
|
|
8811
8812
|
from: i,
|
|
8812
8813
|
to: r
|
|
8813
8814
|
}) => {
|
|
8814
|
-
const p = r === "rune" && i !== "rune" ? x.fromChainOrSignature(s.THORChain) : i === "sym" && r === "sym" || i === "rune" || i === "asset" ? void 0 : n, u =
|
|
8815
|
+
const p = r === "rune" && i !== "rune" ? x.fromChainOrSignature(s.THORChain) : i === "sym" && r === "sym" || i === "rune" || i === "asset" ? void 0 : n, u = Ae(i === "asset" ? n.chain : s.THORChain), y = t || D(A.WITHDRAW, {
|
|
8815
8816
|
symbol: n.symbol,
|
|
8816
8817
|
chain: n.chain,
|
|
8817
8818
|
ticker: n.ticker,
|
|
@@ -8819,7 +8820,7 @@ class pa {
|
|
|
8819
8820
|
targetAssetString: p == null ? void 0 : p.toString(),
|
|
8820
8821
|
singleSide: !1
|
|
8821
8822
|
});
|
|
8822
|
-
return
|
|
8823
|
+
return f(this, v).call(this, { assetValue: u, memo: y });
|
|
8823
8824
|
});
|
|
8824
8825
|
b(this, "savings", async ({
|
|
8825
8826
|
assetValue: t,
|
|
@@ -8827,23 +8828,23 @@ class pa {
|
|
|
8827
8828
|
percent: a,
|
|
8828
8829
|
type: i
|
|
8829
8830
|
}) => {
|
|
8830
|
-
const r = i === "add" ?
|
|
8831
|
+
const r = i === "add" ? A.DEPOSIT : A.WITHDRAW, p = n || D(r, {
|
|
8831
8832
|
ticker: t.ticker,
|
|
8832
8833
|
symbol: t.symbol,
|
|
8833
8834
|
chain: t.chain,
|
|
8834
8835
|
singleSide: !0,
|
|
8835
8836
|
basisPoints: a ? Math.min(1e4, Math.round(a * 100)) : void 0
|
|
8836
|
-
}), u = r ===
|
|
8837
|
-
return
|
|
8837
|
+
}), u = r === A.DEPOSIT ? t : Ae(t.chain);
|
|
8838
|
+
return f(this, v).call(this, { memo: p, assetValue: u });
|
|
8838
8839
|
});
|
|
8839
8840
|
b(this, "loan", ({
|
|
8840
8841
|
assetValue: t,
|
|
8841
8842
|
memo: n,
|
|
8842
8843
|
minAmount: a,
|
|
8843
8844
|
type: i
|
|
8844
|
-
}) =>
|
|
8845
|
+
}) => f(this, v).call(this, {
|
|
8845
8846
|
assetValue: t,
|
|
8846
|
-
memo: n || D(i === "open" ?
|
|
8847
|
+
memo: n || D(i === "open" ? A.OPEN_LOAN : A.CLOSE_LOAN, {
|
|
8847
8848
|
asset: t.toString(),
|
|
8848
8849
|
minAmount: a.toString(),
|
|
8849
8850
|
address: this.getAddress(t.chain)
|
|
@@ -8854,24 +8855,24 @@ class pa {
|
|
|
8854
8855
|
assetValue: n,
|
|
8855
8856
|
address: a
|
|
8856
8857
|
}) => {
|
|
8857
|
-
const i = t === "bond" ?
|
|
8858
|
+
const i = t === "bond" ? A.BOND : t === "unbond" ? A.UNBOND : A.LEAVE, r = D(i, {
|
|
8858
8859
|
address: a,
|
|
8859
8860
|
unbondAmount: t === "unbond" ? n.getBaseValue("number") : void 0
|
|
8860
8861
|
});
|
|
8861
|
-
return
|
|
8862
|
+
return f(this, z).call(this, {
|
|
8862
8863
|
memo: r,
|
|
8863
|
-
assetValue: t === "bond" ? n :
|
|
8864
|
+
assetValue: t === "bond" ? n : Ae(s.THORChain)
|
|
8864
8865
|
});
|
|
8865
8866
|
});
|
|
8866
8867
|
b(this, "registerThorname", ({
|
|
8867
8868
|
assetValue: t,
|
|
8868
8869
|
...n
|
|
8869
|
-
}) =>
|
|
8870
|
+
}) => f(this, z).call(this, { assetValue: t, memo: D(A.THORNAME_REGISTER, n) }));
|
|
8870
8871
|
b(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: i = {} }) => {
|
|
8871
8872
|
try {
|
|
8872
8873
|
t.forEach((r) => {
|
|
8873
8874
|
this[r.connectMethodName] = r.connect({
|
|
8874
|
-
addChain:
|
|
8875
|
+
addChain: f(this, ye),
|
|
8875
8876
|
config: n || {},
|
|
8876
8877
|
apis: a,
|
|
8877
8878
|
rpcUrls: i
|
|
@@ -8950,7 +8951,7 @@ class pa {
|
|
|
8950
8951
|
b(this, "disconnectChain", (t) => {
|
|
8951
8952
|
this.connectedChains[t] = null, this.connectedWallets[t] = null;
|
|
8952
8953
|
});
|
|
8953
|
-
V(this,
|
|
8954
|
+
V(this, F, async (t) => {
|
|
8954
8955
|
switch (t) {
|
|
8955
8956
|
case s.Maya:
|
|
8956
8957
|
case s.THORChain:
|
|
@@ -8976,13 +8977,13 @@ class pa {
|
|
|
8976
8977
|
const { address: i, chain: r, isGasAsset: p, isSynthetic: u } = t, y = [s.Ethereum, s.Avalanche, s.BinanceSmartChain].includes(r);
|
|
8977
8978
|
if (y && p || !y || u)
|
|
8978
8979
|
return !0;
|
|
8979
|
-
const
|
|
8980
|
+
const m = this.connectedWallets[r], T = n === "checkOnly" ? m == null ? void 0 : m.isApproved : m == null ? void 0 : m.approve;
|
|
8980
8981
|
if (!T)
|
|
8981
8982
|
throw new c("core_wallet_connection_not_found");
|
|
8982
8983
|
const _ = this.getAddress(r);
|
|
8983
8984
|
if (!i || !_)
|
|
8984
8985
|
throw new c("core_approve_asset_address_or_from_not_found");
|
|
8985
|
-
const h = a || (await
|
|
8986
|
+
const h = a || (await f(this, F).call(this, r)).router;
|
|
8986
8987
|
return T({
|
|
8987
8988
|
amount: t.getBaseValue("bigint"),
|
|
8988
8989
|
assetAddress: i,
|
|
@@ -8999,7 +9000,7 @@ class pa {
|
|
|
8999
9000
|
gas_rate: i,
|
|
9000
9001
|
router: r,
|
|
9001
9002
|
address: p
|
|
9002
|
-
} = await
|
|
9003
|
+
} = await f(this, F).call(this, t.chain), u = (parseInt(i) || 0) * zt[a];
|
|
9003
9004
|
return this.deposit({
|
|
9004
9005
|
assetValue: t,
|
|
9005
9006
|
recipient: p,
|
|
@@ -9023,7 +9024,7 @@ class pa {
|
|
|
9023
9024
|
this.stagenet = !!t;
|
|
9024
9025
|
}
|
|
9025
9026
|
}
|
|
9026
|
-
|
|
9027
|
+
F = new WeakMap(), ye = new WeakMap(), Z = new WeakMap(), v = new WeakMap(), z = new WeakMap(), ee = new WeakMap();
|
|
9027
9028
|
export {
|
|
9028
9029
|
Tt as AGG_SWAP,
|
|
9029
9030
|
P as ApiEndpoints,
|
|
@@ -9035,11 +9036,11 @@ export {
|
|
|
9035
9036
|
s as Chain,
|
|
9036
9037
|
Se as ChainId,
|
|
9037
9038
|
Kn as ChainIdToChain,
|
|
9038
|
-
|
|
9039
|
+
Fe as ChainToChainId,
|
|
9039
9040
|
We as ChainToExplorerUrl,
|
|
9040
9041
|
jn as ChainToHexChainId,
|
|
9041
|
-
|
|
9042
|
-
|
|
9042
|
+
Ot as ChainToRPC,
|
|
9043
|
+
ft as ContractAddress,
|
|
9043
9044
|
Gn as CosmosChainList,
|
|
9044
9045
|
ht as DerivationPath,
|
|
9045
9046
|
o as ERROR_CODE,
|
|
@@ -9047,11 +9048,11 @@ export {
|
|
|
9047
9048
|
Ve as ERROR_TYPE,
|
|
9048
9049
|
Et as EVMChainList,
|
|
9049
9050
|
X as FeeOption,
|
|
9050
|
-
|
|
9051
|
-
|
|
9051
|
+
wt as LedgerErrorCode,
|
|
9052
|
+
A as MemoType,
|
|
9052
9053
|
$n as NetworkDerivationPath,
|
|
9053
9054
|
mt as QuoteMode,
|
|
9054
|
-
|
|
9055
|
+
Ue as RPCUrl,
|
|
9055
9056
|
g as RequestClient,
|
|
9056
9057
|
ct as SWAP_IN,
|
|
9057
9058
|
bt as SWAP_OUT,
|
|
@@ -9071,7 +9072,7 @@ export {
|
|
|
9071
9072
|
Jn as assetFromString,
|
|
9072
9073
|
Qe as defaultRequestHeaders,
|
|
9073
9074
|
ra as derivationPathToString,
|
|
9074
|
-
|
|
9075
|
+
Fn as erc20ABI,
|
|
9075
9076
|
Zn as filterAssets,
|
|
9076
9077
|
me as formatBigIntToSafeValue,
|
|
9077
9078
|
zt as gasFeeMultiplier,
|
|
@@ -9085,7 +9086,7 @@ export {
|
|
|
9085
9086
|
na as getEstimatedPoolShare,
|
|
9086
9087
|
aa as getLiquiditySlippage,
|
|
9087
9088
|
D as getMemoFor,
|
|
9088
|
-
|
|
9089
|
+
Ae as getMinAmountByChain,
|
|
9089
9090
|
pn as getSymmetricPoolShare,
|
|
9090
9091
|
ta as getSymmetricWithdraw,
|
|
9091
9092
|
ia as getTHORNameCost,
|