@swapkit/core 1.0.0-rc.91 → 1.0.0-rc.93
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.d.ts +6 -0
- package/dist/index.es.js +246 -227
- package/dist/index.es.js.map +1 -1
- package/package.json +13 -11
- package/src/client/types.ts +6 -0
package/dist/index.es.js
CHANGED
|
@@ -624,59 +624,60 @@ 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.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
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: 4 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.SWAP_AMOUNT_TOO_LOW]: "Swap amount too low for this pair.",
|
|
652
|
+
[o.DESTINATION_ADDRESS_SMART_CONTRACT]: "Destination address is a smart contract.",
|
|
653
|
+
[o.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Buy amount must be a positive integer.",
|
|
654
|
+
[o.INVALID_PROVIDER]: "Invalid provider {0}.",
|
|
655
|
+
[o.MISSING_CROSS_CHAIN_PROVIDER]: "Missing cross-chain provider.",
|
|
656
|
+
[o.MISSING_AVAX_PROVIDER]: "Missing AVAX provider.",
|
|
657
|
+
[o.MISSING_BSC_PROVIDER]: "Missing BSC provider.",
|
|
658
|
+
[o.MISSING_ETH_PROVIDER]: "Missing ETH provider.",
|
|
659
|
+
[o.MISSING_ARB_PROVIDER]: "Missing ARB provider.",
|
|
660
|
+
[o.INVALID_PROVIDER_FOR_SWAP_OUT]: "Invalid provider for swap out.",
|
|
661
|
+
[o.INVALID_CHAIN]: "Invalid chain {0}.",
|
|
662
|
+
[o.INVALID_ASSET]: "Invalid asset {0}.",
|
|
663
|
+
[o.UNSUPPORTED_CHAIN]: "Unsupported chain {0}.",
|
|
664
|
+
[o.UNSUPPORTED_ASSET]: "Unsupported asset {0}.",
|
|
665
|
+
[o.UNSUPPORTED_ASSET_FOR_SWAPOUT]: "Unsupported asset {0} for swap out.",
|
|
666
|
+
[o.THORNODE_QUOTE_GENERIC_ERROR]: "ThorNode quote generic error.",
|
|
667
|
+
[o.INVALID_SOURCE_ADDRESS]: "Invalid source address {0}",
|
|
668
|
+
[o.INVALID_DESTINATION_ADDRESS]: "Invalid destination address {0}",
|
|
669
|
+
[o.NOT_ENOUGH_SYNTH_BALANCE]: "Source address doesn't have enough synth balance for this quote.",
|
|
670
|
+
[o.SYNTH_MINTING_CAP_REACHED]: "Synth minting cap reached.",
|
|
671
|
+
[o.INVALID_QUOTE_MODE]: "Invalid quote mode.",
|
|
672
|
+
[o.NO_QUOTES]: "No quotes to service this request.",
|
|
673
|
+
[o.SERVICE_UNAVAILABLE_GENERIC]: "Service unavailable.",
|
|
674
|
+
[o.MISSING_GAS_DATA_GENERIC]: "Missing gas data.",
|
|
675
|
+
[o.MISSING_TOKEN_INFO_GENERIC]: "Missing token info.",
|
|
676
|
+
[o.CANT_FIND_TOKEN_LIST]: "Can't find tokenlist {0}.",
|
|
677
|
+
[o.NO_PRICE]: "No price for asset {0}.",
|
|
678
|
+
[o.PRICE_IS_STALE]: "Price is stale for asset {0}.",
|
|
679
|
+
[o.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
|
|
680
|
+
[o.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
|
|
680
681
|
}, ce = (e, t) => {
|
|
681
682
|
let n = ft[e];
|
|
682
683
|
if (!n)
|
|
@@ -693,7 +694,7 @@ 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
|
|
@@ -703,7 +704,7 @@ let Wn = class He extends Error {
|
|
|
703
704
|
const T = r || ce(i, m || []) || "";
|
|
704
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
709
|
}, this.displayMessageParams = m || [], this.options.shouldTrace && Error.captureStackTrace(this);
|
|
709
710
|
}
|
|
@@ -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 || {}), At = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(At || {}), 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
|
+
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.Polkadot = "DOT", e.Chainflip = "FLIP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(s || {}), At = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(At || {}), 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.DOT = "////", e.ETH = "m/44'/60'/0'/0", e.FLIP = "////", 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],
|
|
@@ -743,10 +744,17 @@ const $n = {
|
|
|
743
744
|
MATIC: [44, 60, 0, 0, 0],
|
|
744
745
|
MAYA: [44, 931, 0, 0, 0],
|
|
745
746
|
OP: [44, 60, 0, 0, 0],
|
|
746
|
-
THOR: [44, 931, 0, 0, 0]
|
|
747
|
+
THOR: [44, 931, 0, 0, 0],
|
|
748
|
+
// Polkadot and related network derivation path is not number based
|
|
749
|
+
DOT: [0, 0, 0, 0, 0],
|
|
750
|
+
FLIP: [0, 0, 0, 0, 0]
|
|
747
751
|
};
|
|
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
|
-
const
|
|
752
|
+
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.DOT = 10] = "DOT", e[e.ETH = 18] = "ETH", e[e.FLIP = 18] = "FLIP", 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 || {});
|
|
753
|
+
const qn = [
|
|
754
|
+
"DOT",
|
|
755
|
+
"FLIP"
|
|
756
|
+
/* Chainflip */
|
|
757
|
+
], Et = [
|
|
750
758
|
"ETH",
|
|
751
759
|
"AVAX",
|
|
752
760
|
"BSC",
|
|
@@ -754,18 +762,18 @@ const Et = [
|
|
|
754
762
|
"OP",
|
|
755
763
|
"MATIC"
|
|
756
764
|
/* Polygon */
|
|
757
|
-
],
|
|
765
|
+
], Gn = [
|
|
758
766
|
"BTC",
|
|
759
767
|
"BCH",
|
|
760
768
|
"DOGE",
|
|
761
769
|
"LTC"
|
|
762
770
|
/* Litecoin */
|
|
763
|
-
],
|
|
771
|
+
], Xn = [
|
|
764
772
|
"GAIA",
|
|
765
773
|
"THOR",
|
|
766
774
|
"BNB"
|
|
767
775
|
/* Binance */
|
|
768
|
-
],
|
|
776
|
+
], jn = [
|
|
769
777
|
"AVAX",
|
|
770
778
|
"BNB",
|
|
771
779
|
"BSC",
|
|
@@ -778,26 +786,26 @@ const Et = [
|
|
|
778
786
|
"THOR"
|
|
779
787
|
/* THORChain */
|
|
780
788
|
];
|
|
781
|
-
var
|
|
782
|
-
const oe = Object.values(s), Rt = Object.keys(s),
|
|
789
|
+
var we = /* @__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.Chainflip = "chainflip", 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.Polkadot = "polkadot", e.Polygon = "137", e.PolygonHex = "0x89", e.THORChain = "thorchain-mainnet-v1", e.THORChainStagenet = "thorchain-stagenet-v2", e))(we || {}), 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.Chainflip = "wss://mainnet-archive.chainflip.io", 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.Polkadot = "wss://rpc.polkadot.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 || {});
|
|
790
|
+
const oe = Object.values(s), Rt = Object.keys(s), Se = oe.reduce(
|
|
783
791
|
(e, t) => {
|
|
784
792
|
const n = Rt.find((a) => s[a] === t);
|
|
785
793
|
return n && (e[t] = n), e;
|
|
786
794
|
},
|
|
787
795
|
{}
|
|
788
796
|
), Ue = oe.reduce(
|
|
789
|
-
(e, t) => (e[t] = Se[
|
|
797
|
+
(e, t) => (e[t] = we[Se[t]], e),
|
|
790
798
|
{}
|
|
791
|
-
),
|
|
792
|
-
(e, t) => (e[t] = Fe[
|
|
799
|
+
), Ot = oe.reduce(
|
|
800
|
+
(e, t) => (e[t] = Fe[Se[t]], e),
|
|
793
801
|
{}
|
|
794
|
-
),
|
|
802
|
+
), Kn = oe.reduce(
|
|
795
803
|
(e, t) => {
|
|
796
|
-
const n = `${
|
|
797
|
-
return e[t] =
|
|
804
|
+
const n = `${Se[t]}Hex`;
|
|
805
|
+
return e[t] = we[n], e;
|
|
798
806
|
},
|
|
799
807
|
{}
|
|
800
|
-
),
|
|
808
|
+
), Yn = {
|
|
801
809
|
"0xa4b1": "ARB",
|
|
802
810
|
42161: "ARB",
|
|
803
811
|
"0xa86a": "AVAX",
|
|
@@ -807,6 +815,7 @@ const oe = Object.values(s), Rt = Object.keys(s), Oe = oe.reduce(
|
|
|
807
815
|
"Binance-Chain-Tigris": "BNB",
|
|
808
816
|
bitcoincash: "BCH",
|
|
809
817
|
bitcoin: "BTC",
|
|
818
|
+
chainflip: "FLIP",
|
|
810
819
|
"cosmoshub-4": "GAIA",
|
|
811
820
|
dogecoin: "DOGE",
|
|
812
821
|
"0x1": "ETH",
|
|
@@ -817,6 +826,7 @@ const oe = Object.values(s), Rt = Object.keys(s), Oe = oe.reduce(
|
|
|
817
826
|
"mayachain-mainnet-v1": "MAYA",
|
|
818
827
|
"0xa": "OP",
|
|
819
828
|
10: "OP",
|
|
829
|
+
polkadot: "DOT",
|
|
820
830
|
"0x89": "MATIC",
|
|
821
831
|
137: "MATIC",
|
|
822
832
|
"thorchain-stagenet-v2": "THOR",
|
|
@@ -829,6 +839,7 @@ const oe = Object.values(s), Rt = Object.keys(s), Oe = oe.reduce(
|
|
|
829
839
|
BNB: "https://explorer.binance.org",
|
|
830
840
|
BCH: "https://www.blockchair.com/bitcoin-cash",
|
|
831
841
|
BTC: "https://blockchair.com/bitcoin",
|
|
842
|
+
FLIP: "https://explorer.polkascan.io/polkadot",
|
|
832
843
|
GAIA: "https://cosmos.bigdipper.live",
|
|
833
844
|
DOGE: "https://blockchair.com/dogecoin",
|
|
834
845
|
KUJI: "https://finder.kujira.network/kaiyo-1",
|
|
@@ -836,19 +847,20 @@ const oe = Object.values(s), Rt = Object.keys(s), Oe = oe.reduce(
|
|
|
836
847
|
LTC: "https://blockchair.com/litecoin",
|
|
837
848
|
MAYA: "https://www.mayascan.org",
|
|
838
849
|
OP: "https://optimistic.etherscan.io",
|
|
850
|
+
DOT: "https://explorer.polkascan.io/polkadot",
|
|
839
851
|
MATIC: "https://polygonscan.com",
|
|
840
852
|
THOR: "https://runescan.io"
|
|
841
853
|
};
|
|
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 || {}),
|
|
854
|
+
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 || {}), wt = /* @__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))(wt || {}), St = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e[e.LockedDevice = 21781] = "LockedDevice", e[e.TC_NotFound = 65535] = "TC_NotFound", e))(St || {}), 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
855
|
if (!t.has(e))
|
|
844
856
|
throw TypeError("Cannot " + n);
|
|
845
857
|
}, q = (e, t, n) => {
|
|
846
858
|
if (t.has(e))
|
|
847
859
|
throw TypeError("Cannot add the same private member more than once");
|
|
848
860
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
849
|
-
}, M = (e, t, n) => (gt(e, t, "access private method"), n),
|
|
850
|
-
|
|
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 || {});
|
|
861
|
+
}, 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 || {});
|
|
862
|
+
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 + "";
|
|
863
|
+
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.Polkadot = "DOT", e.Chainflip = "FLIP", 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.Chainflip = "chainflip", 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.Polkadot = "polkadot", 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.Chainflip = "wss://mainnet-archive.chainflip.io", 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.Polkadot = "wss://rpc.polkadot.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
864
|
const le = Object.values(de), Ct = Object.keys(de), Ie = le.reduce(
|
|
853
865
|
(e, t) => {
|
|
854
866
|
const n = Ct.find((a) => de[a] === t);
|
|
@@ -934,13 +946,13 @@ const ne = (e) => e !== null && typeof e == "object", te = (...e) => {
|
|
|
934
946
|
return e = !0, "half";
|
|
935
947
|
}
|
|
936
948
|
}).headers.has("Content-Type")), e && !t;
|
|
937
|
-
})(), Nt = typeof globalThis.AbortController == "function", Dt = typeof globalThis.ReadableStream == "function",
|
|
949
|
+
})(), Nt = typeof globalThis.AbortController == "function", Dt = typeof globalThis.ReadableStream == "function", Pt = typeof globalThis.FormData == "function", Xe = ["get", "post", "put", "patch", "head", "delete"], kt = {
|
|
938
950
|
json: "application/json",
|
|
939
951
|
text: "text/*",
|
|
940
952
|
formData: "multipart/form-data",
|
|
941
953
|
arrayBuffer: "*/*",
|
|
942
954
|
blob: "*/*"
|
|
943
|
-
}, be = 2147483647, je = Symbol("stop"),
|
|
955
|
+
}, be = 2147483647, je = Symbol("stop"), xt = {
|
|
944
956
|
json: !0,
|
|
945
957
|
parseJson: !0,
|
|
946
958
|
searchParams: !0,
|
|
@@ -1015,7 +1027,7 @@ async function Wt(e, { signal: t }) {
|
|
|
1015
1027
|
const $t = (e, t) => {
|
|
1016
1028
|
const n = {};
|
|
1017
1029
|
for (const a in t)
|
|
1018
|
-
!(a in Bt) && !(a in
|
|
1030
|
+
!(a in Bt) && !(a in xt) && !(a in e) && (n[a] = t[a]);
|
|
1019
1031
|
return n;
|
|
1020
1032
|
};
|
|
1021
1033
|
class re {
|
|
@@ -1044,7 +1056,7 @@ class re {
|
|
|
1044
1056
|
}
|
|
1045
1057
|
return p;
|
|
1046
1058
|
}, r = a._options.retry.methods.includes(a.request.method.toLowerCase()) ? a._retry(i) : i();
|
|
1047
|
-
for (const [p, u] of Object.entries(
|
|
1059
|
+
for (const [p, u] of Object.entries(kt))
|
|
1048
1060
|
r[p] = async () => {
|
|
1049
1061
|
a.request.headers.set("accept", a.request.headers.get("accept") || u);
|
|
1050
1062
|
const y = (await r).clone();
|
|
@@ -1121,7 +1133,7 @@ class re {
|
|
|
1121
1133
|
}
|
|
1122
1134
|
if (vt && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
|
|
1123
1135
|
const a = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), i = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, a);
|
|
1124
|
-
(
|
|
1136
|
+
(Pt && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"]) && this.request.headers.delete("content-type"), this.request = new globalThis.Request(new globalThis.Request(i, { ...this.request }), this._options);
|
|
1125
1137
|
}
|
|
1126
1138
|
this._options.json !== void 0 && (this._options.body = JSON.stringify(this._options.json), this.request.headers.set("content-type", this._options.headers.get("content-type") ?? "application/json"), this.request = new globalThis.Request(this.request, { body: this._options.body }));
|
|
1127
1139
|
}
|
|
@@ -1192,17 +1204,17 @@ class re {
|
|
|
1192
1204
|
const p = t.body.getReader();
|
|
1193
1205
|
n && n({ percent: 0, transferredBytes: 0, totalBytes: a }, new Uint8Array());
|
|
1194
1206
|
async function u() {
|
|
1195
|
-
const { done: y, value:
|
|
1207
|
+
const { done: y, value: l } = await p.read();
|
|
1196
1208
|
if (y) {
|
|
1197
1209
|
r.close();
|
|
1198
1210
|
return;
|
|
1199
1211
|
}
|
|
1200
1212
|
if (n) {
|
|
1201
|
-
i +=
|
|
1213
|
+
i += l.byteLength;
|
|
1202
1214
|
const m = a === 0 ? 0 : i / a;
|
|
1203
|
-
n({ percent: m, transferredBytes: i, totalBytes: a },
|
|
1215
|
+
n({ percent: m, transferredBytes: i, totalBytes: a }, l);
|
|
1204
1216
|
}
|
|
1205
|
-
r.enqueue(
|
|
1217
|
+
r.enqueue(l), await u();
|
|
1206
1218
|
}
|
|
1207
1219
|
await u();
|
|
1208
1220
|
}
|
|
@@ -1221,7 +1233,7 @@ const he = (e) => {
|
|
|
1221
1233
|
return t.create = (n) => he(te(n)), t.extend = (n) => he(te(e, n)), t.stop = je, t;
|
|
1222
1234
|
}, Ye = he();
|
|
1223
1235
|
let ae;
|
|
1224
|
-
const
|
|
1236
|
+
const k = {
|
|
1225
1237
|
CachedPrices: `${L.ThorswapApi}/tokenlist/cached-price`,
|
|
1226
1238
|
GasRates: `${L.ThorswapApi}/resource-worker/gasPrice/getAll`,
|
|
1227
1239
|
Quote: `${L.ThorswapApi}/aggregator/tokens/quote`,
|
|
@@ -1229,7 +1241,7 @@ const P = {
|
|
|
1229
1241
|
TokenlistProviders: `${L.ThorswapApi}/tokenlist/providers`,
|
|
1230
1242
|
TokenList: `${L.ThorswapStatic}/token-list`,
|
|
1231
1243
|
Thorname: `${L.ThorswapApi}/thorname`
|
|
1232
|
-
}, Qe = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, Ne = () => ae || (ae = Ye.create({ headers: Qe }), ae),
|
|
1244
|
+
}, Qe = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, Ne = () => ae || (ae = Ye.create({ headers: Qe }), ae), Qn = ({ apiKey: e, ...t }) => {
|
|
1233
1245
|
ae = Ye.create({
|
|
1234
1246
|
...t,
|
|
1235
1247
|
headers: { ...Qe, ...t.headers, "x-api-key": e }
|
|
@@ -1239,25 +1251,25 @@ const P = {
|
|
|
1239
1251
|
post: (e, t) => Ne().post(e, t).json()
|
|
1240
1252
|
}, qt = ({ tokens: e, ...t }) => {
|
|
1241
1253
|
const n = new URLSearchParams();
|
|
1242
|
-
return e.filter((a, i, r) => r.findIndex((p) => p === a) === i).forEach((a) => n.append("tokens", JSON.stringify(a))), t.metadata && n.append("metadata", "true"), t.lookup && n.append("lookup", "true"), t.sparkline && n.append("sparkline", "true"), g.post(
|
|
1254
|
+
return e.filter((a, i, r) => r.findIndex((p) => p === a) === i).forEach((a) => n.append("tokens", JSON.stringify(a))), t.metadata && n.append("metadata", "true"), t.lookup && n.append("lookup", "true"), t.sparkline && n.append("sparkline", "true"), g.post(k.CachedPrices, {
|
|
1243
1255
|
body: n.toString(),
|
|
1244
1256
|
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
1245
1257
|
});
|
|
1246
|
-
},
|
|
1258
|
+
}, Jn = {
|
|
1247
1259
|
getCachedPrices: qt,
|
|
1248
|
-
getQuote: (e) => g.get(
|
|
1249
|
-
getGasRates: () => g.get(
|
|
1250
|
-
getTxnDetails: (e) => g.get(
|
|
1251
|
-
getTokenlistProviders: () => g.get(
|
|
1252
|
-
getTokenList: (e) => g.get(`${
|
|
1253
|
-
getThornameAddresses: (e) => g.get(`${
|
|
1254
|
-
getThornameRegisteredChains: (e) => g.get(`${
|
|
1255
|
-
getThornameRlookup: (e, t) => g.get(`${
|
|
1260
|
+
getQuote: (e) => g.get(k.Quote, { searchParams: e }),
|
|
1261
|
+
getGasRates: () => g.get(k.GasRates),
|
|
1262
|
+
getTxnDetails: (e) => g.get(k.Txn, { searchParams: e }),
|
|
1263
|
+
getTokenlistProviders: () => g.get(k.TokenlistProviders),
|
|
1264
|
+
getTokenList: (e) => g.get(`${k.TokenList}/${e}.json`),
|
|
1265
|
+
getThornameAddresses: (e) => g.get(`${k.Thorname}/${e}`),
|
|
1266
|
+
getThornameRegisteredChains: (e) => g.get(`${k.Thorname}/chains/${e}`),
|
|
1267
|
+
getThornameRlookup: (e, t) => g.get(`${k.Thorname}/rlookup`, { searchParams: { address: e, chain: t } })
|
|
1256
1268
|
};
|
|
1257
1269
|
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
1270
|
const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
1259
1271
|
try {
|
|
1260
|
-
const { result: n } = await g.post(
|
|
1272
|
+
const { result: n } = await g.post(Ot[e], {
|
|
1261
1273
|
headers: {
|
|
1262
1274
|
accept: "*/*",
|
|
1263
1275
|
"content-type": "application/json",
|
|
@@ -1306,6 +1318,8 @@ const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1306
1318
|
case s.Binance:
|
|
1307
1319
|
case s.Ethereum:
|
|
1308
1320
|
case s.Avalanche:
|
|
1321
|
+
case s.Polkadot:
|
|
1322
|
+
case s.Chainflip:
|
|
1309
1323
|
return t === e;
|
|
1310
1324
|
case s.Arbitrum:
|
|
1311
1325
|
case s.Optimism:
|
|
@@ -1349,7 +1363,9 @@ const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1349
1363
|
case s.Dogecoin:
|
|
1350
1364
|
case s.Binance:
|
|
1351
1365
|
case s.Avalanche:
|
|
1366
|
+
case s.Chainflip:
|
|
1352
1367
|
case s.Polygon:
|
|
1368
|
+
case s.Polkadot:
|
|
1353
1369
|
case s.Bitcoin:
|
|
1354
1370
|
case s.Ethereum:
|
|
1355
1371
|
return { identifier: `${e}.${e}`, decimal: E[e] };
|
|
@@ -1364,6 +1380,8 @@ const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1364
1380
|
case s.Litecoin:
|
|
1365
1381
|
case s.Maya:
|
|
1366
1382
|
case s.THORChain:
|
|
1383
|
+
case s.Polkadot:
|
|
1384
|
+
case s.Chainflip:
|
|
1367
1385
|
return "Native";
|
|
1368
1386
|
case s.Cosmos:
|
|
1369
1387
|
return t === "ATOM" ? "Native" : s.Cosmos;
|
|
@@ -1384,7 +1402,7 @@ const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1384
1402
|
case s.Optimism:
|
|
1385
1403
|
return [s.Ethereum, s.Optimism].includes(t) ? "Native" : "OPTIMISM";
|
|
1386
1404
|
}
|
|
1387
|
-
},
|
|
1405
|
+
}, Zn = (e) => {
|
|
1388
1406
|
var t;
|
|
1389
1407
|
const [n, ...a] = e.split("."), i = e.includes("/"), r = a.join("."), p = (t = r == null ? void 0 : r.split("-")) == null ? void 0 : t[0];
|
|
1390
1408
|
return { chain: n, symbol: r, ticker: p, synth: i };
|
|
@@ -1397,7 +1415,7 @@ const Kt = "0x313ce567", Je = async ({ chain: e, to: t }) => {
|
|
|
1397
1415
|
return !0;
|
|
1398
1416
|
const [, a] = n.split("-");
|
|
1399
1417
|
return Ze({ chain: t, symbol: n }) || !!a;
|
|
1400
|
-
},
|
|
1418
|
+
}, zn = (e) => e.filter((t) => {
|
|
1401
1419
|
const n = `${t.chain}.${t.symbol}`;
|
|
1402
1420
|
return !nn.test(n) && an(n) && t.value !== "0";
|
|
1403
1421
|
});
|
|
@@ -1406,18 +1424,18 @@ function sn({
|
|
|
1406
1424
|
poolUnits: t,
|
|
1407
1425
|
runeDepth: n
|
|
1408
1426
|
}) {
|
|
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(
|
|
1427
|
+
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);
|
|
1428
|
+
return p.mul(u.sub(y).add(l)).div(m);
|
|
1411
1429
|
}
|
|
1412
1430
|
function rn({
|
|
1413
1431
|
liquidityUnits: e,
|
|
1414
1432
|
poolUnits: t,
|
|
1415
1433
|
assetDepth: n
|
|
1416
1434
|
}) {
|
|
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),
|
|
1435
|
+
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);
|
|
1418
1436
|
return m.div(T);
|
|
1419
1437
|
}
|
|
1420
|
-
function
|
|
1438
|
+
function ea({
|
|
1421
1439
|
percent: e,
|
|
1422
1440
|
runeDepth: t,
|
|
1423
1441
|
liquidityUnits: n,
|
|
@@ -1425,7 +1443,7 @@ function zn({
|
|
|
1425
1443
|
}) {
|
|
1426
1444
|
return sn({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
|
|
1427
1445
|
}
|
|
1428
|
-
function
|
|
1446
|
+
function ta({
|
|
1429
1447
|
percent: e,
|
|
1430
1448
|
assetDepth: t,
|
|
1431
1449
|
liquidityUnits: n,
|
|
@@ -1434,7 +1452,7 @@ function ea({
|
|
|
1434
1452
|
return rn({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
|
|
1435
1453
|
}
|
|
1436
1454
|
function I(e) {
|
|
1437
|
-
return
|
|
1455
|
+
return x.fromBigInt(BigInt(e), E.THOR);
|
|
1438
1456
|
}
|
|
1439
1457
|
function pn({
|
|
1440
1458
|
liquidityUnits: e,
|
|
@@ -1447,7 +1465,7 @@ function pn({
|
|
|
1447
1465
|
runeAmount: I(n).mul(e).div(t)
|
|
1448
1466
|
};
|
|
1449
1467
|
}
|
|
1450
|
-
function
|
|
1468
|
+
function na({
|
|
1451
1469
|
liquidityUnits: e,
|
|
1452
1470
|
poolUnits: t,
|
|
1453
1471
|
runeDepth: n,
|
|
@@ -1460,7 +1478,7 @@ function ta({
|
|
|
1460
1478
|
)
|
|
1461
1479
|
);
|
|
1462
1480
|
}
|
|
1463
|
-
function
|
|
1481
|
+
function aa({
|
|
1464
1482
|
runeDepth: e,
|
|
1465
1483
|
poolUnits: t,
|
|
1466
1484
|
assetDepth: n,
|
|
@@ -1468,13 +1486,13 @@ function na({
|
|
|
1468
1486
|
runeAmount: i,
|
|
1469
1487
|
assetAmount: r
|
|
1470
1488
|
}) {
|
|
1471
|
-
const p = new
|
|
1472
|
-
if (
|
|
1489
|
+
const p = new x({ value: e, decimal: 8 }), u = new x({ value: n, decimal: 8 }), y = new x({ value: t, decimal: 8 }), l = new x({ value: i, decimal: 8 }), m = new x({ 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)))), w = T.add(_.add(R.mul(2))), S = O.div(w), B = I(a).add(S);
|
|
1490
|
+
if (S.getBaseValue("number") === 0)
|
|
1473
1491
|
return B.div(y).getBaseValue("number");
|
|
1474
1492
|
const Te = y.add(B);
|
|
1475
1493
|
return B.div(Te).getBaseValue("number");
|
|
1476
1494
|
}
|
|
1477
|
-
function
|
|
1495
|
+
function ia({
|
|
1478
1496
|
runeAmount: e,
|
|
1479
1497
|
assetAmount: t,
|
|
1480
1498
|
runeDepth: n,
|
|
@@ -1482,8 +1500,8 @@ function aa({
|
|
|
1482
1500
|
}) {
|
|
1483
1501
|
if (e === "0" || t === "0" || n === "0" || a === "0")
|
|
1484
1502
|
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(
|
|
1503
|
+
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));
|
|
1504
|
+
return Math.abs(y.div(l).getBaseValue("number"));
|
|
1487
1505
|
}
|
|
1488
1506
|
const D = (e, t) => {
|
|
1489
1507
|
switch (e) {
|
|
@@ -1516,8 +1534,8 @@ const D = (e, t) => {
|
|
|
1516
1534
|
})(n, a)}:${i || ""}:t:0`;
|
|
1517
1535
|
}
|
|
1518
1536
|
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,
|
|
1520
|
-
return `${e}:${n}${u ? "/" : "."}${y}:${r}${
|
|
1537
|
+
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}` : "";
|
|
1538
|
+
return `${e}:${n}${u ? "/" : "."}${y}:${r}${l}`;
|
|
1521
1539
|
}
|
|
1522
1540
|
case f.OPEN_LOAN:
|
|
1523
1541
|
case f.CLOSE_LOAN: {
|
|
@@ -1528,18 +1546,18 @@ const D = (e, t) => {
|
|
|
1528
1546
|
return "";
|
|
1529
1547
|
}
|
|
1530
1548
|
};
|
|
1531
|
-
function
|
|
1549
|
+
function sa(e) {
|
|
1532
1550
|
if (e < 0)
|
|
1533
1551
|
throw new Error("Invalid number of year");
|
|
1534
1552
|
return 10 + e;
|
|
1535
1553
|
}
|
|
1536
|
-
function
|
|
1554
|
+
function ra(e) {
|
|
1537
1555
|
if (e.length > 30)
|
|
1538
1556
|
return !1;
|
|
1539
1557
|
const t = /^[a-zA-Z0-9+_-]+$/g;
|
|
1540
1558
|
return !!e.match(t);
|
|
1541
1559
|
}
|
|
1542
|
-
function
|
|
1560
|
+
function pa([e, t, n, a, i]) {
|
|
1543
1561
|
return `${e}'/${t}'/${n}'/${a}${typeof i != "number" ? "" : `/${i}`}`;
|
|
1544
1562
|
}
|
|
1545
1563
|
const De = [...Object.values(s), "TERRA"];
|
|
@@ -1577,7 +1595,7 @@ var W, G, H, $, Ee, ze, ie, _e, pe, Re;
|
|
|
1577
1595
|
const yn = class et {
|
|
1578
1596
|
constructor(t) {
|
|
1579
1597
|
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 =
|
|
1598
|
+
const n = Oe(t), a = typeof t == "object";
|
|
1581
1599
|
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
1600
|
}
|
|
1583
1601
|
static fromBigInt(t, n) {
|
|
@@ -1656,7 +1674,7 @@ const yn = class et {
|
|
|
1656
1674
|
getBigIntValue(t, n) {
|
|
1657
1675
|
if (!n && typeof t == "object")
|
|
1658
1676
|
return t.bigIntValue;
|
|
1659
|
-
const a =
|
|
1677
|
+
const a = Oe(t), i = ue(a);
|
|
1660
1678
|
return i === "0" || i === "undefined" ? 0n : M(this, pe, Re).call(this, i, n);
|
|
1661
1679
|
}
|
|
1662
1680
|
toSignificant(t = 6) {
|
|
@@ -1699,36 +1717,36 @@ const yn = class et {
|
|
|
1699
1717
|
decimalSeparator: i = ".",
|
|
1700
1718
|
thousandSeparator: r = ","
|
|
1701
1719
|
} = {}) {
|
|
1702
|
-
const p = this.getValue("number"), [u, y = ""] = p.toFixed(6).split("."),
|
|
1720
|
+
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)}` : ""}`;
|
|
1703
1721
|
return `${n === "start" ? t : ""}${m}${n === "end" ? t : ""}`;
|
|
1704
1722
|
}
|
|
1705
1723
|
formatBigIntToSafeValue(t, n) {
|
|
1706
1724
|
const a = n || this.decimal || J, i = Math.max(
|
|
1707
1725
|
a,
|
|
1708
1726
|
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,
|
|
1727
|
+
), 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;
|
|
1710
1728
|
let m = y.slice(-i);
|
|
1711
1729
|
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
1730
|
0,
|
|
1713
|
-
|
|
1731
|
+
l
|
|
1714
1732
|
)}.${m}`.replace(/\.?0*$/, "");
|
|
1715
1733
|
}
|
|
1716
1734
|
};
|
|
1717
1735
|
W = /* @__PURE__ */ new WeakSet(), G = function(e, ...t) {
|
|
1718
1736
|
const n = M(this, ie, _e).call(this, this, ...t), a = Math.max(n, j(this.decimalMultiplier)), i = F(a), r = t.reduce(
|
|
1719
1737
|
(u, y) => {
|
|
1720
|
-
const
|
|
1738
|
+
const l = this.getBigIntValue(y, a);
|
|
1721
1739
|
switch (e) {
|
|
1722
1740
|
case "add":
|
|
1723
|
-
return u +
|
|
1741
|
+
return u + l;
|
|
1724
1742
|
case "sub":
|
|
1725
|
-
return u -
|
|
1743
|
+
return u - l;
|
|
1726
1744
|
case "mul":
|
|
1727
|
-
return u *
|
|
1745
|
+
return u * l / i;
|
|
1728
1746
|
case "div": {
|
|
1729
|
-
if (
|
|
1747
|
+
if (l === 0n)
|
|
1730
1748
|
throw new RangeError("Division by zero");
|
|
1731
|
-
return u * i /
|
|
1749
|
+
return u * i / l;
|
|
1732
1750
|
}
|
|
1733
1751
|
default:
|
|
1734
1752
|
return u;
|
|
@@ -1777,7 +1795,7 @@ const on = Intl.NumberFormat("fullwide", {
|
|
|
1777
1795
|
maximumFractionDigits: 20
|
|
1778
1796
|
});
|
|
1779
1797
|
function ue(e) {
|
|
1780
|
-
const t = `${typeof e == "number" ? on.format(e) :
|
|
1798
|
+
const t = `${typeof e == "number" ? on.format(e) : Oe(e)}`.replaceAll(",", ".").split(".");
|
|
1781
1799
|
return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
|
|
1782
1800
|
}
|
|
1783
1801
|
function nt(e) {
|
|
@@ -1785,11 +1803,11 @@ function nt(e) {
|
|
|
1785
1803
|
const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
|
|
1786
1804
|
return Math.max(n, J);
|
|
1787
1805
|
}
|
|
1788
|
-
function
|
|
1806
|
+
function Oe(e) {
|
|
1789
1807
|
return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
|
|
1790
1808
|
}
|
|
1791
1809
|
const K = /* @__PURE__ */ new Map();
|
|
1792
|
-
class
|
|
1810
|
+
class P extends tt {
|
|
1793
1811
|
constructor({
|
|
1794
1812
|
value: t,
|
|
1795
1813
|
decimal: n,
|
|
@@ -1833,12 +1851,12 @@ class x extends tt {
|
|
|
1833
1851
|
static fromStringSync(t, n = 0) {
|
|
1834
1852
|
const { chain: a, isSynthetic: i } = se(t), r = K.get(t.toUpperCase());
|
|
1835
1853
|
if (i)
|
|
1836
|
-
return
|
|
1854
|
+
return Pe(t, n);
|
|
1837
1855
|
const { tax: p, decimal: u, identifier: y } = r || {
|
|
1838
1856
|
decimal: E[a],
|
|
1839
1857
|
identifier: t
|
|
1840
1858
|
};
|
|
1841
|
-
return new
|
|
1859
|
+
return new P({
|
|
1842
1860
|
tax: p,
|
|
1843
1861
|
value: Y(n, u),
|
|
1844
1862
|
identifier: i ? t : y,
|
|
@@ -1848,16 +1866,16 @@ class x extends tt {
|
|
|
1848
1866
|
static fromIdentifierSync(t, n = 0) {
|
|
1849
1867
|
const { chain: a, isSynthetic: i } = se(t), r = K.get(t);
|
|
1850
1868
|
if (i)
|
|
1851
|
-
return
|
|
1869
|
+
return Pe(t, n);
|
|
1852
1870
|
const { tax: p, decimal: u, identifier: y } = r || {
|
|
1853
1871
|
decimal: E[a],
|
|
1854
1872
|
identifier: t
|
|
1855
1873
|
};
|
|
1856
|
-
return new
|
|
1874
|
+
return new P({ tax: p, decimal: u, identifier: y, value: Y(n, u) });
|
|
1857
1875
|
}
|
|
1858
1876
|
static fromChainOrSignature(t, n = 0) {
|
|
1859
1877
|
const { decimal: a, identifier: i } = en(t);
|
|
1860
|
-
return new
|
|
1878
|
+
return new P({ value: Y(n, a), decimal: a, identifier: i });
|
|
1861
1879
|
}
|
|
1862
1880
|
static loadStaticAssets() {
|
|
1863
1881
|
return new Promise(
|
|
@@ -1885,7 +1903,7 @@ class x extends tt {
|
|
|
1885
1903
|
}
|
|
1886
1904
|
}
|
|
1887
1905
|
function fe(e) {
|
|
1888
|
-
const t =
|
|
1906
|
+
const t = P.fromChainOrSignature(e);
|
|
1889
1907
|
switch (e) {
|
|
1890
1908
|
case s.Bitcoin:
|
|
1891
1909
|
case s.Litecoin:
|
|
@@ -1908,13 +1926,13 @@ function fe(e) {
|
|
|
1908
1926
|
async function Ae(e, t = 0) {
|
|
1909
1927
|
un(e);
|
|
1910
1928
|
const n = K.get(e.toUpperCase()), a = (n == null ? void 0 : n.decimal) || await Zt(se(e));
|
|
1911
|
-
return n || K.set(e.toUpperCase(), { identifier: e, decimal: a }), new
|
|
1929
|
+
return n || K.set(e.toUpperCase(), { identifier: e, decimal: a }), new P({ decimal: a, value: Y(t, a), identifier: e });
|
|
1912
1930
|
}
|
|
1913
|
-
function
|
|
1931
|
+
function Pe(e, t = 0) {
|
|
1914
1932
|
const [n, a] = e.split(".")[0].toUpperCase() === s.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
|
|
1915
1933
|
if (!n || !a)
|
|
1916
1934
|
throw new Error("Invalid asset identifier");
|
|
1917
|
-
return new
|
|
1935
|
+
return new P({
|
|
1918
1936
|
decimal: 8,
|
|
1919
1937
|
value: Y(t, 8),
|
|
1920
1938
|
identifier: `${s.THORChain}.${n}/${a}`
|
|
@@ -1927,13 +1945,13 @@ function se(e) {
|
|
|
1927
1945
|
const t = e.slice(0, 14).includes("/"), [n, a] = e.split(".")[0].toUpperCase() === s.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
|
|
1928
1946
|
if (t && (!n || !a))
|
|
1929
1947
|
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.join(".")).split("-"),
|
|
1948
|
+
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
1949
|
return {
|
|
1932
1950
|
address: y == null ? void 0 : y.toLowerCase(),
|
|
1933
1951
|
chain: r,
|
|
1934
|
-
isGasAsset: Ze({ chain: r, symbol:
|
|
1952
|
+
isGasAsset: Ze({ chain: r, symbol: l }),
|
|
1935
1953
|
isSynthetic: t,
|
|
1936
|
-
symbol: (t ? `${n}/` : "") + (y ? `${u}-${(y == null ? void 0 : y.toLowerCase()) ?? ""}` :
|
|
1954
|
+
symbol: (t ? `${n}/` : "") + (y ? `${u}-${(y == null ? void 0 : y.toLowerCase()) ?? ""}` : l),
|
|
1937
1955
|
ticker: u
|
|
1938
1956
|
};
|
|
1939
1957
|
}
|
|
@@ -2006,12 +2024,12 @@ class c extends Error {
|
|
|
2006
2024
|
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);
|
|
2007
2025
|
}
|
|
2008
2026
|
}
|
|
2009
|
-
class
|
|
2027
|
+
class x extends tt {
|
|
2010
2028
|
eq(t) {
|
|
2011
2029
|
return this.eqValue(t);
|
|
2012
2030
|
}
|
|
2013
2031
|
static fromBigInt(t, n) {
|
|
2014
|
-
return new
|
|
2032
|
+
return new x({
|
|
2015
2033
|
decimal: n,
|
|
2016
2034
|
value: me({ value: t, bigIntDecimal: n, decimal: n })
|
|
2017
2035
|
});
|
|
@@ -2711,7 +2729,7 @@ const ln = [
|
|
|
2711
2729
|
type: "function"
|
|
2712
2730
|
},
|
|
2713
2731
|
{ stateMutability: "payable", type: "receive" }
|
|
2714
|
-
],
|
|
2732
|
+
], ke = [
|
|
2715
2733
|
{
|
|
2716
2734
|
inputs: [{ internalType: "address", name: "_WETH", type: "address" }],
|
|
2717
2735
|
stateMutability: "nonpayable",
|
|
@@ -3112,7 +3130,7 @@ const ln = [
|
|
|
3112
3130
|
type: "function"
|
|
3113
3131
|
},
|
|
3114
3132
|
{ stateMutability: "payable", type: "receive" }
|
|
3115
|
-
],
|
|
3133
|
+
], xe = [
|
|
3116
3134
|
{
|
|
3117
3135
|
inputs: [
|
|
3118
3136
|
{
|
|
@@ -7247,7 +7265,7 @@ const ln = [
|
|
|
7247
7265
|
type: "function"
|
|
7248
7266
|
},
|
|
7249
7267
|
{ stateMutability: "payable", type: "receive" }
|
|
7250
|
-
],
|
|
7268
|
+
], On = [
|
|
7251
7269
|
{
|
|
7252
7270
|
inputs: [
|
|
7253
7271
|
{ internalType: "address", name: "_weth", type: "address" },
|
|
@@ -7417,23 +7435,23 @@ const ln = [
|
|
|
7417
7435
|
type: "function"
|
|
7418
7436
|
},
|
|
7419
7437
|
{ stateMutability: "payable", type: "receive" }
|
|
7420
|
-
],
|
|
7438
|
+
], wn = {
|
|
7421
7439
|
// AVAX
|
|
7422
7440
|
["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106".toLowerCase()]: fn,
|
|
7423
|
-
["0xC22FBb3133dF781E6C25ea6acebe2D2Bb8CeA2f9".toLowerCase()]:
|
|
7441
|
+
["0xC22FBb3133dF781E6C25ea6acebe2D2Bb8CeA2f9".toLowerCase()]: On,
|
|
7424
7442
|
["0x60aE616a2155Ee3d9A68541Ba4544862310933d4".toLowerCase()]: hn,
|
|
7425
|
-
["0x1111111254fb6c44bAC0beD2854e76F90643097d".toLowerCase()]:
|
|
7426
|
-
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]:
|
|
7443
|
+
["0x1111111254fb6c44bAC0beD2854e76F90643097d".toLowerCase()]: xe,
|
|
7444
|
+
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: ke,
|
|
7427
7445
|
// BSC
|
|
7428
7446
|
["0x10ED43C718714eb63d5aA57B78B54704E256024E".toLowerCase()]: Be,
|
|
7429
7447
|
// ETH
|
|
7430
|
-
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]:
|
|
7448
|
+
["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: ke,
|
|
7431
7449
|
["0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f".toLowerCase()]: An,
|
|
7432
7450
|
["0xEfF92A263d31888d860bD50809A8D171709b7b1c".toLowerCase()]: Be,
|
|
7433
7451
|
["0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D".toLowerCase()]: En,
|
|
7434
7452
|
["0xE592427A0AEce92De3Edee1F18E0157C05861564".toLowerCase()]: Rn,
|
|
7435
|
-
["0x1111111254fb6c44bac0bed2854e76f90643097d".toLowerCase()]:
|
|
7436
|
-
},
|
|
7453
|
+
["0x1111111254fb6c44bac0bed2854e76f90643097d".toLowerCase()]: xe
|
|
7454
|
+
}, Sn = [
|
|
7437
7455
|
{
|
|
7438
7456
|
inputs: [
|
|
7439
7457
|
{ internalType: "address", name: "_ttp", type: "address" },
|
|
@@ -8429,8 +8447,8 @@ const ln = [
|
|
|
8429
8447
|
["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: ln,
|
|
8430
8448
|
["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: Tn,
|
|
8431
8449
|
["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: cn
|
|
8432
|
-
},
|
|
8433
|
-
...
|
|
8450
|
+
}, Pn = {
|
|
8451
|
+
...wn,
|
|
8434
8452
|
...at,
|
|
8435
8453
|
// AVAX
|
|
8436
8454
|
["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: _n,
|
|
@@ -8439,14 +8457,14 @@ const ln = [
|
|
|
8439
8457
|
// BSC
|
|
8440
8458
|
["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: bn,
|
|
8441
8459
|
// ETH
|
|
8442
|
-
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]:
|
|
8460
|
+
["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: Sn,
|
|
8443
8461
|
["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: In,
|
|
8444
8462
|
["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: gn,
|
|
8445
8463
|
["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: Cn,
|
|
8446
8464
|
["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: vn,
|
|
8447
8465
|
["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: Nn,
|
|
8448
8466
|
["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: Dn
|
|
8449
|
-
},
|
|
8467
|
+
}, kn = ({
|
|
8450
8468
|
streamSwap: e,
|
|
8451
8469
|
contractAddress: t,
|
|
8452
8470
|
recipient: n,
|
|
@@ -8457,37 +8475,37 @@ const ln = [
|
|
|
8457
8475
|
data: p = "",
|
|
8458
8476
|
deadline: u,
|
|
8459
8477
|
memo: y,
|
|
8460
|
-
router:
|
|
8478
|
+
router: l,
|
|
8461
8479
|
memoStreamingSwap: m,
|
|
8462
8480
|
tcMemo: T,
|
|
8463
8481
|
tcRouter: _,
|
|
8464
8482
|
tcVault: h,
|
|
8465
8483
|
vault: R,
|
|
8466
|
-
token:
|
|
8484
|
+
token: O
|
|
8467
8485
|
}
|
|
8468
8486
|
}) => {
|
|
8469
|
-
const
|
|
8470
|
-
if (
|
|
8487
|
+
const w = !!at[t.toLowerCase()];
|
|
8488
|
+
if (w && !l)
|
|
8471
8489
|
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
8472
|
-
const
|
|
8490
|
+
const S = T || y, B = e && m || S;
|
|
8473
8491
|
if (!h && !R)
|
|
8474
8492
|
throw new Error("TC Vault is required on calldata");
|
|
8475
|
-
if (!_ && !
|
|
8493
|
+
if (!_ && !l)
|
|
8476
8494
|
throw new Error("TC Router is required on calldata");
|
|
8477
8495
|
if (!B)
|
|
8478
8496
|
throw new Error("TC Memo is required on calldata");
|
|
8479
|
-
if (!
|
|
8497
|
+
if (!O)
|
|
8480
8498
|
throw new Error("Token is required on calldata");
|
|
8481
8499
|
const Te = [
|
|
8482
8500
|
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
8483
|
-
a(_ ||
|
|
8501
|
+
a(_ || l),
|
|
8484
8502
|
a(h || R),
|
|
8485
8503
|
B.replace("{recipientAddress}", n),
|
|
8486
|
-
a(
|
|
8504
|
+
a(O),
|
|
8487
8505
|
i
|
|
8488
|
-
], it =
|
|
8506
|
+
], it = w ? [a(l), p, u] : [r, u];
|
|
8489
8507
|
return [...Te, ...it];
|
|
8490
|
-
},
|
|
8508
|
+
}, xn = ({ chain: e, txHash: t }) => {
|
|
8491
8509
|
const n = We[e];
|
|
8492
8510
|
switch (e) {
|
|
8493
8511
|
case s.Binance:
|
|
@@ -8555,7 +8573,7 @@ const ln = [
|
|
|
8555
8573
|
}
|
|
8556
8574
|
};
|
|
8557
8575
|
var U, ye, Z, v, z, ee;
|
|
8558
|
-
class
|
|
8576
|
+
class ua {
|
|
8559
8577
|
constructor({ stagenet: t } = {}) {
|
|
8560
8578
|
b(this, "connectedChains", Le());
|
|
8561
8579
|
b(this, "connectedWallets", Le());
|
|
@@ -8564,7 +8582,7 @@ class pa {
|
|
|
8564
8582
|
var n;
|
|
8565
8583
|
return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
|
|
8566
8584
|
});
|
|
8567
|
-
b(this, "getExplorerTxUrl", (t, n) =>
|
|
8585
|
+
b(this, "getExplorerTxUrl", (t, n) => xn({ chain: t, txHash: n }));
|
|
8568
8586
|
b(this, "getWallet", (t) => this.connectedWallets[t]);
|
|
8569
8587
|
b(this, "getExplorerAddressUrl", (t, n) => Bn({ chain: t, address: n }));
|
|
8570
8588
|
b(this, "getBalance", async (t, n) => {
|
|
@@ -8580,56 +8598,56 @@ class pa {
|
|
|
8580
8598
|
if (!a.complete)
|
|
8581
8599
|
throw new c("core_swap_route_not_complete");
|
|
8582
8600
|
if (Tt.includes(r) && p) {
|
|
8583
|
-
const
|
|
8584
|
-
if (!(
|
|
8601
|
+
const l = this.connectedWallets[p];
|
|
8602
|
+
if (!(l != null && l.sendTransaction))
|
|
8585
8603
|
throw new c("core_wallet_connection_not_found");
|
|
8586
8604
|
if (!(t ? (u = a == null ? void 0 : a.streamingSwap) == null ? void 0 : u.transaction : a == null ? void 0 : a.transaction))
|
|
8587
8605
|
throw new c("core_swap_route_transaction_not_found");
|
|
8588
|
-
const { data: T, from: _, to: h, value: R } = a.transaction,
|
|
8606
|
+
const { data: T, from: _, to: h, value: R } = a.transaction, O = {
|
|
8589
8607
|
data: T,
|
|
8590
8608
|
from: _,
|
|
8591
8609
|
to: h.toLowerCase(),
|
|
8592
8610
|
chainId: BigInt(Ue[p]),
|
|
8593
8611
|
value: R ? BigInt(R) : 0n
|
|
8594
8612
|
};
|
|
8595
|
-
return
|
|
8613
|
+
return l.sendTransaction(O, i);
|
|
8596
8614
|
}
|
|
8597
8615
|
if (bt.includes(r)) {
|
|
8598
8616
|
if (!a.calldata.fromAsset)
|
|
8599
8617
|
throw new c("core_swap_asset_not_recognized");
|
|
8600
|
-
const
|
|
8601
|
-
if (!
|
|
8618
|
+
const l = await P.fromString(a.calldata.fromAsset);
|
|
8619
|
+
if (!l)
|
|
8602
8620
|
throw new c("core_swap_asset_not_recognized");
|
|
8603
|
-
const { address: m } = await A(this, U).call(this,
|
|
8621
|
+
const { address: m } = await A(this, U).call(this, l.chain), {
|
|
8604
8622
|
contract: T,
|
|
8605
|
-
calldata: { expiration: _, amountIn: h, memo: R, memoStreamingSwap:
|
|
8606
|
-
} = a,
|
|
8623
|
+
calldata: { expiration: _, amountIn: h, memo: R, memoStreamingSwap: O }
|
|
8624
|
+
} = a, w = l.add(x.fromBigInt(BigInt(h), l.decimal)), S = t && O || R;
|
|
8607
8625
|
return this.deposit({
|
|
8608
8626
|
expiration: _,
|
|
8609
|
-
assetValue:
|
|
8610
|
-
memo:
|
|
8627
|
+
assetValue: w,
|
|
8628
|
+
memo: S,
|
|
8611
8629
|
feeOptionKey: i,
|
|
8612
8630
|
router: T,
|
|
8613
8631
|
recipient: m
|
|
8614
8632
|
});
|
|
8615
8633
|
}
|
|
8616
8634
|
if (ct.includes(r) && p) {
|
|
8617
|
-
const { calldata:
|
|
8635
|
+
const { calldata: l, contract: m } = a;
|
|
8618
8636
|
if (!m)
|
|
8619
8637
|
throw new c("core_swap_contract_not_found");
|
|
8620
8638
|
const T = this.connectedWallets[p], _ = this.getAddress(p);
|
|
8621
8639
|
if (!(T != null && T.sendTransaction) || !_)
|
|
8622
8640
|
throw new c("core_wallet_connection_not_found");
|
|
8623
|
-
const { getProvider: h, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"),
|
|
8624
|
-
if (!
|
|
8641
|
+
const { getProvider: h, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), O = h(p), w = Pn[m.toLowerCase()];
|
|
8642
|
+
if (!w)
|
|
8625
8643
|
throw new c("core_swap_contract_not_supported", { contractAddress: m });
|
|
8626
|
-
const B = await (await ((y = T.createContract) == null ? void 0 : y.call(T, m,
|
|
8627
|
-
...
|
|
8644
|
+
const B = await (await ((y = T.createContract) == null ? void 0 : y.call(T, m, w, O))).getFunction("swapIn").populateTransaction(
|
|
8645
|
+
...kn({
|
|
8628
8646
|
streamSwap: t,
|
|
8629
8647
|
toChecksumAddress: R,
|
|
8630
8648
|
contractAddress: m,
|
|
8631
8649
|
recipient: n,
|
|
8632
|
-
calldata:
|
|
8650
|
+
calldata: l
|
|
8633
8651
|
}),
|
|
8634
8652
|
{ from: _ }
|
|
8635
8653
|
);
|
|
@@ -8642,7 +8660,7 @@ class pa {
|
|
|
8642
8660
|
const a = this.getAddress(t);
|
|
8643
8661
|
if (!a)
|
|
8644
8662
|
return null;
|
|
8645
|
-
const i = [
|
|
8663
|
+
const i = [P.fromChainOrSignature(t)], r = (p = this.connectedChains[t]) == null ? void 0 : p.walletType;
|
|
8646
8664
|
try {
|
|
8647
8665
|
const y = await ((u = this.getWallet(t)) == null ? void 0 : u.getBalance(a, n));
|
|
8648
8666
|
return this.connectedChains[t] = {
|
|
@@ -8717,8 +8735,8 @@ class pa {
|
|
|
8717
8735
|
return await y.transfer(m);
|
|
8718
8736
|
}
|
|
8719
8737
|
} 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(
|
|
8738
|
+
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"), w = _ == null ? void 0 : _.includes("user rejected"), S = h ? "core_transaction_deposit_insufficient_funds_error" : R ? "core_transaction_deposit_gas_error" : O ? "core_transaction_deposit_server_error" : w ? "core_transaction_user_rejected" : "core_transaction_deposit_error";
|
|
8739
|
+
throw new c(S, T);
|
|
8722
8740
|
}
|
|
8723
8741
|
});
|
|
8724
8742
|
/**
|
|
@@ -8763,31 +8781,31 @@ class pa {
|
|
|
8763
8781
|
isPendingSymmAsset: r,
|
|
8764
8782
|
mode: p = "sym"
|
|
8765
8783
|
}) => {
|
|
8766
|
-
const { chain: u, symbol: y } = n,
|
|
8784
|
+
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) : "";
|
|
8767
8785
|
if (!m && !T)
|
|
8768
8786
|
throw new c("core_transaction_add_liquidity_invalid_params");
|
|
8769
8787
|
if (_ && !h)
|
|
8770
8788
|
throw new c("core_transaction_add_liquidity_no_rune_address");
|
|
8771
|
-
let
|
|
8789
|
+
let O, w;
|
|
8772
8790
|
if (m && t)
|
|
8773
8791
|
try {
|
|
8774
|
-
|
|
8792
|
+
O = await A(this, v).call(this, {
|
|
8775
8793
|
assetValue: t,
|
|
8776
8794
|
memo: D(f.DEPOSIT, { chain: u, symbol: y, address: R })
|
|
8777
8795
|
});
|
|
8778
|
-
} catch (
|
|
8779
|
-
throw new c("core_transaction_add_liquidity_rune_error",
|
|
8796
|
+
} catch (S) {
|
|
8797
|
+
throw new c("core_transaction_add_liquidity_rune_error", S);
|
|
8780
8798
|
}
|
|
8781
8799
|
if (T && n)
|
|
8782
8800
|
try {
|
|
8783
|
-
|
|
8801
|
+
w = await A(this, v).call(this, {
|
|
8784
8802
|
assetValue: n,
|
|
8785
8803
|
memo: D(f.DEPOSIT, { chain: u, symbol: y, address: h })
|
|
8786
8804
|
});
|
|
8787
|
-
} catch (
|
|
8788
|
-
throw new c("core_transaction_add_liquidity_asset_error",
|
|
8805
|
+
} catch (S) {
|
|
8806
|
+
throw new c("core_transaction_add_liquidity_asset_error", S);
|
|
8789
8807
|
}
|
|
8790
|
-
return { runeTx:
|
|
8808
|
+
return { runeTx: O, assetTx: w };
|
|
8791
8809
|
});
|
|
8792
8810
|
b(this, "addLiquidityPart", ({
|
|
8793
8811
|
assetValue: t,
|
|
@@ -8811,7 +8829,7 @@ class pa {
|
|
|
8811
8829
|
from: i,
|
|
8812
8830
|
to: r
|
|
8813
8831
|
}) => {
|
|
8814
|
-
const p = r === "rune" && i !== "rune" ?
|
|
8832
|
+
const p = r === "rune" && i !== "rune" ? P.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, {
|
|
8815
8833
|
symbol: n.symbol,
|
|
8816
8834
|
chain: n.chain,
|
|
8817
8835
|
ticker: n.ticker,
|
|
@@ -9026,28 +9044,28 @@ class pa {
|
|
|
9026
9044
|
U = new WeakMap(), ye = new WeakMap(), Z = new WeakMap(), v = new WeakMap(), z = new WeakMap(), ee = new WeakMap();
|
|
9027
9045
|
export {
|
|
9028
9046
|
Tt as AGG_SWAP,
|
|
9029
|
-
|
|
9047
|
+
k as ApiEndpoints,
|
|
9030
9048
|
Wn as ApiError,
|
|
9031
9049
|
Q as ApiUrl,
|
|
9032
|
-
|
|
9050
|
+
P as AssetValue,
|
|
9033
9051
|
E as BaseDecimal,
|
|
9034
9052
|
tt as BigIntArithmetics,
|
|
9035
9053
|
s as Chain,
|
|
9036
|
-
|
|
9037
|
-
|
|
9054
|
+
we as ChainId,
|
|
9055
|
+
Yn as ChainIdToChain,
|
|
9038
9056
|
Ue as ChainToChainId,
|
|
9039
9057
|
We as ChainToExplorerUrl,
|
|
9040
|
-
|
|
9041
|
-
|
|
9058
|
+
Kn as ChainToHexChainId,
|
|
9059
|
+
Ot as ChainToRPC,
|
|
9042
9060
|
At as ContractAddress,
|
|
9043
|
-
|
|
9061
|
+
Xn as CosmosChainList,
|
|
9044
9062
|
ht as DerivationPath,
|
|
9045
|
-
|
|
9063
|
+
o as ERROR_CODE,
|
|
9046
9064
|
_t as ERROR_MODULE,
|
|
9047
9065
|
Ve as ERROR_TYPE,
|
|
9048
9066
|
Et as EVMChainList,
|
|
9049
9067
|
X as FeeOption,
|
|
9050
|
-
|
|
9068
|
+
St as LedgerErrorCode,
|
|
9051
9069
|
f as MemoType,
|
|
9052
9070
|
$n as NetworkDerivationPath,
|
|
9053
9071
|
mt as QuoteMode,
|
|
@@ -9056,41 +9074,42 @@ export {
|
|
|
9056
9074
|
ct as SWAP_IN,
|
|
9057
9075
|
bt as SWAP_OUT,
|
|
9058
9076
|
jt as StreamingSwapProgressStatus,
|
|
9059
|
-
|
|
9060
|
-
|
|
9077
|
+
qn as SubstrateChainList,
|
|
9078
|
+
Jn as SwapKitApi,
|
|
9079
|
+
ua as SwapKitCore,
|
|
9061
9080
|
c as SwapKitError,
|
|
9062
|
-
|
|
9081
|
+
x as SwapKitNumber,
|
|
9063
9082
|
dt as TCAvalancheDepositABI,
|
|
9064
9083
|
lt as TCBscDepositABI,
|
|
9065
9084
|
ot as TCEthereumVaultAbi,
|
|
9066
|
-
|
|
9085
|
+
jn as TCSupportedChainList,
|
|
9067
9086
|
Gt as TransactionType,
|
|
9068
9087
|
Xt as TxStatus,
|
|
9069
|
-
|
|
9070
|
-
|
|
9071
|
-
|
|
9088
|
+
Gn as UTXOChainList,
|
|
9089
|
+
wt as WalletOption,
|
|
9090
|
+
Zn as assetFromString,
|
|
9072
9091
|
Qe as defaultRequestHeaders,
|
|
9073
|
-
|
|
9092
|
+
pa as derivationPathToString,
|
|
9074
9093
|
Un as erc20ABI,
|
|
9075
|
-
|
|
9094
|
+
zn as filterAssets,
|
|
9076
9095
|
me as formatBigIntToSafeValue,
|
|
9077
9096
|
zt as gasFeeMultiplier,
|
|
9078
9097
|
tn as getAssetType,
|
|
9079
9098
|
rn as getAsymmetricAssetShare,
|
|
9080
|
-
|
|
9099
|
+
ta as getAsymmetricAssetWithdrawAmount,
|
|
9081
9100
|
sn as getAsymmetricRuneShare,
|
|
9082
|
-
|
|
9101
|
+
ea as getAsymmetricRuneWithdrawAmount,
|
|
9083
9102
|
en as getCommonAssetInfo,
|
|
9084
9103
|
Zt as getDecimal,
|
|
9085
|
-
|
|
9086
|
-
|
|
9104
|
+
aa as getEstimatedPoolShare,
|
|
9105
|
+
ia as getLiquiditySlippage,
|
|
9087
9106
|
D as getMemoFor,
|
|
9088
9107
|
fe as getMinAmountByChain,
|
|
9089
9108
|
pn as getSymmetricPoolShare,
|
|
9090
|
-
|
|
9091
|
-
|
|
9109
|
+
na as getSymmetricWithdraw,
|
|
9110
|
+
sa as getTHORNameCost,
|
|
9092
9111
|
Ze as isGasAsset,
|
|
9093
|
-
|
|
9094
|
-
|
|
9112
|
+
Qn as setRequestClientConfig,
|
|
9113
|
+
ra as validateTHORName
|
|
9095
9114
|
};
|
|
9096
9115
|
//# sourceMappingURL=index.es.js.map
|