@swapkit/core 1.0.0-rc.6 → 1.0.0-rc.60

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.es.js CHANGED
@@ -1,16 +1,16 @@
1
- var Ce = Object.defineProperty;
2
- var Ne = (e, t, n) => t in e ? Ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var T = (e, t, n) => (Ne(e, typeof t != "symbol" ? t + "" : t, n), n), De = (e, t, n) => {
1
+ var qe = Object.defineProperty;
2
+ var We = (e, t, n) => t in e ? qe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var T = (e, t, n) => (We(e, typeof t != "symbol" ? t + "" : t, n), n), je = (e, t, n) => {
4
4
  if (!t.has(e))
5
5
  throw TypeError("Cannot " + n);
6
6
  };
7
- var A = (e, t, n) => (De(e, t, "read from private field"), n ? n.call(e) : t.get(e)), P = (e, t, n) => {
7
+ var f = (e, t, n) => (je(e, t, "read from private field"), n ? n.call(e) : t.get(e)), P = (e, t, n) => {
8
8
  if (t.has(e))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
10
  t instanceof WeakSet ? t.add(e) : t.set(e, n);
11
11
  };
12
- var xe = Object.defineProperty, Pe = (e, t, n) => t in e ? xe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (Pe(e, typeof t != "symbol" ? t + "" : t, n), n);
13
- const Lt = [
12
+ var Ke = Object.defineProperty, Ye = (e, t, n) => t in e ? Ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (Ye(e, typeof t != "symbol" ? t + "" : t, n), n);
13
+ const bn = [
14
14
  { inputs: [], stateMutability: "nonpayable", type: "constructor" },
15
15
  {
16
16
  anonymous: !1,
@@ -108,7 +108,7 @@ const Lt = [
108
108
  stateMutability: "nonpayable",
109
109
  type: "function"
110
110
  }
111
- ], Be = [
111
+ ], Xe = [
112
112
  {
113
113
  inputs: [{ internalType: "address", name: "rune", type: "address" }],
114
114
  stateMutability: "nonpayable",
@@ -283,7 +283,7 @@ const Lt = [
283
283
  stateMutability: "view",
284
284
  type: "function"
285
285
  }
286
- ], Ve = [
286
+ ], Je = [
287
287
  { inputs: [], stateMutability: "nonpayable", type: "constructor" },
288
288
  {
289
289
  anonymous: !1,
@@ -447,7 +447,7 @@ const Lt = [
447
447
  stateMutability: "view",
448
448
  type: "function"
449
449
  }
450
- ], Le = [
450
+ ], Qe = [
451
451
  { inputs: [], stateMutability: "nonpayable", type: "constructor" },
452
452
  {
453
453
  anonymous: !1,
@@ -600,13 +600,13 @@ const Lt = [
600
600
  type: "function"
601
601
  }
602
602
  ];
603
- var Ue = /* @__PURE__ */ ((e) => (e.TC_SUPPORTED_TO_TC_SUPPORTED = "TC-TC", e.TC_SUPPORTED_TO_ETH = "TC-ERC20", e.TC_SUPPORTED_TO_AVAX = "TC-ARC20", e.TC_SUPPORTED_TO_BSC = "TC-BEP20", e.ETH_TO_TC_SUPPORTED = "ERC20-TC", e.ETH_TO_ETH = "ERC20-ERC20", e.ETH_TO_AVAX = "ERC20-ARC20", e.ETH_TO_BSC = "ERC20-BEP20", e.AVAX_TO_TC_SUPPORTED = "ARC20-TC", e.AVAX_TO_ETH = "ARC20-ERC20", e.AVAX_TO_AVAX = "ARC20-ARC20", e.AVAX_TO_BSC = "ARC20-BEP20", e.BSC_TO_TC_SUPPORTED = "BEP20-TC", e.BSC_TO_ETH = "BEP20-ERC20", e.BSC_TO_AVAX = "BEP20-ARC20", e.BSC_TO_BSC = "BEP20-BEP20", e))(Ue || {});
604
- const He = [
603
+ var ze = /* @__PURE__ */ ((e) => (e.TC_SUPPORTED_TO_TC_SUPPORTED = "TC-TC", e.TC_SUPPORTED_TO_ETH = "TC-ERC20", e.TC_SUPPORTED_TO_AVAX = "TC-ARC20", e.TC_SUPPORTED_TO_BSC = "TC-BEP20", e.ETH_TO_TC_SUPPORTED = "ERC20-TC", e.ETH_TO_ETH = "ERC20-ERC20", e.ETH_TO_AVAX = "ERC20-ARC20", e.ETH_TO_BSC = "ERC20-BEP20", e.AVAX_TO_TC_SUPPORTED = "ARC20-TC", e.AVAX_TO_ETH = "ARC20-ERC20", e.AVAX_TO_AVAX = "ARC20-ARC20", e.AVAX_TO_BSC = "ARC20-BEP20", e.BSC_TO_TC_SUPPORTED = "BEP20-TC", e.BSC_TO_ETH = "BEP20-ERC20", e.BSC_TO_AVAX = "BEP20-ARC20", e.BSC_TO_BSC = "BEP20-BEP20", e))(ze || {});
604
+ const Ze = [
605
605
  "ERC20-ERC20",
606
606
  "ARC20-ARC20",
607
607
  "BEP20-BEP20"
608
608
  /* BSC_TO_BSC */
609
- ], $e = [
609
+ ], et = [
610
610
  "ERC20-TC",
611
611
  "ERC20-ARC20",
612
612
  "ERC20-BEP20",
@@ -617,95 +617,95 @@ const He = [
617
617
  "BEP20-ERC20",
618
618
  "BEP20-ARC20"
619
619
  /* BSC_TO_AVAX */
620
- ], ke = [
620
+ ], tt = [
621
621
  "TC-TC",
622
622
  "TC-ERC20",
623
623
  "TC-ARC20",
624
624
  "TC-BEP20"
625
625
  /* TC_SUPPORTED_TO_BSC */
626
626
  ];
627
- var Ae = /* @__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))(Ae || {}), Fe = /* @__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))(Fe || {}), 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_0_100 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROFVIDER_NOT_SUPPORTED = "2008", e.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", e.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", e.SOURCE_ADDRESS_SMART_CONTRACT = "2011", e.INVALID_PROVIDER = "2100", e.MISSING_CROSS_CHAIN_PROVIDER = "2101", e.MISSING_AVAX_PROVIDER = "2102", e.MISSING_BSC_PROVIDER = "2103", e.MISSING_ETH_PROVIDER = "2104", e.INVALID_PROVIDER_FOR_SWAP_OUT = "2105", e.MISSING_ARB_PROVIDER = "2106", e.INVALID_CHAIN = "2200", e.INVALID_ASSET = "2201", e.INVALID_ASSET_IDENTIFIER = "2202", e.UNSUPPORTED_CHAIN = "2204", e.UNSUPPORTED_ASSET = "2203", e.UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205", e.INVALID_SOURCE_ADDRESS = "2300", e.INVALID_DESTINATION_ADDRESS = "2301", e.THORNODE_QUOTE_GENERIC_ERROR = "3000", e.NOT_ENOUGH_SYNTH_BALANCE = "3001", e.SYNTH_MINTING_CAP_REACHED = "3002", e.INVALID_QUOTE_MODE = "4000", e.NO_QUOTES = "4001", e.SERVICE_UNAVAILABLE_GENERIC = "5000", e.MISSING_GAS_DATA_GENERIC = "5100", e.MISSING_TOKEN_INFO_GENERIC = "5200", e.CANT_FIND_TOKEN_LIST = "5201", e.NO_PRICE = "5202", e.PRICE_IS_STALE = "5203", e.ADDRESS_NOT_WHITELISTED = "6000", e.ADDRESS_ALREADY_CLAIMED = "6001", e.TEMPORARY_ERROR = "9999", e))(o || {});
628
- const Ge = {
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_0_100]: "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_PROFVIDER_NOT_SUPPORTED]: "Preferred provider not supported.",
650
- [o.DESTINATION_ADDRESS_SMART_CONTRACT]: "Destination address is a smart contract.",
651
- [o.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Buy amount must be a positive integer.",
652
- [o.INVALID_PROVIDER]: "Invalid provider {0}.",
653
- [o.MISSING_CROSS_CHAIN_PROVIDER]: "Missing cross-chain provider.",
654
- [o.MISSING_AVAX_PROVIDER]: "Missing AVAX provider.",
655
- [o.MISSING_BSC_PROVIDER]: "Missing BSC provider.",
656
- [o.MISSING_ETH_PROVIDER]: "Missing ETH provider.",
657
- [o.MISSING_ARB_PROVIDER]: "Missing ARB provider.",
658
- [o.INVALID_PROVIDER_FOR_SWAP_OUT]: "Invalid provider for swap out.",
659
- [o.INVALID_CHAIN]: "Invalid chain {0}.",
660
- [o.INVALID_ASSET]: "Invalid asset {0}.",
661
- [o.UNSUPPORTED_CHAIN]: "Unsupported chain {0}.",
662
- [o.UNSUPPORTED_ASSET]: "Unsupported asset {0}.",
663
- [o.UNSUPPORTED_ASSET_FOR_SWAPOUT]: "Unsupported asset {0} for swap out.",
664
- [o.THORNODE_QUOTE_GENERIC_ERROR]: "ThorNode quote generic error.",
665
- [o.INVALID_SOURCE_ADDRESS]: "Invalid source address {0}",
666
- [o.INVALID_DESTINATION_ADDRESS]: "Invalid destination address {0}",
667
- [o.NOT_ENOUGH_SYNTH_BALANCE]: "Source address doesn't have enough synth balance for this quote.",
668
- [o.SYNTH_MINTING_CAP_REACHED]: "Synth minting cap reached.",
669
- [o.INVALID_QUOTE_MODE]: "Invalid quote mode.",
670
- [o.NO_QUOTES]: "No quotes to service this request.",
671
- [o.SERVICE_UNAVAILABLE_GENERIC]: "Service unavailable.",
672
- [o.MISSING_GAS_DATA_GENERIC]: "Missing gas data.",
673
- [o.MISSING_TOKEN_INFO_GENERIC]: "Missing token info.",
674
- [o.CANT_FIND_TOKEN_LIST]: "Can't find tokenlist {0}.",
675
- [o.NO_PRICE]: "No price for asset {0}.",
676
- [o.PRICE_IS_STALE]: "Price is stale for asset {0}.",
677
- [o.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
678
- [o.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
679
- }, ae = (e, t) => {
680
- let n = Ge[e];
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 || {}), nt = /* @__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))(nt || {}), y = /* @__PURE__ */ ((e) => (e.INVALID_INPUT_PARAMETERS = "1000", e.UNKNOWN_PROVIDERS = "1001", e.CANNOT_FIND_INBOUND_ADDRESS = "1002", e.NO_INBOUND_ADDRESSES = "1003", e.CHAIN_HALTED_OR_UNSUPPORTED = "1004", e.MISSING_INPUT_PARAMETER = "1005", e.INVALID_TYPE_GENERIC = "1100", e.INVALID_NUMBER_STRING = "1101", e.INVALID_NUMBER = "1102", e.INVALID_BOOLEAN = "1103", e.INVALID_OBJECT = "1104", e.INVALID_ARRAY = "1105", e.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", e.SELL_BUY_ASSETS_ARE_THE_SAME = "2001", e.MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", e.AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", e.AFF_ADDRESS_TOO_LONG = "2004", e.AFF_BPS_INTEGER_0_100 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROFVIDER_NOT_SUPPORTED = "2008", e.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", e.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", e.SOURCE_ADDRESS_SMART_CONTRACT = "2011", e.INVALID_PROVIDER = "2100", e.MISSING_CROSS_CHAIN_PROVIDER = "2101", e.MISSING_AVAX_PROVIDER = "2102", e.MISSING_BSC_PROVIDER = "2103", e.MISSING_ETH_PROVIDER = "2104", e.INVALID_PROVIDER_FOR_SWAP_OUT = "2105", e.MISSING_ARB_PROVIDER = "2106", e.INVALID_CHAIN = "2200", e.INVALID_ASSET = "2201", e.INVALID_ASSET_IDENTIFIER = "2202", e.UNSUPPORTED_CHAIN = "2204", e.UNSUPPORTED_ASSET = "2203", e.UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205", e.INVALID_SOURCE_ADDRESS = "2300", e.INVALID_DESTINATION_ADDRESS = "2301", e.THORNODE_QUOTE_GENERIC_ERROR = "3000", e.NOT_ENOUGH_SYNTH_BALANCE = "3001", e.SYNTH_MINTING_CAP_REACHED = "3002", e.INVALID_QUOTE_MODE = "4000", e.NO_QUOTES = "4001", e.SERVICE_UNAVAILABLE_GENERIC = "5000", e.MISSING_GAS_DATA_GENERIC = "5100", e.MISSING_TOKEN_INFO_GENERIC = "5200", e.CANT_FIND_TOKEN_LIST = "5201", e.NO_PRICE = "5202", e.PRICE_IS_STALE = "5203", e.ADDRESS_NOT_WHITELISTED = "6000", e.ADDRESS_ALREADY_CLAIMED = "6001", e.TEMPORARY_ERROR = "9999", e))(y || {});
628
+ const at = {
629
+ [y.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
630
+ [y.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
631
+ [y.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
632
+ [y.NO_INBOUND_ADDRESSES]: "No inbound addresses.",
633
+ [y.CHAIN_HALTED_OR_UNSUPPORTED]: "Chain {0} halted or unsupported.",
634
+ [y.MISSING_INPUT_PARAMETER]: "Missing input parameter: {0}.",
635
+ [y.INVALID_TYPE_GENERIC]: "Invalid type",
636
+ [y.INVALID_NUMBER_STRING]: "Invalid number string.",
637
+ [y.INVALID_NUMBER]: "Invalid number.",
638
+ [y.INVALID_BOOLEAN]: "Invalid boolean.",
639
+ [y.INVALID_OBJECT]: "Invalid object.",
640
+ [y.INVALID_ARRAY]: "Invalid array.",
641
+ [y.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Sell amount must be a positive integer.",
642
+ [y.SELL_BUY_ASSETS_ARE_THE_SAME]: "Sell and buy assets are the same.",
643
+ [y.MISSING_SOURCE_ADDRESS_FOR_SYNTH]: "Source address is required for synth quote.",
644
+ [y.AFF_ADDRESS_AND_BPS_OR_NEITHER]: "Must provide affiliateAddress and affiliateBasisPoints params, or neither.",
645
+ [y.AFF_ADDRESS_TOO_LONG]: "affiliateAddress too long: 3 characters max.",
646
+ [y.AFF_BPS_INTEGER_0_100]: "affiliateBasisPoints must be an integer between 0 and 100.",
647
+ [y.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN]: "Source address {0} invalid for sell chain.",
648
+ [y.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN]: "Destination address {0} invalid for buy chain.",
649
+ [y.PREFERRED_PROFVIDER_NOT_SUPPORTED]: "Preferred provider not supported.",
650
+ [y.DESTINATION_ADDRESS_SMART_CONTRACT]: "Destination address is a smart contract.",
651
+ [y.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Buy amount must be a positive integer.",
652
+ [y.INVALID_PROVIDER]: "Invalid provider {0}.",
653
+ [y.MISSING_CROSS_CHAIN_PROVIDER]: "Missing cross-chain provider.",
654
+ [y.MISSING_AVAX_PROVIDER]: "Missing AVAX provider.",
655
+ [y.MISSING_BSC_PROVIDER]: "Missing BSC provider.",
656
+ [y.MISSING_ETH_PROVIDER]: "Missing ETH provider.",
657
+ [y.MISSING_ARB_PROVIDER]: "Missing ARB provider.",
658
+ [y.INVALID_PROVIDER_FOR_SWAP_OUT]: "Invalid provider for swap out.",
659
+ [y.INVALID_CHAIN]: "Invalid chain {0}.",
660
+ [y.INVALID_ASSET]: "Invalid asset {0}.",
661
+ [y.UNSUPPORTED_CHAIN]: "Unsupported chain {0}.",
662
+ [y.UNSUPPORTED_ASSET]: "Unsupported asset {0}.",
663
+ [y.UNSUPPORTED_ASSET_FOR_SWAPOUT]: "Unsupported asset {0} for swap out.",
664
+ [y.THORNODE_QUOTE_GENERIC_ERROR]: "ThorNode quote generic error.",
665
+ [y.INVALID_SOURCE_ADDRESS]: "Invalid source address {0}",
666
+ [y.INVALID_DESTINATION_ADDRESS]: "Invalid destination address {0}",
667
+ [y.NOT_ENOUGH_SYNTH_BALANCE]: "Source address doesn't have enough synth balance for this quote.",
668
+ [y.SYNTH_MINTING_CAP_REACHED]: "Synth minting cap reached.",
669
+ [y.INVALID_QUOTE_MODE]: "Invalid quote mode.",
670
+ [y.NO_QUOTES]: "No quotes to service this request.",
671
+ [y.SERVICE_UNAVAILABLE_GENERIC]: "Service unavailable.",
672
+ [y.MISSING_GAS_DATA_GENERIC]: "Missing gas data.",
673
+ [y.MISSING_TOKEN_INFO_GENERIC]: "Missing token info.",
674
+ [y.CANT_FIND_TOKEN_LIST]: "Can't find tokenlist {0}.",
675
+ [y.NO_PRICE]: "No price for asset {0}.",
676
+ [y.PRICE_IS_STALE]: "Price is stale for asset {0}.",
677
+ [y.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
678
+ [y.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
679
+ }, re = (e, t) => {
680
+ let n = at[e];
681
681
  for (let a = 0; a < t.length; a++)
682
682
  n = n.replace(`{${a}}`, t[a]);
683
683
  return t.length === 0 ? n.replace("{0}", "") : n;
684
684
  };
685
- let Ut = class we extends Error {
685
+ let wn = class Ce extends Error {
686
686
  constructor({
687
687
  status: t,
688
688
  revision: n,
689
689
  module: a,
690
- code: i,
690
+ code: s,
691
691
  message: r,
692
- type: p,
693
- options: { shouldLog: d, shouldThrow: l, shouldTrace: c } = {
692
+ type: o,
693
+ options: { shouldLog: p, shouldThrow: d, shouldTrace: u } = {
694
694
  shouldLog: !0,
695
695
  shouldThrow: !0,
696
696
  shouldTrace: !0
697
697
  },
698
- displayMessageParams: y
698
+ displayMessageParams: l
699
699
  }) {
700
- const u = r || ae(i, y || []) || "";
701
- super(u), C(this, "status"), C(this, "revision"), C(this, "type"), C(this, "module"), C(this, "code"), C(this, "message"), C(this, "display"), C(this, "stack"), C(this, "options"), C(this, "displayMessageParams"), this.status = t, this.revision = n || "NO_REVISION", this.module = a, this.message = u, this.display = ae(i, y || []), this.code = i, this.type = p || Ae.UNHANDLED_ERROR, this.options = {
702
- shouldLog: d || !0,
703
- shouldTrace: c || !0,
704
- shouldThrow: l || !1
705
- }, this.displayMessageParams = y || [], this.options.shouldTrace && Error.captureStackTrace(this);
700
+ const m = r || re(s, l || []) || "";
701
+ super(m), C(this, "status"), C(this, "revision"), C(this, "type"), C(this, "module"), C(this, "code"), C(this, "message"), C(this, "display"), C(this, "stack"), C(this, "options"), C(this, "displayMessageParams"), this.status = t, this.revision = n || "NO_REVISION", this.module = a, this.message = m, this.display = re(s, l || []), this.code = s, this.type = o || ve.UNHANDLED_ERROR, this.options = {
702
+ shouldLog: p || !0,
703
+ shouldTrace: u || !0,
704
+ shouldThrow: d || !1
705
+ }, this.displayMessageParams = l || [], this.options.shouldTrace && Error.captureStackTrace(this);
706
706
  }
707
707
  static fromErrorInfo(t) {
708
- return new we(t);
708
+ return new Ce(t);
709
709
  }
710
710
  toErrorInfo() {
711
711
  return { ...this, identifier: this.identifier };
@@ -714,7 +714,7 @@ let Ut = class we extends Error {
714
714
  return `${this.revision}-${this.type || "NO_TYPE"}-${this.module}-${this.code}`;
715
715
  }
716
716
  get displayMessage() {
717
- return ae(this.code, this.displayMessageParams || []);
717
+ return re(this.code, this.displayMessageParams || []);
718
718
  }
719
719
  handle() {
720
720
  const t = `[${this.identifier}]: ${this.message}`;
@@ -724,8 +724,8 @@ let Ut = class we extends Error {
724
724
  return this.toErrorInfo();
725
725
  }
726
726
  };
727
- 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 || {}), We = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(We || {}), qe = /* @__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))(qe || {});
728
- const Ht = {
727
+ var i = /* @__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))(i || {}), st = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(st || {}), it = /* @__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))(it || {});
728
+ const An = {
729
729
  ARB: [44, 60, 0, 0, 0],
730
730
  AVAX: [44, 60, 0, 0, 0],
731
731
  BCH: [44, 145, 0, 0, 0],
@@ -742,8 +742,8 @@ const Ht = {
742
742
  OP: [44, 60, 0, 0, 0],
743
743
  THOR: [44, 931, 0, 0, 0]
744
744
  };
745
- 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 || {});
746
- const $t = [
745
+ var w = /* @__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))(w || {});
746
+ const rt = [
747
747
  "ETH",
748
748
  "AVAX",
749
749
  "BSC",
@@ -751,38 +751,50 @@ const $t = [
751
751
  "OP",
752
752
  "MATIC"
753
753
  /* Polygon */
754
- ], kt = [
754
+ ], En = [
755
755
  "BTC",
756
756
  "BCH",
757
757
  "DOGE",
758
758
  "LTC"
759
759
  /* Litecoin */
760
- ], Ft = [
760
+ ], Rn = [
761
761
  "GAIA",
762
762
  "THOR",
763
763
  "BNB"
764
764
  /* Binance */
765
+ ], gn = [
766
+ "AVAX",
767
+ "BNB",
768
+ "BSC",
769
+ "BTC",
770
+ "BCH",
771
+ "GAIA",
772
+ "DOGE",
773
+ "ETH",
774
+ "LTC",
775
+ "THOR"
776
+ /* THORChain */
765
777
  ];
766
- var ce = /* @__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))(ce || {}), Ee = /* @__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))(Ee || {}), 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.finance", e.ThorswapStatic = "https://static.thorswap.net", e))(q || {});
767
- const te = Object.values(s), Ke = Object.keys(s), me = te.reduce(
778
+ var fe = /* @__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))(fe || {}), Me = /* @__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))(Me || {}), 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 || {});
779
+ const ae = Object.values(i), ot = Object.keys(i), be = ae.reduce(
768
780
  (e, t) => {
769
- const n = Ke.find((a) => s[a] === t);
781
+ const n = ot.find((a) => i[a] === t);
770
782
  return n && (e[t] = n), e;
771
783
  },
772
784
  {}
773
- ), Ye = te.reduce(
774
- (e, t) => (e[t] = ce[me[t]], e),
785
+ ), pt = ae.reduce(
786
+ (e, t) => (e[t] = fe[be[t]], e),
775
787
  {}
776
- ), Xe = te.reduce(
777
- (e, t) => (e[t] = Ee[me[t]], e),
788
+ ), dt = ae.reduce(
789
+ (e, t) => (e[t] = Me[be[t]], e),
778
790
  {}
779
- ), Gt = te.reduce(
791
+ ), On = ae.reduce(
780
792
  (e, t) => {
781
- const n = `${me[t]}Hex`;
782
- return e[t] = ce[n], e;
793
+ const n = `${be[t]}Hex`;
794
+ return e[t] = fe[n], e;
783
795
  },
784
796
  {}
785
- ), Wt = {
797
+ ), Sn = {
786
798
  "0xa4b1": "ARB",
787
799
  42161: "ARB",
788
800
  "0xa86a": "AVAX",
@@ -807,7 +819,7 @@ const te = Object.values(s), Ke = Object.keys(s), me = te.reduce(
807
819
  "thorchain-stagenet-v2": "THOR",
808
820
  "thorchain-mainnet-v1": "THOR"
809
821
  /* THORChain */
810
- }, Re = {
822
+ }, Ne = {
811
823
  ARB: "https://arbiscan.io",
812
824
  AVAX: "https://snowtrace.io",
813
825
  BSC: "https://bscscan.com",
@@ -822,308 +834,669 @@ const te = Object.values(s), Ke = Object.keys(s), me = te.reduce(
822
834
  MAYA: "https://www.mayascan.org",
823
835
  OP: "https://optimistic.etherscan.io",
824
836
  MATIC: "https://polygonscan.com",
825
- THOR: "https://viewblock.io/thorchain"
837
+ THOR: "https://runescan.io"
826
838
  };
827
- var je = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(je || {}), 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 || {}), F = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(F || {}), Je = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", e.XDEFI = "XDEFI", e.METAMASK = "METAMASK", e.COINBASE_WEB = "COINBASE_WEB", e.TREZOR = "TREZOR", e.TRUSTWALLET_WEB = "TRUSTWALLET_WEB", e.LEDGER = "LEDGER", e.KEPLR = "KEPLR", e.OKX = "OKX", e.BRAVE = "BRAVE", e.WALLETCONNECT = "WALLETCONNECT", e))(Je || {}), Qe = Object.defineProperty, ze = (e, t, n) => t in e ? Qe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, N = (e, t, n) => (ze(e, typeof t != "symbol" ? t + "" : t, n), n), Ze = (e, t, n) => {
839
+ var ut = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(ut || {}), h = /* @__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))(h || {}), F = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(F || {}), lt = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", e.XDEFI = "XDEFI", e.METAMASK = "METAMASK", e.COINBASE_WEB = "COINBASE_WEB", e.TREZOR = "TREZOR", e.TRUSTWALLET_WEB = "TRUSTWALLET_WEB", e.LEDGER = "LEDGER", e.KEPLR = "KEPLR", e.OKX = "OKX", e.BRAVE = "BRAVE", e.WALLETCONNECT = "WALLETCONNECT", e))(lt || {}), yt = Object.defineProperty, ct = (e, t, n) => t in e ? yt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, I = (e, t, n) => (ct(e, typeof t != "symbol" ? t + "" : t, n), n), mt = (e, t, n) => {
828
840
  if (!t.has(e))
829
841
  throw TypeError("Cannot " + n);
830
- }, B = (e, t, n) => {
842
+ }, H = (e, t, n) => {
831
843
  if (t.has(e))
832
844
  throw TypeError("Cannot add the same private member more than once");
833
845
  t instanceof WeakSet ? t.add(e) : t.set(e, n);
834
- }, R = (e, t, n) => (Ze(e, t, "access private method"), n);
835
- const qt = (e) => {
836
- if (e < 0)
837
- throw new Error("Invalid number of year");
838
- return 10 + e;
839
- }, Kt = (e) => {
840
- if (e.length > 30)
841
- return !1;
842
- const t = /^[a-zA-Z0-9+_-]+$/g;
843
- return !!e.match(t);
844
- }, Yt = ([e, t, n, a, i]) => `${e}'/${t}'/${n}'/${a}${typeof i != "number" ? "" : `/${i}`}`, Oe = async (e, t) => {
845
- const n = Object.entries(t || {}).reduce(
846
- (a, [i, r]) => (r && (a[i] = r), a),
847
- {}
848
- );
849
- return (await fetch(
850
- `${e}${t ? `?${new URLSearchParams(n).toString()}` : ""}`,
851
- { method: "GET", mode: "cors", credentials: "omit", referrer: "https://sk.thorswap.net" }
852
- )).json();
853
- }, et = async (e, t, n, a = !1) => {
854
- const i = await fetch(`${e}`, {
855
- body: t,
856
- headers: n,
857
- method: "POST",
858
- referrer: "https://sk.thorswap.net"
859
- });
860
- return a ? i.text() : i.json();
861
- }, tt = "0x313ce567", Ie = async ({ chain: e, to: t }) => {
846
+ }, R = (e, t, n) => (mt(e, t, "access private method"), n);
847
+ const Tt = "0x313ce567", xe = async ({ chain: e, to: t }) => {
862
848
  try {
863
- const n = await et(
864
- Xe[e],
865
- JSON.stringify({
866
- method: "eth_call",
867
- params: [{ to: t.toLowerCase(), data: tt }, "latest"],
849
+ const { result: n } = await Ae.post(dt[e], {
850
+ headers: {
851
+ accept: "*/*",
852
+ "content-type": "application/json",
853
+ "cache-control": "no-cache"
854
+ },
855
+ body: JSON.stringify({
868
856
  id: 44,
869
- jsonrpc: "2.0"
870
- }),
871
- { accept: "*/*", "cache-control": "no-cache", "content-type": "application/json" },
872
- !0
873
- ), { result: a } = JSON.parse(n);
874
- return parseInt(BigInt(a).toString());
857
+ jsonrpc: "2.0",
858
+ method: "eth_call",
859
+ params: [{ to: t.toLowerCase(), data: Tt }, "latest"]
860
+ })
861
+ });
862
+ return parseInt(BigInt(n).toString());
875
863
  } catch (n) {
876
- return console.error(n), E[e];
864
+ return console.error(n), w[e];
877
865
  }
878
- }, nt = async (e) => {
879
- if (e === s.Ethereum)
880
- return E.ETH;
866
+ }, ht = async (e) => {
867
+ if (e === i.Ethereum)
868
+ return w.ETH;
881
869
  const [, t] = e.split("-");
882
- return t != null && t.startsWith("0x") ? Ie({ chain: s.Ethereum, to: t }) : E.ETH;
883
- }, at = async (e) => {
870
+ return t != null && t.startsWith("0x") ? xe({ chain: i.Ethereum, to: t }) : w.ETH;
871
+ }, _t = async (e) => {
884
872
  const [, t] = e.split("-");
885
- return t != null && t.startsWith("0x") ? Ie({ chain: s.Avalanche, to: t.toLowerCase() }) : E.AVAX;
886
- }, st = async (e) => (e === s.BinanceSmartChain, E.BSC), Se = async ({ chain: e, symbol: t }) => {
873
+ return t != null && t.startsWith("0x") ? xe({ chain: i.Avalanche, to: t.toLowerCase() }) : w.AVAX;
874
+ }, ft = async (e) => (e === i.BinanceSmartChain, w.BSC), bt = async ({ chain: e, symbol: t }) => {
887
875
  switch (e) {
888
- case s.Ethereum:
889
- return nt(t);
890
- case s.Avalanche:
891
- return at(t);
892
- case s.BinanceSmartChain:
893
- return st(t);
876
+ case i.Ethereum:
877
+ return ht(t);
878
+ case i.Avalanche:
879
+ return _t(t);
880
+ case i.BinanceSmartChain:
881
+ return ft(t);
894
882
  default:
895
- return E[e];
883
+ return w[e];
896
884
  }
897
- }, it = {
885
+ }, wt = {
898
886
  [F.Average]: 1.2,
899
887
  [F.Fast]: 1.5,
900
888
  [F.Fastest]: 2
901
- }, rt = ({ chain: e, symbol: t }) => {
889
+ }, De = ({ chain: e, symbol: t }) => {
902
890
  switch (e) {
903
- case s.Bitcoin:
904
- case s.BitcoinCash:
905
- case s.Litecoin:
906
- case s.Dogecoin:
907
- case s.Binance:
908
- case s.Ethereum:
909
- case s.Avalanche:
891
+ case i.Bitcoin:
892
+ case i.BitcoinCash:
893
+ case i.Litecoin:
894
+ case i.Dogecoin:
895
+ case i.Binance:
896
+ case i.Ethereum:
897
+ case i.Avalanche:
910
898
  return t === e;
911
- case s.Arbitrum:
912
- case s.Optimism:
899
+ case i.Arbitrum:
900
+ case i.Optimism:
913
901
  return t === "ETH";
914
- case s.Maya:
902
+ case i.Maya:
915
903
  return t === "CACAO";
916
- case s.Kujira:
904
+ case i.Kujira:
917
905
  return t === "KUJI";
918
- case s.Cosmos:
906
+ case i.Cosmos:
919
907
  return t === "ATOM";
920
- case s.Polygon:
908
+ case i.Polygon:
921
909
  return t === "MATIC";
922
- case s.BinanceSmartChain:
910
+ case i.BinanceSmartChain:
923
911
  return t === "BNB";
924
- case s.THORChain:
912
+ case i.THORChain:
925
913
  return t === "RUNE";
926
914
  }
927
- }, pt = (e) => {
915
+ }, At = (e) => {
928
916
  switch (e) {
929
917
  case "ETH.THOR":
930
918
  return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
931
919
  case "ETH.vTHOR":
932
920
  return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
933
- case s.Cosmos:
934
- return { identifier: "GAIA.ATOM", decimal: E[e] };
935
- case s.THORChain:
936
- return { identifier: "THOR.RUNE", decimal: E[e] };
937
- case s.BinanceSmartChain:
938
- return { identifier: "BSC.BNB", decimal: E[e] };
939
- case s.Maya:
940
- return { identifier: "MAYA.CACAO", decimal: E.MAYA };
921
+ case i.Cosmos:
922
+ return { identifier: "GAIA.ATOM", decimal: w[e] };
923
+ case i.THORChain:
924
+ return { identifier: "THOR.RUNE", decimal: w[e] };
925
+ case i.BinanceSmartChain:
926
+ return { identifier: "BSC.BNB", decimal: w[e] };
927
+ case i.Maya:
928
+ return { identifier: "MAYA.CACAO", decimal: w.MAYA };
941
929
  case "MAYA.MAYA":
942
930
  return { identifier: "MAYA.MAYA", decimal: 4 };
943
- case s.Kujira:
944
- case s.Arbitrum:
945
- case s.Optimism:
946
- case s.BitcoinCash:
947
- case s.Litecoin:
948
- case s.Dogecoin:
949
- case s.Binance:
950
- case s.Avalanche:
951
- case s.Polygon:
952
- case s.Bitcoin:
953
- case s.Ethereum:
954
- return { identifier: `${e}.${e}`, decimal: E[e] };
955
- }
956
- }, ot = ({ chain: e, symbol: t }) => {
931
+ case i.Kujira:
932
+ case i.Arbitrum:
933
+ case i.Optimism:
934
+ case i.BitcoinCash:
935
+ case i.Litecoin:
936
+ case i.Dogecoin:
937
+ case i.Binance:
938
+ case i.Avalanche:
939
+ case i.Polygon:
940
+ case i.Bitcoin:
941
+ case i.Ethereum:
942
+ return { identifier: `${e}.${e}`, decimal: w[e] };
943
+ }
944
+ }, Et = ({ chain: e, symbol: t }) => {
957
945
  if (t.includes("/"))
958
946
  return "Synth";
959
947
  switch (e) {
960
- case s.Bitcoin:
961
- case s.BitcoinCash:
962
- case s.Dogecoin:
963
- case s.Litecoin:
964
- case s.Maya:
965
- case s.THORChain:
948
+ case i.Bitcoin:
949
+ case i.BitcoinCash:
950
+ case i.Dogecoin:
951
+ case i.Litecoin:
952
+ case i.Maya:
953
+ case i.THORChain:
966
954
  return "Native";
967
- case s.Cosmos:
968
- return t === "ATOM" ? "Native" : "GAIA";
969
- case s.Kujira:
970
- return t === "KUJI" ? "Native" : "KUJI";
971
- case s.Binance:
972
- return t === s.Binance ? "Native" : "BEP2";
973
- case s.BinanceSmartChain:
974
- return t === s.Binance ? "Native" : "BEP20";
975
- case s.Ethereum:
976
- return t === s.Ethereum ? "Native" : "ERC20";
977
- case s.Avalanche:
978
- return t === s.Avalanche ? "Native" : "AVAX";
979
- case s.Polygon:
980
- return t === s.Polygon ? "Native" : "POLYGON";
981
- case s.Arbitrum:
982
- return [s.Ethereum, s.Arbitrum].includes(t) ? "Native" : "ARBITRUM";
983
- case s.Optimism:
984
- return [s.Ethereum, s.Optimism].includes(t) ? "Native" : "OPTIMISM";
985
- }
986
- }, Xt = (e) => {
955
+ case i.Cosmos:
956
+ return t === "ATOM" ? "Native" : i.Cosmos;
957
+ case i.Kujira:
958
+ return t === i.Kujira ? "Native" : i.Kujira;
959
+ case i.Binance:
960
+ return t === i.Binance ? "Native" : "BEP2";
961
+ case i.BinanceSmartChain:
962
+ return t === i.Binance ? "Native" : "BEP20";
963
+ case i.Ethereum:
964
+ return t === i.Ethereum ? "Native" : "ERC20";
965
+ case i.Avalanche:
966
+ return t === i.Avalanche ? "Native" : i.Avalanche;
967
+ case i.Polygon:
968
+ return t === i.Polygon ? "Native" : "POLYGON";
969
+ case i.Arbitrum:
970
+ return [i.Ethereum, i.Arbitrum].includes(t) ? "Native" : "ARBITRUM";
971
+ case i.Optimism:
972
+ return [i.Ethereum, i.Optimism].includes(t) ? "Native" : "OPTIMISM";
973
+ }
974
+ }, In = (e) => {
987
975
  var t;
988
- const [n, ...a] = e.split("."), i = e.includes("/"), r = a.join("."), p = (t = r == null ? void 0 : r.split("-")) == null ? void 0 : t[0];
989
- return { chain: n, symbol: r, ticker: p, synth: i };
990
- }, dt = ({
976
+ const [n, ...a] = e.split("."), s = e.includes("/"), r = a.join("."), o = (t = r == null ? void 0 : r.split("-")) == null ? void 0 : t[0];
977
+ return { chain: n, symbol: r, ticker: o, synth: s };
978
+ }, Rt = new RegExp(
979
+ /(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
980
+ "gmi"
981
+ ), gt = (e) => {
982
+ const [t, n] = e.split(".");
983
+ if (!rt.includes(t))
984
+ return !0;
985
+ const [, a] = n.split("-");
986
+ return De({ chain: t, symbol: n }) || !!a;
987
+ }, vn = (e) => e.filter((t) => {
988
+ const n = `${t.chain}.${t.symbol}`;
989
+ return !Rt.test(n) && gt(n) && t.value !== "0";
990
+ }), Ot = ({
991
991
  liquidityUnits: e,
992
992
  poolUnits: t,
993
993
  runeDepth: n
994
994
  }) => {
995
- const a = w(e), i = w(t), r = w(n), p = a.mul(r), d = i.mul(i).mul(2), l = i.mul(a).mul(2), c = a.mul(a), y = i.mul(i).mul(i);
996
- return p.mul(d.sub(l).add(c)).div(y);
997
- }, ut = ({
995
+ const a = g(e), s = g(t), r = g(n), o = a.mul(r), p = s.mul(s).mul(2), d = s.mul(a).mul(2), u = a.mul(a), l = s.mul(s).mul(s);
996
+ return o.mul(p.sub(d).add(u)).div(l);
997
+ }, St = ({
998
998
  liquidityUnits: e,
999
999
  poolUnits: t,
1000
1000
  assetDepth: n
1001
1001
  }) => {
1002
- const a = w(e), i = w(t), r = w(n), p = a.mul(r), d = i.mul(i).mul(2), l = i.mul(a).mul(2), c = a.mul(a), y = p.mul(d.sub(l).add(c)), u = i.mul(i).mul(i);
1003
- return y.div(u);
1004
- }, jt = ({
1002
+ const a = g(e), s = g(t), r = g(n), o = a.mul(r), p = s.mul(s).mul(2), d = s.mul(a).mul(2), u = a.mul(a), l = o.mul(p.sub(d).add(u)), m = s.mul(s).mul(s);
1003
+ return l.div(m);
1004
+ }, Cn = ({
1005
1005
  percent: e,
1006
1006
  runeDepth: t,
1007
1007
  liquidityUnits: n,
1008
1008
  poolUnits: a
1009
- }) => dt({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), Jt = ({
1009
+ }) => Ot({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), Mn = ({
1010
1010
  percent: e,
1011
1011
  assetDepth: t,
1012
1012
  liquidityUnits: n,
1013
1013
  poolUnits: a
1014
- }) => ut({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), w = (e) => new le({ value: e, decimal: E.THOR }), yt = ({
1014
+ }) => St({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), g = (e) => x.fromBigInt(BigInt(e), w.THOR), It = ({
1015
1015
  liquidityUnits: e,
1016
1016
  poolUnits: t,
1017
1017
  runeDepth: n,
1018
1018
  assetDepth: a
1019
1019
  }) => ({
1020
- assetAmount: w(a).mul(e).div(t),
1021
- runeAmount: w(n).mul(e).div(t)
1022
- }), Qt = ({
1020
+ assetAmount: g(a).mul(e).div(t),
1021
+ runeAmount: g(n).mul(e).div(t)
1022
+ }), Nn = ({
1023
1023
  liquidityUnits: e,
1024
1024
  poolUnits: t,
1025
1025
  runeDepth: n,
1026
1026
  assetDepth: a,
1027
- percent: i
1027
+ percent: s
1028
1028
  }) => Object.fromEntries(
1029
- Object.entries(yt({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
1030
- ([r, p]) => [r, p.mul(i)]
1029
+ Object.entries(It({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
1030
+ ([r, o]) => [r, o.mul(s)]
1031
1031
  )
1032
- ), zt = ({
1032
+ ), xn = ({
1033
1033
  runeDepth: e,
1034
1034
  poolUnits: t,
1035
1035
  assetDepth: n,
1036
1036
  liquidityUnits: a,
1037
- runeAmount: i,
1037
+ runeAmount: s,
1038
1038
  assetAmount: r
1039
1039
  }) => {
1040
- const p = w(e), d = w(n), l = w(t), c = w(i), y = w(r), u = c.mul(d), h = y.mul(p), _ = c.mul(y), O = p.mul(d), I = l.mul(u.add(h.add(_.mul(2)))), g = u.add(h.add(O.mul(2))), S = I.div(g), b = w(a).add(S);
1041
- if (S.baseValueNumber === 0)
1042
- return b.div(l).baseValueNumber;
1043
- const M = l.add(b);
1044
- return b.div(M).baseValueNumber;
1045
- }, Zt = ({
1040
+ const o = new x({ value: e, decimal: 8 }), p = new x({ value: n, decimal: 8 }), d = new x({ value: t, decimal: 8 }), u = new x({ value: s, decimal: 8 }), l = new x({ value: r, decimal: 8 }), m = u.mul(p), _ = l.mul(o), b = u.mul(l), A = o.mul(p), E = d.mul(m.add(_.add(b.mul(2)))), O = m.add(_.add(A.mul(2))), S = E.div(O), D = g(a).add(S);
1041
+ if (S.getBaseValue("number") === 0)
1042
+ return D.div(d).getBaseValue("number");
1043
+ const ie = d.add(D);
1044
+ return D.div(ie).getBaseValue("number");
1045
+ }, Dn = ({
1046
1046
  runeAmount: e,
1047
1047
  assetAmount: t,
1048
1048
  runeDepth: n,
1049
1049
  assetDepth: a
1050
1050
  }) => {
1051
- const i = w(n), r = w(a), p = w(t), d = w(e), l = p.mul(i).sub(r.mul(d)), c = r.mul(d).add(i.mul(r));
1052
- return Math.abs(l.div(c).baseValueNumber);
1053
- }, lt = ({
1051
+ if (e === "0" || t === "0" || n === "0" || a === "0")
1052
+ return 0;
1053
+ const s = g(n), r = g(a), o = g(t), p = g(e), d = o.mul(s).sub(r.mul(p)), u = r.mul(p).add(s.mul(r));
1054
+ return Math.abs(d.div(u).getBaseValue("number"));
1055
+ }, vt = ({
1054
1056
  symbol: e,
1055
1057
  ticker: t,
1056
1058
  chain: n
1057
- }) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e, x = (e, t) => {
1059
+ }) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e, N = (e, t) => {
1058
1060
  switch (e) {
1059
- case f.LEAVE:
1060
- case f.BOND: {
1061
+ case h.LEAVE:
1062
+ case h.BOND: {
1061
1063
  const { address: n } = t;
1062
1064
  return `${e}:${n}`;
1063
1065
  }
1064
- case f.UNBOND: {
1066
+ case h.UNBOND: {
1065
1067
  const { address: n, unbondAmount: a } = t;
1066
1068
  return `${e}:${n}:${a * 10 ** 8}`;
1067
1069
  }
1068
- case f.THORNAME_REGISTER: {
1069
- const { name: n, chain: a, address: i, owner: r } = t;
1070
- return `${e}:${n}:${a}:${i}${r ? `:${r}` : ""}`;
1070
+ case h.THORNAME_REGISTER: {
1071
+ const { name: n, chain: a, address: s, owner: r } = t;
1072
+ return `${e}:${n}:${a}:${s}${r ? `:${r}` : ""}`;
1071
1073
  }
1072
- case f.DEPOSIT: {
1073
- const { chain: n, symbol: a, address: i, singleSide: r } = t;
1074
- return r ? `${e}:${n}/${a}::t:0` : `${e}:${n}.${a}:${i || ""}:t:0`;
1074
+ case h.DEPOSIT: {
1075
+ const { chain: n, symbol: a, address: s, singleSide: r } = t;
1076
+ return r ? `${e}:${n}/${a}::t:0` : `${e}:${((o, p) => {
1077
+ switch (o) {
1078
+ case i.Litecoin:
1079
+ return "l";
1080
+ case i.Dogecoin:
1081
+ return "d";
1082
+ case i.BitcoinCash:
1083
+ return "c";
1084
+ default:
1085
+ return `${o}.${p}`;
1086
+ }
1087
+ })(n, a)}:${s || ""}:t:0`;
1075
1088
  }
1076
- case f.WITHDRAW: {
1077
- const { chain: n, ticker: a, symbol: i, basisPoints: r, targetAssetString: p, singleSide: d } = t, l = !d && p ? `:${p}` : "", c = lt({ chain: n, symbol: i, ticker: a });
1078
- return `${e}:${n}${d ? "/" : "."}${c}:${r}${l}`;
1089
+ case h.WITHDRAW: {
1090
+ const { chain: n, ticker: a, symbol: s, basisPoints: r, targetAssetString: o, singleSide: p } = t, d = !p && o ? `:${o}` : "", u = vt({ chain: n, symbol: s, ticker: a });
1091
+ return `${e}:${n}${p ? "/" : "."}${u}:${r}${d}`;
1079
1092
  }
1080
- case f.OPEN_LOAN:
1081
- case f.CLOSE_LOAN: {
1093
+ case h.OPEN_LOAN:
1094
+ case h.CLOSE_LOAN: {
1082
1095
  const { asset: n, address: a } = t;
1083
1096
  return `${e}:${n}:${a}`;
1084
1097
  }
1085
1098
  default:
1086
1099
  return "";
1087
1100
  }
1088
- }, K = 8, ge = ({
1089
- value: e,
1090
- bigIntDecimal: t = K,
1091
- decimal: n = K
1092
- }) => {
1093
- const a = e < 0n;
1094
- let i = e.toString().substring(a ? 1 : 0);
1095
- const r = n - (i.length - 1);
1096
- r > 0 && (i = "0".repeat(r) + i);
1097
- const p = i.length - n;
1098
- let d = i.slice(-n);
1099
- return parseInt(d[t]) >= 5 ? d = `${d.substring(0, t - 1)}${(parseInt(d[t - 1]) + 1).toString()}` : d = d.substring(0, t), `${a ? "-" : ""}${i.slice(0, p)}.${d}`.replace(
1100
- /\.?0*$/,
1101
- ""
1102
- );
1103
- }, Te = Object.values(s), ct = (e = "") => {
1101
+ }, Pn = (e) => {
1102
+ if (e < 0)
1103
+ throw new Error("Invalid number of year");
1104
+ return 10 + e;
1105
+ }, Bn = (e) => {
1106
+ if (e.length > 30)
1107
+ return !1;
1108
+ const t = /^[a-zA-Z0-9+_-]+$/g;
1109
+ return !!e.match(t);
1110
+ }, Ln = ([e, t, n, a, s]) => `${e}'/${t}'/${n}'/${a}${typeof s != "number" ? "" : `/${s}`}`;
1111
+ class Ee extends Error {
1112
+ constructor(t, n, a) {
1113
+ const s = t.status || t.status === 0 ? t.status : "", r = t.statusText || "", o = `${s} ${r}`.trim(), p = o ? `status code ${o}` : "an unknown error";
1114
+ super(`Request failed with ${p}`), Object.defineProperty(this, "response", {
1115
+ enumerable: !0,
1116
+ configurable: !0,
1117
+ writable: !0,
1118
+ value: void 0
1119
+ }), Object.defineProperty(this, "request", {
1120
+ enumerable: !0,
1121
+ configurable: !0,
1122
+ writable: !0,
1123
+ value: void 0
1124
+ }), Object.defineProperty(this, "options", {
1125
+ enumerable: !0,
1126
+ configurable: !0,
1127
+ writable: !0,
1128
+ value: void 0
1129
+ }), this.name = "HTTPError", this.response = t, this.request = n, this.options = a;
1130
+ }
1131
+ }
1132
+ class Pe extends Error {
1133
+ constructor(t) {
1134
+ super("Request timed out"), Object.defineProperty(this, "request", {
1135
+ enumerable: !0,
1136
+ configurable: !0,
1137
+ writable: !0,
1138
+ value: void 0
1139
+ }), this.name = "TimeoutError", this.request = t;
1140
+ }
1141
+ }
1142
+ const J = (e) => e !== null && typeof e == "object", X = (...e) => {
1143
+ for (const t of e)
1144
+ if ((!J(t) || Array.isArray(t)) && t !== void 0)
1145
+ throw new TypeError("The `options` argument must be an object");
1146
+ return we({}, ...e);
1147
+ }, Be = (e = {}, t = {}) => {
1148
+ const n = new globalThis.Headers(e), a = t instanceof globalThis.Headers, s = new globalThis.Headers(t);
1149
+ for (const [r, o] of s.entries())
1150
+ a && o === "undefined" || o === void 0 ? n.delete(r) : n.set(r, o);
1151
+ return n;
1152
+ }, we = (...e) => {
1153
+ let t = {}, n = {};
1154
+ for (const a of e)
1155
+ if (Array.isArray(a))
1156
+ Array.isArray(t) || (t = []), t = [...t, ...a];
1157
+ else if (J(a)) {
1158
+ for (let [s, r] of Object.entries(a))
1159
+ J(r) && s in t && (r = we(t[s], r)), t = { ...t, [s]: r };
1160
+ J(a.headers) && (n = Be(n, a.headers), t.headers = n);
1161
+ }
1162
+ return t;
1163
+ }, Ct = (() => {
1164
+ let e = !1, t = !1;
1165
+ const n = typeof globalThis.ReadableStream == "function", a = typeof globalThis.Request == "function";
1166
+ return n && a && (t = new globalThis.Request("https://empty.invalid", {
1167
+ body: new globalThis.ReadableStream(),
1168
+ method: "POST",
1169
+ // @ts-expect-error - Types are outdated.
1170
+ get duplex() {
1171
+ return e = !0, "half";
1172
+ }
1173
+ }).headers.has("Content-Type")), e && !t;
1174
+ })(), Mt = typeof globalThis.AbortController == "function", Nt = typeof globalThis.ReadableStream == "function", xt = typeof globalThis.FormData == "function", Le = ["get", "post", "put", "patch", "head", "delete"], Dt = {
1175
+ json: "application/json",
1176
+ text: "text/*",
1177
+ formData: "multipart/form-data",
1178
+ arrayBuffer: "*/*",
1179
+ blob: "*/*"
1180
+ }, oe = 2147483647, Ve = Symbol("stop"), Pt = {
1181
+ json: !0,
1182
+ parseJson: !0,
1183
+ searchParams: !0,
1184
+ prefixUrl: !0,
1185
+ retry: !0,
1186
+ timeout: !0,
1187
+ hooks: !0,
1188
+ throwHttpErrors: !0,
1189
+ onDownloadProgress: !0,
1190
+ fetch: !0
1191
+ }, Bt = {
1192
+ method: !0,
1193
+ headers: !0,
1194
+ body: !0,
1195
+ mode: !0,
1196
+ credentials: !0,
1197
+ cache: !0,
1198
+ redirect: !0,
1199
+ referrer: !0,
1200
+ referrerPolicy: !0,
1201
+ integrity: !0,
1202
+ keepalive: !0,
1203
+ signal: !0,
1204
+ window: !0,
1205
+ dispatcher: !0,
1206
+ duplex: !0
1207
+ }, Lt = (e) => Le.includes(e) ? e.toUpperCase() : e, Vt = ["get", "put", "head", "delete", "options", "trace"], Ut = [408, 413, 429, 500, 502, 503, 504], Ue = [413, 429, 503], Re = {
1208
+ limit: 2,
1209
+ methods: Vt,
1210
+ statusCodes: Ut,
1211
+ afterStatusCodes: Ue,
1212
+ maxRetryAfter: Number.POSITIVE_INFINITY,
1213
+ backoffLimit: Number.POSITIVE_INFINITY,
1214
+ delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
1215
+ }, $t = (e = {}) => {
1216
+ if (typeof e == "number")
1217
+ return {
1218
+ ...Re,
1219
+ limit: e
1220
+ };
1221
+ if (e.methods && !Array.isArray(e.methods))
1222
+ throw new Error("retry.methods must be an array");
1223
+ if (e.statusCodes && !Array.isArray(e.statusCodes))
1224
+ throw new Error("retry.statusCodes must be an array");
1225
+ return {
1226
+ ...Re,
1227
+ ...e,
1228
+ afterStatusCodes: Ue
1229
+ };
1230
+ };
1231
+ async function Ht(e, t, n, a) {
1232
+ return new Promise((s, r) => {
1233
+ const o = setTimeout(() => {
1234
+ n && n.abort(), r(new Pe(e));
1235
+ }, a.timeout);
1236
+ a.fetch(e, t).then(s).catch(r).then(() => {
1237
+ clearTimeout(o);
1238
+ });
1239
+ });
1240
+ }
1241
+ async function kt(e, { signal: t }) {
1242
+ return new Promise((n, a) => {
1243
+ t && (t.throwIfAborted(), t.addEventListener("abort", s, { once: !0 }));
1244
+ function s() {
1245
+ clearTimeout(r), a(t.reason);
1246
+ }
1247
+ const r = setTimeout(() => {
1248
+ t == null || t.removeEventListener("abort", s), n();
1249
+ }, e);
1250
+ });
1251
+ }
1252
+ const Ft = (e, t) => {
1253
+ const n = {};
1254
+ for (const a in t)
1255
+ !(a in Bt) && !(a in Pt) && !(a in e) && (n[a] = t[a]);
1256
+ return n;
1257
+ };
1258
+ class Z {
1259
+ static create(t, n) {
1260
+ const a = new Z(t, n), s = async () => {
1261
+ if (typeof a._options.timeout == "number" && a._options.timeout > oe)
1262
+ throw new RangeError(`The \`timeout\` option cannot be greater than ${oe}`);
1263
+ await Promise.resolve();
1264
+ let o = await a._fetch();
1265
+ for (const p of a._options.hooks.afterResponse) {
1266
+ const d = await p(a.request, a._options, a._decorateResponse(o.clone()));
1267
+ d instanceof globalThis.Response && (o = d);
1268
+ }
1269
+ if (a._decorateResponse(o), !o.ok && a._options.throwHttpErrors) {
1270
+ let p = new Ee(o, a.request, a._options);
1271
+ for (const d of a._options.hooks.beforeError)
1272
+ p = await d(p);
1273
+ throw p;
1274
+ }
1275
+ if (a._options.onDownloadProgress) {
1276
+ if (typeof a._options.onDownloadProgress != "function")
1277
+ throw new TypeError("The `onDownloadProgress` option must be a function");
1278
+ if (!Nt)
1279
+ throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
1280
+ return a._stream(o.clone(), a._options.onDownloadProgress);
1281
+ }
1282
+ return o;
1283
+ }, r = a._options.retry.methods.includes(a.request.method.toLowerCase()) ? a._retry(s) : s();
1284
+ for (const [o, p] of Object.entries(Dt))
1285
+ r[o] = async () => {
1286
+ a.request.headers.set("accept", a.request.headers.get("accept") || p);
1287
+ const d = (await r).clone();
1288
+ if (o === "json") {
1289
+ if (d.status === 204 || (await d.clone().arrayBuffer()).byteLength === 0)
1290
+ return "";
1291
+ if (n.parseJson)
1292
+ return n.parseJson(await d.text());
1293
+ }
1294
+ return d[o]();
1295
+ };
1296
+ return r;
1297
+ }
1298
+ // eslint-disable-next-line complexity
1299
+ constructor(t, n = {}) {
1300
+ if (Object.defineProperty(this, "request", {
1301
+ enumerable: !0,
1302
+ configurable: !0,
1303
+ writable: !0,
1304
+ value: void 0
1305
+ }), Object.defineProperty(this, "abortController", {
1306
+ enumerable: !0,
1307
+ configurable: !0,
1308
+ writable: !0,
1309
+ value: void 0
1310
+ }), Object.defineProperty(this, "_retryCount", {
1311
+ enumerable: !0,
1312
+ configurable: !0,
1313
+ writable: !0,
1314
+ value: 0
1315
+ }), Object.defineProperty(this, "_input", {
1316
+ enumerable: !0,
1317
+ configurable: !0,
1318
+ writable: !0,
1319
+ value: void 0
1320
+ }), Object.defineProperty(this, "_options", {
1321
+ enumerable: !0,
1322
+ configurable: !0,
1323
+ writable: !0,
1324
+ value: void 0
1325
+ }), this._input = t, this._options = {
1326
+ // TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
1327
+ credentials: this._input.credentials || "same-origin",
1328
+ ...n,
1329
+ headers: Be(this._input.headers, n.headers),
1330
+ hooks: we({
1331
+ beforeRequest: [],
1332
+ beforeRetry: [],
1333
+ beforeError: [],
1334
+ afterResponse: []
1335
+ }, n.hooks),
1336
+ method: Lt(n.method ?? this._input.method),
1337
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
1338
+ prefixUrl: String(n.prefixUrl || ""),
1339
+ retry: $t(n.retry),
1340
+ throwHttpErrors: n.throwHttpErrors !== !1,
1341
+ timeout: n.timeout ?? 1e4,
1342
+ fetch: n.fetch ?? globalThis.fetch.bind(globalThis)
1343
+ }, typeof this._input != "string" && !(this._input instanceof URL || this._input instanceof globalThis.Request))
1344
+ throw new TypeError("`input` must be a string, URL, or Request");
1345
+ if (this._options.prefixUrl && typeof this._input == "string") {
1346
+ if (this._input.startsWith("/"))
1347
+ throw new Error("`input` must not begin with a slash when using `prefixUrl`");
1348
+ this._options.prefixUrl.endsWith("/") || (this._options.prefixUrl += "/"), this._input = this._options.prefixUrl + this._input;
1349
+ }
1350
+ if (Mt) {
1351
+ if (this.abortController = new globalThis.AbortController(), this._options.signal) {
1352
+ const a = this._options.signal;
1353
+ this._options.signal.addEventListener("abort", () => {
1354
+ this.abortController.abort(a.reason);
1355
+ });
1356
+ }
1357
+ this._options.signal = this.abortController.signal;
1358
+ }
1359
+ if (Ct && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
1360
+ const a = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), s = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, a);
1361
+ (xt && 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(s, { ...this.request }), this._options);
1362
+ }
1363
+ 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 }));
1364
+ }
1365
+ _calculateRetryDelay(t) {
1366
+ if (this._retryCount++, this._retryCount < this._options.retry.limit && !(t instanceof Pe)) {
1367
+ if (t instanceof Ee) {
1368
+ if (!this._options.retry.statusCodes.includes(t.response.status))
1369
+ return 0;
1370
+ const a = t.response.headers.get("Retry-After");
1371
+ if (a && this._options.retry.afterStatusCodes.includes(t.response.status)) {
1372
+ let s = Number(a);
1373
+ return Number.isNaN(s) ? s = Date.parse(a) - Date.now() : s *= 1e3, this._options.retry.maxRetryAfter !== void 0 && s > this._options.retry.maxRetryAfter ? 0 : s;
1374
+ }
1375
+ if (t.response.status === 413)
1376
+ return 0;
1377
+ }
1378
+ const n = this._options.retry.delay(this._retryCount);
1379
+ return Math.min(this._options.retry.backoffLimit, n);
1380
+ }
1381
+ return 0;
1382
+ }
1383
+ _decorateResponse(t) {
1384
+ return this._options.parseJson && (t.json = async () => this._options.parseJson(await t.text())), t;
1385
+ }
1386
+ async _retry(t) {
1387
+ try {
1388
+ return await t();
1389
+ } catch (n) {
1390
+ const a = Math.min(this._calculateRetryDelay(n), oe);
1391
+ if (a !== 0 && this._retryCount > 0) {
1392
+ await kt(a, { signal: this._options.signal });
1393
+ for (const s of this._options.hooks.beforeRetry)
1394
+ if (await s({
1395
+ request: this.request,
1396
+ options: this._options,
1397
+ error: n,
1398
+ retryCount: this._retryCount
1399
+ }) === Ve)
1400
+ return;
1401
+ return this._retry(t);
1402
+ }
1403
+ throw n;
1404
+ }
1405
+ }
1406
+ async _fetch() {
1407
+ for (const n of this._options.hooks.beforeRequest) {
1408
+ const a = await n(this.request, this._options);
1409
+ if (a instanceof Request) {
1410
+ this.request = a;
1411
+ break;
1412
+ }
1413
+ if (a instanceof Response)
1414
+ return a;
1415
+ }
1416
+ const t = Ft(this.request, this._options);
1417
+ return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Ht(this.request.clone(), t, this.abortController, this._options);
1418
+ }
1419
+ /* istanbul ignore next */
1420
+ _stream(t, n) {
1421
+ const a = Number(t.headers.get("content-length")) || 0;
1422
+ let s = 0;
1423
+ return t.status === 204 ? (n && n({ percent: 1, totalBytes: a, transferredBytes: s }, new Uint8Array()), new globalThis.Response(null, {
1424
+ status: t.status,
1425
+ statusText: t.statusText,
1426
+ headers: t.headers
1427
+ })) : new globalThis.Response(new globalThis.ReadableStream({
1428
+ async start(r) {
1429
+ const o = t.body.getReader();
1430
+ n && n({ percent: 0, transferredBytes: 0, totalBytes: a }, new Uint8Array());
1431
+ async function p() {
1432
+ const { done: d, value: u } = await o.read();
1433
+ if (d) {
1434
+ r.close();
1435
+ return;
1436
+ }
1437
+ if (n) {
1438
+ s += u.byteLength;
1439
+ const l = a === 0 ? 0 : s / a;
1440
+ n({ percent: l, transferredBytes: s, totalBytes: a }, u);
1441
+ }
1442
+ r.enqueue(u), await p();
1443
+ }
1444
+ await p();
1445
+ }
1446
+ }), {
1447
+ status: t.status,
1448
+ statusText: t.statusText,
1449
+ headers: t.headers
1450
+ });
1451
+ }
1452
+ }
1453
+ /*! MIT License © Sindre Sorhus */
1454
+ const le = (e) => {
1455
+ const t = (n, a) => Z.create(n, X(e, a));
1456
+ for (const n of Le)
1457
+ t[n] = (a, s) => Z.create(a, X(e, s, { method: n }));
1458
+ return t.create = (n) => le(X(n)), t.extend = (n) => le(X(e, n)), t.stop = Ve, t;
1459
+ }, Gt = le(), qt = Gt, Wt = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, ge = qt.create({ headers: Wt }), Ae = {
1460
+ get: (e, t) => ge.get(e, t).json(),
1461
+ post: (e, t) => ge.post(e, t).json()
1462
+ }, Oe = Object.values(i), jt = (e = "") => {
1104
1463
  const t = e.toUpperCase(), [n] = t.split(".");
1105
- if (Te.includes(n))
1464
+ if (Oe.includes(n))
1106
1465
  return !0;
1107
1466
  const [a] = t.split("/");
1108
- if (Te.includes(a))
1467
+ if (Oe.includes(a))
1109
1468
  return !0;
1110
1469
  throw new Error(
1111
1470
  `Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
1112
1471
  );
1113
- }, U = (e) => 10n ** BigInt(e), G = (e) => Math.log10(parseFloat(e.toString()));
1114
- var L, $, ie, ve, re, _e, z, pe, H, W, Z, oe, k, J;
1115
- const mt = class Q {
1472
+ }, W = 8, L = (e) => 10n ** BigInt(e), G = (e) => Math.log10(parseFloat(e.toString()));
1473
+ function se({
1474
+ value: e,
1475
+ bigIntDecimal: t = W,
1476
+ decimal: n = W
1477
+ }) {
1478
+ const a = e < 0n;
1479
+ let s = e.toString().substring(a ? 1 : 0);
1480
+ const r = n - (s.length - 1);
1481
+ r > 0 && (s = "0".repeat(r) + s);
1482
+ const o = s.length - n;
1483
+ let p = s.slice(-n);
1484
+ return parseInt(p[t]) >= 5 ? p = `${p.substring(0, t - 1)}${(parseInt(p[t - 1]) + 1).toString()}` : p = p.substring(0, t), `${a ? "-" : ""}${s.slice(0, o)}.${p}`.replace(
1485
+ /\.?0*$/,
1486
+ ""
1487
+ );
1488
+ }
1489
+ var U, k, B, $, ye, $e, Q, pe, ee, ce;
1490
+ const Kt = class He {
1116
1491
  constructor(t) {
1117
- B(this, L), B(this, ie), B(this, re), B(this, z), B(this, H), B(this, Z), B(this, k), N(this, "decimalMultiplier", 10n ** 8n), N(this, "bigIntValue", 0n), N(this, "decimal");
1118
- const n = typeof t == "object", a = n ? t.value : t;
1119
- this.decimal = n ? t.decimal : void 0, this.decimalMultiplier = U(
1120
- Math.max(R(this, Z, oe).call(this, R(this, H, W).call(this, a)), this.decimal || 0)
1121
- ), R(this, ie, ve).call(this, a);
1492
+ H(this, U), H(this, B), H(this, ye), H(this, Q), H(this, ee), I(this, "decimalMultiplier", 10n ** 8n), I(this, "bigIntValue", 0n), I(this, "decimal");
1493
+ const n = Te(t), a = typeof t == "object";
1494
+ this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier : L(Math.max(ke(te(n)), this.decimal || 0)), R(this, ye, $e).call(this, n);
1122
1495
  }
1123
1496
  static fromBigInt(t, n) {
1124
- return new Q({
1497
+ return new He({
1125
1498
  decimal: n,
1126
- value: ge({ value: t, bigIntDecimal: n, decimal: n })
1499
+ value: se({ value: t, bigIntDecimal: n, decimal: n })
1127
1500
  });
1128
1501
  }
1129
1502
  static shiftDecimals({
@@ -1131,198 +1504,273 @@ const mt = class Q {
1131
1504
  from: n,
1132
1505
  to: a
1133
1506
  }) {
1134
- return Q.fromBigInt(
1135
- new Q(t).bigIntValue * U(a) / U(n),
1507
+ return this.fromBigInt(
1508
+ t.getBaseValue("bigint") * L(a) / L(n),
1136
1509
  a
1137
1510
  );
1138
1511
  }
1139
- get unsafeNumber() {
1140
- return parseFloat((this.bigIntValue / this.decimalMultiplier).toString());
1141
- }
1142
- get baseValue() {
1143
- return R(this, k, J).call(this, "string");
1144
- }
1145
- get baseValueNumber() {
1146
- return R(this, k, J).call(this, "number");
1147
- }
1148
- get baseValueBigInt() {
1149
- return R(this, k, J).call(this, "number");
1150
- }
1151
- get value() {
1152
- return this.formatBigIntToSafeValue(
1153
- this.bigIntValue,
1154
- this.decimal || G(this.decimalMultiplier)
1155
- );
1512
+ set(t) {
1513
+ return new this.constructor({ decimal: this.decimal, value: t, identifier: this.toString() });
1156
1514
  }
1157
1515
  add(...t) {
1158
- return R(this, L, $).call(this, "add", ...t);
1516
+ return R(this, U, k).call(this, "add", ...t);
1159
1517
  }
1160
1518
  sub(...t) {
1161
- return R(this, L, $).call(this, "sub", ...t);
1519
+ return R(this, U, k).call(this, "sub", ...t);
1162
1520
  }
1163
1521
  mul(...t) {
1164
- return R(this, L, $).call(this, "mul", ...t);
1522
+ return R(this, U, k).call(this, "mul", ...t);
1165
1523
  }
1166
1524
  div(...t) {
1167
- return R(this, L, $).call(this, "div", ...t);
1525
+ return R(this, U, k).call(this, "div", ...t);
1168
1526
  }
1169
1527
  gt(t) {
1170
- return this.bigIntValue > this.getBigIntValue(t);
1528
+ return R(this, B, $).call(this, "gt", t);
1171
1529
  }
1172
1530
  gte(t) {
1173
- return this.bigIntValue >= this.getBigIntValue(t);
1531
+ return R(this, B, $).call(this, "gte", t);
1174
1532
  }
1175
1533
  lt(t) {
1176
- return this.bigIntValue < this.getBigIntValue(t);
1534
+ return R(this, B, $).call(this, "lt", t);
1177
1535
  }
1178
1536
  lte(t) {
1179
- return this.bigIntValue <= this.getBigIntValue(t);
1537
+ return R(this, B, $).call(this, "lte", t);
1180
1538
  }
1181
1539
  eqValue(t) {
1182
- return this.bigIntValue === this.getBigIntValue(t);
1540
+ return R(this, B, $).call(this, "eqValue", t);
1541
+ }
1542
+ // @ts-expect-error False positive
1543
+ getValue(t) {
1544
+ const n = this.formatBigIntToSafeValue(
1545
+ this.bigIntValue,
1546
+ this.decimal || G(this.decimalMultiplier)
1547
+ );
1548
+ switch (t) {
1549
+ case "number":
1550
+ return Number(n);
1551
+ case "string":
1552
+ return n;
1553
+ case "bigint":
1554
+ return this.bigIntValue * 10n ** BigInt(this.decimal || 8n) / this.decimalMultiplier;
1555
+ }
1556
+ }
1557
+ // @ts-expect-error
1558
+ getBaseValue(t) {
1559
+ const n = this.decimalMultiplier / L(this.decimal || w.THOR), a = this.bigIntValue / n;
1560
+ switch (t) {
1561
+ case "number":
1562
+ return Number(a);
1563
+ case "string":
1564
+ return a.toString();
1565
+ case "bigint":
1566
+ return a;
1567
+ }
1183
1568
  }
1184
1569
  getBigIntValue(t, n) {
1185
- return !n && typeof t == "object" ? t.bigIntValue : (t = typeof t == "object" ? t.value : t, R(this, z, pe).call(this, R(this, H, W).call(this, t), n));
1570
+ if (!n && typeof t == "object")
1571
+ return t.bigIntValue;
1572
+ const a = Te(t), s = te(a);
1573
+ return s === "0" || s === "undefined" ? 0n : R(this, ee, ce).call(this, s, n);
1574
+ }
1575
+ toSignificant(t = 6) {
1576
+ const [n, a] = this.getValue("string").split("."), s = n || "", r = a || "";
1577
+ if ((parseInt(s) ? s.length + r.length : r.length) <= t)
1578
+ return this.getValue("string");
1579
+ if (s.length >= t)
1580
+ return s.slice(0, t).padEnd(s.length, "0");
1581
+ if (parseInt(s))
1582
+ return `${s}.${r.slice(0, t - s.length)}`.padEnd(
1583
+ t - s.length,
1584
+ "0"
1585
+ );
1586
+ const o = parseInt(r), p = `${o}`.slice(0, t);
1587
+ return `0.${p.padStart(
1588
+ r.length - `${o}`.length + p.length,
1589
+ "0"
1590
+ )}`;
1591
+ }
1592
+ toFixed(t = 6) {
1593
+ const [n, a] = this.getValue("string").split("."), s = n || "", r = a || "";
1594
+ if (parseInt(s))
1595
+ return `${s}.${r.slice(0, t)}`.padEnd(t, "0");
1596
+ const o = parseInt(r), p = `${o}`.slice(0, t);
1597
+ return `0.${p.padStart(
1598
+ r.length - `${o}`.length + p.length,
1599
+ "0"
1600
+ )}`;
1601
+ }
1602
+ toAbbreviation(t = 2) {
1603
+ const n = this.getValue("number"), a = ["", "K", "M", "B", "T", "Q", "Qi", "S"], s = Math.floor(Math.log10(Math.abs(n)) / 3), r = a[s];
1604
+ if (!r)
1605
+ return this.getValue("string");
1606
+ const o = 10 ** (s * 3);
1607
+ return `${(n / o).toFixed(t)}${r}`;
1608
+ }
1609
+ toCurrency(t = "$", {
1610
+ currencyPosition: n = "start",
1611
+ decimal: a = 2,
1612
+ decimalSeparator: s = ".",
1613
+ thousandSeparator: r = ","
1614
+ } = {}) {
1615
+ const o = this.getValue("number"), [p, d = ""] = o.toFixed(6).split("."), u = p.replace(/\B(?=(\d{3})+(?!\d))/g, r), l = !p && !d ? "0.00" : p === "0" ? `${parseFloat(`0.${d}`)}`.replace(".", s) : `${u}${parseInt(d) ? `${s}${d.slice(0, a)}` : ""}`;
1616
+ return `${n === "start" ? t : ""}${l}${n === "end" ? t : ""}`;
1186
1617
  }
1187
1618
  formatBigIntToSafeValue(t, n) {
1188
- const a = n || this.decimal || K, i = Math.max(
1619
+ const a = n || this.decimal || W, s = Math.max(
1189
1620
  a,
1190
1621
  G(this.decimalMultiplier)
1191
- ), r = t < 0n;
1192
- let p = t.toString().substring(r ? 1 : 0);
1193
- const d = i - (p.length - 1);
1194
- d > 0 && (p = "0".repeat(d) + p);
1195
- const l = p.length - i;
1196
- let c = p.slice(-i);
1197
- return parseInt(c[a]) >= 5 ? c = `${c.substring(0, a - 1)}${(parseInt(c[a - 1]) + 1).toString()}` : c = c.substring(0, a), `${r ? "-" : ""}${p.slice(0, l)}.${c}`.replace(
1198
- /\.?0*$/,
1199
- ""
1200
- );
1201
- }
1202
- toSignificant(t) {
1203
- const n = this.value.split("."), a = n[0], i = n[1];
1204
- return i ? `${a}.${i.slice(0, t || this.decimal)}`.replace(
1205
- /\.?0*$/,
1206
- ""
1207
- ) : a;
1622
+ ), r = t < 0n, o = t.toString().substring(r ? 1 : 0), p = s - (o.length - 1), d = p > 0 ? "0".repeat(p) + o : o, u = d.length - s;
1623
+ let l = d.slice(-s);
1624
+ return parseInt(l[a]) >= 5 ? l = `${l.substring(0, a - 1)}${(parseInt(l[a - 1]) + 1).toString()}` : l = l.substring(0, a), `${r ? "-" : ""}${d.slice(
1625
+ 0,
1626
+ u
1627
+ )}.${l}`.replace(/\.?0*$/, "");
1208
1628
  }
1209
1629
  };
1210
- L = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
1211
- const n = R(this, re, _e).call(this, this, ...t), a = U(n), i = t.reduce(
1630
+ U = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
1631
+ const n = R(this, Q, pe).call(this, this, ...t), a = Math.max(n, G(this.decimalMultiplier)), s = L(a), r = t.reduce(
1212
1632
  (p, d) => {
1213
- const l = this.getBigIntValue(d, n);
1214
- if (e === "div" && l === 0n)
1215
- throw new RangeError("Division by zero");
1216
- return e === "add" ? p + l : e === "sub" ? p - l : e === "mul" ? p * l / a : p * a / l;
1633
+ const u = this.getBigIntValue(d, a);
1634
+ switch (e) {
1635
+ case "add":
1636
+ return p + u;
1637
+ case "sub":
1638
+ return p - u;
1639
+ case "mul":
1640
+ return p * u / s;
1641
+ case "div": {
1642
+ if (u === 0n)
1643
+ throw new RangeError("Division by zero");
1644
+ return p * s / u;
1645
+ }
1646
+ default:
1647
+ return p;
1648
+ }
1217
1649
  },
1218
1650
  //normalize is to precision multiplier base
1219
- this.bigIntValue * a / this.decimalMultiplier
1220
- ), r = ge({
1221
- bigIntDecimal: n,
1222
- decimal: Math.max(n, G(this.decimalMultiplier)),
1223
- value: i
1651
+ this.bigIntValue * s / this.decimalMultiplier
1652
+ ), o = se({
1653
+ bigIntDecimal: a,
1654
+ decimal: a,
1655
+ value: r
1224
1656
  });
1225
- return new this.constructor({ decimal: this.decimal, value: r, identifier: this.toString() });
1226
- }, ie = /* @__PURE__ */ new WeakSet(), ve = function(e, t) {
1227
- const n = R(this, H, W).call(this, e) || "0";
1228
- this.bigIntValue = t || R(this, z, pe).call(this, n);
1229
- }, re = /* @__PURE__ */ new WeakSet(), _e = function(...e) {
1230
- const t = e.map(
1231
- (n) => typeof n == "object" ? n.decimal || G(n.decimalMultiplier) : R(this, Z, oe).call(this, R(this, H, W).call(this, n))
1232
- ).filter(Boolean);
1233
- return Math.max(...t, K);
1234
- }, z = /* @__PURE__ */ new WeakSet(), pe = function(e, t) {
1235
- const n = t ? U(t) : this.decimalMultiplier, a = G(n), [i, r = ""] = e.split(".");
1236
- return BigInt(`${i}${r.padEnd(a, "0")}`);
1237
- }, H = /* @__PURE__ */ new WeakSet(), W = function(e) {
1238
- const t = `${typeof e == "number" ? Number(e).toLocaleString("fullwide", {
1239
- useGrouping: !1,
1240
- maximumFractionDigits: 20
1241
- }) : e}`.replaceAll(",", ".").split(".");
1242
- return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
1243
- }, Z = /* @__PURE__ */ new WeakSet(), oe = function(e) {
1244
- var t;
1245
- const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
1246
- return Math.max(n, K);
1247
- }, k = /* @__PURE__ */ new WeakSet(), J = function(e) {
1248
- const t = this.decimalMultiplier / U(this.decimal || 0), n = this.bigIntValue / t;
1657
+ return new this.constructor({
1658
+ decimalMultiplier: L(a),
1659
+ decimal: this.decimal,
1660
+ value: o,
1661
+ identifier: this.toString()
1662
+ });
1663
+ }, B = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
1664
+ const n = R(this, Q, pe).call(this, this, ...t), a = this.getBigIntValue(t[0], n), s = this.getBigIntValue(this, n);
1249
1665
  switch (e) {
1250
- case "number":
1251
- return Number(n);
1252
- case "string":
1253
- return n.toString();
1254
- default:
1255
- return n;
1666
+ case "gt":
1667
+ return s > a;
1668
+ case "gte":
1669
+ return s >= a;
1670
+ case "lt":
1671
+ return s < a;
1672
+ case "lte":
1673
+ return s <= a;
1674
+ case "eqValue":
1675
+ return s === a;
1256
1676
  }
1677
+ }, ye = /* @__PURE__ */ new WeakSet(), $e = function(e) {
1678
+ const t = te(e) || "0";
1679
+ this.bigIntValue = R(this, ee, ce).call(this, t);
1680
+ }, Q = /* @__PURE__ */ new WeakSet(), pe = function(...e) {
1681
+ const t = e.map((n) => typeof n == "object" ? n.decimal || G(n.decimalMultiplier) : ke(te(n))).filter(Boolean);
1682
+ return Math.max(...t, W);
1683
+ }, ee = /* @__PURE__ */ new WeakSet(), ce = function(e, t) {
1684
+ const n = t ? L(t) : this.decimalMultiplier, a = G(n), [s = "", r = ""] = e.split(".");
1685
+ return BigInt(`${s}${r.padEnd(a, "0")}`);
1257
1686
  };
1258
- let de = mt, ue;
1259
- const se = (e) => {
1260
- if (!ue)
1687
+ let me = Kt;
1688
+ const Yt = Intl.NumberFormat("fullwide", {
1689
+ useGrouping: !1,
1690
+ maximumFractionDigits: 20
1691
+ });
1692
+ function te(e) {
1693
+ const t = `${typeof e == "number" ? Yt.format(e) : Te(e)}`.replaceAll(",", ".").split(".");
1694
+ return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
1695
+ }
1696
+ function ke(e) {
1697
+ var t;
1698
+ const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
1699
+ return Math.max(n, W);
1700
+ }
1701
+ function Te(e) {
1702
+ return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
1703
+ }
1704
+ const z = (e, t) => typeof e == "bigint" ? se({ value: e, bigIntDecimal: t, decimal: t }) : e;
1705
+ let he;
1706
+ const Se = (e) => {
1707
+ if (!he)
1261
1708
  throw new Error("Static assets not loaded, call await AssetValue.loadStaticAssets() first");
1262
- return ue.get(e.toUpperCase()) || { decimal: E.THOR, identifier: "" };
1263
- }, he = async (e, t = 0) => {
1264
- ct(e);
1265
- const n = await Se(ye(e));
1266
- return new v({ decimal: n, value: t, identifier: e });
1709
+ return he.get(e.toUpperCase()) || { decimal: w.THOR, identifier: "" };
1710
+ }, de = async (e, t = 0) => {
1711
+ jt(e);
1712
+ const n = await bt(_e(e)), a = z(t, n);
1713
+ return new M({ decimal: n, value: a, identifier: e });
1267
1714
  };
1268
- class v extends de {
1715
+ class M extends me {
1269
1716
  constructor(t) {
1717
+ const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`;
1270
1718
  super(
1271
- t.value instanceof de ? t.value : { decimal: t.decimal, value: t.value }
1272
- ), N(this, "address"), N(this, "chain"), N(this, "isSynthetic", !1), N(this, "isGasAsset", !1), N(this, "symbol"), N(this, "ticker"), N(this, "type");
1273
- const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a = ye(n);
1274
- this.type = ot(a), this.chain = a.chain, this.ticker = a.ticker, this.symbol = a.symbol, this.address = a.address, this.isSynthetic = a.isSynthetic, this.isGasAsset = a.isGasAsset;
1719
+ t.value instanceof me ? t.value : { decimal: t.decimal, value: t.value }
1720
+ ), I(this, "address"), I(this, "chain"), I(this, "isGasAsset", !1), I(this, "isSynthetic", !1), I(this, "symbol"), I(this, "tax"), I(this, "ticker"), I(this, "type");
1721
+ const a = _e(n);
1722
+ this.type = Et(a), this.chain = a.chain, this.ticker = a.ticker, this.symbol = a.symbol, this.address = a.address, this.isSynthetic = a.isSynthetic, this.isGasAsset = a.isGasAsset, this.tax = t.tax;
1723
+ }
1724
+ toString() {
1725
+ return this.isSynthetic ? this.symbol : `${this.chain}.${this.symbol}`;
1726
+ }
1727
+ toUrl() {
1728
+ return this.isSynthetic ? `${this.chain}.${this.symbol.replace("/", ".")}` : this.toString();
1275
1729
  }
1276
- static async fromString(t, n = 0) {
1277
- return he(t, n);
1730
+ eq({ chain: t, symbol: n }) {
1731
+ return this.chain === t && this.symbol === n;
1732
+ }
1733
+ // THOR.RUNE
1734
+ // THOR.ETH.ETH
1735
+ // ETH.THOR-0x1234567890
1736
+ static fromUrl(t, n = 0) {
1737
+ const [a, s, r] = t.split(".");
1738
+ if (!a || !s)
1739
+ throw new Error("Invalid asset url");
1740
+ const o = a === i.THORChain && r ? `${a}.${s}/${r}` : t;
1741
+ return de(o, n);
1742
+ }
1743
+ static fromString(t, n = 0) {
1744
+ return de(t, n);
1278
1745
  }
1279
1746
  static fromStringSync(t, n = 0) {
1280
- const { decimal: a, identifier: i } = se(
1281
- t
1282
- );
1283
- return i ? new v({ decimal: a, identifier: i, value: n }) : void 0;
1747
+ const { isSynthetic: a } = _e(t), {
1748
+ tax: s,
1749
+ decimal: r,
1750
+ identifier: o
1751
+ } = Se(t), p = z(n, r);
1752
+ return o ? new M({ tax: s, decimal: r, identifier: o, value: p }) : a ? new M({ tax: s, decimal: 8, identifier: t, value: p }) : void 0;
1284
1753
  }
1285
- static async fromIdentifier(t, n = 0) {
1286
- return he(t, n);
1754
+ static fromIdentifier(t, n = 0) {
1755
+ return de(t, n);
1287
1756
  }
1288
1757
  static fromIdentifierSync(t, n = 0) {
1289
- const { decimal: a, identifier: i } = se(t);
1290
- return new v({ decimal: a, identifier: i, value: n });
1758
+ const { decimal: a, identifier: s } = Se(t), r = z(n, a);
1759
+ return new M({ decimal: a, identifier: s, value: r });
1291
1760
  }
1292
1761
  static fromChainOrSignature(t, n = 0) {
1293
- const { decimal: a, identifier: i } = pt(t);
1294
- return new v({ value: n, decimal: a, identifier: i });
1295
- }
1296
- static async fromTCQuote(t, n = 0) {
1297
- const a = await Se(ye(t)), i = this.shiftDecimals({ value: n, from: E.THOR, to: a });
1298
- return new v({ value: i, identifier: t, decimal: a });
1299
- }
1300
- static fromTCQuoteStatic(t, n = 0) {
1301
- const a = se(t), i = this.shiftDecimals({
1302
- value: n,
1303
- from: E.THOR,
1304
- to: a.decimal
1305
- });
1306
- return new v({ ...a, value: i });
1762
+ const { decimal: a, identifier: s } = At(t), r = z(n, a);
1763
+ return new M({ value: r, decimal: a, identifier: s });
1307
1764
  }
1308
- static async loadStaticAssets() {
1765
+ static loadStaticAssets() {
1309
1766
  return new Promise(
1310
1767
  async (t, n) => {
1311
1768
  try {
1312
- const {
1313
- // Omit ThorchainList from import to avoid decimals conflict (TC uses 8 for all)
1314
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1315
- ThorchainList: a,
1316
- NativeList: i,
1317
- ...r
1318
- } = await import("@swapkit/tokens");
1319
- ue = [i, ...Object.values(r)].reduce(
1320
- (p, { tokens: d }) => (d.forEach(({ identifier: l, chain: c, ...y }) => {
1321
- const u = "decimals" in y ? y.decimals : E[c];
1322
- p.set(l, { identifier: l, decimal: u });
1323
- }), p),
1324
- /* @__PURE__ */ new Map()
1325
- ), t({ ok: !0 });
1769
+ const a = await import("@swapkit/tokens");
1770
+ he = Object.values(a).reduce((s, { tokens: r }) => (r.forEach(({ identifier: o, chain: p, ...d }) => {
1771
+ const u = "decimals" in d ? d.decimals : w[p];
1772
+ s.set(o, { identifier: o, decimal: u });
1773
+ }), s), /* @__PURE__ */ new Map()), t({ ok: !0 });
1326
1774
  } catch (a) {
1327
1775
  console.error(a), n({
1328
1776
  ok: !1,
@@ -1333,45 +1781,36 @@ class v extends de {
1333
1781
  }
1334
1782
  );
1335
1783
  }
1336
- get assetValue() {
1337
- return `${this.value} ${this.ticker}`;
1338
- }
1339
- toString() {
1340
- return `${this.chain}.${this.symbol}`;
1341
- }
1342
- eq({ chain: t, symbol: n }) {
1343
- return this.chain === t && this.symbol === n;
1344
- }
1345
1784
  }
1346
- const fe = (e) => {
1347
- const t = v.fromChainOrSignature(e);
1785
+ const ue = (e) => {
1786
+ const t = M.fromChainOrSignature(e);
1348
1787
  switch (e) {
1349
- case s.Bitcoin:
1350
- case s.Litecoin:
1351
- case s.BitcoinCash:
1352
- return t.add(10001);
1353
- case s.Dogecoin:
1354
- return t.add(100000001);
1355
- case s.Avalanche:
1356
- case s.Ethereum:
1357
- return t.add(10 * 10 ** 9);
1358
- case s.THORChain:
1359
- case s.Maya:
1360
- return t.add(0);
1788
+ case i.Bitcoin:
1789
+ case i.Litecoin:
1790
+ case i.BitcoinCash:
1791
+ return t.set(10001e-8);
1792
+ case i.Dogecoin:
1793
+ return t.set(1.00000001);
1794
+ case i.Avalanche:
1795
+ case i.Ethereum:
1796
+ return t.set(1e-8);
1797
+ case i.THORChain:
1798
+ case i.Maya:
1799
+ return t.set(0);
1361
1800
  default:
1362
- return t.add(1);
1801
+ return t.set(1e-8);
1363
1802
  }
1364
- }, ye = (e) => {
1365
- const t = e.slice(0, 14).includes("/"), n = e.includes(".") ? e : `${s.THORChain}.${e}`, [a, i] = n.split("."), [r, p] = i.split("-");
1803
+ }, _e = (e) => {
1804
+ const t = e.slice(0, 14).includes("/"), [n, a] = e.split(".").pop().split("/"), s = e.includes(".") && !t ? e : `${i.THORChain}.${a}`, [r, o] = s.split("."), [p, d] = (t ? a : o).split("-");
1366
1805
  return {
1367
- address: p == null ? void 0 : p.toLowerCase(),
1368
- chain: a,
1369
- isGasAsset: rt({ chain: a, symbol: i }),
1806
+ address: d == null ? void 0 : d.toLowerCase(),
1807
+ chain: r,
1808
+ isGasAsset: De({ chain: r, symbol: o }),
1370
1809
  isSynthetic: t,
1371
- symbol: p ? `${r}-${(p == null ? void 0 : p.toLowerCase()) ?? ""}` : i,
1372
- ticker: t ? i : r
1810
+ symbol: (t ? `${n}/` : "") + (d ? `${p}-${(d == null ? void 0 : d.toLowerCase()) ?? ""}` : o),
1811
+ ticker: p
1373
1812
  };
1374
- }, Tt = {
1813
+ }, Xt = {
1375
1814
  /**
1376
1815
  * Core
1377
1816
  */
@@ -1418,6 +1857,7 @@ const fe = (e) => {
1418
1857
  core_transaction_deposit_to_pool_error: 10310,
1419
1858
  core_transaction_deposit_insufficient_funds_error: 10311,
1420
1859
  core_transaction_deposit_gas_error: 10312,
1860
+ core_transaction_invalid_sender_address: 10313,
1421
1861
  core_transaction_deposit_server_error: 10313,
1422
1862
  /**
1423
1863
  * Wallets
@@ -1428,20 +1868,23 @@ const fe = (e) => {
1428
1868
  */
1429
1869
  helpers_number_different_decimals: 99101
1430
1870
  };
1431
- class m extends Error {
1871
+ class c extends Error {
1432
1872
  constructor(t, n) {
1433
- console.error(n), super(t, { cause: { code: Tt[t], message: t } }), Object.setPrototypeOf(this, m.prototype);
1873
+ console.error(n, { stack: n == null ? void 0 : n.stack, message: n == null ? void 0 : n.message }), super(t, { cause: { code: Xt[t], message: t } }), Object.setPrototypeOf(this, c.prototype);
1434
1874
  }
1435
1875
  }
1436
- class le extends de {
1876
+ class x extends me {
1437
1877
  eq(t) {
1438
1878
  return this.eqValue(t);
1439
1879
  }
1440
- toString() {
1441
- return this.value;
1880
+ static fromBigInt(t, n) {
1881
+ return new x({
1882
+ decimal: n,
1883
+ value: se({ value: t, bigIntDecimal: n, decimal: n })
1884
+ });
1442
1885
  }
1443
1886
  }
1444
- const _t = [
1887
+ const Jt = [
1445
1888
  {
1446
1889
  inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
1447
1890
  stateMutability: "nonpayable",
@@ -1532,7 +1975,7 @@ const _t = [
1532
1975
  type: "function"
1533
1976
  },
1534
1977
  { stateMutability: "payable", type: "receive" }
1535
- ], ht = [
1978
+ ], Qt = [
1536
1979
  {
1537
1980
  inputs: [
1538
1981
  { internalType: "address", name: "_ttp", type: "address" },
@@ -1676,7 +2119,7 @@ const _t = [
1676
2119
  type: "function"
1677
2120
  },
1678
2121
  { stateMutability: "payable", type: "receive" }
1679
- ], ft = [
2122
+ ], zt = [
1680
2123
  {
1681
2124
  inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
1682
2125
  stateMutability: "nonpayable",
@@ -1781,7 +2224,7 @@ const _t = [
1781
2224
  type: "function"
1782
2225
  },
1783
2226
  { stateMutability: "payable", type: "receive" }
1784
- ], bt = [
2227
+ ], Zt = [
1785
2228
  {
1786
2229
  inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
1787
2230
  stateMutability: "nonpayable",
@@ -1872,7 +2315,7 @@ const _t = [
1872
2315
  type: "function"
1873
2316
  },
1874
2317
  { stateMutability: "payable", type: "receive" }
1875
- ], At = [
2318
+ ], en = [
1876
2319
  {
1877
2320
  inputs: [
1878
2321
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2016,7 +2459,7 @@ const _t = [
2016
2459
  type: "function"
2017
2460
  },
2018
2461
  { stateMutability: "payable", type: "receive" }
2019
- ], wt = [
2462
+ ], tn = [
2020
2463
  {
2021
2464
  inputs: [
2022
2465
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2135,7 +2578,7 @@ const _t = [
2135
2578
  type: "function"
2136
2579
  },
2137
2580
  { stateMutability: "payable", type: "receive" }
2138
- ], Et = [
2581
+ ], nn = [
2139
2582
  {
2140
2583
  inputs: [
2141
2584
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2254,7 +2697,7 @@ const _t = [
2254
2697
  type: "function"
2255
2698
  },
2256
2699
  { stateMutability: "payable", type: "receive" }
2257
- ], Rt = [
2700
+ ], an = [
2258
2701
  {
2259
2702
  inputs: [
2260
2703
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2373,7 +2816,7 @@ const _t = [
2373
2816
  type: "function"
2374
2817
  },
2375
2818
  { stateMutability: "payable", type: "receive" }
2376
- ], Ot = [
2819
+ ], sn = [
2377
2820
  {
2378
2821
  inputs: [
2379
2822
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2492,7 +2935,7 @@ const _t = [
2492
2935
  type: "function"
2493
2936
  },
2494
2937
  { stateMutability: "payable", type: "receive" }
2495
- ], It = [
2938
+ ], rn = [
2496
2939
  {
2497
2940
  inputs: [
2498
2941
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2619,7 +3062,7 @@ const _t = [
2619
3062
  type: "function"
2620
3063
  },
2621
3064
  { stateMutability: "payable", type: "receive" }
2622
- ], St = [
3065
+ ], on = [
2623
3066
  {
2624
3067
  inputs: [
2625
3068
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2746,7 +3189,7 @@ const _t = [
2746
3189
  type: "function"
2747
3190
  },
2748
3191
  { stateMutability: "payable", type: "receive" }
2749
- ], gt = [
3192
+ ], pn = [
2750
3193
  {
2751
3194
  inputs: [
2752
3195
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2873,7 +3316,7 @@ const _t = [
2873
3316
  type: "function"
2874
3317
  },
2875
3318
  { stateMutability: "payable", type: "receive" }
2876
- ], vt = [
3319
+ ], dn = [
2877
3320
  {
2878
3321
  inputs: [
2879
3322
  { internalType: "address", name: "_ttp", type: "address" },
@@ -3000,7 +3443,7 @@ const _t = [
3000
3443
  type: "function"
3001
3444
  },
3002
3445
  { stateMutability: "payable", type: "receive" }
3003
- ], Mt = [
3446
+ ], un = [
3004
3447
  {
3005
3448
  inputs: [
3006
3449
  { internalType: "address", name: "_ttp", type: "address" },
@@ -3127,281 +3570,301 @@ const _t = [
3127
3570
  type: "function"
3128
3571
  },
3129
3572
  { stateMutability: "payable", type: "receive" }
3130
- ], Me = {
3131
- ["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: _t,
3132
- ["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: ft,
3133
- ["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: bt
3134
- }, Ct = {
3135
- ...Me,
3573
+ ], Fe = {
3574
+ ["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: Jt,
3575
+ ["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: zt,
3576
+ ["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: Zt
3577
+ }, ln = {
3578
+ ...Fe,
3136
3579
  // AVAX
3137
- ["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: wt,
3138
- ["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: ht,
3139
- ["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: Rt,
3580
+ ["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: tn,
3581
+ ["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: Qt,
3582
+ ["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: an,
3140
3583
  // BSC
3141
- ["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: At,
3584
+ ["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: en,
3142
3585
  // ETH
3143
- ["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: Et,
3144
- ["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: Ot,
3145
- ["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: It,
3146
- ["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: St,
3147
- ["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: gt,
3148
- ["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: vt,
3149
- ["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: Mt
3150
- }, Nt = ({
3586
+ ["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: nn,
3587
+ ["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: sn,
3588
+ ["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: rn,
3589
+ ["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: on,
3590
+ ["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: pn,
3591
+ ["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: dn,
3592
+ ["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: un
3593
+ }, yn = ({
3151
3594
  streamSwap: e,
3152
3595
  contractAddress: t,
3153
3596
  recipient: n,
3154
3597
  toChecksumAddress: a,
3155
3598
  calldata: {
3156
- amount: i,
3599
+ amount: s,
3157
3600
  amountOutMin: r = "",
3158
- data: p = "",
3159
- deadline: d,
3160
- memo: l,
3161
- router: c,
3162
- memoStreamingSwap: y,
3163
- tcMemo: u,
3164
- tcRouter: h,
3165
- tcVault: _,
3166
- vault: O,
3167
- token: I
3601
+ data: o = "",
3602
+ deadline: p,
3603
+ memo: d,
3604
+ router: u,
3605
+ memoStreamingSwap: l,
3606
+ tcMemo: m,
3607
+ tcRouter: _,
3608
+ tcVault: b,
3609
+ vault: A,
3610
+ token: E
3168
3611
  }
3169
3612
  }) => {
3170
- const g = !!Me[t.toLowerCase()];
3171
- if (g && !c)
3613
+ const O = !!Fe[t.toLowerCase()];
3614
+ if (O && !u)
3172
3615
  throw new Error("Router is required on calldata for swapIn with GenericContract");
3173
- const S = u || l, b = e && y || S;
3174
- if (!_ && !O)
3616
+ const S = m || d, D = e && l || S;
3617
+ if (!b && !A)
3175
3618
  throw new Error("TC Vault is required on calldata");
3176
- if (!h && !c)
3619
+ if (!_ && !u)
3177
3620
  throw new Error("TC Router is required on calldata");
3178
- if (!b)
3621
+ if (!D)
3179
3622
  throw new Error("TC Memo is required on calldata");
3180
- if (!I)
3623
+ if (!E)
3181
3624
  throw new Error("Token is required on calldata");
3182
- const M = [
3625
+ const ie = [
3183
3626
  // v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
3184
- a(h || c),
3185
- a(_ || O),
3186
- b.replace("{recipientAddress}", n),
3187
- a(I),
3188
- i
3189
- ], ne = g ? [a(c), p, d] : [r, d];
3190
- return [...M, ...ne];
3191
- }, Dt = ({ chain: e, txHash: t }) => {
3192
- const n = Re[e];
3627
+ a(_ || u),
3628
+ a(b || A),
3629
+ D.replace("{recipientAddress}", n),
3630
+ a(E),
3631
+ s
3632
+ ], Ge = O ? [a(u), o, p] : [r, p];
3633
+ return [...ie, ...Ge];
3634
+ }, cn = ({ chain: e, txHash: t }) => {
3635
+ const n = Ne[e];
3193
3636
  switch (e) {
3194
- case s.Binance:
3195
- case s.Bitcoin:
3196
- case s.BitcoinCash:
3197
- case s.Maya:
3198
- case s.Kujira:
3199
- case s.THORChain:
3200
- return `${n}/tx/${t}`;
3201
- case s.Arbitrum:
3202
- case s.Avalanche:
3203
- case s.BinanceSmartChain:
3204
- case s.Ethereum:
3205
- case s.Optimism:
3206
- case s.Polygon:
3637
+ case i.Binance:
3638
+ case i.Bitcoin:
3639
+ case i.BitcoinCash:
3640
+ case i.Maya:
3641
+ case i.Kujira:
3642
+ case i.THORChain:
3643
+ return `${n}/tx/${t.startsWith("0x") ? t.slice(2) : t}`;
3644
+ case i.Arbitrum:
3645
+ case i.Avalanche:
3646
+ case i.BinanceSmartChain:
3647
+ case i.Ethereum:
3648
+ case i.Optimism:
3649
+ case i.Polygon:
3207
3650
  return `${n}/tx/${t.startsWith("0x") ? t : `0x${t}`}`;
3208
- case s.Cosmos:
3651
+ case i.Cosmos:
3209
3652
  return `${n}/transactions/${t}`;
3210
- case s.Dogecoin:
3653
+ case i.Dogecoin:
3211
3654
  return `${n}/transaction/${t.toLowerCase()}`;
3212
- case s.Litecoin:
3655
+ case i.Litecoin:
3213
3656
  return `${n}/${t}`;
3214
3657
  default:
3215
3658
  throw new Error(`Unsupported chain: ${e}`);
3216
3659
  }
3217
- }, xt = ({ chain: e, address: t }) => {
3218
- const n = Re[e];
3660
+ }, mn = ({ chain: e, address: t }) => {
3661
+ const n = Ne[e];
3219
3662
  switch (e) {
3220
- case s.Arbitrum:
3221
- case s.Avalanche:
3222
- case s.Binance:
3223
- case s.BinanceSmartChain:
3224
- case s.Bitcoin:
3225
- case s.BitcoinCash:
3226
- case s.Dogecoin:
3227
- case s.Ethereum:
3228
- case s.Maya:
3229
- case s.Optimism:
3230
- case s.Polygon:
3231
- case s.Kujira:
3232
- case s.THORChain:
3663
+ case i.Arbitrum:
3664
+ case i.Avalanche:
3665
+ case i.Binance:
3666
+ case i.BinanceSmartChain:
3667
+ case i.Bitcoin:
3668
+ case i.BitcoinCash:
3669
+ case i.Dogecoin:
3670
+ case i.Ethereum:
3671
+ case i.Maya:
3672
+ case i.Optimism:
3673
+ case i.Polygon:
3674
+ case i.Kujira:
3675
+ case i.THORChain:
3233
3676
  return `${n}/address/${t}`;
3234
- case s.Cosmos:
3677
+ case i.Cosmos:
3235
3678
  return `${n}/account/${t}`;
3236
- case s.Litecoin:
3679
+ case i.Litecoin:
3237
3680
  return `${n}/${t}`;
3238
3681
  default:
3239
3682
  throw new Error(`Unsupported chain: ${e}`);
3240
3683
  }
3241
- }, Pt = (e) => {
3684
+ }, Tn = (e) => {
3242
3685
  const t = e ? q.ThornodeStagenet : q.ThornodeMainnet;
3243
- return Oe(`${t}/thorchain/inbound_addresses`);
3244
- }, Bt = (e) => {
3686
+ return Ae.get(`${t}/thorchain/inbound_addresses`);
3687
+ }, hn = (e) => {
3245
3688
  const t = e ? q.ThornodeStagenet : q.ThornodeMainnet;
3246
- return Oe(`${t}/thorchain/mimir`);
3247
- }, be = () => Object.values(s).reduce(
3689
+ return Ae.get(`${t}/thorchain/mimir`);
3690
+ }, Ie = () => Object.values(i).reduce(
3248
3691
  (e, t) => (e[t] = null, e),
3249
3692
  {}
3250
- );
3251
- var V, ee, Y, D, X, j;
3252
- class en {
3693
+ ), _n = async ({
3694
+ chain: e,
3695
+ address: t
3696
+ }) => {
3697
+ if (!t)
3698
+ return !1;
3699
+ switch (e) {
3700
+ case i.Bitcoin:
3701
+ return !t.startsWith("bc1p");
3702
+ default:
3703
+ return !0;
3704
+ }
3705
+ };
3706
+ var V, ne, j, v, K, Y;
3707
+ class Vn {
3253
3708
  constructor({ stagenet: t } = {}) {
3254
- T(this, "connectedChains", be());
3255
- T(this, "connectedWallets", be());
3709
+ T(this, "connectedChains", Ie());
3710
+ T(this, "connectedWallets", Ie());
3256
3711
  T(this, "stagenet", !1);
3257
3712
  T(this, "getAddress", (t) => {
3258
3713
  var n;
3259
3714
  return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
3260
3715
  });
3261
- T(this, "getExplorerTxUrl", (t, n) => Dt({ chain: t, txHash: n }));
3716
+ T(this, "getExplorerTxUrl", (t, n) => cn({ chain: t, txHash: n }));
3262
3717
  T(this, "getWallet", (t) => this.connectedWallets[t]);
3263
- T(this, "getExplorerAddressUrl", (t, n) => xt({ chain: t, address: n }));
3718
+ T(this, "getExplorerAddressUrl", (t, n) => mn({ chain: t, address: n }));
3264
3719
  T(this, "getBalance", async (t, n) => {
3265
- var i;
3266
- if (!n)
3267
- return ((i = this.connectedChains[t]) == null ? void 0 : i.balance) || [];
3268
- const a = await this.getWalletByChain(t);
3720
+ const a = await this.getWalletByChain(t, n);
3269
3721
  return (a == null ? void 0 : a.balance) || [];
3270
3722
  });
3271
- T(this, "swap", async ({ streamSwap: t, recipient: n, route: a, feeOptionKey: i }) => {
3272
- var d, l, c, y;
3273
- const { quoteMode: r } = a.meta, p = r.startsWith("ERC20-") ? s.Ethereum : r.startsWith("ARC20-") ? s.Avalanche : s.BinanceSmartChain;
3723
+ T(this, "swap", async ({ streamSwap: t, recipient: n, route: a, feeOptionKey: s }) => {
3724
+ var p, d;
3725
+ const { quoteMode: r } = a.meta, o = r.startsWith("ERC20-") ? i.Ethereum : r.startsWith("ARC20-") ? i.Avalanche : i.BinanceSmartChain;
3274
3726
  if (!a.complete)
3275
- throw new m("core_swap_route_not_complete");
3727
+ throw new c("core_swap_route_not_complete");
3276
3728
  try {
3277
- if (He.includes(r)) {
3278
- const u = this.connectedWallets[p];
3729
+ if (Ze.includes(r)) {
3730
+ const u = this.connectedWallets[o];
3279
3731
  if (!(u != null && u.sendTransaction))
3280
- throw new m("core_wallet_connection_not_found");
3281
- if (!(t ? (d = a == null ? void 0 : a.streamingSwap) == null ? void 0 : d.transaction : a == null ? void 0 : a.transaction))
3282
- throw new m("core_swap_route_transaction_not_found");
3283
- const { isHexString: _, parseUnits: O } = await import("./index-cf1865cd.js"), { data: I, from: g, to: S, value: b } = a.transaction, M = {
3284
- data: I,
3285
- from: g,
3286
- to: S.toLowerCase(),
3287
- chainId: BigInt(Ye[p]),
3288
- value: b ? new le({
3289
- value: _(b) ? b : O(b, "wei").toString(16)
3290
- }).baseValueBigInt : 0n
3732
+ throw new c("core_wallet_connection_not_found");
3733
+ if (!(t ? (p = a == null ? void 0 : a.streamingSwap) == null ? void 0 : p.transaction : a == null ? void 0 : a.transaction))
3734
+ throw new c("core_swap_route_transaction_not_found");
3735
+ const { data: m, from: _, to: b, value: A } = a.transaction, E = {
3736
+ data: m,
3737
+ from: _,
3738
+ to: b.toLowerCase(),
3739
+ chainId: BigInt(pt[o]),
3740
+ value: A ? BigInt(A) : 0n
3291
3741
  };
3292
- return u.sendTransaction(M, i);
3742
+ return u.sendTransaction(E, s);
3293
3743
  }
3294
- if (ke.includes(r)) {
3744
+ if (tt.includes(r)) {
3295
3745
  if (!a.calldata.fromAsset)
3296
- throw new m("core_swap_asset_not_recognized");
3297
- const u = await v.fromString(a.calldata.fromAsset);
3746
+ throw new c("core_swap_asset_not_recognized");
3747
+ const u = await M.fromString(a.calldata.fromAsset);
3298
3748
  if (!u)
3299
- throw new m("core_swap_asset_not_recognized");
3300
- const { address: h } = await A(this, V).call(this, u.chain), {
3301
- contract: _,
3302
- calldata: { amountIn: O, memo: I, memoStreamingSwap: g }
3303
- } = a, S = u.add(le.fromBigInt(BigInt(O), u.decimal)), b = t && g || I;
3304
- return this.deposit({ assetValue: S, memo: b, feeOptionKey: i, router: _, recipient: h });
3749
+ throw new c("core_swap_asset_not_recognized");
3750
+ const { address: l } = await f(this, V).call(this, u.chain), {
3751
+ contract: m,
3752
+ calldata: { expiration: _, amountIn: b, memo: A, memoStreamingSwap: E }
3753
+ } = a, O = u.add(x.fromBigInt(BigInt(b), u.decimal)), S = t && E || A;
3754
+ return this.deposit({
3755
+ expiration: _,
3756
+ assetValue: O,
3757
+ memo: S,
3758
+ feeOptionKey: s,
3759
+ router: m,
3760
+ recipient: l
3761
+ });
3305
3762
  }
3306
- if ($e.includes(r)) {
3307
- const { calldata: u, contract: h } = a;
3308
- if (!h)
3309
- throw new m("core_swap_contract_not_found");
3310
- const _ = this.connectedWallets[p], O = this.getAddress(p);
3311
- if (!(_ != null && _.sendTransaction) || !O)
3312
- throw new m("core_wallet_connection_not_found");
3313
- const { getProvider: I, toChecksumAddress: g } = await import("@swapkit/toolbox-evm"), S = I(p), b = Ct[h.toLowerCase()];
3314
- if (!b)
3315
- throw new m("core_swap_contract_not_supported", { contractAddress: h });
3316
- const ne = await ((y = (c = (await ((l = _.createContract) == null ? void 0 : l.call(_, h, b, S))).populateTransaction).swapIn) == null ? void 0 : y.call(
3317
- c,
3318
- ...Nt({
3763
+ if (et.includes(r)) {
3764
+ const { calldata: u, contract: l } = a;
3765
+ if (!l)
3766
+ throw new c("core_swap_contract_not_found");
3767
+ const m = this.connectedWallets[o], _ = this.getAddress(o);
3768
+ if (!(m != null && m.sendTransaction) || !_)
3769
+ throw new c("core_wallet_connection_not_found");
3770
+ const { getProvider: b, toChecksumAddress: A } = await import("@swapkit/toolbox-evm"), E = b(o), O = ln[l.toLowerCase()];
3771
+ if (!O)
3772
+ throw new c("core_swap_contract_not_supported", { contractAddress: l });
3773
+ const D = await (await ((d = m.createContract) == null ? void 0 : d.call(m, l, O, E))).getFunction("swapIn").populateTransaction(
3774
+ ...yn({
3319
3775
  streamSwap: t,
3320
- toChecksumAddress: g,
3321
- contractAddress: h,
3776
+ toChecksumAddress: A,
3777
+ contractAddress: l,
3322
3778
  recipient: n,
3323
3779
  calldata: u
3324
3780
  }),
3325
- { from: O }
3326
- ));
3327
- return _.sendTransaction(ne, i);
3781
+ { from: _ }
3782
+ );
3783
+ return m.sendTransaction(D, s);
3328
3784
  }
3329
- throw new m("core_swap_quote_mode_not_supported", { quoteMode: r });
3785
+ throw new c("core_swap_quote_mode_not_supported", { quoteMode: r });
3330
3786
  } catch (u) {
3331
- throw new m("core_swap_transaction_error", u);
3787
+ throw new c("core_swap_transaction_error", u);
3332
3788
  }
3333
3789
  });
3334
- T(this, "getWalletByChain", async (t) => {
3335
- var i, r;
3336
- const n = this.getAddress(t);
3337
- if (!n)
3790
+ T(this, "getWalletByChain", async (t, n) => {
3791
+ var o, p;
3792
+ const a = this.getAddress(t);
3793
+ if (!a)
3338
3794
  return null;
3339
- const a = await ((i = this.getWallet(t)) == null ? void 0 : i.getBalance(n)) ?? [
3340
- v.fromChainOrSignature(t)
3341
- ];
3342
- return this.connectedChains[t] = {
3343
- address: n,
3344
- balance: a,
3345
- walletType: (r = this.connectedChains[t]) == null ? void 0 : r.walletType
3346
- }, { ...this.connectedChains[t] };
3795
+ const s = [M.fromChainOrSignature(t)], r = (o = this.connectedChains[t]) == null ? void 0 : o.walletType;
3796
+ try {
3797
+ const d = await ((p = this.getWallet(t)) == null ? void 0 : p.getBalance(a, n));
3798
+ return this.connectedChains[t] = {
3799
+ address: a,
3800
+ balance: d != null && d.length ? d : s,
3801
+ walletType: r
3802
+ }, { ...this.connectedChains[t] };
3803
+ } catch (d) {
3804
+ return console.error(d), { address: a, balance: s, walletType: r };
3805
+ }
3347
3806
  });
3348
- T(this, "approveAssetValue", (t, n) => A(this, Y).call(this, { assetValue: t, type: "approve", contractAddress: n }));
3349
- T(this, "isAssetValueApproved", (t, n) => A(this, Y).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
3807
+ T(this, "approveAssetValue", (t, n) => f(this, j).call(this, { assetValue: t, type: "approve", contractAddress: n }));
3808
+ T(this, "isAssetValueApproved", (t, n) => f(this, j).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
3350
3809
  T(this, "validateAddress", ({ address: t, chain: n }) => {
3351
- var a, i;
3352
- return (i = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : i.call(a, t);
3810
+ var a, s;
3811
+ return (s = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : s.call(a, t);
3353
3812
  });
3354
3813
  T(this, "transfer", async (t) => {
3355
3814
  const n = this.connectedWallets[t.assetValue.chain];
3356
3815
  if (!n)
3357
- throw new m("core_wallet_connection_not_found");
3816
+ throw new c("core_wallet_connection_not_found");
3358
3817
  try {
3359
- return await n.transfer(A(this, j).call(this, t));
3818
+ return await n.transfer(f(this, Y).call(this, t));
3360
3819
  } catch (a) {
3361
- throw new m("core_swap_transaction_error", a);
3820
+ throw new c("core_swap_transaction_error", a);
3362
3821
  }
3363
3822
  });
3364
3823
  T(this, "deposit", async ({
3365
3824
  assetValue: t,
3366
3825
  recipient: n,
3367
3826
  router: a,
3368
- ...i
3827
+ ...s
3369
3828
  }) => {
3370
- const { chain: r, symbol: p, ticker: d } = t, l = this.connectedWallets[r];
3371
- if (!l)
3372
- throw new m("core_wallet_connection_not_found");
3373
- const c = A(this, j).call(this, { assetValue: t, recipient: n, router: a, ...i });
3829
+ const { chain: r, symbol: o, ticker: p } = t, d = this.connectedWallets[r];
3830
+ if (!await _n({ address: await (d == null ? void 0 : d.getAddress()), chain: r }))
3831
+ throw new c("core_transaction_invalid_sender_address");
3832
+ if (!d)
3833
+ throw new c("core_wallet_connection_not_found");
3834
+ const u = f(this, Y).call(this, { assetValue: t, recipient: n, router: a, ...s });
3374
3835
  try {
3375
3836
  switch (r) {
3376
- case s.THORChain: {
3377
- const y = l;
3378
- return await (n === "" ? y.deposit(c) : y.transfer(c));
3837
+ case i.THORChain: {
3838
+ const l = d;
3839
+ return await (n === "" ? l.deposit(u) : l.transfer(u));
3379
3840
  }
3380
- case s.Ethereum:
3381
- case s.BinanceSmartChain:
3382
- case s.Avalanche: {
3383
- const { getChecksumAddressFromAsset: y } = await import("@swapkit/toolbox-evm"), u = r === s.Avalanche ? Ve : r === s.BinanceSmartChain ? Le : Be;
3384
- return await l.call({
3385
- abi: u,
3386
- contractAddress: a || (await A(this, V).call(this, r)).router,
3841
+ case i.Ethereum:
3842
+ case i.BinanceSmartChain:
3843
+ case i.Avalanche: {
3844
+ const { getChecksumAddressFromAsset: l } = await import("@swapkit/toolbox-evm"), m = r === i.Avalanche ? Je : r === i.BinanceSmartChain ? Qe : Xe;
3845
+ return await d.call({
3846
+ abi: m,
3847
+ contractAddress: a || (await f(this, V).call(this, r)).router,
3387
3848
  funcName: "depositWithExpiry",
3388
3849
  funcParams: [
3389
3850
  n,
3390
- y({ chain: r, symbol: p, ticker: d }, r),
3391
- // TODO: (@Towan) Re-Check on that conversion 🙏
3392
- t.baseValueBigInt.toString(),
3393
- c.memo,
3394
- i.expiration
3851
+ l({ chain: r, symbol: o, ticker: p }, r),
3852
+ t.getBaseValue("string"),
3853
+ u.memo,
3854
+ s.expiration || parseInt(`${((/* @__PURE__ */ new Date()).getTime() + 15 * 60 * 1e3) / 1e3}`)
3395
3855
  ],
3396
- txOverrides: { from: c.from, value: t.baseValueBigInt }
3856
+ txOverrides: {
3857
+ from: u.from,
3858
+ value: t.isGasAsset ? t.getBaseValue("bigint") : void 0
3859
+ }
3397
3860
  });
3398
3861
  }
3399
3862
  default:
3400
- return await l.transfer(c);
3863
+ return await d.transfer(u);
3401
3864
  }
3402
- } catch (y) {
3403
- const u = ((y == null ? void 0 : y.message) || (y == null ? void 0 : y.toString())).toLowerCase(), h = u == null ? void 0 : u.includes("insufficient funds"), _ = u == null ? void 0 : u.includes("gas"), O = u == null ? void 0 : u.includes("server"), I = h ? "core_transaction_deposit_insufficient_funds_error" : _ ? "core_transaction_deposit_gas_error" : O ? "core_transaction_deposit_server_error" : "core_transaction_deposit_error";
3404
- throw new m(I, y);
3865
+ } catch (l) {
3866
+ const m = ((l == null ? void 0 : l.message) || (l == null ? void 0 : l.toString())).toLowerCase(), _ = m == null ? void 0 : m.includes("insufficient funds"), b = m == null ? void 0 : m.includes("gas"), A = m == null ? void 0 : m.includes("server"), E = _ ? "core_transaction_deposit_insufficient_funds_error" : b ? "core_transaction_deposit_gas_error" : A ? "core_transaction_deposit_server_error" : "core_transaction_deposit_error";
3867
+ throw new c(E, l);
3405
3868
  }
3406
3869
  });
3407
3870
  /**
@@ -3412,115 +3875,117 @@ class en {
3412
3875
  assetValue: n
3413
3876
  }) => {
3414
3877
  if (t.lte(0) || n.lte(0))
3415
- throw new m("core_transaction_create_liquidity_invalid_params");
3416
- let a = "", i = "";
3878
+ throw new c("core_transaction_create_liquidity_invalid_params");
3879
+ let a = "", s = "";
3417
3880
  try {
3418
- a = await A(this, D).call(this, {
3881
+ a = await f(this, v).call(this, {
3419
3882
  assetValue: t,
3420
- memo: x(f.DEPOSIT, {
3883
+ memo: N(h.DEPOSIT, {
3421
3884
  ...n,
3422
3885
  address: this.getAddress(n.chain)
3423
3886
  })
3424
3887
  });
3425
3888
  } catch (r) {
3426
- throw new m("core_transaction_create_liquidity_rune_error", r);
3889
+ throw new c("core_transaction_create_liquidity_rune_error", r);
3427
3890
  }
3428
3891
  try {
3429
- i = await A(this, D).call(this, {
3892
+ s = await f(this, v).call(this, {
3430
3893
  assetValue: n,
3431
- memo: x(f.DEPOSIT, {
3894
+ memo: N(h.DEPOSIT, {
3432
3895
  ...n,
3433
- address: this.getAddress(s.THORChain)
3896
+ address: this.getAddress(i.THORChain)
3434
3897
  })
3435
3898
  });
3436
3899
  } catch (r) {
3437
- throw new m("core_transaction_create_liquidity_asset_error", r);
3900
+ throw new c("core_transaction_create_liquidity_asset_error", r);
3438
3901
  }
3439
- return { runeTx: a, assetTx: i };
3902
+ return { runeTx: a, assetTx: s };
3440
3903
  });
3441
3904
  T(this, "addLiquidity", async ({
3442
- poolIdentifier: t,
3443
- runeAssetValue: n,
3444
- assetValue: a,
3445
- runeAddr: i,
3446
- assetAddr: r,
3447
- isPendingSymmAsset: p,
3448
- mode: d = "sym"
3905
+ runeAssetValue: t,
3906
+ assetValue: n,
3907
+ runeAddr: a,
3908
+ assetAddr: s,
3909
+ isPendingSymmAsset: r,
3910
+ mode: o = "sym"
3449
3911
  }) => {
3450
- const [l, ...c] = t.split("."), y = d === "sym", u = (n == null ? void 0 : n.gt(0)) && (y || d === "rune"), h = (a == null ? void 0 : a.gt(0)) && (y || d === "asset"), _ = p || u, O = _ ? i || this.getAddress(s.THORChain) : "", I = y || d === "asset" ? r || this.getAddress(l) : "";
3451
- if (!u && !h)
3452
- throw new m("core_transaction_add_liquidity_invalid_params");
3453
- if (_ && !O)
3454
- throw new m("core_transaction_add_liquidity_no_rune_address");
3455
- let g, S;
3456
- const b = { chain: l, symbol: c.join(".") };
3457
- if (u && n)
3912
+ const { chain: p, symbol: d } = n, u = o === "sym", l = (t == null ? void 0 : t.gt(0)) && (u || o === "rune"), m = (n == null ? void 0 : n.gt(0)) && (u || o === "asset"), _ = r || l, b = _ ? a || this.getAddress(i.THORChain) : "", A = u || o === "asset" ? s || this.getAddress(p) : "";
3913
+ if (!l && !m)
3914
+ throw new c("core_transaction_add_liquidity_invalid_params");
3915
+ if (_ && !b)
3916
+ throw new c("core_transaction_add_liquidity_no_rune_address");
3917
+ let E, O;
3918
+ if (l && t)
3458
3919
  try {
3459
- g = await A(this, D).call(this, {
3460
- assetValue: n,
3461
- memo: x(f.DEPOSIT, { ...b, address: I })
3920
+ E = await f(this, v).call(this, {
3921
+ assetValue: t,
3922
+ memo: N(h.DEPOSIT, { chain: p, symbol: d, address: A })
3462
3923
  });
3463
- } catch (M) {
3464
- throw new m("core_transaction_add_liquidity_rune_error", M);
3924
+ } catch (S) {
3925
+ throw new c("core_transaction_add_liquidity_rune_error", S);
3465
3926
  }
3466
- if (h && a)
3927
+ if (m && n)
3467
3928
  try {
3468
- S = await A(this, D).call(this, {
3469
- assetValue: a,
3470
- memo: x(f.DEPOSIT, { ...b, address: O })
3929
+ O = await f(this, v).call(this, {
3930
+ assetValue: n,
3931
+ memo: N(h.DEPOSIT, { chain: p, symbol: d, address: b })
3471
3932
  });
3472
- } catch (M) {
3473
- throw new m("core_transaction_add_liquidity_asset_error", M);
3933
+ } catch (S) {
3934
+ throw new c("core_transaction_add_liquidity_asset_error", S);
3474
3935
  }
3475
- return { runeTx: g, assetTx: S };
3936
+ return { runeTx: E, assetTx: O };
3937
+ });
3938
+ T(this, "addLiquidityPart", ({
3939
+ assetValue: t,
3940
+ poolAddress: n,
3941
+ address: a,
3942
+ symmetric: s
3943
+ }) => {
3944
+ if (s && !a)
3945
+ throw new c("core_transaction_add_liquidity_invalid_params");
3946
+ const r = s && a || "";
3947
+ return f(this, v).call(this, { assetValue: t, memo: `+:${n}:${r}:t:0` });
3476
3948
  });
3477
3949
  T(this, "withdraw", async ({
3478
3950
  memo: t,
3479
3951
  assetValue: n,
3480
3952
  percent: a,
3481
- from: i,
3953
+ from: s,
3482
3954
  to: r
3483
3955
  }) => {
3484
- const p = r === "rune" ? v.fromChainOrSignature(s.THORChain) : i === "sym" && r === "sym" || i === "rune" || i === "asset" ? void 0 : n;
3485
- try {
3486
- return await A(this, D).call(this, {
3487
- assetValue: fe(i === "asset" ? n.chain : s.THORChain),
3488
- memo: t || x(f.WITHDRAW, {
3489
- symbol: n.symbol,
3490
- chain: n.chain,
3491
- ticker: n.ticker,
3492
- basisPoints: Math.max(1e4, Math.round(a * 100)),
3493
- targetAssetString: p == null ? void 0 : p.toString(),
3494
- singleSide: !1
3495
- })
3496
- });
3497
- } catch (d) {
3498
- throw new m("core_transaction_withdraw_error", d);
3499
- }
3956
+ const o = r === "rune" ? M.fromChainOrSignature(i.THORChain) : s === "sym" && r === "sym" || s === "rune" || s === "asset" ? void 0 : n, p = ue(s === "asset" ? n.chain : i.THORChain), d = t || N(h.WITHDRAW, {
3957
+ symbol: n.symbol,
3958
+ chain: n.chain,
3959
+ ticker: n.ticker,
3960
+ basisPoints: Math.max(1e4, Math.round(a * 100)),
3961
+ targetAssetString: o == null ? void 0 : o.toString(),
3962
+ singleSide: !1
3963
+ });
3964
+ return f(this, v).call(this, { assetValue: p, memo: d });
3500
3965
  });
3501
3966
  T(this, "savings", async ({
3502
3967
  assetValue: t,
3503
3968
  memo: n,
3504
3969
  percent: a,
3505
- type: i
3970
+ type: s
3506
3971
  }) => {
3507
- const r = i === "add" ? f.DEPOSIT : f.WITHDRAW, p = n || x(r, {
3972
+ const r = s === "add" ? h.DEPOSIT : h.WITHDRAW, o = n || N(r, {
3508
3973
  ticker: t.ticker,
3509
3974
  symbol: t.symbol,
3510
3975
  chain: t.chain,
3511
3976
  singleSide: !0,
3512
- basisPoints: a ? Math.max(1e4, Math.round(a * 100)) : void 0
3513
- });
3514
- return A(this, D).call(this, { assetValue: t, memo: p });
3977
+ basisPoints: a ? Math.min(1e4, Math.round(a * 100)) : void 0
3978
+ }), p = r === h.DEPOSIT ? t : ue(t.chain);
3979
+ return f(this, v).call(this, { memo: o, assetValue: p });
3515
3980
  });
3516
3981
  T(this, "loan", ({
3517
3982
  assetValue: t,
3518
3983
  memo: n,
3519
3984
  minAmount: a,
3520
- type: i
3521
- }) => A(this, D).call(this, {
3985
+ type: s
3986
+ }) => f(this, v).call(this, {
3522
3987
  assetValue: t,
3523
- memo: n || x(i === "open" ? f.OPEN_LOAN : f.CLOSE_LOAN, {
3988
+ memo: n || N(s === "open" ? h.OPEN_LOAN : h.CLOSE_LOAN, {
3524
3989
  asset: t.toString(),
3525
3990
  minAmount: a.toString(),
3526
3991
  address: this.getAddress(t.chain)
@@ -3531,31 +3996,31 @@ class en {
3531
3996
  assetValue: n,
3532
3997
  address: a
3533
3998
  }) => {
3534
- const i = t === "bond" ? f.BOND : t === "unbond" ? f.UNBOND : f.LEAVE, r = x(i, {
3999
+ const s = t === "bond" ? h.BOND : t === "unbond" ? h.UNBOND : h.LEAVE, r = N(s, {
3535
4000
  address: a,
3536
- unbondAmount: t === "unbond" ? n.baseValueNumber : void 0
4001
+ unbondAmount: t === "unbond" ? n.getBaseValue("number") : void 0
3537
4002
  });
3538
- return A(this, X).call(this, {
4003
+ return f(this, K).call(this, {
3539
4004
  memo: r,
3540
- assetValue: t === "bond" ? n : fe(s.THORChain)
4005
+ assetValue: t === "bond" ? n : ue(i.THORChain)
3541
4006
  });
3542
4007
  });
3543
4008
  T(this, "registerThorname", ({
3544
4009
  assetValue: t,
3545
4010
  ...n
3546
- }) => A(this, X).call(this, { assetValue: t, memo: x(f.THORNAME_REGISTER, n) }));
3547
- T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: i = {} }) => {
4011
+ }) => f(this, K).call(this, { assetValue: t, memo: N(h.THORNAME_REGISTER, n) }));
4012
+ T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: s = {} }) => {
3548
4013
  try {
3549
4014
  t.forEach((r) => {
3550
4015
  this[r.connectMethodName] = r.connect({
3551
- addChain: A(this, ee),
4016
+ addChain: f(this, ne),
3552
4017
  config: n || {},
3553
4018
  apis: a,
3554
- rpcUrls: i
4019
+ rpcUrls: s
3555
4020
  });
3556
4021
  });
3557
4022
  } catch (r) {
3558
- throw new m("core_extend_error", r);
4023
+ throw new c("core_extend_error", r);
3559
4024
  }
3560
4025
  });
3561
4026
  T(this, "estimateMaxSendableAmount", async ({
@@ -3564,132 +4029,132 @@ class en {
3564
4029
  }) => {
3565
4030
  const a = this.getWallet(t);
3566
4031
  switch (t) {
3567
- case s.Arbitrum:
3568
- case s.Avalanche:
3569
- case s.BinanceSmartChain:
3570
- case s.Ethereum:
3571
- case s.Optimism:
3572
- case s.Polygon: {
3573
- const { estimateMaxSendableAmount: i } = await import("@swapkit/toolbox-evm");
3574
- return i({
4032
+ case i.Arbitrum:
4033
+ case i.Avalanche:
4034
+ case i.BinanceSmartChain:
4035
+ case i.Ethereum:
4036
+ case i.Optimism:
4037
+ case i.Polygon: {
4038
+ const { estimateMaxSendableAmount: s } = await import("@swapkit/toolbox-evm");
4039
+ return s({
3575
4040
  ...n,
3576
4041
  toolbox: a
3577
4042
  });
3578
4043
  }
3579
- case s.Bitcoin:
3580
- case s.BitcoinCash:
3581
- case s.Dogecoin:
3582
- case s.Litecoin:
4044
+ case i.Bitcoin:
4045
+ case i.BitcoinCash:
4046
+ case i.Dogecoin:
4047
+ case i.Litecoin:
3583
4048
  return a.estimateMaxSendableAmount(n);
3584
- case s.Binance:
3585
- case s.THORChain:
3586
- case s.Cosmos: {
3587
- const { estimateMaxSendableAmount: i } = await import("@swapkit/toolbox-cosmos");
3588
- return i({
4049
+ case i.Binance:
4050
+ case i.THORChain:
4051
+ case i.Cosmos: {
4052
+ const { estimateMaxSendableAmount: s } = await import("@swapkit/toolbox-cosmos");
4053
+ return s({
3589
4054
  ...n,
3590
4055
  toolbox: a
3591
4056
  });
3592
4057
  }
3593
4058
  default:
3594
- throw new m("core_estimated_max_spendable_chain_not_supported");
4059
+ throw new c("core_estimated_max_spendable_chain_not_supported");
3595
4060
  }
3596
4061
  });
3597
4062
  /**
3598
4063
  * Wallet connection methods
3599
4064
  */
3600
4065
  T(this, "connectXDEFI", async (t) => {
3601
- throw new m("core_wallet_xdefi_not_installed");
4066
+ throw new c("core_wallet_xdefi_not_installed");
3602
4067
  });
3603
4068
  T(this, "connectEVMWallet", async (t, n) => {
3604
- throw new m("core_wallet_evmwallet_not_installed");
4069
+ throw new c("core_wallet_evmwallet_not_installed");
3605
4070
  });
3606
4071
  T(this, "connectWalletconnect", async (t, n) => {
3607
- throw new m("core_wallet_walletconnect_not_installed");
4072
+ throw new c("core_wallet_walletconnect_not_installed");
3608
4073
  });
3609
4074
  T(this, "connectKeystore", async (t, n) => {
3610
- throw new m("core_wallet_keystore_not_installed");
4075
+ throw new c("core_wallet_keystore_not_installed");
3611
4076
  });
3612
4077
  T(this, "connectLedger", async (t, n) => {
3613
- throw new m("core_wallet_ledger_not_installed");
4078
+ throw new c("core_wallet_ledger_not_installed");
3614
4079
  });
3615
4080
  T(this, "connectTrezor", async (t, n) => {
3616
- throw new m("core_wallet_trezor_not_installed");
4081
+ throw new c("core_wallet_trezor_not_installed");
3617
4082
  });
3618
4083
  T(this, "connectKeplr", async (t) => {
3619
- throw new m("core_wallet_keplr_not_installed");
4084
+ throw new c("core_wallet_keplr_not_installed");
3620
4085
  });
3621
4086
  T(this, "connectOkx", async (t) => {
3622
- throw new m("core_wallet_okx_not_installed");
4087
+ throw new c("core_wallet_okx_not_installed");
3623
4088
  });
3624
4089
  T(this, "disconnectChain", (t) => {
3625
4090
  this.connectedChains[t] = null, this.connectedWallets[t] = null;
3626
4091
  });
3627
4092
  P(this, V, async (t) => {
3628
- if (t === s.THORChain)
4093
+ if (t === i.THORChain)
3629
4094
  return {
3630
4095
  gas_rate: "0",
3631
4096
  router: "0",
3632
4097
  address: "",
3633
4098
  halted: !1,
3634
- chain: s.THORChain
4099
+ chain: i.THORChain
3635
4100
  };
3636
- const a = (await Pt(this.stagenet)).find((i) => i.chain === t);
4101
+ const a = (await Tn(this.stagenet)).find((s) => s.chain === t);
3637
4102
  if (!a)
3638
- throw new m("core_inbound_data_not_found");
4103
+ throw new c("core_inbound_data_not_found");
3639
4104
  if (a != null && a.halted)
3640
- throw new m("core_chain_halted");
4105
+ throw new c("core_chain_halted");
3641
4106
  return a;
3642
4107
  });
3643
- P(this, ee, ({ chain: t, wallet: n, walletMethods: a }) => {
4108
+ P(this, ne, ({ chain: t, wallet: n, walletMethods: a }) => {
3644
4109
  this.connectedChains[t] = n, this.connectedWallets[t] = a;
3645
4110
  });
3646
- P(this, Y, async ({
3647
- assetValue: { baseValueBigInt: t, address: n, chain: a, isGasAsset: i, isSynthetic: r },
3648
- type: p = "checkOnly",
3649
- contractAddress: d
4111
+ P(this, j, async ({
4112
+ assetValue: t,
4113
+ type: n = "checkOnly",
4114
+ contractAddress: a
3650
4115
  }) => {
3651
- const l = [s.Ethereum, s.Avalanche, s.BinanceSmartChain].includes(a);
3652
- if (l && i || !l || r)
4116
+ const { address: s, chain: r, isGasAsset: o, isSynthetic: p } = t, d = [i.Ethereum, i.Avalanche, i.BinanceSmartChain].includes(r);
4117
+ if (d && o || !d || p)
3653
4118
  return !0;
3654
- const y = this.connectedWallets[a], u = p === "checkOnly" ? y == null ? void 0 : y.isApproved : y == null ? void 0 : y.approve;
3655
- if (!u)
3656
- throw new m("core_wallet_connection_not_found");
3657
- const h = this.getAddress(a);
3658
- if (!n || !h)
3659
- throw new m("core_approve_asset_address_or_from_not_found");
3660
- const _ = d || (await A(this, V).call(this, a)).router;
3661
- return u({
3662
- amount: t,
3663
- assetAddress: n,
3664
- from: h,
3665
- spenderAddress: _
4119
+ const l = this.connectedWallets[r], m = n === "checkOnly" ? l == null ? void 0 : l.isApproved : l == null ? void 0 : l.approve;
4120
+ if (!m)
4121
+ throw new c("core_wallet_connection_not_found");
4122
+ const _ = this.getAddress(r);
4123
+ if (!s || !_)
4124
+ throw new c("core_approve_asset_address_or_from_not_found");
4125
+ const b = a || (await f(this, V).call(this, r)).router;
4126
+ return m({
4127
+ amount: t.getBaseValue("bigint"),
4128
+ assetAddress: s,
4129
+ from: _,
4130
+ spenderAddress: b
3666
4131
  });
3667
4132
  });
3668
- P(this, D, async ({
4133
+ P(this, v, async ({
3669
4134
  assetValue: t,
3670
4135
  memo: n,
3671
4136
  feeOptionKey: a = F.Fast
3672
4137
  }) => {
3673
4138
  const {
3674
- gas_rate: i,
4139
+ gas_rate: s,
3675
4140
  router: r,
3676
- address: p
3677
- } = await A(this, V).call(this, t.chain), d = (parseInt(i) || 0) * it[a];
4141
+ address: o
4142
+ } = await f(this, V).call(this, t.chain), p = (parseInt(s) || 0) * wt[a];
3678
4143
  return this.deposit({
3679
4144
  assetValue: t,
3680
- recipient: p,
4145
+ recipient: o,
3681
4146
  memo: n,
3682
4147
  router: r,
3683
- feeRate: d
4148
+ feeRate: p
3684
4149
  });
3685
4150
  });
3686
- P(this, X, async ({ memo: t, assetValue: n }) => {
3687
- const a = await Bt(this.stagenet);
4151
+ P(this, K, async ({ memo: t, assetValue: n }) => {
4152
+ const a = await hn(this.stagenet);
3688
4153
  if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
3689
- throw new m("core_chain_halted");
4154
+ throw new c("core_chain_halted");
3690
4155
  return this.deposit({ assetValue: n, recipient: "", memo: t });
3691
4156
  });
3692
- P(this, j, ({ assetValue: t, ...n }) => ({
4157
+ P(this, Y, ({ assetValue: t, ...n }) => ({
3693
4158
  ...n,
3694
4159
  memo: n.memo || "",
3695
4160
  from: this.getAddress(t.chain),
@@ -3698,65 +4163,66 @@ class en {
3698
4163
  this.stagenet = !!t;
3699
4164
  }
3700
4165
  }
3701
- V = new WeakMap(), ee = new WeakMap(), Y = new WeakMap(), D = new WeakMap(), X = new WeakMap(), j = new WeakMap();
4166
+ V = new WeakMap(), ne = new WeakMap(), j = new WeakMap(), v = new WeakMap(), K = new WeakMap(), Y = new WeakMap();
3702
4167
  export {
3703
- He as AGG_SWAP,
3704
- Ut as ApiError,
4168
+ Ze as AGG_SWAP,
4169
+ wn as ApiError,
3705
4170
  q as ApiUrl,
3706
- v as AssetValue,
3707
- E as BaseDecimal,
3708
- s as Chain,
3709
- ce as ChainId,
3710
- Wt as ChainIdToChain,
3711
- Ye as ChainToChainId,
3712
- Re as ChainToExplorerUrl,
3713
- Gt as ChainToHexChainId,
3714
- Xe as ChainToRPC,
3715
- We as ContractAddress,
3716
- Ft as CosmosChainList,
3717
- K as DEFAULT_DECIMAL,
3718
- qe as DerivationPath,
3719
- o as ERROR_CODE,
3720
- Fe as ERROR_MODULE,
3721
- Ae as ERROR_TYPE,
3722
- $t as EVMChainList,
3723
- je as ErrorCode,
4171
+ M as AssetValue,
4172
+ w as BaseDecimal,
4173
+ me as BigIntArithmetics,
4174
+ i as Chain,
4175
+ fe as ChainId,
4176
+ Sn as ChainIdToChain,
4177
+ pt as ChainToChainId,
4178
+ Ne as ChainToExplorerUrl,
4179
+ On as ChainToHexChainId,
4180
+ dt as ChainToRPC,
4181
+ st as ContractAddress,
4182
+ Rn as CosmosChainList,
4183
+ it as DerivationPath,
4184
+ y as ERROR_CODE,
4185
+ nt as ERROR_MODULE,
4186
+ ve as ERROR_TYPE,
4187
+ rt as EVMChainList,
4188
+ ut as ErrorCode,
3724
4189
  F as FeeOption,
3725
- f as MemoType,
3726
- Ht as NetworkDerivationPath,
3727
- Ue as QuoteMode,
3728
- Ee as RPCUrl,
3729
- $e as SWAP_IN,
3730
- ke as SWAP_OUT,
3731
- en as SwapKitCore,
3732
- m as SwapKitError,
3733
- le as SwapKitNumber,
3734
- Ve as TCAvalancheDepositABI,
3735
- Le as TCBscDepositABI,
3736
- Be as TCEthereumVaultAbi,
3737
- kt as UTXOChainList,
3738
- Je as WalletOption,
3739
- Xt as assetFromString,
3740
- Yt as derivationPathToString,
3741
- Lt as erc20ABI,
3742
- ge as formatBigIntToSafeValue,
3743
- it as gasFeeMultiplier,
3744
- ot as getAssetType,
3745
- ut as getAsymmetricAssetShare,
3746
- Jt as getAsymmetricAssetWithdrawAmount,
3747
- dt as getAsymmetricRuneShare,
3748
- jt as getAsymmetricRuneWithdrawAmount,
3749
- pt as getCommonAssetInfo,
3750
- Se as getDecimal,
3751
- zt as getEstimatedPoolShare,
3752
- Zt as getLiquiditySlippage,
3753
- x as getMemoFor,
3754
- fe as getMinAmountByChain,
3755
- Oe as getRequest,
3756
- yt as getSymmetricPoolShare,
3757
- Qt as getSymmetricWithdraw,
3758
- qt as getTHORNameCost,
3759
- rt as isGasAsset,
3760
- et as postRequest,
3761
- Kt as validateTHORName
4190
+ h as MemoType,
4191
+ An as NetworkDerivationPath,
4192
+ ze as QuoteMode,
4193
+ Me as RPCUrl,
4194
+ Ae as RequestClient,
4195
+ et as SWAP_IN,
4196
+ tt as SWAP_OUT,
4197
+ Vn as SwapKitCore,
4198
+ c as SwapKitError,
4199
+ x as SwapKitNumber,
4200
+ Je as TCAvalancheDepositABI,
4201
+ Qe as TCBscDepositABI,
4202
+ Xe as TCEthereumVaultAbi,
4203
+ gn as TCSupportedChainList,
4204
+ En as UTXOChainList,
4205
+ lt as WalletOption,
4206
+ In as assetFromString,
4207
+ Ln as derivationPathToString,
4208
+ bn as erc20ABI,
4209
+ vn as filterAssets,
4210
+ se as formatBigIntToSafeValue,
4211
+ wt as gasFeeMultiplier,
4212
+ Et as getAssetType,
4213
+ St as getAsymmetricAssetShare,
4214
+ Mn as getAsymmetricAssetWithdrawAmount,
4215
+ Ot as getAsymmetricRuneShare,
4216
+ Cn as getAsymmetricRuneWithdrawAmount,
4217
+ At as getCommonAssetInfo,
4218
+ bt as getDecimal,
4219
+ xn as getEstimatedPoolShare,
4220
+ Dn as getLiquiditySlippage,
4221
+ N as getMemoFor,
4222
+ ue as getMinAmountByChain,
4223
+ It as getSymmetricPoolShare,
4224
+ Nn as getSymmetricWithdraw,
4225
+ Pn as getTHORNameCost,
4226
+ De as isGasAsset,
4227
+ Bn as validateTHORName
3762
4228
  };