@swapkit/core 1.0.0-rc.89 → 1.0.0-rc.90
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 +320 -316
- package/dist/index.es.js.map +1 -1
- package/package.json +9 -9
- package/src/client/index.ts +115 -108
package/dist/index.es.js
CHANGED
|
@@ -624,59 +624,59 @@ 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 || {}),
|
|
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
628
|
const ft = {
|
|
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
|
+
[o.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
|
|
630
|
+
[o.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
|
|
631
|
+
[o.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
|
|
632
|
+
[o.NO_INBOUND_ADDRESSES]: "No inbound addresses.",
|
|
633
|
+
[o.CHAIN_HALTED_OR_UNSUPPORTED]: "Chain {0} halted or unsupported.",
|
|
634
|
+
[o.MISSING_INPUT_PARAMETER]: "Missing input parameter: {0}.",
|
|
635
|
+
[o.INVALID_TYPE_GENERIC]: "Invalid type",
|
|
636
|
+
[o.INVALID_NUMBER_STRING]: "Invalid number string.",
|
|
637
|
+
[o.INVALID_NUMBER]: "Invalid number.",
|
|
638
|
+
[o.INVALID_BOOLEAN]: "Invalid boolean.",
|
|
639
|
+
[o.INVALID_OBJECT]: "Invalid object.",
|
|
640
|
+
[o.INVALID_ARRAY]: "Invalid array.",
|
|
641
|
+
[o.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Sell amount must be a positive integer.",
|
|
642
|
+
[o.SELL_BUY_ASSETS_ARE_THE_SAME]: "Sell and buy assets are the same.",
|
|
643
|
+
[o.MISSING_SOURCE_ADDRESS_FOR_SYNTH]: "Source address is required for synth quote.",
|
|
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: 3 characters max.",
|
|
646
|
+
[o.AFF_BPS_INTEGER_MAX_500]: "affiliateBasisPoints must be an integer between 0 and 100.",
|
|
647
|
+
[o.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN]: "Source address {0} invalid for sell chain.",
|
|
648
|
+
[o.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN]: "Destination address {0} invalid for buy chain.",
|
|
649
|
+
[o.PREFERRED_PROVIDER_NOT_SUPPORTED]: "Preferred provider not supported.",
|
|
650
|
+
[o.SOURCE_ADDRESS_SMART_CONTRACT]: "Source address is a smart contract.",
|
|
651
|
+
[o.DESTINATION_ADDRESS_SMART_CONTRACT]: "Destination address is a smart contract.",
|
|
652
|
+
[o.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Buy amount must be a positive integer.",
|
|
653
|
+
[o.INVALID_PROVIDER]: "Invalid provider {0}.",
|
|
654
|
+
[o.MISSING_CROSS_CHAIN_PROVIDER]: "Missing cross-chain provider.",
|
|
655
|
+
[o.MISSING_AVAX_PROVIDER]: "Missing AVAX provider.",
|
|
656
|
+
[o.MISSING_BSC_PROVIDER]: "Missing BSC provider.",
|
|
657
|
+
[o.MISSING_ETH_PROVIDER]: "Missing ETH provider.",
|
|
658
|
+
[o.MISSING_ARB_PROVIDER]: "Missing ARB provider.",
|
|
659
|
+
[o.INVALID_PROVIDER_FOR_SWAP_OUT]: "Invalid provider for swap out.",
|
|
660
|
+
[o.INVALID_CHAIN]: "Invalid chain {0}.",
|
|
661
|
+
[o.INVALID_ASSET]: "Invalid asset {0}.",
|
|
662
|
+
[o.UNSUPPORTED_CHAIN]: "Unsupported chain {0}.",
|
|
663
|
+
[o.UNSUPPORTED_ASSET]: "Unsupported asset {0}.",
|
|
664
|
+
[o.UNSUPPORTED_ASSET_FOR_SWAPOUT]: "Unsupported asset {0} for swap out.",
|
|
665
|
+
[o.THORNODE_QUOTE_GENERIC_ERROR]: "ThorNode quote generic error.",
|
|
666
|
+
[o.INVALID_SOURCE_ADDRESS]: "Invalid source address {0}",
|
|
667
|
+
[o.INVALID_DESTINATION_ADDRESS]: "Invalid destination address {0}",
|
|
668
|
+
[o.NOT_ENOUGH_SYNTH_BALANCE]: "Source address doesn't have enough synth balance for this quote.",
|
|
669
|
+
[o.SYNTH_MINTING_CAP_REACHED]: "Synth minting cap reached.",
|
|
670
|
+
[o.INVALID_QUOTE_MODE]: "Invalid quote mode.",
|
|
671
|
+
[o.NO_QUOTES]: "No quotes to service this request.",
|
|
672
|
+
[o.SERVICE_UNAVAILABLE_GENERIC]: "Service unavailable.",
|
|
673
|
+
[o.MISSING_GAS_DATA_GENERIC]: "Missing gas data.",
|
|
674
|
+
[o.MISSING_TOKEN_INFO_GENERIC]: "Missing token info.",
|
|
675
|
+
[o.CANT_FIND_TOKEN_LIST]: "Can't find tokenlist {0}.",
|
|
676
|
+
[o.NO_PRICE]: "No price for asset {0}.",
|
|
677
|
+
[o.PRICE_IS_STALE]: "Price is stale for asset {0}.",
|
|
678
|
+
[o.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
|
|
679
|
+
[o.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
|
|
680
680
|
}, ce = (e, t) => {
|
|
681
681
|
let n = ft[e];
|
|
682
682
|
if (!n)
|
|
@@ -693,19 +693,19 @@ let Wn = class He extends Error {
|
|
|
693
693
|
code: i,
|
|
694
694
|
message: r,
|
|
695
695
|
type: p,
|
|
696
|
-
options: { shouldLog: u, shouldThrow: y, shouldTrace:
|
|
696
|
+
options: { shouldLog: u, shouldThrow: y, shouldTrace: m } = {
|
|
697
697
|
shouldLog: !0,
|
|
698
698
|
shouldThrow: !0,
|
|
699
699
|
shouldTrace: !0
|
|
700
700
|
},
|
|
701
|
-
displayMessageParams:
|
|
701
|
+
displayMessageParams: l
|
|
702
702
|
}) {
|
|
703
|
-
const
|
|
704
|
-
super(
|
|
703
|
+
const T = r || ce(i, l || []) || "";
|
|
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, l || []), this.code = i, this.type = p || Ve.UNHANDLED_ERROR, this.options = {
|
|
705
705
|
shouldLog: u || !0,
|
|
706
|
-
shouldTrace:
|
|
706
|
+
shouldTrace: m || !0,
|
|
707
707
|
shouldThrow: y || !1
|
|
708
|
-
}, this.displayMessageParams =
|
|
708
|
+
}, this.displayMessageParams = l || [], this.options.shouldTrace && Error.captureStackTrace(this);
|
|
709
709
|
}
|
|
710
710
|
static fromErrorInfo(t) {
|
|
711
711
|
return new He(t);
|
|
@@ -745,7 +745,7 @@ const $n = {
|
|
|
745
745
|
OP: [44, 60, 0, 0, 0],
|
|
746
746
|
THOR: [44, 931, 0, 0, 0]
|
|
747
747
|
};
|
|
748
|
-
var
|
|
748
|
+
var E = /* @__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))(E || {});
|
|
749
749
|
const Et = [
|
|
750
750
|
"ETH",
|
|
751
751
|
"AVAX",
|
|
@@ -778,7 +778,7 @@ const Et = [
|
|
|
778
778
|
"THOR"
|
|
779
779
|
/* THORChain */
|
|
780
780
|
];
|
|
781
|
-
var
|
|
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 || {}), Fe = /* @__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))(Fe || {}), 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 || {});
|
|
782
782
|
const oe = Object.values(s), Rt = Object.keys(s), Oe = oe.reduce(
|
|
783
783
|
(e, t) => {
|
|
784
784
|
const n = Rt.find((a) => s[a] === t);
|
|
@@ -786,15 +786,15 @@ const oe = Object.values(s), Rt = Object.keys(s), Oe = oe.reduce(
|
|
|
786
786
|
},
|
|
787
787
|
{}
|
|
788
788
|
), Ue = oe.reduce(
|
|
789
|
-
(e, t) => (e[t] =
|
|
789
|
+
(e, t) => (e[t] = Se[Oe[t]], e),
|
|
790
790
|
{}
|
|
791
|
-
),
|
|
791
|
+
), wt = oe.reduce(
|
|
792
792
|
(e, t) => (e[t] = Fe[Oe[t]], e),
|
|
793
793
|
{}
|
|
794
794
|
), jn = oe.reduce(
|
|
795
795
|
(e, t) => {
|
|
796
796
|
const n = `${Oe[t]}Hex`;
|
|
797
|
-
return e[t] =
|
|
797
|
+
return e[t] = Se[n], e;
|
|
798
798
|
},
|
|
799
799
|
{}
|
|
800
800
|
), Kn = {
|
|
@@ -839,15 +839,15 @@ const oe = Object.values(s), Rt = Object.keys(s), Oe = oe.reduce(
|
|
|
839
839
|
MATIC: "https://polygonscan.com",
|
|
840
840
|
THOR: "https://runescan.io"
|
|
841
841
|
};
|
|
842
|
-
var
|
|
842
|
+
var f = /* @__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))(f || {}), 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 || {}), Ot = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e[e.LockedDevice = 21781] = "LockedDevice", e[e.TC_NotFound = 65535] = "TC_NotFound", e))(Ot || {}), 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
843
|
if (!t.has(e))
|
|
844
844
|
throw TypeError("Cannot " + n);
|
|
845
845
|
}, q = (e, t, n) => {
|
|
846
846
|
if (t.has(e))
|
|
847
847
|
throw TypeError("Cannot add the same private member more than once");
|
|
848
848
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
849
|
-
},
|
|
850
|
-
|
|
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 + "";
|
|
851
851
|
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
852
|
const le = Object.values(de), Ct = Object.keys(de), Ie = le.reduce(
|
|
853
853
|
(e, t) => {
|
|
@@ -1192,17 +1192,17 @@ class re {
|
|
|
1192
1192
|
const p = t.body.getReader();
|
|
1193
1193
|
n && n({ percent: 0, transferredBytes: 0, totalBytes: a }, new Uint8Array());
|
|
1194
1194
|
async function u() {
|
|
1195
|
-
const { done: y, value:
|
|
1195
|
+
const { done: y, value: m } = await p.read();
|
|
1196
1196
|
if (y) {
|
|
1197
1197
|
r.close();
|
|
1198
1198
|
return;
|
|
1199
1199
|
}
|
|
1200
1200
|
if (n) {
|
|
1201
|
-
i +=
|
|
1202
|
-
const
|
|
1203
|
-
n({ percent:
|
|
1201
|
+
i += m.byteLength;
|
|
1202
|
+
const l = a === 0 ? 0 : i / a;
|
|
1203
|
+
n({ percent: l, transferredBytes: i, totalBytes: a }, m);
|
|
1204
1204
|
}
|
|
1205
|
-
r.enqueue(
|
|
1205
|
+
r.enqueue(m), await u();
|
|
1206
1206
|
}
|
|
1207
1207
|
await u();
|
|
1208
1208
|
}
|
|
@@ -1257,7 +1257,7 @@ const P = {
|
|
|
1257
1257
|
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
1258
|
const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
1259
1259
|
try {
|
|
1260
|
-
const { result: n } = await g.post(
|
|
1260
|
+
const { result: n } = await g.post(wt[e], {
|
|
1261
1261
|
headers: {
|
|
1262
1262
|
accept: "*/*",
|
|
1263
1263
|
"content-type": "application/json",
|
|
@@ -1272,17 +1272,17 @@ const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1272
1272
|
});
|
|
1273
1273
|
return parseInt(BigInt(n).toString());
|
|
1274
1274
|
} catch (n) {
|
|
1275
|
-
return console.error(n),
|
|
1275
|
+
return console.error(n), E[e];
|
|
1276
1276
|
}
|
|
1277
1277
|
}, Yt = async (e) => {
|
|
1278
1278
|
if (e === s.Ethereum)
|
|
1279
|
-
return
|
|
1279
|
+
return E.ETH;
|
|
1280
1280
|
const [, t] = e.split("-");
|
|
1281
|
-
return t != null && t.startsWith("0x") ? Je({ chain: s.Ethereum, to: t }) :
|
|
1281
|
+
return t != null && t.startsWith("0x") ? Je({ chain: s.Ethereum, to: t }) : E.ETH;
|
|
1282
1282
|
}, Qt = async (e) => {
|
|
1283
1283
|
const [, t] = e.split("-");
|
|
1284
|
-
return t != null && t.startsWith("0x") ? Je({ chain: s.Avalanche, to: t.toLowerCase() }) :
|
|
1285
|
-
}, Jt = async (e) => (e === s.BinanceSmartChain,
|
|
1284
|
+
return t != null && t.startsWith("0x") ? Je({ chain: s.Avalanche, to: t.toLowerCase() }) : E.AVAX;
|
|
1285
|
+
}, Jt = async (e) => (e === s.BinanceSmartChain, E.BSC), Zt = async ({ chain: e, symbol: t }) => {
|
|
1286
1286
|
switch (e) {
|
|
1287
1287
|
case s.Ethereum:
|
|
1288
1288
|
return Yt(t);
|
|
@@ -1291,7 +1291,7 @@ const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1291
1291
|
case s.BinanceSmartChain:
|
|
1292
1292
|
return Jt(t);
|
|
1293
1293
|
default:
|
|
1294
|
-
return
|
|
1294
|
+
return E[e];
|
|
1295
1295
|
}
|
|
1296
1296
|
}, zt = {
|
|
1297
1297
|
[X.Average]: 1.2,
|
|
@@ -1330,13 +1330,13 @@ const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1330
1330
|
case `${s.Ethereum}.vTHOR`:
|
|
1331
1331
|
return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
|
|
1332
1332
|
case s.Cosmos:
|
|
1333
|
-
return { identifier: "GAIA.ATOM", decimal:
|
|
1333
|
+
return { identifier: "GAIA.ATOM", decimal: E[e] };
|
|
1334
1334
|
case s.THORChain:
|
|
1335
|
-
return { identifier: "THOR.RUNE", decimal:
|
|
1335
|
+
return { identifier: "THOR.RUNE", decimal: E[e] };
|
|
1336
1336
|
case s.BinanceSmartChain:
|
|
1337
|
-
return { identifier: "BSC.BNB", decimal:
|
|
1337
|
+
return { identifier: "BSC.BNB", decimal: E[e] };
|
|
1338
1338
|
case s.Maya:
|
|
1339
|
-
return { identifier: "MAYA.CACAO", decimal:
|
|
1339
|
+
return { identifier: "MAYA.CACAO", decimal: E.MAYA };
|
|
1340
1340
|
case `${s.Maya}.MAYA`:
|
|
1341
1341
|
return { identifier: "MAYA.MAYA", decimal: 4 };
|
|
1342
1342
|
case `${s.Kujira}.USK`:
|
|
@@ -1352,7 +1352,7 @@ const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1352
1352
|
case s.Polygon:
|
|
1353
1353
|
case s.Bitcoin:
|
|
1354
1354
|
case s.Ethereum:
|
|
1355
|
-
return { identifier: `${e}.${e}`, decimal:
|
|
1355
|
+
return { identifier: `${e}.${e}`, decimal: E[e] };
|
|
1356
1356
|
}
|
|
1357
1357
|
}, tn = ({ chain: e, symbol: t }) => {
|
|
1358
1358
|
if (t.includes("/"))
|
|
@@ -1406,16 +1406,16 @@ function sn({
|
|
|
1406
1406
|
poolUnits: t,
|
|
1407
1407
|
runeDepth: n
|
|
1408
1408
|
}) {
|
|
1409
|
-
const a =
|
|
1410
|
-
return p.mul(u.sub(y).add(
|
|
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), m = a.mul(a), l = i.mul(i).mul(i);
|
|
1410
|
+
return p.mul(u.sub(y).add(m)).div(l);
|
|
1411
1411
|
}
|
|
1412
1412
|
function rn({
|
|
1413
1413
|
liquidityUnits: e,
|
|
1414
1414
|
poolUnits: t,
|
|
1415
1415
|
assetDepth: n
|
|
1416
1416
|
}) {
|
|
1417
|
-
const a =
|
|
1418
|
-
return
|
|
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), m = a.mul(a), l = p.mul(u.sub(y).add(m)), T = i.mul(i).mul(i);
|
|
1418
|
+
return l.div(T);
|
|
1419
1419
|
}
|
|
1420
1420
|
function zn({
|
|
1421
1421
|
percent: e,
|
|
@@ -1433,8 +1433,8 @@ function ea({
|
|
|
1433
1433
|
}) {
|
|
1434
1434
|
return rn({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
|
|
1435
1435
|
}
|
|
1436
|
-
function
|
|
1437
|
-
return k.fromBigInt(BigInt(e),
|
|
1436
|
+
function I(e) {
|
|
1437
|
+
return k.fromBigInt(BigInt(e), E.THOR);
|
|
1438
1438
|
}
|
|
1439
1439
|
function pn({
|
|
1440
1440
|
liquidityUnits: e,
|
|
@@ -1443,8 +1443,8 @@ function pn({
|
|
|
1443
1443
|
assetDepth: a
|
|
1444
1444
|
}) {
|
|
1445
1445
|
return {
|
|
1446
|
-
assetAmount:
|
|
1447
|
-
runeAmount:
|
|
1446
|
+
assetAmount: I(a).mul(e).div(t),
|
|
1447
|
+
runeAmount: I(n).mul(e).div(t)
|
|
1448
1448
|
};
|
|
1449
1449
|
}
|
|
1450
1450
|
function ta({
|
|
@@ -1468,8 +1468,8 @@ function na({
|
|
|
1468
1468
|
runeAmount: i,
|
|
1469
1469
|
assetAmount: r
|
|
1470
1470
|
}) {
|
|
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 (
|
|
1471
|
+
const p = new k({ value: e, decimal: 8 }), u = new k({ value: n, decimal: 8 }), y = new k({ value: t, decimal: 8 }), m = new k({ value: i, decimal: 8 }), l = new k({ value: r, decimal: 8 }), T = m.mul(u), _ = l.mul(p), h = m.mul(l), R = p.mul(u), w = y.mul(T.add(_.add(h.mul(2)))), S = T.add(_.add(R.mul(2))), O = w.div(S), B = I(a).add(O);
|
|
1472
|
+
if (O.getBaseValue("number") === 0)
|
|
1473
1473
|
return B.div(y).getBaseValue("number");
|
|
1474
1474
|
const Te = y.add(B);
|
|
1475
1475
|
return B.div(Te).getBaseValue("number");
|
|
@@ -1482,25 +1482,25 @@ function aa({
|
|
|
1482
1482
|
}) {
|
|
1483
1483
|
if (e === "0" || t === "0" || n === "0" || a === "0")
|
|
1484
1484
|
return 0;
|
|
1485
|
-
const i =
|
|
1486
|
-
return Math.abs(y.div(
|
|
1485
|
+
const i = I(n), r = I(a), p = I(t), u = I(e), y = p.mul(i).sub(r.mul(u)), m = r.mul(u).add(i.mul(r));
|
|
1486
|
+
return Math.abs(y.div(m).getBaseValue("number"));
|
|
1487
1487
|
}
|
|
1488
1488
|
const D = (e, t) => {
|
|
1489
1489
|
switch (e) {
|
|
1490
|
-
case
|
|
1491
|
-
case
|
|
1490
|
+
case f.LEAVE:
|
|
1491
|
+
case f.BOND: {
|
|
1492
1492
|
const { address: n } = t;
|
|
1493
1493
|
return `${e}:${n}`;
|
|
1494
1494
|
}
|
|
1495
|
-
case
|
|
1495
|
+
case f.UNBOND: {
|
|
1496
1496
|
const { address: n, unbondAmount: a } = t;
|
|
1497
1497
|
return `${e}:${n}:${a}`;
|
|
1498
1498
|
}
|
|
1499
|
-
case
|
|
1499
|
+
case f.THORNAME_REGISTER: {
|
|
1500
1500
|
const { name: n, chain: a, address: i, owner: r } = t;
|
|
1501
1501
|
return `${e}:${n}:${a}:${i}${r ? `:${r}` : ""}`;
|
|
1502
1502
|
}
|
|
1503
|
-
case
|
|
1503
|
+
case f.DEPOSIT: {
|
|
1504
1504
|
const { chain: n, symbol: a, address: i, singleSide: r } = t;
|
|
1505
1505
|
return r ? `${e}:${n}/${a}::t:0` : `${e}:${((p, u) => {
|
|
1506
1506
|
switch (p) {
|
|
@@ -1515,12 +1515,12 @@ const D = (e, t) => {
|
|
|
1515
1515
|
}
|
|
1516
1516
|
})(n, a)}:${i || ""}:t:0`;
|
|
1517
1517
|
}
|
|
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}${
|
|
1518
|
+
case f.WITHDRAW: {
|
|
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, m = !u && p ? `:${p}` : "";
|
|
1520
|
+
return `${e}:${n}${u ? "/" : "."}${y}:${r}${m}`;
|
|
1521
1521
|
}
|
|
1522
|
-
case
|
|
1523
|
-
case
|
|
1522
|
+
case f.OPEN_LOAN:
|
|
1523
|
+
case f.CLOSE_LOAN: {
|
|
1524
1524
|
const { asset: n, address: a } = t;
|
|
1525
1525
|
return `${e}:${n}:${a}`;
|
|
1526
1526
|
}
|
|
@@ -1577,8 +1577,8 @@ var W, G, H, $, Ee, ze, ie, _e, pe, Re;
|
|
|
1577
1577
|
const yn = class et {
|
|
1578
1578
|
constructor(t) {
|
|
1579
1579
|
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 : F(Math.max(nt(ue(n)), this.decimal || 0)),
|
|
1580
|
+
const n = we(t), a = typeof t == "object";
|
|
1581
|
+
this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier : F(Math.max(nt(ue(n)), this.decimal || 0)), M(this, Ee, ze).call(this, n);
|
|
1582
1582
|
}
|
|
1583
1583
|
static fromBigInt(t, n) {
|
|
1584
1584
|
return new et({
|
|
@@ -1600,31 +1600,31 @@ const yn = class et {
|
|
|
1600
1600
|
return new this.constructor({ decimal: this.decimal, value: t, identifier: this.toString() });
|
|
1601
1601
|
}
|
|
1602
1602
|
add(...t) {
|
|
1603
|
-
return
|
|
1603
|
+
return M(this, W, G).call(this, "add", ...t);
|
|
1604
1604
|
}
|
|
1605
1605
|
sub(...t) {
|
|
1606
|
-
return
|
|
1606
|
+
return M(this, W, G).call(this, "sub", ...t);
|
|
1607
1607
|
}
|
|
1608
1608
|
mul(...t) {
|
|
1609
|
-
return
|
|
1609
|
+
return M(this, W, G).call(this, "mul", ...t);
|
|
1610
1610
|
}
|
|
1611
1611
|
div(...t) {
|
|
1612
|
-
return
|
|
1612
|
+
return M(this, W, G).call(this, "div", ...t);
|
|
1613
1613
|
}
|
|
1614
1614
|
gt(t) {
|
|
1615
|
-
return
|
|
1615
|
+
return M(this, H, $).call(this, "gt", t);
|
|
1616
1616
|
}
|
|
1617
1617
|
gte(t) {
|
|
1618
|
-
return
|
|
1618
|
+
return M(this, H, $).call(this, "gte", t);
|
|
1619
1619
|
}
|
|
1620
1620
|
lt(t) {
|
|
1621
|
-
return
|
|
1621
|
+
return M(this, H, $).call(this, "lt", t);
|
|
1622
1622
|
}
|
|
1623
1623
|
lte(t) {
|
|
1624
|
-
return
|
|
1624
|
+
return M(this, H, $).call(this, "lte", t);
|
|
1625
1625
|
}
|
|
1626
1626
|
eqValue(t) {
|
|
1627
|
-
return
|
|
1627
|
+
return M(this, H, $).call(this, "eqValue", t);
|
|
1628
1628
|
}
|
|
1629
1629
|
// @ts-expect-error False positive
|
|
1630
1630
|
getValue(t) {
|
|
@@ -1643,7 +1643,7 @@ const yn = class et {
|
|
|
1643
1643
|
}
|
|
1644
1644
|
// @ts-expect-error
|
|
1645
1645
|
getBaseValue(t) {
|
|
1646
|
-
const n = this.decimalMultiplier / F(this.decimal ||
|
|
1646
|
+
const n = this.decimalMultiplier / F(this.decimal || E.THOR), a = this.bigIntValue / n;
|
|
1647
1647
|
switch (t) {
|
|
1648
1648
|
case "number":
|
|
1649
1649
|
return Number(a);
|
|
@@ -1656,8 +1656,8 @@ const yn = class et {
|
|
|
1656
1656
|
getBigIntValue(t, n) {
|
|
1657
1657
|
if (!n && typeof t == "object")
|
|
1658
1658
|
return t.bigIntValue;
|
|
1659
|
-
const a =
|
|
1660
|
-
return i === "0" || i === "undefined" ? 0n :
|
|
1659
|
+
const a = we(t), i = ue(a);
|
|
1660
|
+
return i === "0" || i === "undefined" ? 0n : M(this, pe, Re).call(this, i, n);
|
|
1661
1661
|
}
|
|
1662
1662
|
toSignificant(t = 6) {
|
|
1663
1663
|
const [n, a] = this.getValue("string").split("."), i = n || "", r = a || "";
|
|
@@ -1699,36 +1699,36 @@ const yn = class et {
|
|
|
1699
1699
|
decimalSeparator: i = ".",
|
|
1700
1700
|
thousandSeparator: r = ","
|
|
1701
1701
|
} = {}) {
|
|
1702
|
-
const p = this.getValue("number"), [u, y = ""] = p.toFixed(6).split("."),
|
|
1703
|
-
return `${n === "start" ? t : ""}${
|
|
1702
|
+
const p = this.getValue("number"), [u, y = ""] = p.toFixed(6).split("."), m = u.replace(/\B(?=(\d{3})+(?!\d))/g, r), l = !u && !y ? "0.00" : u === "0" ? `${parseFloat(`0.${y}`)}`.replace(".", i) : `${m}${parseInt(y) ? `${i}${y.slice(0, a)}` : ""}`;
|
|
1703
|
+
return `${n === "start" ? t : ""}${l}${n === "end" ? t : ""}`;
|
|
1704
1704
|
}
|
|
1705
1705
|
formatBigIntToSafeValue(t, n) {
|
|
1706
1706
|
const a = n || this.decimal || J, i = Math.max(
|
|
1707
1707
|
a,
|
|
1708
1708
|
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(
|
|
1709
|
+
), r = t < 0n, p = t.toString().substring(r ? 1 : 0), u = i - (p.length - 1), y = u > 0 ? "0".repeat(u) + p : p, m = y.length - i;
|
|
1710
|
+
let l = y.slice(-i);
|
|
1711
|
+
return parseInt(l[a]) >= 5 ? l = `${l.substring(0, a - 1)}${(parseInt(l[a - 1]) + 1).toString()}` : l = l.substring(0, a), `${r ? "-" : ""}${y.slice(
|
|
1712
1712
|
0,
|
|
1713
|
-
|
|
1714
|
-
)}.${
|
|
1713
|
+
m
|
|
1714
|
+
)}.${l}`.replace(/\.?0*$/, "");
|
|
1715
1715
|
}
|
|
1716
1716
|
};
|
|
1717
1717
|
W = /* @__PURE__ */ new WeakSet(), G = function(e, ...t) {
|
|
1718
|
-
const n =
|
|
1718
|
+
const n = M(this, ie, _e).call(this, this, ...t), a = Math.max(n, j(this.decimalMultiplier)), i = F(a), r = t.reduce(
|
|
1719
1719
|
(u, y) => {
|
|
1720
|
-
const
|
|
1720
|
+
const m = this.getBigIntValue(y, a);
|
|
1721
1721
|
switch (e) {
|
|
1722
1722
|
case "add":
|
|
1723
|
-
return u +
|
|
1723
|
+
return u + m;
|
|
1724
1724
|
case "sub":
|
|
1725
|
-
return u -
|
|
1725
|
+
return u - m;
|
|
1726
1726
|
case "mul":
|
|
1727
|
-
return u *
|
|
1727
|
+
return u * m / i;
|
|
1728
1728
|
case "div": {
|
|
1729
|
-
if (
|
|
1729
|
+
if (m === 0n)
|
|
1730
1730
|
throw new RangeError("Division by zero");
|
|
1731
|
-
return u * i /
|
|
1731
|
+
return u * i / m;
|
|
1732
1732
|
}
|
|
1733
1733
|
default:
|
|
1734
1734
|
return u;
|
|
@@ -1748,7 +1748,7 @@ W = /* @__PURE__ */ new WeakSet(), G = function(e, ...t) {
|
|
|
1748
1748
|
identifier: this.toString()
|
|
1749
1749
|
});
|
|
1750
1750
|
}, H = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
|
|
1751
|
-
const n =
|
|
1751
|
+
const n = M(this, ie, _e).call(this, this, ...t), a = this.getBigIntValue(t[0], n), i = this.getBigIntValue(this, n);
|
|
1752
1752
|
switch (e) {
|
|
1753
1753
|
case "gt":
|
|
1754
1754
|
return i > a;
|
|
@@ -1763,7 +1763,7 @@ W = /* @__PURE__ */ new WeakSet(), G = function(e, ...t) {
|
|
|
1763
1763
|
}
|
|
1764
1764
|
}, Ee = /* @__PURE__ */ new WeakSet(), ze = function(e) {
|
|
1765
1765
|
const t = ue(e) || "0";
|
|
1766
|
-
this.bigIntValue =
|
|
1766
|
+
this.bigIntValue = M(this, pe, Re).call(this, t);
|
|
1767
1767
|
}, ie = /* @__PURE__ */ new WeakSet(), _e = function(...e) {
|
|
1768
1768
|
const t = e.map((n) => typeof n == "object" ? n.decimal || j(n.decimalMultiplier) : nt(ue(n))).filter(Boolean);
|
|
1769
1769
|
return Math.max(...t, J);
|
|
@@ -1777,7 +1777,7 @@ const on = Intl.NumberFormat("fullwide", {
|
|
|
1777
1777
|
maximumFractionDigits: 20
|
|
1778
1778
|
});
|
|
1779
1779
|
function ue(e) {
|
|
1780
|
-
const t = `${typeof e == "number" ? on.format(e) :
|
|
1780
|
+
const t = `${typeof e == "number" ? on.format(e) : we(e)}`.replaceAll(",", ".").split(".");
|
|
1781
1781
|
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1782
1782
|
}
|
|
1783
1783
|
function nt(e) {
|
|
@@ -1785,7 +1785,7 @@ function nt(e) {
|
|
|
1785
1785
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1786
1786
|
return Math.max(n, J);
|
|
1787
1787
|
}
|
|
1788
|
-
function
|
|
1788
|
+
function we(e) {
|
|
1789
1789
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1790
1790
|
}
|
|
1791
1791
|
const K = /* @__PURE__ */ new Map();
|
|
@@ -1835,7 +1835,7 @@ class x extends tt {
|
|
|
1835
1835
|
if (i)
|
|
1836
1836
|
return xe(t, n);
|
|
1837
1837
|
const { tax: p, decimal: u, identifier: y } = r || {
|
|
1838
|
-
decimal:
|
|
1838
|
+
decimal: E[a],
|
|
1839
1839
|
identifier: t
|
|
1840
1840
|
};
|
|
1841
1841
|
return new x({
|
|
@@ -1850,7 +1850,7 @@ class x extends tt {
|
|
|
1850
1850
|
if (i)
|
|
1851
1851
|
return xe(t, n);
|
|
1852
1852
|
const { tax: p, decimal: u, identifier: y } = r || {
|
|
1853
|
-
decimal:
|
|
1853
|
+
decimal: E[a],
|
|
1854
1854
|
identifier: t
|
|
1855
1855
|
};
|
|
1856
1856
|
return new x({ tax: p, decimal: u, identifier: y, value: Y(n, u) });
|
|
@@ -1869,7 +1869,7 @@ class x extends tt {
|
|
|
1869
1869
|
(r = i == null ? void 0 : i.tokens) == null || r.forEach(({ identifier: p, chain: u, ...y }) => {
|
|
1870
1870
|
K.set(p.toUpperCase(), {
|
|
1871
1871
|
identifier: p,
|
|
1872
|
-
decimal: "decimals" in y ? y.decimals :
|
|
1872
|
+
decimal: "decimals" in y ? y.decimals : E[u]
|
|
1873
1873
|
});
|
|
1874
1874
|
});
|
|
1875
1875
|
}), t({ ok: !0 });
|
|
@@ -1986,19 +1986,24 @@ const dn = {
|
|
|
1986
1986
|
core_transaction_deposit_insufficient_funds_error: 10311,
|
|
1987
1987
|
core_transaction_deposit_gas_error: 10312,
|
|
1988
1988
|
core_transaction_invalid_sender_address: 10313,
|
|
1989
|
-
core_transaction_deposit_server_error:
|
|
1989
|
+
core_transaction_deposit_server_error: 10314,
|
|
1990
|
+
core_transaction_user_rejected: 10315,
|
|
1990
1991
|
/**
|
|
1991
1992
|
* Wallets
|
|
1992
1993
|
*/
|
|
1993
1994
|
wallet_ledger_connection_error: 20001,
|
|
1995
|
+
wallet_ledger_connection_claimed: 20002,
|
|
1996
|
+
wallet_ledger_get_address_error: 20003,
|
|
1997
|
+
wallet_ledger_device_not_found: 20004,
|
|
1998
|
+
wallet_ledger_device_locked: 20005,
|
|
1994
1999
|
/**
|
|
1995
2000
|
* Helpers
|
|
1996
2001
|
*/
|
|
1997
2002
|
helpers_number_different_decimals: 99101
|
|
1998
2003
|
};
|
|
1999
|
-
class
|
|
2004
|
+
class c extends Error {
|
|
2000
2005
|
constructor(t, n) {
|
|
2001
|
-
console.error(n, { stack: n == null ? void 0 : n.stack, message: n == null ? void 0 : n.message }), super(t, { cause: { code: dn[t], message: t } }), Object.setPrototypeOf(this,
|
|
2006
|
+
n && console.error(n, { stack: n == null ? void 0 : n.stack, message: n == null ? void 0 : n.message }), super(t, { cause: { code: dn[t], message: t } }), Object.setPrototypeOf(this, c.prototype);
|
|
2002
2007
|
}
|
|
2003
2008
|
}
|
|
2004
2009
|
class k extends tt {
|
|
@@ -7242,7 +7247,7 @@ const ln = [
|
|
|
7242
7247
|
type: "function"
|
|
7243
7248
|
},
|
|
7244
7249
|
{ stateMutability: "payable", type: "receive" }
|
|
7245
|
-
],
|
|
7250
|
+
], wn = [
|
|
7246
7251
|
{
|
|
7247
7252
|
inputs: [
|
|
7248
7253
|
{ internalType: "address", name: "_weth", type: "address" },
|
|
@@ -7412,10 +7417,10 @@ const ln = [
|
|
|
7412
7417
|
type: "function"
|
|
7413
7418
|
},
|
|
7414
7419
|
{ stateMutability: "payable", type: "receive" }
|
|
7415
|
-
],
|
|
7420
|
+
], Sn = {
|
|
7416
7421
|
// AVAX
|
|
7417
7422
|
["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106".toLowerCase()]: fn,
|
|
7418
|
-
["0xC22FBb3133dF781E6C25ea6acebe2D2Bb8CeA2f9".toLowerCase()]:
|
|
7423
|
+
["0xC22FBb3133dF781E6C25ea6acebe2D2Bb8CeA2f9".toLowerCase()]: wn,
|
|
7419
7424
|
["0x60aE616a2155Ee3d9A68541Ba4544862310933d4".toLowerCase()]: hn,
|
|
7420
7425
|
["0x1111111254fb6c44bAC0beD2854e76F90643097d".toLowerCase()]: ke,
|
|
7421
7426
|
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: Pe,
|
|
@@ -8425,7 +8430,7 @@ const ln = [
|
|
|
8425
8430
|
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: Tn,
|
|
8426
8431
|
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: cn
|
|
8427
8432
|
}, xn = {
|
|
8428
|
-
...
|
|
8433
|
+
...Sn,
|
|
8429
8434
|
...at,
|
|
8430
8435
|
// AVAX
|
|
8431
8436
|
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: _n,
|
|
@@ -8452,35 +8457,35 @@ const ln = [
|
|
|
8452
8457
|
data: p = "",
|
|
8453
8458
|
deadline: u,
|
|
8454
8459
|
memo: y,
|
|
8455
|
-
router:
|
|
8456
|
-
memoStreamingSwap:
|
|
8457
|
-
tcMemo:
|
|
8458
|
-
tcRouter:
|
|
8459
|
-
tcVault:
|
|
8460
|
+
router: m,
|
|
8461
|
+
memoStreamingSwap: l,
|
|
8462
|
+
tcMemo: T,
|
|
8463
|
+
tcRouter: _,
|
|
8464
|
+
tcVault: h,
|
|
8460
8465
|
vault: R,
|
|
8461
|
-
token:
|
|
8466
|
+
token: w
|
|
8462
8467
|
}
|
|
8463
8468
|
}) => {
|
|
8464
|
-
const
|
|
8465
|
-
if (
|
|
8469
|
+
const S = !!at[t.toLowerCase()];
|
|
8470
|
+
if (S && !m)
|
|
8466
8471
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
8467
|
-
const
|
|
8468
|
-
if (!
|
|
8472
|
+
const O = T || y, B = e && l || O;
|
|
8473
|
+
if (!h && !R)
|
|
8469
8474
|
throw new Error("TC Vault is required on calldata");
|
|
8470
|
-
if (!
|
|
8475
|
+
if (!_ && !m)
|
|
8471
8476
|
throw new Error("TC Router is required on calldata");
|
|
8472
8477
|
if (!B)
|
|
8473
8478
|
throw new Error("TC Memo is required on calldata");
|
|
8474
|
-
if (!
|
|
8479
|
+
if (!w)
|
|
8475
8480
|
throw new Error("Token is required on calldata");
|
|
8476
8481
|
const Te = [
|
|
8477
8482
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
8478
|
-
a(
|
|
8479
|
-
a(
|
|
8483
|
+
a(_ || m),
|
|
8484
|
+
a(h || R),
|
|
8480
8485
|
B.replace("{recipientAddress}", n),
|
|
8481
|
-
a(
|
|
8486
|
+
a(w),
|
|
8482
8487
|
i
|
|
8483
|
-
], it =
|
|
8488
|
+
], it = S ? [a(m), p, u] : [r, u];
|
|
8484
8489
|
return [...Te, ...it];
|
|
8485
8490
|
}, kn = ({ chain: e, txHash: t }) => {
|
|
8486
8491
|
const n = We[e];
|
|
@@ -8573,68 +8578,64 @@ class pa {
|
|
|
8573
8578
|
// evmTransactionDetails: contractCallParams,
|
|
8574
8579
|
} = a, p = r.startsWith("ERC20-") ? s.Ethereum : r.startsWith("ARC20-") ? s.Avalanche : r.startsWith("BEP20-") ? s.BinanceSmartChain : void 0;
|
|
8575
8580
|
if (!a.complete)
|
|
8576
|
-
throw new
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
if (
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
return c.sendTransaction(B, i);
|
|
8633
|
-
}
|
|
8634
|
-
throw new T("core_swap_quote_mode_not_supported", { quoteMode: r });
|
|
8635
|
-
} catch (d) {
|
|
8636
|
-
throw new T("core_swap_transaction_error", d);
|
|
8581
|
+
throw new c("core_swap_route_not_complete");
|
|
8582
|
+
if (Tt.includes(r) && p) {
|
|
8583
|
+
const m = this.connectedWallets[p];
|
|
8584
|
+
if (!(m != null && m.sendTransaction))
|
|
8585
|
+
throw new c("core_wallet_connection_not_found");
|
|
8586
|
+
if (!(t ? (u = a == null ? void 0 : a.streamingSwap) == null ? void 0 : u.transaction : a == null ? void 0 : a.transaction))
|
|
8587
|
+
throw new c("core_swap_route_transaction_not_found");
|
|
8588
|
+
const { data: T, from: _, to: h, value: R } = a.transaction, w = {
|
|
8589
|
+
data: T,
|
|
8590
|
+
from: _,
|
|
8591
|
+
to: h.toLowerCase(),
|
|
8592
|
+
chainId: BigInt(Ue[p]),
|
|
8593
|
+
value: R ? BigInt(R) : 0n
|
|
8594
|
+
};
|
|
8595
|
+
return m.sendTransaction(w, i);
|
|
8596
|
+
}
|
|
8597
|
+
if (bt.includes(r)) {
|
|
8598
|
+
if (!a.calldata.fromAsset)
|
|
8599
|
+
throw new c("core_swap_asset_not_recognized");
|
|
8600
|
+
const m = await x.fromString(a.calldata.fromAsset);
|
|
8601
|
+
if (!m)
|
|
8602
|
+
throw new c("core_swap_asset_not_recognized");
|
|
8603
|
+
const { address: l } = await A(this, U).call(this, m.chain), {
|
|
8604
|
+
contract: T,
|
|
8605
|
+
calldata: { expiration: _, amountIn: h, memo: R, memoStreamingSwap: w }
|
|
8606
|
+
} = a, S = m.add(k.fromBigInt(BigInt(h), m.decimal)), O = t && w || R;
|
|
8607
|
+
return this.deposit({
|
|
8608
|
+
expiration: _,
|
|
8609
|
+
assetValue: S,
|
|
8610
|
+
memo: O,
|
|
8611
|
+
feeOptionKey: i,
|
|
8612
|
+
router: T,
|
|
8613
|
+
recipient: l
|
|
8614
|
+
});
|
|
8615
|
+
}
|
|
8616
|
+
if (ct.includes(r) && p) {
|
|
8617
|
+
const { calldata: m, contract: l } = a;
|
|
8618
|
+
if (!l)
|
|
8619
|
+
throw new c("core_swap_contract_not_found");
|
|
8620
|
+
const T = this.connectedWallets[p], _ = this.getAddress(p);
|
|
8621
|
+
if (!(T != null && T.sendTransaction) || !_)
|
|
8622
|
+
throw new c("core_wallet_connection_not_found");
|
|
8623
|
+
const { getProvider: h, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), w = h(p), S = xn[l.toLowerCase()];
|
|
8624
|
+
if (!S)
|
|
8625
|
+
throw new c("core_swap_contract_not_supported", { contractAddress: l });
|
|
8626
|
+
const B = await (await ((y = T.createContract) == null ? void 0 : y.call(T, l, S, w))).getFunction("swapIn").populateTransaction(
|
|
8627
|
+
...Pn({
|
|
8628
|
+
streamSwap: t,
|
|
8629
|
+
toChecksumAddress: R,
|
|
8630
|
+
contractAddress: l,
|
|
8631
|
+
recipient: n,
|
|
8632
|
+
calldata: m
|
|
8633
|
+
}),
|
|
8634
|
+
{ from: _ }
|
|
8635
|
+
);
|
|
8636
|
+
return T.sendTransaction(B, i);
|
|
8637
8637
|
}
|
|
8638
|
+
throw new c("core_swap_quote_mode_not_supported", { quoteMode: r });
|
|
8638
8639
|
});
|
|
8639
8640
|
b(this, "getWalletByChain", async (t, n) => {
|
|
8640
8641
|
var p, u;
|
|
@@ -8662,11 +8663,11 @@ class pa {
|
|
|
8662
8663
|
b(this, "transfer", async (t) => {
|
|
8663
8664
|
const n = this.connectedWallets[t.assetValue.chain];
|
|
8664
8665
|
if (!n)
|
|
8665
|
-
throw new
|
|
8666
|
+
throw new c("core_wallet_connection_not_found");
|
|
8666
8667
|
try {
|
|
8667
8668
|
return await n.transfer(A(this, ee).call(this, t));
|
|
8668
8669
|
} catch (a) {
|
|
8669
|
-
throw new
|
|
8670
|
+
throw new c("core_swap_transaction_error", a);
|
|
8670
8671
|
}
|
|
8671
8672
|
});
|
|
8672
8673
|
b(this, "deposit", async ({
|
|
@@ -8676,44 +8677,48 @@ class pa {
|
|
|
8676
8677
|
...i
|
|
8677
8678
|
}) => {
|
|
8678
8679
|
const { chain: r, symbol: p, ticker: u } = t, y = this.connectedWallets[r];
|
|
8679
|
-
if (!await Hn({
|
|
8680
|
-
|
|
8680
|
+
if (!await Hn({
|
|
8681
|
+
address: await (y == null ? void 0 : y.getAddress()),
|
|
8682
|
+
chain: r
|
|
8683
|
+
}))
|
|
8684
|
+
throw new c("core_transaction_invalid_sender_address");
|
|
8681
8685
|
if (!y)
|
|
8682
|
-
throw new
|
|
8683
|
-
const
|
|
8686
|
+
throw new c("core_wallet_connection_not_found");
|
|
8687
|
+
const l = A(this, ee).call(this, { assetValue: t, recipient: n, router: a, ...i });
|
|
8684
8688
|
try {
|
|
8685
8689
|
switch (r) {
|
|
8686
|
-
case s.THORChain:
|
|
8687
|
-
|
|
8688
|
-
|
|
8690
|
+
case s.THORChain:
|
|
8691
|
+
case s.Maya: {
|
|
8692
|
+
const T = y;
|
|
8693
|
+
return await (n === "" ? T.deposit(l) : T.transfer(l));
|
|
8689
8694
|
}
|
|
8690
8695
|
case s.Ethereum:
|
|
8691
8696
|
case s.BinanceSmartChain:
|
|
8692
8697
|
case s.Avalanche: {
|
|
8693
|
-
const { getChecksumAddressFromAsset:
|
|
8698
|
+
const { getChecksumAddressFromAsset: T } = await import("@swapkit/toolbox-evm"), _ = r === s.Avalanche ? dt : r === s.BinanceSmartChain ? lt : ot;
|
|
8694
8699
|
return await y.call({
|
|
8695
|
-
abi:
|
|
8700
|
+
abi: _,
|
|
8696
8701
|
contractAddress: a || (await A(this, U).call(this, r)).router,
|
|
8697
8702
|
funcName: "depositWithExpiry",
|
|
8698
8703
|
funcParams: [
|
|
8699
8704
|
n,
|
|
8700
|
-
|
|
8705
|
+
T({ chain: r, symbol: p, ticker: u }, r),
|
|
8701
8706
|
t.getBaseValue("string"),
|
|
8702
|
-
|
|
8707
|
+
l.memo,
|
|
8703
8708
|
i.expiration || parseInt(`${((/* @__PURE__ */ new Date()).getTime() + 15 * 60 * 1e3) / 1e3}`)
|
|
8704
8709
|
],
|
|
8705
8710
|
txOverrides: {
|
|
8706
|
-
from:
|
|
8711
|
+
from: l.from,
|
|
8707
8712
|
value: t.isGasAsset ? t.getBaseValue("bigint") : void 0
|
|
8708
8713
|
}
|
|
8709
8714
|
});
|
|
8710
8715
|
}
|
|
8711
8716
|
default:
|
|
8712
|
-
return await y.transfer(
|
|
8717
|
+
return await y.transfer(l);
|
|
8713
8718
|
}
|
|
8714
|
-
} catch (
|
|
8715
|
-
const
|
|
8716
|
-
throw new
|
|
8719
|
+
} 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"), w = _ == null ? void 0 : _.includes("server"), S = _ == null ? void 0 : _.includes("user rejected"), O = h ? "core_transaction_deposit_insufficient_funds_error" : R ? "core_transaction_deposit_gas_error" : w ? "core_transaction_deposit_server_error" : S ? "core_transaction_user_rejected" : "core_transaction_deposit_error";
|
|
8721
|
+
throw new c(O, T);
|
|
8717
8722
|
}
|
|
8718
8723
|
});
|
|
8719
8724
|
/**
|
|
@@ -8724,29 +8729,29 @@ class pa {
|
|
|
8724
8729
|
assetValue: n
|
|
8725
8730
|
}) => {
|
|
8726
8731
|
if (t.lte(0) || n.lte(0))
|
|
8727
|
-
throw new
|
|
8732
|
+
throw new c("core_transaction_create_liquidity_invalid_params");
|
|
8728
8733
|
let a = "", i = "";
|
|
8729
8734
|
try {
|
|
8730
8735
|
a = await A(this, v).call(this, {
|
|
8731
8736
|
assetValue: t,
|
|
8732
|
-
memo: D(
|
|
8737
|
+
memo: D(f.DEPOSIT, {
|
|
8733
8738
|
...n,
|
|
8734
8739
|
address: this.getAddress(n.chain)
|
|
8735
8740
|
})
|
|
8736
8741
|
});
|
|
8737
8742
|
} catch (r) {
|
|
8738
|
-
throw new
|
|
8743
|
+
throw new c("core_transaction_create_liquidity_rune_error", r);
|
|
8739
8744
|
}
|
|
8740
8745
|
try {
|
|
8741
8746
|
i = await A(this, v).call(this, {
|
|
8742
8747
|
assetValue: n,
|
|
8743
|
-
memo: D(
|
|
8748
|
+
memo: D(f.DEPOSIT, {
|
|
8744
8749
|
...n,
|
|
8745
8750
|
address: this.getAddress(s.THORChain)
|
|
8746
8751
|
})
|
|
8747
8752
|
});
|
|
8748
8753
|
} catch (r) {
|
|
8749
|
-
throw new
|
|
8754
|
+
throw new c("core_transaction_create_liquidity_asset_error", r);
|
|
8750
8755
|
}
|
|
8751
8756
|
return { runeTx: a, assetTx: i };
|
|
8752
8757
|
});
|
|
@@ -8758,31 +8763,31 @@ class pa {
|
|
|
8758
8763
|
isPendingSymmAsset: r,
|
|
8759
8764
|
mode: p = "sym"
|
|
8760
8765
|
}) => {
|
|
8761
|
-
const { chain: u, symbol: y } = n,
|
|
8762
|
-
if (!
|
|
8763
|
-
throw new
|
|
8764
|
-
if (
|
|
8765
|
-
throw new
|
|
8766
|
-
let
|
|
8767
|
-
if (
|
|
8766
|
+
const { chain: u, symbol: y } = n, m = p === "sym", l = (t == null ? void 0 : t.gt(0)) && (m || p === "rune"), T = (n == null ? void 0 : n.gt(0)) && (m || p === "asset"), _ = r || l, h = _ ? a || this.getAddress(s.THORChain) : "", R = m || p === "asset" ? i || this.getAddress(u) : "";
|
|
8767
|
+
if (!l && !T)
|
|
8768
|
+
throw new c("core_transaction_add_liquidity_invalid_params");
|
|
8769
|
+
if (_ && !h)
|
|
8770
|
+
throw new c("core_transaction_add_liquidity_no_rune_address");
|
|
8771
|
+
let w, S;
|
|
8772
|
+
if (l && t)
|
|
8768
8773
|
try {
|
|
8769
|
-
|
|
8774
|
+
w = await A(this, v).call(this, {
|
|
8770
8775
|
assetValue: t,
|
|
8771
|
-
memo: D(
|
|
8776
|
+
memo: D(f.DEPOSIT, { chain: u, symbol: y, address: R })
|
|
8772
8777
|
});
|
|
8773
|
-
} catch (
|
|
8774
|
-
throw new
|
|
8778
|
+
} catch (O) {
|
|
8779
|
+
throw new c("core_transaction_add_liquidity_rune_error", O);
|
|
8775
8780
|
}
|
|
8776
|
-
if (
|
|
8781
|
+
if (T && n)
|
|
8777
8782
|
try {
|
|
8778
|
-
|
|
8783
|
+
S = await A(this, v).call(this, {
|
|
8779
8784
|
assetValue: n,
|
|
8780
|
-
memo: D(
|
|
8785
|
+
memo: D(f.DEPOSIT, { chain: u, symbol: y, address: h })
|
|
8781
8786
|
});
|
|
8782
|
-
} catch (
|
|
8783
|
-
throw new
|
|
8787
|
+
} catch (O) {
|
|
8788
|
+
throw new c("core_transaction_add_liquidity_asset_error", O);
|
|
8784
8789
|
}
|
|
8785
|
-
return { runeTx:
|
|
8790
|
+
return { runeTx: w, assetTx: S };
|
|
8786
8791
|
});
|
|
8787
8792
|
b(this, "addLiquidityPart", ({
|
|
8788
8793
|
assetValue: t,
|
|
@@ -8791,8 +8796,8 @@ class pa {
|
|
|
8791
8796
|
symmetric: i
|
|
8792
8797
|
}) => {
|
|
8793
8798
|
if (i && !a)
|
|
8794
|
-
throw new
|
|
8795
|
-
const r = D(
|
|
8799
|
+
throw new c("core_transaction_add_liquidity_invalid_params");
|
|
8800
|
+
const r = D(f.DEPOSIT, {
|
|
8796
8801
|
chain: n.split(".")[0],
|
|
8797
8802
|
symbol: n.split(".")[1],
|
|
8798
8803
|
address: i ? a : ""
|
|
@@ -8806,7 +8811,7 @@ class pa {
|
|
|
8806
8811
|
from: i,
|
|
8807
8812
|
to: r
|
|
8808
8813
|
}) => {
|
|
8809
|
-
const p = r === "rune" && i !== "rune" ? x.fromChainOrSignature(s.THORChain) : i === "sym" && r === "sym" || i === "rune" || i === "asset" ? void 0 : n, u = fe(i === "asset" ? n.chain : s.THORChain), y = t || D(
|
|
8814
|
+
const p = r === "rune" && i !== "rune" ? x.fromChainOrSignature(s.THORChain) : i === "sym" && r === "sym" || i === "rune" || i === "asset" ? void 0 : n, u = fe(i === "asset" ? n.chain : s.THORChain), y = t || D(f.WITHDRAW, {
|
|
8810
8815
|
symbol: n.symbol,
|
|
8811
8816
|
chain: n.chain,
|
|
8812
8817
|
ticker: n.ticker,
|
|
@@ -8822,13 +8827,13 @@ class pa {
|
|
|
8822
8827
|
percent: a,
|
|
8823
8828
|
type: i
|
|
8824
8829
|
}) => {
|
|
8825
|
-
const r = i === "add" ?
|
|
8830
|
+
const r = i === "add" ? f.DEPOSIT : f.WITHDRAW, p = n || D(r, {
|
|
8826
8831
|
ticker: t.ticker,
|
|
8827
8832
|
symbol: t.symbol,
|
|
8828
8833
|
chain: t.chain,
|
|
8829
8834
|
singleSide: !0,
|
|
8830
8835
|
basisPoints: a ? Math.min(1e4, Math.round(a * 100)) : void 0
|
|
8831
|
-
}), u = r ===
|
|
8836
|
+
}), u = r === f.DEPOSIT ? t : fe(t.chain);
|
|
8832
8837
|
return A(this, v).call(this, { memo: p, assetValue: u });
|
|
8833
8838
|
});
|
|
8834
8839
|
b(this, "loan", ({
|
|
@@ -8838,7 +8843,7 @@ class pa {
|
|
|
8838
8843
|
type: i
|
|
8839
8844
|
}) => A(this, v).call(this, {
|
|
8840
8845
|
assetValue: t,
|
|
8841
|
-
memo: n || D(i === "open" ?
|
|
8846
|
+
memo: n || D(i === "open" ? f.OPEN_LOAN : f.CLOSE_LOAN, {
|
|
8842
8847
|
asset: t.toString(),
|
|
8843
8848
|
minAmount: a.toString(),
|
|
8844
8849
|
address: this.getAddress(t.chain)
|
|
@@ -8849,7 +8854,7 @@ class pa {
|
|
|
8849
8854
|
assetValue: n,
|
|
8850
8855
|
address: a
|
|
8851
8856
|
}) => {
|
|
8852
|
-
const i = t === "bond" ?
|
|
8857
|
+
const i = t === "bond" ? f.BOND : t === "unbond" ? f.UNBOND : f.LEAVE, r = D(i, {
|
|
8853
8858
|
address: a,
|
|
8854
8859
|
unbondAmount: t === "unbond" ? n.getBaseValue("number") : void 0
|
|
8855
8860
|
});
|
|
@@ -8861,7 +8866,7 @@ class pa {
|
|
|
8861
8866
|
b(this, "registerThorname", ({
|
|
8862
8867
|
assetValue: t,
|
|
8863
8868
|
...n
|
|
8864
|
-
}) => A(this, z).call(this, { assetValue: t, memo: D(
|
|
8869
|
+
}) => A(this, z).call(this, { assetValue: t, memo: D(f.THORNAME_REGISTER, n) }));
|
|
8865
8870
|
b(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: i = {} }) => {
|
|
8866
8871
|
try {
|
|
8867
8872
|
t.forEach((r) => {
|
|
@@ -8873,7 +8878,7 @@ class pa {
|
|
|
8873
8878
|
});
|
|
8874
8879
|
});
|
|
8875
8880
|
} catch (r) {
|
|
8876
|
-
throw new
|
|
8881
|
+
throw new c("core_extend_error", r);
|
|
8877
8882
|
}
|
|
8878
8883
|
});
|
|
8879
8884
|
b(this, "estimateMaxSendableAmount", async ({
|
|
@@ -8909,57 +8914,56 @@ class pa {
|
|
|
8909
8914
|
});
|
|
8910
8915
|
}
|
|
8911
8916
|
default:
|
|
8912
|
-
throw new
|
|
8917
|
+
throw new c("core_estimated_max_spendable_chain_not_supported");
|
|
8913
8918
|
}
|
|
8914
8919
|
});
|
|
8915
8920
|
/**
|
|
8916
8921
|
* Wallet connection methods
|
|
8917
8922
|
*/
|
|
8918
8923
|
b(this, "connectXDEFI", async (t) => {
|
|
8919
|
-
throw new
|
|
8924
|
+
throw new c("core_wallet_xdefi_not_installed");
|
|
8920
8925
|
});
|
|
8921
8926
|
b(this, "connectEVMWallet", async (t, n) => {
|
|
8922
|
-
throw new
|
|
8927
|
+
throw new c("core_wallet_evmwallet_not_installed");
|
|
8923
8928
|
});
|
|
8924
8929
|
b(this, "connectWalletconnect", async (t, n) => {
|
|
8925
|
-
throw new
|
|
8930
|
+
throw new c("core_wallet_walletconnect_not_installed");
|
|
8926
8931
|
});
|
|
8927
8932
|
b(this, "connectKeepkey", async (t, n) => {
|
|
8928
|
-
throw new
|
|
8933
|
+
throw new c("core_wallet_keepkey_not_installed");
|
|
8929
8934
|
});
|
|
8930
8935
|
b(this, "connectKeystore", async (t, n) => {
|
|
8931
|
-
throw new
|
|
8936
|
+
throw new c("core_wallet_keystore_not_installed");
|
|
8932
8937
|
});
|
|
8933
8938
|
b(this, "connectLedger", async (t, n) => {
|
|
8934
|
-
throw new
|
|
8939
|
+
throw new c("core_wallet_ledger_not_installed");
|
|
8935
8940
|
});
|
|
8936
8941
|
b(this, "connectTrezor", async (t, n) => {
|
|
8937
|
-
throw new
|
|
8942
|
+
throw new c("core_wallet_trezor_not_installed");
|
|
8938
8943
|
});
|
|
8939
8944
|
b(this, "connectKeplr", async (t) => {
|
|
8940
|
-
throw new
|
|
8945
|
+
throw new c("core_wallet_keplr_not_installed");
|
|
8941
8946
|
});
|
|
8942
8947
|
b(this, "connectOkx", async (t) => {
|
|
8943
|
-
throw new
|
|
8948
|
+
throw new c("core_wallet_okx_not_installed");
|
|
8944
8949
|
});
|
|
8945
8950
|
b(this, "disconnectChain", (t) => {
|
|
8946
8951
|
this.connectedChains[t] = null, this.connectedWallets[t] = null;
|
|
8947
8952
|
});
|
|
8948
8953
|
V(this, U, async (t) => {
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
return a;
|
|
8954
|
+
switch (t) {
|
|
8955
|
+
case s.Maya:
|
|
8956
|
+
case s.THORChain:
|
|
8957
|
+
return { gas_rate: "0", router: "", address: "", halted: !1, chain: t };
|
|
8958
|
+
default: {
|
|
8959
|
+
const a = (await Ln(this.stagenet)).find((i) => i.chain === t);
|
|
8960
|
+
if (!a)
|
|
8961
|
+
throw new c("core_inbound_data_not_found");
|
|
8962
|
+
if (a != null && a.halted)
|
|
8963
|
+
throw new c("core_chain_halted");
|
|
8964
|
+
return a;
|
|
8965
|
+
}
|
|
8966
|
+
}
|
|
8963
8967
|
});
|
|
8964
8968
|
V(this, ye, ({ chain: t, wallet: n, walletMethods: a }) => {
|
|
8965
8969
|
this.connectedChains[t] = n, this.connectedWallets[t] = a;
|
|
@@ -8972,18 +8976,18 @@ class pa {
|
|
|
8972
8976
|
const { address: i, chain: r, isGasAsset: p, isSynthetic: u } = t, y = [s.Ethereum, s.Avalanche, s.BinanceSmartChain].includes(r);
|
|
8973
8977
|
if (y && p || !y || u)
|
|
8974
8978
|
return !0;
|
|
8975
|
-
const
|
|
8976
|
-
if (!
|
|
8977
|
-
throw new
|
|
8978
|
-
const
|
|
8979
|
-
if (!i || !
|
|
8980
|
-
throw new
|
|
8981
|
-
const
|
|
8982
|
-
return
|
|
8979
|
+
const l = this.connectedWallets[r], T = n === "checkOnly" ? l == null ? void 0 : l.isApproved : l == null ? void 0 : l.approve;
|
|
8980
|
+
if (!T)
|
|
8981
|
+
throw new c("core_wallet_connection_not_found");
|
|
8982
|
+
const _ = this.getAddress(r);
|
|
8983
|
+
if (!i || !_)
|
|
8984
|
+
throw new c("core_approve_asset_address_or_from_not_found");
|
|
8985
|
+
const h = a || (await A(this, U).call(this, r)).router;
|
|
8986
|
+
return T({
|
|
8983
8987
|
amount: t.getBaseValue("bigint"),
|
|
8984
8988
|
assetAddress: i,
|
|
8985
|
-
from:
|
|
8986
|
-
spenderAddress:
|
|
8989
|
+
from: _,
|
|
8990
|
+
spenderAddress: h
|
|
8987
8991
|
});
|
|
8988
8992
|
});
|
|
8989
8993
|
V(this, v, async ({
|
|
@@ -9007,7 +9011,7 @@ class pa {
|
|
|
9007
9011
|
V(this, z, async ({ memo: t, assetValue: n }) => {
|
|
9008
9012
|
const a = await Vn(this.stagenet);
|
|
9009
9013
|
if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
|
|
9010
|
-
throw new
|
|
9014
|
+
throw new c("core_chain_halted");
|
|
9011
9015
|
return this.deposit({ assetValue: n, recipient: "", memo: t });
|
|
9012
9016
|
});
|
|
9013
9017
|
V(this, ee, ({ assetValue: t, ...n }) => ({
|
|
@@ -9026,25 +9030,25 @@ export {
|
|
|
9026
9030
|
Wn as ApiError,
|
|
9027
9031
|
Q as ApiUrl,
|
|
9028
9032
|
x as AssetValue,
|
|
9029
|
-
|
|
9033
|
+
E as BaseDecimal,
|
|
9030
9034
|
tt as BigIntArithmetics,
|
|
9031
9035
|
s as Chain,
|
|
9032
|
-
|
|
9036
|
+
Se as ChainId,
|
|
9033
9037
|
Kn as ChainIdToChain,
|
|
9034
9038
|
Ue as ChainToChainId,
|
|
9035
9039
|
We as ChainToExplorerUrl,
|
|
9036
9040
|
jn as ChainToHexChainId,
|
|
9037
|
-
|
|
9041
|
+
wt as ChainToRPC,
|
|
9038
9042
|
At as ContractAddress,
|
|
9039
9043
|
Gn as CosmosChainList,
|
|
9040
9044
|
ht as DerivationPath,
|
|
9041
|
-
|
|
9045
|
+
o as ERROR_CODE,
|
|
9042
9046
|
_t as ERROR_MODULE,
|
|
9043
9047
|
Ve as ERROR_TYPE,
|
|
9044
9048
|
Et as EVMChainList,
|
|
9045
|
-
wt as ErrorCode,
|
|
9046
9049
|
X as FeeOption,
|
|
9047
|
-
|
|
9050
|
+
Ot as LedgerErrorCode,
|
|
9051
|
+
f as MemoType,
|
|
9048
9052
|
$n as NetworkDerivationPath,
|
|
9049
9053
|
mt as QuoteMode,
|
|
9050
9054
|
Fe as RPCUrl,
|
|
@@ -9054,7 +9058,7 @@ export {
|
|
|
9054
9058
|
jt as StreamingSwapProgressStatus,
|
|
9055
9059
|
Qn as SwapKitApi,
|
|
9056
9060
|
pa as SwapKitCore,
|
|
9057
|
-
|
|
9061
|
+
c as SwapKitError,
|
|
9058
9062
|
k as SwapKitNumber,
|
|
9059
9063
|
dt as TCAvalancheDepositABI,
|
|
9060
9064
|
lt as TCBscDepositABI,
|
|
@@ -9063,7 +9067,7 @@ export {
|
|
|
9063
9067
|
Gt as TransactionType,
|
|
9064
9068
|
Xt as TxStatus,
|
|
9065
9069
|
qn as UTXOChainList,
|
|
9066
|
-
|
|
9070
|
+
St as WalletOption,
|
|
9067
9071
|
Jn as assetFromString,
|
|
9068
9072
|
Qe as defaultRequestHeaders,
|
|
9069
9073
|
ra as derivationPathToString,
|