@swapkit/core 1.0.0-rc.13 → 1.0.0-rc.15

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 Me = Object.defineProperty;
2
- var Ce = (e, t, n) => t in e ? Me(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var T = (e, t, n) => (Ce(e, typeof t != "symbol" ? t + "" : t, n), n), Ne = (e, t, n) => {
1
+ var Ge = Object.defineProperty;
2
+ var We = (e, t, n) => t in e ? Ge(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), qe = (e, t, n) => {
4
4
  if (!t.has(e))
5
5
  throw TypeError("Cannot " + n);
6
6
  };
7
- var f = (e, t, n) => (Ne(e, t, "read from private field"), n ? n.call(e) : t.get(e)), B = (e, t, n) => {
7
+ var f = (e, t, n) => (qe(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, De = (e, t, n) => t in e ? xe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, M = (e, t, n) => (De(e, typeof t != "symbol" ? t + "" : t, n), n);
13
- const Lt = [
12
+ var je = Object.defineProperty, Ye = (e, t, n) => t in e ? je(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 cn = [
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
+ ], Ke = [
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
- ], Pe = [
286
+ ], Xe = [
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
- ], Ve = [
450
+ ], Je = [
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 Le = /* @__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))(Le || {});
604
- const Ue = [
603
+ var Qe = /* @__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))(Qe || {});
604
+ const ze = [
605
605
  "ERC20-ERC20",
606
606
  "ARC20-ARC20",
607
607
  "BEP20-BEP20"
608
608
  /* BSC_TO_BSC */
609
- ], He = [
609
+ ], Ze = [
610
610
  "ERC20-TC",
611
611
  "ERC20-ARC20",
612
612
  "ERC20-BEP20",
@@ -617,95 +617,95 @@ const Ue = [
617
617
  "BEP20-ERC20",
618
618
  "BEP20-ARC20"
619
619
  /* BSC_TO_AVAX */
620
- ], $e = [
620
+ ], et = [
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 fe = /* @__PURE__ */ ((e) => (e.VALIDATION_ERROR = "VALIDATION_ERROR", e.REQUEST_PARAMETER_ERROR = "REQUEST_PARAMETER_ERROR", e.RESPONSE_PARSING_ERROR = "RESPONSE_PARSING_ERROR", e.UNSUPPORTED = "UNSUPPORTED", e.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", e.INCOMPATIBLE_ASSETS_OPERATIONS = "INCOMPATIBLE_ASSETS_OPERATIONS", e.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", e.DOWN_FOR_MAINTENANCE = "DOWN_FOR_MAINTENANCE", e.MISSING_INBOUND_INFO = "MISSING_INBOUND_INFO", e.QUOTE_FETCHING_ERROR = "QUOTE_FETCHING_ERROR", e.AIRDROP_ERROR = "AIRDROP_ERROR", e.UNHANDLED_ERROR = "UNHANDLED_ERROR", e))(fe || {}), ke = /* @__PURE__ */ ((e) => (e.HEALTH_CONTROLLER = "1000", e.LIQUIDITY_CONTROLLER = "1001", e.PROVIDER_CONTROLLER = "1002", e.QUOTE_CONTROLLER = "1003", e.SWAP_CONTROLLER = "1004", e.UTIL_CONTROLLER = "1005", e.AIRDROP_CONTROLLER = "1006", e.PROVIDER = "2000", e.ASSET = "2001", e.TOKEN_LIST = "2002", e.QUOTE = "2100", e.QUOTE_TXN_DETAILS = "2101", e.THORCHAIN_PROVIDER = "3000", e.UNISWAPV2_ETH_PROVIDER = "3001", e.UNISWAPV3_ETH_PROVIDER = "3002", e.SUSHISWAP_ETH_PROVIDER = "3003", e.PANCAKESWAP_BSC_PROVIDER = "3004", e.PANCAKESWAP_ETH_PROVIDER = "3005", e.ONEINCH_ETH_PROVIDER = "3006", e.ONEINCH_BSC_PROVIDER = "3007", e.ONEINCH_AVAX_PROVIDER = "3008", e.ZEROX_ETH_PROVIDER = "3009", e.WOOFI_AVAX_PROVIDER = "3010", e.PANGOLIN_AVAX_PROVIDER = "3011", e.TRADERJOE_AVAX_PROVIDER = "3012", e.KYBER_ETH_PROVIDER = "3013", e.KYBER_AVAX_PROVIDER = "3014", e.WOOFI_BSC_PROVIDER = "3015", e.STARGATE_PROVIDER = "3016", e.PROVIDER_UTIL = "4000", e.TXN_DETAILS = "5000", e.AIRDROP_UTIL = "6000", e))(ke || {}), u = /* @__PURE__ */ ((e) => (e.INVALID_INPUT_PARAMETERS = "1000", e.UNKNOWN_PROVIDERS = "1001", e.CANNOT_FIND_INBOUND_ADDRESS = "1002", e.NO_INBOUND_ADDRESSES = "1003", e.CHAIN_HALTED_OR_UNSUPPORTED = "1004", e.MISSING_INPUT_PARAMETER = "1005", e.INVALID_TYPE_GENERIC = "1100", e.INVALID_NUMBER_STRING = "1101", e.INVALID_NUMBER = "1102", e.INVALID_BOOLEAN = "1103", e.INVALID_OBJECT = "1104", e.INVALID_ARRAY = "1105", e.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", e.SELL_BUY_ASSETS_ARE_THE_SAME = "2001", e.MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", e.AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", e.AFF_ADDRESS_TOO_LONG = "2004", e.AFF_BPS_INTEGER_0_100 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROFVIDER_NOT_SUPPORTED = "2008", e.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", e.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", e.SOURCE_ADDRESS_SMART_CONTRACT = "2011", e.INVALID_PROVIDER = "2100", e.MISSING_CROSS_CHAIN_PROVIDER = "2101", e.MISSING_AVAX_PROVIDER = "2102", e.MISSING_BSC_PROVIDER = "2103", e.MISSING_ETH_PROVIDER = "2104", e.INVALID_PROVIDER_FOR_SWAP_OUT = "2105", e.MISSING_ARB_PROVIDER = "2106", e.INVALID_CHAIN = "2200", e.INVALID_ASSET = "2201", e.INVALID_ASSET_IDENTIFIER = "2202", e.UNSUPPORTED_CHAIN = "2204", e.UNSUPPORTED_ASSET = "2203", e.UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205", e.INVALID_SOURCE_ADDRESS = "2300", e.INVALID_DESTINATION_ADDRESS = "2301", e.THORNODE_QUOTE_GENERIC_ERROR = "3000", e.NOT_ENOUGH_SYNTH_BALANCE = "3001", e.SYNTH_MINTING_CAP_REACHED = "3002", e.INVALID_QUOTE_MODE = "4000", e.NO_QUOTES = "4001", e.SERVICE_UNAVAILABLE_GENERIC = "5000", e.MISSING_GAS_DATA_GENERIC = "5100", e.MISSING_TOKEN_INFO_GENERIC = "5200", e.CANT_FIND_TOKEN_LIST = "5201", e.NO_PRICE = "5202", e.PRICE_IS_STALE = "5203", e.ADDRESS_NOT_WHITELISTED = "6000", e.ADDRESS_ALREADY_CLAIMED = "6001", e.TEMPORARY_ERROR = "9999", e))(u || {});
628
- const Fe = {
629
- [u.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
630
- [u.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
631
- [u.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
632
- [u.NO_INBOUND_ADDRESSES]: "No inbound addresses.",
633
- [u.CHAIN_HALTED_OR_UNSUPPORTED]: "Chain {0} halted or unsupported.",
634
- [u.MISSING_INPUT_PARAMETER]: "Missing input parameter: {0}.",
635
- [u.INVALID_TYPE_GENERIC]: "Invalid type",
636
- [u.INVALID_NUMBER_STRING]: "Invalid number string.",
637
- [u.INVALID_NUMBER]: "Invalid number.",
638
- [u.INVALID_BOOLEAN]: "Invalid boolean.",
639
- [u.INVALID_OBJECT]: "Invalid object.",
640
- [u.INVALID_ARRAY]: "Invalid array.",
641
- [u.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Sell amount must be a positive integer.",
642
- [u.SELL_BUY_ASSETS_ARE_THE_SAME]: "Sell and buy assets are the same.",
643
- [u.MISSING_SOURCE_ADDRESS_FOR_SYNTH]: "Source address is required for synth quote.",
644
- [u.AFF_ADDRESS_AND_BPS_OR_NEITHER]: "Must provide affiliateAddress and affiliateBasisPoints params, or neither.",
645
- [u.AFF_ADDRESS_TOO_LONG]: "affiliateAddress too long: 3 characters max.",
646
- [u.AFF_BPS_INTEGER_0_100]: "affiliateBasisPoints must be an integer between 0 and 100.",
647
- [u.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN]: "Source address {0} invalid for sell chain.",
648
- [u.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN]: "Destination address {0} invalid for buy chain.",
649
- [u.PREFERRED_PROFVIDER_NOT_SUPPORTED]: "Preferred provider not supported.",
650
- [u.DESTINATION_ADDRESS_SMART_CONTRACT]: "Destination address is a smart contract.",
651
- [u.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Buy amount must be a positive integer.",
652
- [u.INVALID_PROVIDER]: "Invalid provider {0}.",
653
- [u.MISSING_CROSS_CHAIN_PROVIDER]: "Missing cross-chain provider.",
654
- [u.MISSING_AVAX_PROVIDER]: "Missing AVAX provider.",
655
- [u.MISSING_BSC_PROVIDER]: "Missing BSC provider.",
656
- [u.MISSING_ETH_PROVIDER]: "Missing ETH provider.",
657
- [u.MISSING_ARB_PROVIDER]: "Missing ARB provider.",
658
- [u.INVALID_PROVIDER_FOR_SWAP_OUT]: "Invalid provider for swap out.",
659
- [u.INVALID_CHAIN]: "Invalid chain {0}.",
660
- [u.INVALID_ASSET]: "Invalid asset {0}.",
661
- [u.UNSUPPORTED_CHAIN]: "Unsupported chain {0}.",
662
- [u.UNSUPPORTED_ASSET]: "Unsupported asset {0}.",
663
- [u.UNSUPPORTED_ASSET_FOR_SWAPOUT]: "Unsupported asset {0} for swap out.",
664
- [u.THORNODE_QUOTE_GENERIC_ERROR]: "ThorNode quote generic error.",
665
- [u.INVALID_SOURCE_ADDRESS]: "Invalid source address {0}",
666
- [u.INVALID_DESTINATION_ADDRESS]: "Invalid destination address {0}",
667
- [u.NOT_ENOUGH_SYNTH_BALANCE]: "Source address doesn't have enough synth balance for this quote.",
668
- [u.SYNTH_MINTING_CAP_REACHED]: "Synth minting cap reached.",
669
- [u.INVALID_QUOTE_MODE]: "Invalid quote mode.",
670
- [u.NO_QUOTES]: "No quotes to service this request.",
671
- [u.SERVICE_UNAVAILABLE_GENERIC]: "Service unavailable.",
672
- [u.MISSING_GAS_DATA_GENERIC]: "Missing gas data.",
673
- [u.MISSING_TOKEN_INFO_GENERIC]: "Missing token info.",
674
- [u.CANT_FIND_TOKEN_LIST]: "Can't find tokenlist {0}.",
675
- [u.NO_PRICE]: "No price for asset {0}.",
676
- [u.PRICE_IS_STALE]: "Price is stale for asset {0}.",
677
- [u.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
678
- [u.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
679
- }, ee = (e, t) => {
680
- let n = Fe[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 || {}), tt = /* @__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))(tt || {}), l = /* @__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))(l || {});
628
+ const nt = {
629
+ [l.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
630
+ [l.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
631
+ [l.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
632
+ [l.NO_INBOUND_ADDRESSES]: "No inbound addresses.",
633
+ [l.CHAIN_HALTED_OR_UNSUPPORTED]: "Chain {0} halted or unsupported.",
634
+ [l.MISSING_INPUT_PARAMETER]: "Missing input parameter: {0}.",
635
+ [l.INVALID_TYPE_GENERIC]: "Invalid type",
636
+ [l.INVALID_NUMBER_STRING]: "Invalid number string.",
637
+ [l.INVALID_NUMBER]: "Invalid number.",
638
+ [l.INVALID_BOOLEAN]: "Invalid boolean.",
639
+ [l.INVALID_OBJECT]: "Invalid object.",
640
+ [l.INVALID_ARRAY]: "Invalid array.",
641
+ [l.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Sell amount must be a positive integer.",
642
+ [l.SELL_BUY_ASSETS_ARE_THE_SAME]: "Sell and buy assets are the same.",
643
+ [l.MISSING_SOURCE_ADDRESS_FOR_SYNTH]: "Source address is required for synth quote.",
644
+ [l.AFF_ADDRESS_AND_BPS_OR_NEITHER]: "Must provide affiliateAddress and affiliateBasisPoints params, or neither.",
645
+ [l.AFF_ADDRESS_TOO_LONG]: "affiliateAddress too long: 3 characters max.",
646
+ [l.AFF_BPS_INTEGER_0_100]: "affiliateBasisPoints must be an integer between 0 and 100.",
647
+ [l.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN]: "Source address {0} invalid for sell chain.",
648
+ [l.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN]: "Destination address {0} invalid for buy chain.",
649
+ [l.PREFERRED_PROFVIDER_NOT_SUPPORTED]: "Preferred provider not supported.",
650
+ [l.DESTINATION_ADDRESS_SMART_CONTRACT]: "Destination address is a smart contract.",
651
+ [l.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Buy amount must be a positive integer.",
652
+ [l.INVALID_PROVIDER]: "Invalid provider {0}.",
653
+ [l.MISSING_CROSS_CHAIN_PROVIDER]: "Missing cross-chain provider.",
654
+ [l.MISSING_AVAX_PROVIDER]: "Missing AVAX provider.",
655
+ [l.MISSING_BSC_PROVIDER]: "Missing BSC provider.",
656
+ [l.MISSING_ETH_PROVIDER]: "Missing ETH provider.",
657
+ [l.MISSING_ARB_PROVIDER]: "Missing ARB provider.",
658
+ [l.INVALID_PROVIDER_FOR_SWAP_OUT]: "Invalid provider for swap out.",
659
+ [l.INVALID_CHAIN]: "Invalid chain {0}.",
660
+ [l.INVALID_ASSET]: "Invalid asset {0}.",
661
+ [l.UNSUPPORTED_CHAIN]: "Unsupported chain {0}.",
662
+ [l.UNSUPPORTED_ASSET]: "Unsupported asset {0}.",
663
+ [l.UNSUPPORTED_ASSET_FOR_SWAPOUT]: "Unsupported asset {0} for swap out.",
664
+ [l.THORNODE_QUOTE_GENERIC_ERROR]: "ThorNode quote generic error.",
665
+ [l.INVALID_SOURCE_ADDRESS]: "Invalid source address {0}",
666
+ [l.INVALID_DESTINATION_ADDRESS]: "Invalid destination address {0}",
667
+ [l.NOT_ENOUGH_SYNTH_BALANCE]: "Source address doesn't have enough synth balance for this quote.",
668
+ [l.SYNTH_MINTING_CAP_REACHED]: "Synth minting cap reached.",
669
+ [l.INVALID_QUOTE_MODE]: "Invalid quote mode.",
670
+ [l.NO_QUOTES]: "No quotes to service this request.",
671
+ [l.SERVICE_UNAVAILABLE_GENERIC]: "Service unavailable.",
672
+ [l.MISSING_GAS_DATA_GENERIC]: "Missing gas data.",
673
+ [l.MISSING_TOKEN_INFO_GENERIC]: "Missing token info.",
674
+ [l.CANT_FIND_TOKEN_LIST]: "Can't find tokenlist {0}.",
675
+ [l.NO_PRICE]: "No price for asset {0}.",
676
+ [l.PRICE_IS_STALE]: "Price is stale for asset {0}.",
677
+ [l.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
678
+ [l.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
679
+ }, ae = (e, t) => {
680
+ let n = nt[e];
681
681
  for (let a = 0; a < t.length; a++)
682
682
  n = n.replace(`{${a}}`, t[a]);
683
683
  return t.length === 0 ? n.replace("{0}", "") : n;
684
684
  };
685
- class be extends Error {
685
+ let mn = 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: y, shouldTrace: l } = {
692
+ type: o,
693
+ options: { shouldLog: p, shouldThrow: u, shouldTrace: y } = {
694
694
  shouldLog: !0,
695
695
  shouldThrow: !0,
696
696
  shouldTrace: !0
697
697
  },
698
- displayMessageParams: o
698
+ displayMessageParams: d
699
699
  }) {
700
- const c = r || ee(i, o || []) || "";
701
- super(c), M(this, "status"), M(this, "revision"), M(this, "type"), M(this, "module"), M(this, "code"), M(this, "message"), M(this, "display"), M(this, "stack"), M(this, "options"), M(this, "displayMessageParams"), this.status = t, this.revision = n || "NO_REVISION", this.module = a, this.message = c, this.display = ee(i, o || []), this.code = i, this.type = p || fe.UNHANDLED_ERROR, this.options = {
702
- shouldLog: d || !0,
703
- shouldTrace: l || !0,
704
- shouldThrow: y || !1
705
- }, this.displayMessageParams = o || [], this.options.shouldTrace && Error.captureStackTrace(this);
700
+ const c = r || ae(s, d || []) || "";
701
+ super(c), 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 = c, this.display = ae(s, d || []), this.code = s, this.type = o || ve.UNHANDLED_ERROR, this.options = {
702
+ shouldLog: p || !0,
703
+ shouldTrace: y || !0,
704
+ shouldThrow: u || !1
705
+ }, this.displayMessageParams = d || [], this.options.shouldTrace && Error.captureStackTrace(this);
706
706
  }
707
707
  static fromErrorInfo(t) {
708
- return new be(t);
708
+ return new Ce(t);
709
709
  }
710
710
  toErrorInfo() {
711
711
  return { ...this, identifier: this.identifier };
@@ -714,7 +714,7 @@ class be extends Error {
714
714
  return `${this.revision}-${this.type || "NO_TYPE"}-${this.module}-${this.code}`;
715
715
  }
716
716
  get displayMessage() {
717
- return ee(this.code, this.displayMessageParams || []);
717
+ return ae(this.code, this.displayMessageParams || []);
718
718
  }
719
719
  handle() {
720
720
  const t = `[${this.identifier}]: ${this.message}`;
@@ -723,9 +723,9 @@ class be extends Error {
723
723
  throw Error(t, { cause: this.stack });
724
724
  return this.toErrorInfo();
725
725
  }
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 || {}), Ge = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(Ge || {}), We = /* @__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))(We || {});
728
- const Ut = {
726
+ };
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 || {}), at = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(at || {}), st = /* @__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))(st || {});
728
+ const Tn = {
729
729
  ARB: [44, 60, 0, 0, 0],
730
730
  AVAX: [44, 60, 0, 0, 0],
731
731
  BCH: [44, 145, 0, 0, 0],
@@ -743,7 +743,7 @@ const Ut = {
743
743
  THOR: [44, 931, 0, 0, 0]
744
744
  };
745
745
  var b = /* @__PURE__ */ ((e) => (e[e.ARB = 18] = "ARB", e[e.AVAX = 18] = "AVAX", e[e.BCH = 8] = "BCH", e[e.BNB = 8] = "BNB", e[e.BSC = 18] = "BSC", e[e.BTC = 8] = "BTC", e[e.DASH = 8] = "DASH", e[e.DOGE = 8] = "DOGE", e[e.ETH = 18] = "ETH", e[e.GAIA = 6] = "GAIA", e[e.KUJI = 6] = "KUJI", e[e.LTC = 8] = "LTC", e[e.MATIC = 18] = "MATIC", e[e.MAYA = 10] = "MAYA", e[e.OP = 18] = "OP", e[e.THOR = 8] = "THOR", e))(b || {});
746
- const Ht = [
746
+ const hn = [
747
747
  "ETH",
748
748
  "AVAX",
749
749
  "BSC",
@@ -751,38 +751,38 @@ const Ht = [
751
751
  "OP",
752
752
  "MATIC"
753
753
  /* Polygon */
754
- ], $t = [
754
+ ], _n = [
755
755
  "BTC",
756
756
  "BCH",
757
757
  "DOGE",
758
758
  "LTC"
759
759
  /* Litecoin */
760
- ], kt = [
760
+ ], fn = [
761
761
  "GAIA",
762
762
  "THOR",
763
763
  "BNB"
764
764
  /* Binance */
765
765
  ];
766
- var ye = /* @__PURE__ */ ((e) => (e.Arbitrum = "42161", e.ArbitrumHex = "0xa4b1", e.Avalanche = "43114", e.AvalancheHex = "0xa86a", e.Binance = "Binance-Chain-Tigris", e.BinanceSmartChain = "56", e.BinanceSmartChainHex = "0x38", e.Bitcoin = "bitcoin", e.BitcoinCash = "bitcoincash", e.Cosmos = "cosmoshub-4", e.Dogecoin = "dogecoin", e.Kujira = "kaiyo-1", e.Ethereum = "1", e.EthereumHex = "0x1", e.Litecoin = "litecoin", e.Maya = "mayachain-mainnet-v1", e.MayaStagenet = "mayachain-stagenet-v1", e.Optimism = "10", e.OptimismHex = "0xa", e.Polygon = "137", e.PolygonHex = "0x89", e.THORChain = "thorchain-mainnet-v1", e.THORChainStagenet = "thorchain-stagenet-v2", e))(ye || {}), Ae = /* @__PURE__ */ ((e) => (e.Arbitrum = "https://arb1.arbitrum.io/rpc", e.Avalanche = "https://node-router.thorswap.net/avalanche-c", e.Binance = "", e.BinanceSmartChain = "https://bsc-dataseed.binance.org", e.Bitcoin = "https://node-router.thorswap.net/bitcoin", e.BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash", e.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", e.Kujira = "https://rpc-kujira.synergynodes.com/", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Litecoin = "https://node-router.thorswap.net/litecoin", e.Maya = "https://tendermint.mayachain.info", e.MayaStagenet = "https://stagenet.tendermint.mayachain.info", e.Optimism = "https://mainnet.optimism.io", e.Polygon = "https://polygon-rpc.com", e.THORChain = "https://rpc.thorswap.net", e.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", e))(Ae || {}), W = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.finance", e.ThorswapStatic = "https://static.thorswap.net", e))(W || {});
767
- const Z = Object.values(s), qe = Object.keys(s), le = Z.reduce(
766
+ var he = /* @__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))(he || {}), 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 || {}), W = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.finance", e.ThorswapStatic = "https://static.thorswap.net", e))(W || {});
767
+ const ne = Object.values(i), it = Object.keys(i), _e = ne.reduce(
768
768
  (e, t) => {
769
- const n = qe.find((a) => s[a] === t);
769
+ const n = it.find((a) => i[a] === t);
770
770
  return n && (e[t] = n), e;
771
771
  },
772
772
  {}
773
- ), Ke = Z.reduce(
774
- (e, t) => (e[t] = ye[le[t]], e),
773
+ ), rt = ne.reduce(
774
+ (e, t) => (e[t] = he[_e[t]], e),
775
775
  {}
776
- ), Ye = Z.reduce(
777
- (e, t) => (e[t] = Ae[le[t]], e),
776
+ ), ot = ne.reduce(
777
+ (e, t) => (e[t] = Me[_e[t]], e),
778
778
  {}
779
- ), Ft = Z.reduce(
779
+ ), bn = ne.reduce(
780
780
  (e, t) => {
781
- const n = `${le[t]}Hex`;
782
- return e[t] = ye[n], e;
781
+ const n = `${_e[t]}Hex`;
782
+ return e[t] = he[n], e;
783
783
  },
784
784
  {}
785
- ), Gt = {
785
+ ), wn = {
786
786
  "0xa4b1": "ARB",
787
787
  42161: "ARB",
788
788
  "0xa86a": "AVAX",
@@ -807,7 +807,7 @@ const Z = Object.values(s), qe = Object.keys(s), le = Z.reduce(
807
807
  "thorchain-stagenet-v2": "THOR",
808
808
  "thorchain-mainnet-v1": "THOR"
809
809
  /* THORChain */
810
- }, we = {
810
+ }, Ne = {
811
811
  ARB: "https://arbiscan.io",
812
812
  AVAX: "https://snowtrace.io",
813
813
  BSC: "https://bscscan.com",
@@ -824,320 +824,651 @@ const Z = Object.values(s), qe = Object.keys(s), le = Z.reduce(
824
824
  MATIC: "https://polygonscan.com",
825
825
  THOR: "https://viewblock.io/thorchain"
826
826
  };
827
- var Xe = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(Xe || {}), _ = /* @__PURE__ */ ((e) => (e.BOND = "BOND", e.DEPOSIT = "+", e.LEAVE = "LEAVE", e.THORNAME_REGISTER = "~", e.UNBOND = "UNBOND", e.WITHDRAW = "-", e.OPEN_LOAN = "$+", e.CLOSE_LOAN = "$-", e))(_ || {}), k = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(k || {}), je = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", e.XDEFI = "XDEFI", e.METAMASK = "METAMASK", e.COINBASE_WEB = "COINBASE_WEB", e.TREZOR = "TREZOR", e.TRUSTWALLET_WEB = "TRUSTWALLET_WEB", e.LEDGER = "LEDGER", e.KEPLR = "KEPLR", e.OKX = "OKX", e.BRAVE = "BRAVE", e.WALLETCONNECT = "WALLETCONNECT", e))(je || {}), Qe = Object.defineProperty, Je = (e, t, n) => t in e ? Qe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (Je(e, typeof t != "symbol" ? t + "" : t, n), n), ze = (e, t, n) => {
827
+ var pt = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(pt || {}), 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 || {}), k = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(k || {}), dt = /* @__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))(dt || {}), ut = Object.defineProperty, lt = (e, t, n) => t in e ? ut(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, M = (e, t, n) => (lt(e, typeof t != "symbol" ? t + "" : t, n), n), yt = (e, t, n) => {
828
828
  if (!t.has(e))
829
829
  throw TypeError("Cannot " + n);
830
830
  }, V = (e, t, n) => {
831
831
  if (t.has(e))
832
832
  throw TypeError("Cannot add the same private member more than once");
833
833
  t instanceof WeakSet ? t.add(e) : t.set(e, n);
834
- }, g = (e, t, n) => (ze(e, t, "access private method"), n);
835
- const Wt = (e) => {
836
- if (e < 0)
837
- throw new Error("Invalid number of year");
838
- return 10 + e;
839
- }, qt = (e) => {
840
- if (e.length > 30)
841
- return !1;
842
- const t = /^[a-zA-Z0-9+_-]+$/g;
843
- return !!e.match(t);
844
- }, Kt = ([e, t, n, a, i]) => `${e}'/${t}'/${n}'/${a}${typeof i != "number" ? "" : `/${i}`}`, Ee = async (e, t) => {
834
+ }, O = (e, t, n) => (yt(e, t, "access private method"), n);
835
+ const ct = "0x313ce567", xe = async ({ chain: e, to: t }) => {
845
836
  try {
846
- const n = Object.entries(t || {}).reduce(
847
- (a, [i, r]) => (r && (a[i] = r), a),
848
- {}
849
- );
850
- return (await fetch(
851
- `${e}${t ? `?${new URLSearchParams(n).toString()}` : ""}`,
852
- { method: "GET", mode: "cors", credentials: "omit", referrer: "https://sk.thorswap.net" }
853
- )).json();
854
- } catch (n) {
855
- return console.error(n), {};
856
- }
857
- }, Ze = async (e, t, n, a = !1) => {
858
- try {
859
- const i = await fetch(`${e}`, {
860
- body: t,
861
- headers: n,
862
- method: "POST",
863
- referrer: "https://sk.thorswap.net"
864
- });
865
- return a ? i.text() : i.json();
866
- } catch {
867
- return {};
868
- }
869
- }, et = "0x313ce567", Re = async ({ chain: e, to: t }) => {
870
- try {
871
- const n = await Ze(
872
- Ye[e],
873
- JSON.stringify({
874
- method: "eth_call",
875
- params: [{ to: t.toLowerCase(), data: et }, "latest"],
837
+ const { result: n } = await be.post(ot[e], {
838
+ headers: { accept: "*/*", "cache-control": "no-cache" },
839
+ body: JSON.stringify({
876
840
  id: 44,
877
- jsonrpc: "2.0"
878
- }),
879
- { accept: "*/*", "cache-control": "no-cache", "content-type": "application/json" },
880
- !0
881
- ), { result: a } = JSON.parse(n);
882
- return parseInt(BigInt(a).toString());
841
+ jsonrpc: "2.0",
842
+ method: "eth_call",
843
+ params: [{ to: t.toLowerCase(), data: ct }, "latest"]
844
+ })
845
+ });
846
+ return parseInt(BigInt(n).toString());
883
847
  } catch (n) {
884
848
  return console.error(n), b[e];
885
849
  }
886
- }, tt = async (e) => {
887
- if (e === s.Ethereum)
850
+ }, mt = async (e) => {
851
+ if (e === i.Ethereum)
888
852
  return b.ETH;
889
853
  const [, t] = e.split("-");
890
- return t != null && t.startsWith("0x") ? Re({ chain: s.Ethereum, to: t }) : b.ETH;
891
- }, nt = async (e) => {
854
+ return t != null && t.startsWith("0x") ? xe({ chain: i.Ethereum, to: t }) : b.ETH;
855
+ }, Tt = async (e) => {
892
856
  const [, t] = e.split("-");
893
- return t != null && t.startsWith("0x") ? Re({ chain: s.Avalanche, to: t.toLowerCase() }) : b.AVAX;
894
- }, at = async (e) => (e === s.BinanceSmartChain, b.BSC), Oe = async ({ chain: e, symbol: t }) => {
857
+ return t != null && t.startsWith("0x") ? xe({ chain: i.Avalanche, to: t.toLowerCase() }) : b.AVAX;
858
+ }, ht = async (e) => (e === i.BinanceSmartChain, b.BSC), De = async ({ chain: e, symbol: t }) => {
895
859
  switch (e) {
896
- case s.Ethereum:
897
- return tt(t);
898
- case s.Avalanche:
899
- return nt(t);
900
- case s.BinanceSmartChain:
901
- return at(t);
860
+ case i.Ethereum:
861
+ return mt(t);
862
+ case i.Avalanche:
863
+ return Tt(t);
864
+ case i.BinanceSmartChain:
865
+ return ht(t);
902
866
  default:
903
867
  return b[e];
904
868
  }
905
- }, st = {
869
+ }, _t = {
906
870
  [k.Average]: 1.2,
907
871
  [k.Fast]: 1.5,
908
872
  [k.Fastest]: 2
909
- }, it = ({ chain: e, symbol: t }) => {
873
+ }, ft = ({ chain: e, symbol: t }) => {
910
874
  switch (e) {
911
- case s.Bitcoin:
912
- case s.BitcoinCash:
913
- case s.Litecoin:
914
- case s.Dogecoin:
915
- case s.Binance:
916
- case s.Ethereum:
917
- case s.Avalanche:
875
+ case i.Bitcoin:
876
+ case i.BitcoinCash:
877
+ case i.Litecoin:
878
+ case i.Dogecoin:
879
+ case i.Binance:
880
+ case i.Ethereum:
881
+ case i.Avalanche:
918
882
  return t === e;
919
- case s.Arbitrum:
920
- case s.Optimism:
883
+ case i.Arbitrum:
884
+ case i.Optimism:
921
885
  return t === "ETH";
922
- case s.Maya:
886
+ case i.Maya:
923
887
  return t === "CACAO";
924
- case s.Kujira:
888
+ case i.Kujira:
925
889
  return t === "KUJI";
926
- case s.Cosmos:
890
+ case i.Cosmos:
927
891
  return t === "ATOM";
928
- case s.Polygon:
892
+ case i.Polygon:
929
893
  return t === "MATIC";
930
- case s.BinanceSmartChain:
894
+ case i.BinanceSmartChain:
931
895
  return t === "BNB";
932
- case s.THORChain:
896
+ case i.THORChain:
933
897
  return t === "RUNE";
934
898
  }
935
- }, rt = (e) => {
899
+ }, bt = (e) => {
936
900
  switch (e) {
937
901
  case "ETH.THOR":
938
902
  return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
939
903
  case "ETH.vTHOR":
940
904
  return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
941
- case s.Cosmos:
905
+ case i.Cosmos:
942
906
  return { identifier: "GAIA.ATOM", decimal: b[e] };
943
- case s.THORChain:
907
+ case i.THORChain:
944
908
  return { identifier: "THOR.RUNE", decimal: b[e] };
945
- case s.BinanceSmartChain:
909
+ case i.BinanceSmartChain:
946
910
  return { identifier: "BSC.BNB", decimal: b[e] };
947
- case s.Maya:
911
+ case i.Maya:
948
912
  return { identifier: "MAYA.CACAO", decimal: b.MAYA };
949
913
  case "MAYA.MAYA":
950
914
  return { identifier: "MAYA.MAYA", decimal: 4 };
951
- case s.Kujira:
952
- case s.Arbitrum:
953
- case s.Optimism:
954
- case s.BitcoinCash:
955
- case s.Litecoin:
956
- case s.Dogecoin:
957
- case s.Binance:
958
- case s.Avalanche:
959
- case s.Polygon:
960
- case s.Bitcoin:
961
- case s.Ethereum:
915
+ case i.Kujira:
916
+ case i.Arbitrum:
917
+ case i.Optimism:
918
+ case i.BitcoinCash:
919
+ case i.Litecoin:
920
+ case i.Dogecoin:
921
+ case i.Binance:
922
+ case i.Avalanche:
923
+ case i.Polygon:
924
+ case i.Bitcoin:
925
+ case i.Ethereum:
962
926
  return { identifier: `${e}.${e}`, decimal: b[e] };
963
927
  }
964
- }, pt = ({ chain: e, symbol: t }) => {
928
+ }, wt = ({ chain: e, symbol: t }) => {
965
929
  if (t.includes("/"))
966
930
  return "Synth";
967
931
  switch (e) {
968
- case s.Bitcoin:
969
- case s.BitcoinCash:
970
- case s.Dogecoin:
971
- case s.Litecoin:
972
- case s.Maya:
973
- case s.THORChain:
932
+ case i.Bitcoin:
933
+ case i.BitcoinCash:
934
+ case i.Dogecoin:
935
+ case i.Litecoin:
936
+ case i.Maya:
937
+ case i.THORChain:
974
938
  return "Native";
975
- case s.Cosmos:
976
- return t === "ATOM" ? "Native" : s.Cosmos;
977
- case s.Kujira:
978
- return t === s.Kujira ? "Native" : s.Kujira;
979
- case s.Binance:
980
- return t === s.Binance ? "Native" : "BEP2";
981
- case s.BinanceSmartChain:
982
- return t === s.Binance ? "Native" : "BEP20";
983
- case s.Ethereum:
984
- return t === s.Ethereum ? "Native" : "ERC20";
985
- case s.Avalanche:
986
- return t === s.Avalanche ? "Native" : s.Avalanche;
987
- case s.Polygon:
988
- return t === s.Polygon ? "Native" : "POLYGON";
989
- case s.Arbitrum:
990
- return [s.Ethereum, s.Arbitrum].includes(t) ? "Native" : "ARBITRUM";
991
- case s.Optimism:
992
- return [s.Ethereum, s.Optimism].includes(t) ? "Native" : "OPTIMISM";
993
- }
994
- }, Yt = (e) => {
939
+ case i.Cosmos:
940
+ return t === "ATOM" ? "Native" : i.Cosmos;
941
+ case i.Kujira:
942
+ return t === i.Kujira ? "Native" : i.Kujira;
943
+ case i.Binance:
944
+ return t === i.Binance ? "Native" : "BEP2";
945
+ case i.BinanceSmartChain:
946
+ return t === i.Binance ? "Native" : "BEP20";
947
+ case i.Ethereum:
948
+ return t === i.Ethereum ? "Native" : "ERC20";
949
+ case i.Avalanche:
950
+ return t === i.Avalanche ? "Native" : i.Avalanche;
951
+ case i.Polygon:
952
+ return t === i.Polygon ? "Native" : "POLYGON";
953
+ case i.Arbitrum:
954
+ return [i.Ethereum, i.Arbitrum].includes(t) ? "Native" : "ARBITRUM";
955
+ case i.Optimism:
956
+ return [i.Ethereum, i.Optimism].includes(t) ? "Native" : "OPTIMISM";
957
+ }
958
+ }, An = (e) => {
995
959
  var t;
996
- const [n, ...a] = e.split("."), i = e.includes("/"), r = a.join("."), p = (t = r == null ? void 0 : r.split("-")) == null ? void 0 : t[0];
997
- return { chain: n, symbol: r, ticker: p, synth: i };
998
- }, ot = new RegExp(
960
+ const [n, ...a] = e.split("."), s = e.includes("/"), r = a.join("."), o = (t = r == null ? void 0 : r.split("-")) == null ? void 0 : t[0];
961
+ return { chain: n, symbol: r, ticker: o, synth: s };
962
+ }, At = new RegExp(
999
963
  /(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
1000
964
  "gmi"
1001
- ), Xt = (e) => e.filter(
1002
- (t) => !ot.test(t.toString()) && !t.toString().includes("undefined")
1003
- ), dt = ({
965
+ ), En = (e) => e.filter(
966
+ (t) => !At.test(t.toString()) && !t.toString().includes("undefined")
967
+ ), Et = ({
1004
968
  liquidityUnits: e,
1005
969
  poolUnits: t,
1006
970
  runeDepth: n
1007
971
  }) => {
1008
- const a = A(e), i = A(t), r = A(n), p = a.mul(r), d = i.mul(i).mul(2), y = i.mul(a).mul(2), l = a.mul(a), o = i.mul(i).mul(i);
1009
- return p.mul(d.sub(y).add(l)).div(o);
1010
- }, ut = ({
972
+ const a = w(e), s = w(t), r = w(n), o = a.mul(r), p = s.mul(s).mul(2), u = s.mul(a).mul(2), y = a.mul(a), d = s.mul(s).mul(s);
973
+ return o.mul(p.sub(u).add(y)).div(d);
974
+ }, Rt = ({
1011
975
  liquidityUnits: e,
1012
976
  poolUnits: t,
1013
977
  assetDepth: n
1014
978
  }) => {
1015
- const a = A(e), i = A(t), r = A(n), p = a.mul(r), d = i.mul(i).mul(2), y = i.mul(a).mul(2), l = a.mul(a), o = p.mul(d.sub(y).add(l)), c = i.mul(i).mul(i);
1016
- return o.div(c);
1017
- }, jt = ({
979
+ const a = w(e), s = w(t), r = w(n), o = a.mul(r), p = s.mul(s).mul(2), u = s.mul(a).mul(2), y = a.mul(a), d = o.mul(p.sub(u).add(y)), c = s.mul(s).mul(s);
980
+ return d.div(c);
981
+ }, Rn = ({
1018
982
  percent: e,
1019
983
  runeDepth: t,
1020
984
  liquidityUnits: n,
1021
985
  poolUnits: a
1022
- }) => dt({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), Qt = ({
986
+ }) => Et({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), gn = ({
1023
987
  percent: e,
1024
988
  assetDepth: t,
1025
989
  liquidityUnits: n,
1026
990
  poolUnits: a
1027
- }) => ut({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), A = (e) => new ue({ value: e, decimal: b.THOR }), yt = ({
991
+ }) => Rt({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), w = (e) => new Te({ value: e, decimal: b.THOR }), gt = ({
1028
992
  liquidityUnits: e,
1029
993
  poolUnits: t,
1030
994
  runeDepth: n,
1031
995
  assetDepth: a
1032
996
  }) => ({
1033
- assetAmount: A(a).mul(e).div(t),
1034
- runeAmount: A(n).mul(e).div(t)
1035
- }), Jt = ({
997
+ assetAmount: w(a).mul(e).div(t),
998
+ runeAmount: w(n).mul(e).div(t)
999
+ }), On = ({
1036
1000
  liquidityUnits: e,
1037
1001
  poolUnits: t,
1038
1002
  runeDepth: n,
1039
1003
  assetDepth: a,
1040
- percent: i
1004
+ percent: s
1041
1005
  }) => Object.fromEntries(
1042
- Object.entries(yt({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
1043
- ([r, p]) => [r, p.mul(i)]
1006
+ Object.entries(gt({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
1007
+ ([r, o]) => [r, o.mul(s)]
1044
1008
  )
1045
- ), zt = ({
1009
+ ), In = ({
1046
1010
  runeDepth: e,
1047
1011
  poolUnits: t,
1048
1012
  assetDepth: n,
1049
1013
  liquidityUnits: a,
1050
- runeAmount: i,
1014
+ runeAmount: s,
1051
1015
  assetAmount: r
1052
1016
  }) => {
1053
- const p = A(e), d = A(n), y = A(t), l = A(i), o = A(r), c = l.mul(d), h = o.mul(p), w = l.mul(o), R = p.mul(d), O = y.mul(c.add(h.add(w.mul(2)))), E = c.add(h.add(R.mul(2))), I = O.div(E), S = A(a).add(I);
1017
+ const o = w(e), p = w(n), u = w(t), y = w(s), d = w(r), c = y.mul(p), _ = d.mul(o), A = y.mul(d), R = o.mul(p), g = u.mul(c.add(_.add(A.mul(2)))), E = c.add(_.add(R.mul(2))), I = g.div(E), S = w(a).add(I);
1054
1018
  if (I.baseValueNumber === 0)
1055
- return S.div(y).baseValueNumber;
1056
- const D = y.add(S);
1019
+ return S.div(u).baseValueNumber;
1020
+ const D = u.add(S);
1057
1021
  return S.div(D).baseValueNumber;
1058
- }, Zt = ({
1022
+ }, Sn = ({
1059
1023
  runeAmount: e,
1060
1024
  assetAmount: t,
1061
1025
  runeDepth: n,
1062
1026
  assetDepth: a
1063
1027
  }) => {
1064
- const i = A(n), r = A(a), p = A(t), d = A(e), y = p.mul(i).sub(r.mul(d)), l = r.mul(d).add(i.mul(r));
1065
- return Math.abs(y.div(l).baseValueNumber);
1066
- }, lt = ({
1028
+ const s = w(n), r = w(a), o = w(t), p = w(e), u = o.mul(s).sub(r.mul(p)), y = r.mul(p).add(s.mul(r));
1029
+ return Math.abs(u.div(y).baseValueNumber);
1030
+ }, Ot = ({
1067
1031
  symbol: e,
1068
1032
  ticker: t,
1069
1033
  chain: n
1070
1034
  }) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e, x = (e, t) => {
1071
1035
  switch (e) {
1072
- case _.LEAVE:
1073
- case _.BOND: {
1036
+ case h.LEAVE:
1037
+ case h.BOND: {
1074
1038
  const { address: n } = t;
1075
1039
  return `${e}:${n}`;
1076
1040
  }
1077
- case _.UNBOND: {
1041
+ case h.UNBOND: {
1078
1042
  const { address: n, unbondAmount: a } = t;
1079
1043
  return `${e}:${n}:${a * 10 ** 8}`;
1080
1044
  }
1081
- case _.THORNAME_REGISTER: {
1082
- const { name: n, chain: a, address: i, owner: r } = t;
1083
- return `${e}:${n}:${a}:${i}${r ? `:${r}` : ""}`;
1045
+ case h.THORNAME_REGISTER: {
1046
+ const { name: n, chain: a, address: s, owner: r } = t;
1047
+ return `${e}:${n}:${a}:${s}${r ? `:${r}` : ""}`;
1084
1048
  }
1085
- case _.DEPOSIT: {
1086
- const { chain: n, symbol: a, address: i, singleSide: r } = t;
1087
- return r ? `${e}:${n}/${a}::t:0` : `${e}:${n}.${a}:${i || ""}:t:0`;
1049
+ case h.DEPOSIT: {
1050
+ const { chain: n, symbol: a, address: s, singleSide: r } = t;
1051
+ return r ? `${e}:${n}/${a}::t:0` : `${e}:${n}.${a}:${s || ""}:t:0`;
1088
1052
  }
1089
- case _.WITHDRAW: {
1090
- const { chain: n, ticker: a, symbol: i, basisPoints: r, targetAssetString: p, singleSide: d } = t, y = !d && p ? `:${p}` : "", l = lt({ chain: n, symbol: i, ticker: a });
1091
- return `${e}:${n}${d ? "/" : "."}${l}:${r}${y}`;
1053
+ case h.WITHDRAW: {
1054
+ const { chain: n, ticker: a, symbol: s, basisPoints: r, targetAssetString: o, singleSide: p } = t, u = !p && o ? `:${o}` : "", y = Ot({ chain: n, symbol: s, ticker: a });
1055
+ return `${e}:${n}${p ? "/" : "."}${y}:${r}${u}`;
1092
1056
  }
1093
- case _.OPEN_LOAN:
1094
- case _.CLOSE_LOAN: {
1057
+ case h.OPEN_LOAN:
1058
+ case h.CLOSE_LOAN: {
1095
1059
  const { asset: n, address: a } = t;
1096
1060
  return `${e}:${n}:${a}`;
1097
1061
  }
1098
1062
  default:
1099
1063
  return "";
1100
1064
  }
1101
- }, ce = Object.values(s), ct = (e = "") => {
1065
+ }, vn = (e) => {
1066
+ if (e < 0)
1067
+ throw new Error("Invalid number of year");
1068
+ return 10 + e;
1069
+ }, Cn = (e) => {
1070
+ if (e.length > 30)
1071
+ return !1;
1072
+ const t = /^[a-zA-Z0-9+_-]+$/g;
1073
+ return !!e.match(t);
1074
+ }, Mn = ([e, t, n, a, s]) => `${e}'/${t}'/${n}'/${a}${typeof s != "number" ? "" : `/${s}`}`;
1075
+ class we extends Error {
1076
+ constructor(t, n, a) {
1077
+ const s = t.status || t.status === 0 ? t.status : "", r = t.statusText || "", o = `${s} ${r}`.trim(), p = o ? `status code ${o}` : "an unknown error";
1078
+ super(`Request failed with ${p}`), Object.defineProperty(this, "response", {
1079
+ enumerable: !0,
1080
+ configurable: !0,
1081
+ writable: !0,
1082
+ value: void 0
1083
+ }), Object.defineProperty(this, "request", {
1084
+ enumerable: !0,
1085
+ configurable: !0,
1086
+ writable: !0,
1087
+ value: void 0
1088
+ }), Object.defineProperty(this, "options", {
1089
+ enumerable: !0,
1090
+ configurable: !0,
1091
+ writable: !0,
1092
+ value: void 0
1093
+ }), this.name = "HTTPError", this.response = t, this.request = n, this.options = a;
1094
+ }
1095
+ }
1096
+ class Pe extends Error {
1097
+ constructor(t) {
1098
+ super("Request timed out"), Object.defineProperty(this, "request", {
1099
+ enumerable: !0,
1100
+ configurable: !0,
1101
+ writable: !0,
1102
+ value: void 0
1103
+ }), this.name = "TimeoutError", this.request = t;
1104
+ }
1105
+ }
1106
+ const J = (e) => e !== null && typeof e == "object", X = (...e) => {
1107
+ for (const t of e)
1108
+ if ((!J(t) || Array.isArray(t)) && t !== void 0)
1109
+ throw new TypeError("The `options` argument must be an object");
1110
+ return fe({}, ...e);
1111
+ }, Be = (e = {}, t = {}) => {
1112
+ const n = new globalThis.Headers(e), a = t instanceof globalThis.Headers, s = new globalThis.Headers(t);
1113
+ for (const [r, o] of s.entries())
1114
+ a && o === "undefined" || o === void 0 ? n.delete(r) : n.set(r, o);
1115
+ return n;
1116
+ }, fe = (...e) => {
1117
+ let t = {}, n = {};
1118
+ for (const a of e)
1119
+ if (Array.isArray(a))
1120
+ Array.isArray(t) || (t = []), t = [...t, ...a];
1121
+ else if (J(a)) {
1122
+ for (let [s, r] of Object.entries(a))
1123
+ J(r) && s in t && (r = fe(t[s], r)), t = { ...t, [s]: r };
1124
+ J(a.headers) && (n = Be(n, a.headers), t.headers = n);
1125
+ }
1126
+ return t;
1127
+ }, It = (() => {
1128
+ let e = !1, t = !1;
1129
+ const n = typeof globalThis.ReadableStream == "function", a = typeof globalThis.Request == "function";
1130
+ return n && a && (t = new globalThis.Request("https://empty.invalid", {
1131
+ body: new globalThis.ReadableStream(),
1132
+ method: "POST",
1133
+ // @ts-expect-error - Types are outdated.
1134
+ get duplex() {
1135
+ return e = !0, "half";
1136
+ }
1137
+ }).headers.has("Content-Type")), e && !t;
1138
+ })(), St = typeof globalThis.AbortController == "function", vt = typeof globalThis.ReadableStream == "function", Ct = typeof globalThis.FormData == "function", Ve = ["get", "post", "put", "patch", "head", "delete"], Mt = {
1139
+ json: "application/json",
1140
+ text: "text/*",
1141
+ formData: "multipart/form-data",
1142
+ arrayBuffer: "*/*",
1143
+ blob: "*/*"
1144
+ }, se = 2147483647, Le = Symbol("stop"), Nt = {
1145
+ json: !0,
1146
+ parseJson: !0,
1147
+ searchParams: !0,
1148
+ prefixUrl: !0,
1149
+ retry: !0,
1150
+ timeout: !0,
1151
+ hooks: !0,
1152
+ throwHttpErrors: !0,
1153
+ onDownloadProgress: !0,
1154
+ fetch: !0
1155
+ }, xt = {
1156
+ method: !0,
1157
+ headers: !0,
1158
+ body: !0,
1159
+ mode: !0,
1160
+ credentials: !0,
1161
+ cache: !0,
1162
+ redirect: !0,
1163
+ referrer: !0,
1164
+ referrerPolicy: !0,
1165
+ integrity: !0,
1166
+ keepalive: !0,
1167
+ signal: !0,
1168
+ window: !0,
1169
+ dispatcher: !0,
1170
+ duplex: !0
1171
+ }, Dt = (e) => Ve.includes(e) ? e.toUpperCase() : e, Pt = ["get", "put", "head", "delete", "options", "trace"], Bt = [408, 413, 429, 500, 502, 503, 504], Ue = [413, 429, 503], Ae = {
1172
+ limit: 2,
1173
+ methods: Pt,
1174
+ statusCodes: Bt,
1175
+ afterStatusCodes: Ue,
1176
+ maxRetryAfter: Number.POSITIVE_INFINITY,
1177
+ backoffLimit: Number.POSITIVE_INFINITY,
1178
+ delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
1179
+ }, Vt = (e = {}) => {
1180
+ if (typeof e == "number")
1181
+ return {
1182
+ ...Ae,
1183
+ limit: e
1184
+ };
1185
+ if (e.methods && !Array.isArray(e.methods))
1186
+ throw new Error("retry.methods must be an array");
1187
+ if (e.statusCodes && !Array.isArray(e.statusCodes))
1188
+ throw new Error("retry.statusCodes must be an array");
1189
+ return {
1190
+ ...Ae,
1191
+ ...e,
1192
+ afterStatusCodes: Ue
1193
+ };
1194
+ };
1195
+ async function Lt(e, t, n, a) {
1196
+ return new Promise((s, r) => {
1197
+ const o = setTimeout(() => {
1198
+ n && n.abort(), r(new Pe(e));
1199
+ }, a.timeout);
1200
+ a.fetch(e, t).then(s).catch(r).then(() => {
1201
+ clearTimeout(o);
1202
+ });
1203
+ });
1204
+ }
1205
+ async function Ut(e, { signal: t }) {
1206
+ return new Promise((n, a) => {
1207
+ t && (t.throwIfAborted(), t.addEventListener("abort", s, { once: !0 }));
1208
+ function s() {
1209
+ clearTimeout(r), a(t.reason);
1210
+ }
1211
+ const r = setTimeout(() => {
1212
+ t == null || t.removeEventListener("abort", s), n();
1213
+ }, e);
1214
+ });
1215
+ }
1216
+ const Ht = (e, t) => {
1217
+ const n = {};
1218
+ for (const a in t)
1219
+ !(a in xt) && !(a in Nt) && !(a in e) && (n[a] = t[a]);
1220
+ return n;
1221
+ };
1222
+ class z {
1223
+ static create(t, n) {
1224
+ const a = new z(t, n), s = async () => {
1225
+ if (typeof a._options.timeout == "number" && a._options.timeout > se)
1226
+ throw new RangeError(`The \`timeout\` option cannot be greater than ${se}`);
1227
+ await Promise.resolve();
1228
+ let o = await a._fetch();
1229
+ for (const p of a._options.hooks.afterResponse) {
1230
+ const u = await p(a.request, a._options, a._decorateResponse(o.clone()));
1231
+ u instanceof globalThis.Response && (o = u);
1232
+ }
1233
+ if (a._decorateResponse(o), !o.ok && a._options.throwHttpErrors) {
1234
+ let p = new we(o, a.request, a._options);
1235
+ for (const u of a._options.hooks.beforeError)
1236
+ p = await u(p);
1237
+ throw p;
1238
+ }
1239
+ if (a._options.onDownloadProgress) {
1240
+ if (typeof a._options.onDownloadProgress != "function")
1241
+ throw new TypeError("The `onDownloadProgress` option must be a function");
1242
+ if (!vt)
1243
+ throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
1244
+ return a._stream(o.clone(), a._options.onDownloadProgress);
1245
+ }
1246
+ return o;
1247
+ }, r = a._options.retry.methods.includes(a.request.method.toLowerCase()) ? a._retry(s) : s();
1248
+ for (const [o, p] of Object.entries(Mt))
1249
+ r[o] = async () => {
1250
+ a.request.headers.set("accept", a.request.headers.get("accept") || p);
1251
+ const u = (await r).clone();
1252
+ if (o === "json") {
1253
+ if (u.status === 204 || (await u.clone().arrayBuffer()).byteLength === 0)
1254
+ return "";
1255
+ if (n.parseJson)
1256
+ return n.parseJson(await u.text());
1257
+ }
1258
+ return u[o]();
1259
+ };
1260
+ return r;
1261
+ }
1262
+ // eslint-disable-next-line complexity
1263
+ constructor(t, n = {}) {
1264
+ if (Object.defineProperty(this, "request", {
1265
+ enumerable: !0,
1266
+ configurable: !0,
1267
+ writable: !0,
1268
+ value: void 0
1269
+ }), Object.defineProperty(this, "abortController", {
1270
+ enumerable: !0,
1271
+ configurable: !0,
1272
+ writable: !0,
1273
+ value: void 0
1274
+ }), Object.defineProperty(this, "_retryCount", {
1275
+ enumerable: !0,
1276
+ configurable: !0,
1277
+ writable: !0,
1278
+ value: 0
1279
+ }), Object.defineProperty(this, "_input", {
1280
+ enumerable: !0,
1281
+ configurable: !0,
1282
+ writable: !0,
1283
+ value: void 0
1284
+ }), Object.defineProperty(this, "_options", {
1285
+ enumerable: !0,
1286
+ configurable: !0,
1287
+ writable: !0,
1288
+ value: void 0
1289
+ }), this._input = t, this._options = {
1290
+ // TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
1291
+ credentials: this._input.credentials || "same-origin",
1292
+ ...n,
1293
+ headers: Be(this._input.headers, n.headers),
1294
+ hooks: fe({
1295
+ beforeRequest: [],
1296
+ beforeRetry: [],
1297
+ beforeError: [],
1298
+ afterResponse: []
1299
+ }, n.hooks),
1300
+ method: Dt(n.method ?? this._input.method),
1301
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
1302
+ prefixUrl: String(n.prefixUrl || ""),
1303
+ retry: Vt(n.retry),
1304
+ throwHttpErrors: n.throwHttpErrors !== !1,
1305
+ timeout: n.timeout ?? 1e4,
1306
+ fetch: n.fetch ?? globalThis.fetch.bind(globalThis)
1307
+ }, typeof this._input != "string" && !(this._input instanceof URL || this._input instanceof globalThis.Request))
1308
+ throw new TypeError("`input` must be a string, URL, or Request");
1309
+ if (this._options.prefixUrl && typeof this._input == "string") {
1310
+ if (this._input.startsWith("/"))
1311
+ throw new Error("`input` must not begin with a slash when using `prefixUrl`");
1312
+ this._options.prefixUrl.endsWith("/") || (this._options.prefixUrl += "/"), this._input = this._options.prefixUrl + this._input;
1313
+ }
1314
+ if (St) {
1315
+ if (this.abortController = new globalThis.AbortController(), this._options.signal) {
1316
+ const a = this._options.signal;
1317
+ this._options.signal.addEventListener("abort", () => {
1318
+ this.abortController.abort(a.reason);
1319
+ });
1320
+ }
1321
+ this._options.signal = this.abortController.signal;
1322
+ }
1323
+ if (It && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
1324
+ const a = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), s = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, a);
1325
+ (Ct && 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);
1326
+ }
1327
+ 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 }));
1328
+ }
1329
+ _calculateRetryDelay(t) {
1330
+ if (this._retryCount++, this._retryCount < this._options.retry.limit && !(t instanceof Pe)) {
1331
+ if (t instanceof we) {
1332
+ if (!this._options.retry.statusCodes.includes(t.response.status))
1333
+ return 0;
1334
+ const a = t.response.headers.get("Retry-After");
1335
+ if (a && this._options.retry.afterStatusCodes.includes(t.response.status)) {
1336
+ let s = Number(a);
1337
+ 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;
1338
+ }
1339
+ if (t.response.status === 413)
1340
+ return 0;
1341
+ }
1342
+ const n = this._options.retry.delay(this._retryCount);
1343
+ return Math.min(this._options.retry.backoffLimit, n);
1344
+ }
1345
+ return 0;
1346
+ }
1347
+ _decorateResponse(t) {
1348
+ return this._options.parseJson && (t.json = async () => this._options.parseJson(await t.text())), t;
1349
+ }
1350
+ async _retry(t) {
1351
+ try {
1352
+ return await t();
1353
+ } catch (n) {
1354
+ const a = Math.min(this._calculateRetryDelay(n), se);
1355
+ if (a !== 0 && this._retryCount > 0) {
1356
+ await Ut(a, { signal: this._options.signal });
1357
+ for (const s of this._options.hooks.beforeRetry)
1358
+ if (await s({
1359
+ request: this.request,
1360
+ options: this._options,
1361
+ error: n,
1362
+ retryCount: this._retryCount
1363
+ }) === Le)
1364
+ return;
1365
+ return this._retry(t);
1366
+ }
1367
+ throw n;
1368
+ }
1369
+ }
1370
+ async _fetch() {
1371
+ for (const n of this._options.hooks.beforeRequest) {
1372
+ const a = await n(this.request, this._options);
1373
+ if (a instanceof Request) {
1374
+ this.request = a;
1375
+ break;
1376
+ }
1377
+ if (a instanceof Response)
1378
+ return a;
1379
+ }
1380
+ const t = Ht(this.request, this._options);
1381
+ return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Lt(this.request.clone(), t, this.abortController, this._options);
1382
+ }
1383
+ /* istanbul ignore next */
1384
+ _stream(t, n) {
1385
+ const a = Number(t.headers.get("content-length")) || 0;
1386
+ let s = 0;
1387
+ return t.status === 204 ? (n && n({ percent: 1, totalBytes: a, transferredBytes: s }, new Uint8Array()), new globalThis.Response(null, {
1388
+ status: t.status,
1389
+ statusText: t.statusText,
1390
+ headers: t.headers
1391
+ })) : new globalThis.Response(new globalThis.ReadableStream({
1392
+ async start(r) {
1393
+ const o = t.body.getReader();
1394
+ n && n({ percent: 0, transferredBytes: 0, totalBytes: a }, new Uint8Array());
1395
+ async function p() {
1396
+ const { done: u, value: y } = await o.read();
1397
+ if (u) {
1398
+ r.close();
1399
+ return;
1400
+ }
1401
+ if (n) {
1402
+ s += y.byteLength;
1403
+ const d = a === 0 ? 0 : s / a;
1404
+ n({ percent: d, transferredBytes: s, totalBytes: a }, y);
1405
+ }
1406
+ r.enqueue(y), await p();
1407
+ }
1408
+ await p();
1409
+ }
1410
+ }), {
1411
+ status: t.status,
1412
+ statusText: t.statusText,
1413
+ headers: t.headers
1414
+ });
1415
+ }
1416
+ }
1417
+ /*! MIT License © Sindre Sorhus */
1418
+ const re = (e) => {
1419
+ const t = (n, a) => z.create(n, X(e, a));
1420
+ for (const n of Ve)
1421
+ t[n] = (a, s) => z.create(a, X(e, s, { method: n }));
1422
+ return t.create = (n) => re(X(n)), t.extend = (n) => re(X(e, n)), t.stop = Le, t;
1423
+ }, $t = re(), kt = $t, Ee = kt.create({
1424
+ headers: {
1425
+ referrer: "https://sk.thorswap.net",
1426
+ referer: "https://sk.thorswap.net",
1427
+ "Content-Type": "application/json"
1428
+ }
1429
+ }), be = {
1430
+ get: (e, t) => Ee.get(e, t).json(),
1431
+ post: (e, t) => Ee.post(e, t).json()
1432
+ }, Re = Object.values(i), Ft = (e = "") => {
1102
1433
  const t = e.toUpperCase(), [n] = t.split(".");
1103
- if (ce.includes(n))
1434
+ if (Re.includes(n))
1104
1435
  return !0;
1105
1436
  const [a] = t.split("/");
1106
- if (ce.includes(a))
1437
+ if (Re.includes(a))
1107
1438
  return !0;
1108
1439
  throw new Error(
1109
1440
  `Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
1110
1441
  );
1111
1442
  }, q = 8, U = (e) => 10n ** BigInt(e), F = (e) => Math.log10(parseFloat(e.toString()));
1112
- function ge({
1443
+ function He({
1113
1444
  value: e,
1114
1445
  bigIntDecimal: t = q,
1115
1446
  decimal: n = q
1116
1447
  }) {
1117
1448
  const a = e < 0n;
1118
- let i = e.toString().substring(a ? 1 : 0);
1119
- const r = n - (i.length - 1);
1120
- r > 0 && (i = "0".repeat(r) + i);
1121
- const p = i.length - n;
1122
- let d = i.slice(-n);
1123
- return parseInt(d[t]) >= 5 ? d = `${d.substring(0, t - 1)}${(parseInt(d[t - 1]) + 1).toString()}` : d = d.substring(0, t), `${a ? "-" : ""}${i.slice(0, p)}.${d}`.replace(
1449
+ let s = e.toString().substring(a ? 1 : 0);
1450
+ const r = n - (s.length - 1);
1451
+ r > 0 && (s = "0".repeat(r) + s);
1452
+ const o = s.length - n;
1453
+ let p = s.slice(-n);
1454
+ 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(
1124
1455
  /\.?0*$/,
1125
1456
  ""
1126
1457
  );
1127
1458
  }
1128
- var L, $, ne, Ie, ae, me, Q, se, H, G, J, ie;
1129
- const mt = class j {
1459
+ var L, $, oe, $e, pe, ge, Z, de, H, G, ee, ue;
1460
+ const Gt = class Q {
1130
1461
  constructor(t) {
1131
- V(this, L), V(this, ne), V(this, ae), V(this, Q), V(this, H), V(this, J), C(this, "decimalMultiplier", 10n ** 8n), C(this, "bigIntValue", 0n), C(this, "decimal");
1132
- const n = pe(t);
1462
+ V(this, L), V(this, oe), V(this, pe), V(this, Z), V(this, H), V(this, ee), M(this, "decimalMultiplier", 10n ** 8n), M(this, "bigIntValue", 0n), M(this, "decimal");
1463
+ const n = ye(t);
1133
1464
  this.decimal = typeof t == "object" ? t.decimal : void 0, this.decimalMultiplier = U(
1134
- Math.max(g(this, J, ie).call(this, g(this, H, G).call(this, n)), this.decimal || 0)
1135
- ), g(this, ne, Ie).call(this, n);
1465
+ Math.max(O(this, ee, ue).call(this, O(this, H, G).call(this, n)), this.decimal || 0)
1466
+ ), O(this, oe, $e).call(this, n);
1136
1467
  }
1137
1468
  static fromBigInt(t, n) {
1138
- return new j({
1469
+ return new Q({
1139
1470
  decimal: n,
1140
- value: ge({ value: t, bigIntDecimal: n, decimal: n })
1471
+ value: He({ value: t, bigIntDecimal: n, decimal: n })
1141
1472
  });
1142
1473
  }
1143
1474
  static shiftDecimals({
@@ -1145,8 +1476,8 @@ const mt = class j {
1145
1476
  from: n,
1146
1477
  to: a
1147
1478
  }) {
1148
- return j.fromBigInt(
1149
- new j(t).bigIntValue * U(a) / U(n),
1479
+ return Q.fromBigInt(
1480
+ new Q(t).bigIntValue * U(a) / U(n),
1150
1481
  a
1151
1482
  );
1152
1483
  }
@@ -1172,16 +1503,16 @@ const mt = class j {
1172
1503
  return new this.constructor({ decimal: this.decimal, value: t, identifier: this.toString() });
1173
1504
  }
1174
1505
  add(...t) {
1175
- return g(this, L, $).call(this, "add", ...t);
1506
+ return O(this, L, $).call(this, "add", ...t);
1176
1507
  }
1177
1508
  sub(...t) {
1178
- return g(this, L, $).call(this, "sub", ...t);
1509
+ return O(this, L, $).call(this, "sub", ...t);
1179
1510
  }
1180
1511
  mul(...t) {
1181
- return g(this, L, $).call(this, "mul", ...t);
1512
+ return O(this, L, $).call(this, "mul", ...t);
1182
1513
  }
1183
1514
  div(...t) {
1184
- return g(this, L, $).call(this, "div", ...t);
1515
+ return O(this, L, $).call(this, "div", ...t);
1185
1516
  }
1186
1517
  gt(t) {
1187
1518
  return this.bigIntValue > this.getBigIntValue(t);
@@ -1226,109 +1557,119 @@ const mt = class j {
1226
1557
  getBigIntValue(t, n) {
1227
1558
  if (!n && typeof t == "object")
1228
1559
  return t.bigIntValue;
1229
- const a = pe(t), i = g(this, H, G).call(this, a);
1230
- return i === "0" || i === "undefined" ? 0n : g(this, Q, se).call(this, i, n);
1560
+ const a = ye(t), s = O(this, H, G).call(this, a);
1561
+ return s === "0" || s === "undefined" ? 0n : O(this, Z, de).call(this, s, n);
1231
1562
  }
1232
1563
  formatBigIntToSafeValue(t, n) {
1233
- const a = n || this.decimal || q, i = Math.max(
1564
+ const a = n || this.decimal || q, s = Math.max(
1234
1565
  a,
1235
1566
  F(this.decimalMultiplier)
1236
- ), r = t < 0n, p = t.toString().substring(r ? 1 : 0), d = i - (p.length - 1), y = d > 0 ? "0".repeat(d) + p : p, l = y.length - i;
1237
- let o = y.slice(-i);
1238
- return parseInt(o[a]) >= 5 ? o = `${o.substring(0, a - 1)}${(parseInt(o[a - 1]) + 1).toString()}` : o = o.substring(0, a), `${r ? "-" : ""}${y.slice(
1567
+ ), r = t < 0n, o = t.toString().substring(r ? 1 : 0), p = s - (o.length - 1), u = p > 0 ? "0".repeat(p) + o : o, y = u.length - s;
1568
+ let d = u.slice(-s);
1569
+ return parseInt(d[a]) >= 5 ? d = `${d.substring(0, a - 1)}${(parseInt(d[a - 1]) + 1).toString()}` : d = d.substring(0, a), `${r ? "-" : ""}${u.slice(
1239
1570
  0,
1240
- l
1241
- )}.${o}`.replace(/\.?0*$/, "");
1571
+ y
1572
+ )}.${d}`.replace(/\.?0*$/, "");
1242
1573
  }
1243
1574
  toSignificant(t = 6) {
1244
- const [n, a] = this.getValue("string").split("."), i = n || "", r = a || "", p = parseInt(i) ? i.length + r.length : r.length;
1245
- if (p <= t)
1575
+ const [n, a] = this.getValue("string").split("."), s = n || "", r = a || "", o = parseInt(s) ? s.length + r.length : r.length;
1576
+ if (o <= t)
1246
1577
  return this.getValue("string");
1247
- if (i.length >= t)
1248
- return i.slice(0, t).padEnd(i.length, "0");
1249
- if (parseInt(i))
1250
- return `${i}.${r.slice(0, t - i.length)}`.padEnd(
1251
- p - t,
1578
+ if (s.length >= t)
1579
+ return s.slice(0, t).padEnd(s.length, "0");
1580
+ if (parseInt(s))
1581
+ return `${s}.${r.slice(0, t - s.length)}`.padEnd(
1582
+ o - t,
1252
1583
  "0"
1253
1584
  );
1254
- const d = parseInt(r), y = `${d}`.slice(0, t);
1255
- return `0.${y.padStart(
1256
- r.length - `${d}`.length + y.length,
1585
+ const p = parseInt(r), u = `${p}`.slice(0, t);
1586
+ return `0.${u.padStart(
1587
+ r.length - `${p}`.length + u.length,
1588
+ "0"
1589
+ )}`;
1590
+ }
1591
+ toFixed(t = 6) {
1592
+ const [n, a] = this.getValue("string").split("."), s = n || "", r = a || "";
1593
+ if (parseInt(s))
1594
+ return `${s}.${r.slice(0, t)}`.padEnd(t, "0");
1595
+ const o = parseInt(r), p = `${o}`.slice(0, t);
1596
+ return `0.${p.padStart(
1597
+ r.length - `${o}`.length + p.length,
1257
1598
  "0"
1258
1599
  )}`;
1259
1600
  }
1260
1601
  };
1261
1602
  L = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
1262
- const n = g(this, ae, me).call(this, this, ...t), a = U(n), i = t.reduce(
1263
- (p, d) => {
1264
- const y = this.getBigIntValue(d, n);
1603
+ const n = O(this, pe, ge).call(this, this, ...t), a = U(n), s = t.reduce(
1604
+ (o, p) => {
1605
+ const u = this.getBigIntValue(p, n);
1265
1606
  switch (e) {
1266
1607
  case "add":
1267
- return p + y;
1608
+ return o + u;
1268
1609
  case "sub":
1269
- return p - y;
1610
+ return o - u;
1270
1611
  case "mul":
1271
- return p * y / a;
1612
+ return o * u / a;
1272
1613
  case "div": {
1273
- if (y === 0n)
1614
+ if (u === 0n)
1274
1615
  throw new RangeError("Division by zero");
1275
- return p * a / y;
1616
+ return o * a / u;
1276
1617
  }
1277
1618
  default:
1278
- return p;
1619
+ return o;
1279
1620
  }
1280
1621
  },
1281
1622
  //normalize is to precision multiplier base
1282
1623
  this.bigIntValue * a / this.decimalMultiplier
1283
- ), r = ge({
1624
+ ), r = He({
1284
1625
  bigIntDecimal: n,
1285
1626
  decimal: Math.max(n, F(this.decimalMultiplier)),
1286
- value: i
1627
+ value: s
1287
1628
  });
1288
1629
  return new this.constructor({ decimal: this.decimal, value: r, identifier: this.toString() });
1289
- }, ne = /* @__PURE__ */ new WeakSet(), Ie = function(e) {
1290
- const t = g(this, H, G).call(this, e) || "0";
1291
- this.bigIntValue = g(this, Q, se).call(this, t);
1292
- }, ae = /* @__PURE__ */ new WeakSet(), me = function(...e) {
1630
+ }, oe = /* @__PURE__ */ new WeakSet(), $e = function(e) {
1631
+ const t = O(this, H, G).call(this, e) || "0";
1632
+ this.bigIntValue = O(this, Z, de).call(this, t);
1633
+ }, pe = /* @__PURE__ */ new WeakSet(), ge = function(...e) {
1293
1634
  const t = e.map(
1294
- (n) => typeof n == "object" ? n.decimal || F(n.decimalMultiplier) : g(this, J, ie).call(this, g(this, H, G).call(this, n))
1635
+ (n) => typeof n == "object" ? n.decimal || F(n.decimalMultiplier) : O(this, ee, ue).call(this, O(this, H, G).call(this, n))
1295
1636
  ).filter(Boolean);
1296
1637
  return Math.max(...t, q);
1297
- }, Q = /* @__PURE__ */ new WeakSet(), se = function(e, t) {
1298
- const n = t ? U(t) : this.decimalMultiplier, a = F(n), [i = "", r = ""] = e.split(".");
1299
- return BigInt(`${i}${r.padEnd(a, "0")}`);
1638
+ }, Z = /* @__PURE__ */ new WeakSet(), de = function(e, t) {
1639
+ const n = t ? U(t) : this.decimalMultiplier, a = F(n), [s = "", r = ""] = e.split(".");
1640
+ return BigInt(`${s}${r.padEnd(a, "0")}`);
1300
1641
  }, H = /* @__PURE__ */ new WeakSet(), G = function(e) {
1301
1642
  const t = `${typeof e == "number" ? Number(e).toLocaleString("fullwide", {
1302
1643
  useGrouping: !1,
1303
1644
  maximumFractionDigits: 20
1304
- }) : pe(e)}`.replaceAll(",", ".").split(".");
1645
+ }) : ye(e)}`.replaceAll(",", ".").split(".");
1305
1646
  return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
1306
- }, J = /* @__PURE__ */ new WeakSet(), ie = function(e) {
1647
+ }, ee = /* @__PURE__ */ new WeakSet(), ue = function(e) {
1307
1648
  var t;
1308
1649
  const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
1309
1650
  return Math.max(n, q);
1310
1651
  };
1311
- let re = mt;
1312
- function pe(e) {
1652
+ let le = Gt;
1653
+ function ye(e) {
1313
1654
  return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
1314
1655
  }
1315
- let oe;
1316
- const te = (e) => {
1317
- if (!oe)
1656
+ let ce;
1657
+ const ie = (e) => {
1658
+ if (!ce)
1318
1659
  throw new Error("Static assets not loaded, call await AssetValue.loadStaticAssets() first");
1319
- return oe.get(e.toUpperCase()) || { decimal: b.THOR, identifier: "" };
1320
- }, Te = async (e, t = 0) => {
1321
- ct(e);
1322
- const n = await Oe(de(e));
1660
+ return ce.get(e.toUpperCase()) || { decimal: b.THOR, identifier: "" };
1661
+ }, Oe = async (e, t = 0) => {
1662
+ Ft(e);
1663
+ const n = await De(me(e));
1323
1664
  return new v({ decimal: n, value: t, identifier: e });
1324
1665
  };
1325
- class v extends re {
1666
+ class v extends le {
1326
1667
  constructor(t) {
1327
1668
  super(
1328
- t.value instanceof re ? t.value : { decimal: t.decimal, value: t.value }
1329
- ), C(this, "address"), C(this, "chain"), C(this, "isSynthetic", !1), C(this, "isGasAsset", !1), C(this, "symbol"), C(this, "ticker"), C(this, "type");
1330
- const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a = de(n);
1331
- this.type = pt(a), this.chain = a.chain, this.ticker = a.ticker, this.symbol = a.symbol, this.address = a.address, this.isSynthetic = a.isSynthetic, this.isGasAsset = a.isGasAsset;
1669
+ t.value instanceof le ? t.value : { decimal: t.decimal, value: t.value }
1670
+ ), M(this, "address"), M(this, "chain"), M(this, "isSynthetic", !1), M(this, "isGasAsset", !1), M(this, "symbol"), M(this, "ticker"), M(this, "type");
1671
+ const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a = me(n);
1672
+ this.type = wt(a), this.chain = a.chain, this.ticker = a.ticker, this.symbol = a.symbol, this.address = a.address, this.isSynthetic = a.isSynthetic, this.isGasAsset = a.isGasAsset;
1332
1673
  }
1333
1674
  get assetValue() {
1334
1675
  return `${this.getValue("string")} ${this.ticker}`;
@@ -1344,36 +1685,36 @@ class v extends re {
1344
1685
  return this.chain === t && this.symbol === n;
1345
1686
  }
1346
1687
  static async fromString(t, n = 0) {
1347
- return Te(t, n);
1688
+ return Oe(t, n);
1348
1689
  }
1349
1690
  static fromStringSync(t, n = 0) {
1350
- const { decimal: a, identifier: i } = te(
1691
+ const { decimal: a, identifier: s } = ie(
1351
1692
  t
1352
1693
  );
1353
- return i ? new v({ decimal: a, identifier: i, value: n }) : void 0;
1694
+ return s ? new v({ decimal: a, identifier: s, value: n }) : void 0;
1354
1695
  }
1355
1696
  static async fromIdentifier(t, n = 0) {
1356
- return Te(t, n);
1697
+ return Oe(t, n);
1357
1698
  }
1358
1699
  static fromIdentifierSync(t, n = 0) {
1359
- const { decimal: a, identifier: i } = te(t);
1360
- return new v({ decimal: a, identifier: i, value: n });
1700
+ const { decimal: a, identifier: s } = ie(t);
1701
+ return new v({ decimal: a, identifier: s, value: n });
1361
1702
  }
1362
1703
  static fromChainOrSignature(t, n = 0) {
1363
- const { decimal: a, identifier: i } = rt(t);
1364
- return new v({ value: n, decimal: a, identifier: i });
1704
+ const { decimal: a, identifier: s } = bt(t);
1705
+ return new v({ value: n, decimal: a, identifier: s });
1365
1706
  }
1366
1707
  static async fromTCQuote(t, n = 0) {
1367
- const a = await Oe(de(t)), i = this.shiftDecimals({ value: n, from: b.THOR, to: a });
1368
- return new v({ value: i, identifier: t, decimal: a });
1708
+ const a = await De(me(t)), s = this.shiftDecimals({ value: n, from: b.THOR, to: a });
1709
+ return new v({ value: s, identifier: t, decimal: a });
1369
1710
  }
1370
1711
  static fromTCQuoteStatic(t, n = 0) {
1371
- const a = te(t), i = this.shiftDecimals({
1712
+ const a = ie(t), s = this.shiftDecimals({
1372
1713
  value: n,
1373
1714
  from: b.THOR,
1374
1715
  to: a.decimal
1375
1716
  });
1376
- return new v({ ...a, value: i });
1717
+ return new v({ ...a, value: s });
1377
1718
  }
1378
1719
  static async loadStaticAssets() {
1379
1720
  return new Promise(
@@ -1383,14 +1724,14 @@ class v extends re {
1383
1724
  // Omit ThorchainList from import to avoid decimals conflict (TC uses 8 for all)
1384
1725
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1385
1726
  ThorchainList: a,
1386
- NativeList: i,
1727
+ NativeList: s,
1387
1728
  ...r
1388
1729
  } = await import("@swapkit/tokens");
1389
- oe = [i, ...Object.values(r)].reduce(
1390
- (p, { tokens: d }) => (d.forEach(({ identifier: y, chain: l, ...o }) => {
1391
- const c = "decimals" in o ? o.decimals : b[l];
1392
- p.set(y, { identifier: y, decimal: c });
1393
- }), p),
1730
+ ce = [s, ...Object.values(r)].reduce(
1731
+ (o, { tokens: p }) => (p.forEach(({ identifier: u, chain: y, ...d }) => {
1732
+ const c = "decimals" in d ? d.decimals : b[y];
1733
+ o.set(u, { identifier: u, decimal: c });
1734
+ }), o),
1394
1735
  /* @__PURE__ */ new Map()
1395
1736
  ), t({ ok: !0 });
1396
1737
  } catch (a) {
@@ -1404,35 +1745,35 @@ class v extends re {
1404
1745
  );
1405
1746
  }
1406
1747
  }
1407
- const _e = (e) => {
1748
+ const Ie = (e) => {
1408
1749
  const t = v.fromChainOrSignature(e);
1409
1750
  switch (e) {
1410
- case s.Bitcoin:
1411
- case s.Litecoin:
1412
- case s.BitcoinCash:
1751
+ case i.Bitcoin:
1752
+ case i.Litecoin:
1753
+ case i.BitcoinCash:
1413
1754
  return t.add(10001);
1414
- case s.Dogecoin:
1755
+ case i.Dogecoin:
1415
1756
  return t.add(100000001);
1416
- case s.Avalanche:
1417
- case s.Ethereum:
1757
+ case i.Avalanche:
1758
+ case i.Ethereum:
1418
1759
  return t.add(10 * 10 ** 9);
1419
- case s.THORChain:
1420
- case s.Maya:
1760
+ case i.THORChain:
1761
+ case i.Maya:
1421
1762
  return t.add(0);
1422
1763
  default:
1423
1764
  return t.add(1);
1424
1765
  }
1425
- }, de = (e) => {
1426
- const t = e.slice(0, 14).includes("/"), n = e.includes(".") ? e : `${s.THORChain}.${e}`, [a, i] = n.split("."), [r, p] = i.split("-");
1766
+ }, me = (e) => {
1767
+ const t = e.slice(0, 14).includes("/"), n = e.includes(".") ? e : `${i.THORChain}.${e}`, [a, s] = n.split("."), [r, o] = s.split("-");
1427
1768
  return {
1428
- address: p == null ? void 0 : p.toLowerCase(),
1769
+ address: o == null ? void 0 : o.toLowerCase(),
1429
1770
  chain: a,
1430
- isGasAsset: it({ chain: a, symbol: i }),
1771
+ isGasAsset: ft({ chain: a, symbol: s }),
1431
1772
  isSynthetic: t,
1432
- symbol: p ? `${r}-${(p == null ? void 0 : p.toLowerCase()) ?? ""}` : i,
1433
- ticker: t ? i : r
1773
+ symbol: o ? `${r}-${(o == null ? void 0 : o.toLowerCase()) ?? ""}` : s,
1774
+ ticker: t ? s : r
1434
1775
  };
1435
- }, Tt = {
1776
+ }, Wt = {
1436
1777
  /**
1437
1778
  * Core
1438
1779
  */
@@ -1491,15 +1832,15 @@ const _e = (e) => {
1491
1832
  };
1492
1833
  class m extends Error {
1493
1834
  constructor(t, n) {
1494
- console.error(n), super(t, { cause: { code: Tt[t], message: t } }), Object.setPrototypeOf(this, m.prototype);
1835
+ console.error(n), super(t, { cause: { code: Wt[t], message: t } }), Object.setPrototypeOf(this, m.prototype);
1495
1836
  }
1496
1837
  }
1497
- class ue extends re {
1838
+ class Te extends le {
1498
1839
  eq(t) {
1499
1840
  return this.eqValue(t);
1500
1841
  }
1501
1842
  }
1502
- const _t = [
1843
+ const qt = [
1503
1844
  {
1504
1845
  inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
1505
1846
  stateMutability: "nonpayable",
@@ -1590,7 +1931,7 @@ const _t = [
1590
1931
  type: "function"
1591
1932
  },
1592
1933
  { stateMutability: "payable", type: "receive" }
1593
- ], ht = [
1934
+ ], jt = [
1594
1935
  {
1595
1936
  inputs: [
1596
1937
  { internalType: "address", name: "_ttp", type: "address" },
@@ -1734,7 +2075,7 @@ const _t = [
1734
2075
  type: "function"
1735
2076
  },
1736
2077
  { stateMutability: "payable", type: "receive" }
1737
- ], ft = [
2078
+ ], Yt = [
1738
2079
  {
1739
2080
  inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
1740
2081
  stateMutability: "nonpayable",
@@ -1839,7 +2180,7 @@ const _t = [
1839
2180
  type: "function"
1840
2181
  },
1841
2182
  { stateMutability: "payable", type: "receive" }
1842
- ], bt = [
2183
+ ], Kt = [
1843
2184
  {
1844
2185
  inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
1845
2186
  stateMutability: "nonpayable",
@@ -1930,7 +2271,7 @@ const _t = [
1930
2271
  type: "function"
1931
2272
  },
1932
2273
  { stateMutability: "payable", type: "receive" }
1933
- ], At = [
2274
+ ], Xt = [
1934
2275
  {
1935
2276
  inputs: [
1936
2277
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2074,7 +2415,7 @@ const _t = [
2074
2415
  type: "function"
2075
2416
  },
2076
2417
  { stateMutability: "payable", type: "receive" }
2077
- ], wt = [
2418
+ ], Jt = [
2078
2419
  {
2079
2420
  inputs: [
2080
2421
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2193,7 +2534,7 @@ const _t = [
2193
2534
  type: "function"
2194
2535
  },
2195
2536
  { stateMutability: "payable", type: "receive" }
2196
- ], Et = [
2537
+ ], Qt = [
2197
2538
  {
2198
2539
  inputs: [
2199
2540
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2312,7 +2653,7 @@ const _t = [
2312
2653
  type: "function"
2313
2654
  },
2314
2655
  { stateMutability: "payable", type: "receive" }
2315
- ], Rt = [
2656
+ ], zt = [
2316
2657
  {
2317
2658
  inputs: [
2318
2659
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2431,7 +2772,7 @@ const _t = [
2431
2772
  type: "function"
2432
2773
  },
2433
2774
  { stateMutability: "payable", type: "receive" }
2434
- ], Ot = [
2775
+ ], Zt = [
2435
2776
  {
2436
2777
  inputs: [
2437
2778
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2550,7 +2891,7 @@ const _t = [
2550
2891
  type: "function"
2551
2892
  },
2552
2893
  { stateMutability: "payable", type: "receive" }
2553
- ], gt = [
2894
+ ], en = [
2554
2895
  {
2555
2896
  inputs: [
2556
2897
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2677,7 +3018,7 @@ const _t = [
2677
3018
  type: "function"
2678
3019
  },
2679
3020
  { stateMutability: "payable", type: "receive" }
2680
- ], It = [
3021
+ ], tn = [
2681
3022
  {
2682
3023
  inputs: [
2683
3024
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2804,7 +3145,7 @@ const _t = [
2804
3145
  type: "function"
2805
3146
  },
2806
3147
  { stateMutability: "payable", type: "receive" }
2807
- ], St = [
3148
+ ], nn = [
2808
3149
  {
2809
3150
  inputs: [
2810
3151
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2931,7 +3272,7 @@ const _t = [
2931
3272
  type: "function"
2932
3273
  },
2933
3274
  { stateMutability: "payable", type: "receive" }
2934
- ], vt = [
3275
+ ], an = [
2935
3276
  {
2936
3277
  inputs: [
2937
3278
  { internalType: "address", name: "_ttp", type: "address" },
@@ -3058,7 +3399,7 @@ const _t = [
3058
3399
  type: "function"
3059
3400
  },
3060
3401
  { stateMutability: "payable", type: "receive" }
3061
- ], Mt = [
3402
+ ], sn = [
3062
3403
  {
3063
3404
  inputs: [
3064
3405
  { internalType: "address", name: "_ttp", type: "address" },
@@ -3185,239 +3526,239 @@ const _t = [
3185
3526
  type: "function"
3186
3527
  },
3187
3528
  { stateMutability: "payable", type: "receive" }
3188
- ], Se = {
3189
- ["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: _t,
3190
- ["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: ft,
3191
- ["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: bt
3192
- }, Ct = {
3193
- ...Se,
3529
+ ], ke = {
3530
+ ["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: qt,
3531
+ ["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: Yt,
3532
+ ["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: Kt
3533
+ }, rn = {
3534
+ ...ke,
3194
3535
  // AVAX
3195
- ["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: wt,
3196
- ["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: ht,
3197
- ["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: Rt,
3536
+ ["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: Jt,
3537
+ ["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: jt,
3538
+ ["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: zt,
3198
3539
  // BSC
3199
- ["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: At,
3540
+ ["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: Xt,
3200
3541
  // ETH
3201
- ["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: Et,
3202
- ["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: Ot,
3203
- ["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: gt,
3204
- ["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: It,
3205
- ["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: St,
3206
- ["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: vt,
3207
- ["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: Mt
3208
- }, Nt = ({
3542
+ ["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: Qt,
3543
+ ["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: Zt,
3544
+ ["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: en,
3545
+ ["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: tn,
3546
+ ["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: nn,
3547
+ ["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: an,
3548
+ ["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: sn
3549
+ }, on = ({
3209
3550
  streamSwap: e,
3210
3551
  contractAddress: t,
3211
3552
  recipient: n,
3212
3553
  toChecksumAddress: a,
3213
3554
  calldata: {
3214
- amount: i,
3555
+ amount: s,
3215
3556
  amountOutMin: r = "",
3216
- data: p = "",
3217
- deadline: d,
3218
- memo: y,
3219
- router: l,
3220
- memoStreamingSwap: o,
3557
+ data: o = "",
3558
+ deadline: p,
3559
+ memo: u,
3560
+ router: y,
3561
+ memoStreamingSwap: d,
3221
3562
  tcMemo: c,
3222
- tcRouter: h,
3223
- tcVault: w,
3563
+ tcRouter: _,
3564
+ tcVault: A,
3224
3565
  vault: R,
3225
- token: O
3566
+ token: g
3226
3567
  }
3227
3568
  }) => {
3228
- const E = !!Se[t.toLowerCase()];
3229
- if (E && !l)
3569
+ const E = !!ke[t.toLowerCase()];
3570
+ if (E && !y)
3230
3571
  throw new Error("Router is required on calldata for swapIn with GenericContract");
3231
- const I = c || y, S = e && o || I;
3232
- if (!w && !R)
3572
+ const I = c || u, S = e && d || I;
3573
+ if (!A && !R)
3233
3574
  throw new Error("TC Vault is required on calldata");
3234
- if (!h && !l)
3575
+ if (!_ && !y)
3235
3576
  throw new Error("TC Router is required on calldata");
3236
3577
  if (!S)
3237
3578
  throw new Error("TC Memo is required on calldata");
3238
- if (!O)
3579
+ if (!g)
3239
3580
  throw new Error("Token is required on calldata");
3240
3581
  const D = [
3241
3582
  // v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
3242
- a(h || l),
3243
- a(w || R),
3583
+ a(_ || y),
3584
+ a(A || R),
3244
3585
  S.replace("{recipientAddress}", n),
3245
- a(O),
3246
- i
3247
- ], ve = E ? [a(l), p, d] : [r, d];
3248
- return [...D, ...ve];
3249
- }, xt = ({ chain: e, txHash: t }) => {
3250
- const n = we[e];
3586
+ a(g),
3587
+ s
3588
+ ], Fe = E ? [a(y), o, p] : [r, p];
3589
+ return [...D, ...Fe];
3590
+ }, pn = ({ chain: e, txHash: t }) => {
3591
+ const n = Ne[e];
3251
3592
  switch (e) {
3252
- case s.Binance:
3253
- case s.Bitcoin:
3254
- case s.BitcoinCash:
3255
- case s.Maya:
3256
- case s.Kujira:
3257
- case s.THORChain:
3593
+ case i.Binance:
3594
+ case i.Bitcoin:
3595
+ case i.BitcoinCash:
3596
+ case i.Maya:
3597
+ case i.Kujira:
3598
+ case i.THORChain:
3258
3599
  return `${n}/tx/${t}`;
3259
- case s.Arbitrum:
3260
- case s.Avalanche:
3261
- case s.BinanceSmartChain:
3262
- case s.Ethereum:
3263
- case s.Optimism:
3264
- case s.Polygon:
3600
+ case i.Arbitrum:
3601
+ case i.Avalanche:
3602
+ case i.BinanceSmartChain:
3603
+ case i.Ethereum:
3604
+ case i.Optimism:
3605
+ case i.Polygon:
3265
3606
  return `${n}/tx/${t.startsWith("0x") ? t : `0x${t}`}`;
3266
- case s.Cosmos:
3607
+ case i.Cosmos:
3267
3608
  return `${n}/transactions/${t}`;
3268
- case s.Dogecoin:
3609
+ case i.Dogecoin:
3269
3610
  return `${n}/transaction/${t.toLowerCase()}`;
3270
- case s.Litecoin:
3611
+ case i.Litecoin:
3271
3612
  return `${n}/${t}`;
3272
3613
  default:
3273
3614
  throw new Error(`Unsupported chain: ${e}`);
3274
3615
  }
3275
- }, Dt = ({ chain: e, address: t }) => {
3276
- const n = we[e];
3616
+ }, dn = ({ chain: e, address: t }) => {
3617
+ const n = Ne[e];
3277
3618
  switch (e) {
3278
- case s.Arbitrum:
3279
- case s.Avalanche:
3280
- case s.Binance:
3281
- case s.BinanceSmartChain:
3282
- case s.Bitcoin:
3283
- case s.BitcoinCash:
3284
- case s.Dogecoin:
3285
- case s.Ethereum:
3286
- case s.Maya:
3287
- case s.Optimism:
3288
- case s.Polygon:
3289
- case s.Kujira:
3290
- case s.THORChain:
3619
+ case i.Arbitrum:
3620
+ case i.Avalanche:
3621
+ case i.Binance:
3622
+ case i.BinanceSmartChain:
3623
+ case i.Bitcoin:
3624
+ case i.BitcoinCash:
3625
+ case i.Dogecoin:
3626
+ case i.Ethereum:
3627
+ case i.Maya:
3628
+ case i.Optimism:
3629
+ case i.Polygon:
3630
+ case i.Kujira:
3631
+ case i.THORChain:
3291
3632
  return `${n}/address/${t}`;
3292
- case s.Cosmos:
3633
+ case i.Cosmos:
3293
3634
  return `${n}/account/${t}`;
3294
- case s.Litecoin:
3635
+ case i.Litecoin:
3295
3636
  return `${n}/${t}`;
3296
3637
  default:
3297
3638
  throw new Error(`Unsupported chain: ${e}`);
3298
3639
  }
3299
- }, Bt = (e) => {
3640
+ }, un = (e) => {
3300
3641
  const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
3301
- return Ee(`${t}/thorchain/inbound_addresses`);
3302
- }, Pt = (e) => {
3642
+ return be.get(`${t}/thorchain/inbound_addresses`);
3643
+ }, ln = (e) => {
3303
3644
  const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
3304
- return Ee(`${t}/thorchain/mimir`);
3305
- }, he = () => Object.values(s).reduce(
3645
+ return be.get(`${t}/thorchain/mimir`);
3646
+ }, Se = () => Object.values(i).reduce(
3306
3647
  (e, t) => (e[t] = null, e),
3307
3648
  {}
3308
3649
  );
3309
- var P, z, K, N, Y, X;
3310
- class en {
3650
+ var B, te, j, N, Y, K;
3651
+ class Nn {
3311
3652
  constructor({ stagenet: t } = {}) {
3312
- T(this, "connectedChains", he());
3313
- T(this, "connectedWallets", he());
3653
+ T(this, "connectedChains", Se());
3654
+ T(this, "connectedWallets", Se());
3314
3655
  T(this, "stagenet", !1);
3315
3656
  T(this, "getAddress", (t) => {
3316
3657
  var n;
3317
3658
  return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
3318
3659
  });
3319
- T(this, "getExplorerTxUrl", (t, n) => xt({ chain: t, txHash: n }));
3660
+ T(this, "getExplorerTxUrl", (t, n) => pn({ chain: t, txHash: n }));
3320
3661
  T(this, "getWallet", (t) => this.connectedWallets[t]);
3321
- T(this, "getExplorerAddressUrl", (t, n) => Dt({ chain: t, address: n }));
3662
+ T(this, "getExplorerAddressUrl", (t, n) => dn({ chain: t, address: n }));
3322
3663
  T(this, "getBalance", async (t, n) => {
3323
3664
  const a = await this.getWalletByChain(t, n);
3324
3665
  return (a == null ? void 0 : a.balance) || [];
3325
3666
  });
3326
- T(this, "swap", async ({ streamSwap: t, recipient: n, route: a, feeOptionKey: i }) => {
3327
- var d, y;
3328
- const { quoteMode: r } = a.meta, p = r.startsWith("ERC20-") ? s.Ethereum : r.startsWith("ARC20-") ? s.Avalanche : s.BinanceSmartChain;
3667
+ T(this, "swap", async ({ streamSwap: t, recipient: n, route: a, feeOptionKey: s }) => {
3668
+ var p, u;
3669
+ const { quoteMode: r } = a.meta, o = r.startsWith("ERC20-") ? i.Ethereum : r.startsWith("ARC20-") ? i.Avalanche : i.BinanceSmartChain;
3329
3670
  if (!a.complete)
3330
3671
  throw new m("core_swap_route_not_complete");
3331
3672
  try {
3332
- if (Ue.includes(r)) {
3333
- const l = this.connectedWallets[p];
3334
- if (!(l != null && l.sendTransaction))
3673
+ if (ze.includes(r)) {
3674
+ const y = this.connectedWallets[o];
3675
+ if (!(y != null && y.sendTransaction))
3335
3676
  throw new m("core_wallet_connection_not_found");
3336
- if (!(t ? (d = a == null ? void 0 : a.streamingSwap) == null ? void 0 : d.transaction : a == null ? void 0 : a.transaction))
3677
+ if (!(t ? (p = a == null ? void 0 : a.streamingSwap) == null ? void 0 : p.transaction : a == null ? void 0 : a.transaction))
3337
3678
  throw new m("core_swap_route_transaction_not_found");
3338
- const { isHexString: c, parseUnits: h } = await import("./index-cf1865cd.js"), { data: w, from: R, to: O, value: E } = a.transaction, I = {
3339
- data: w,
3679
+ const { isHexString: c, parseUnits: _ } = await import("./index-cf1865cd.js"), { data: A, from: R, to: g, value: E } = a.transaction, I = {
3680
+ data: A,
3340
3681
  from: R,
3341
- to: O.toLowerCase(),
3342
- chainId: BigInt(Ke[p]),
3343
- value: E ? new ue({
3344
- value: c(E) ? E : h(E, "wei").toString(16)
3682
+ to: g.toLowerCase(),
3683
+ chainId: BigInt(rt[o]),
3684
+ value: E ? new Te({
3685
+ value: c(E) ? E : _(E, "wei").toString(16)
3345
3686
  }).baseValueBigInt : 0n
3346
3687
  };
3347
- return l.sendTransaction(I, i);
3688
+ return y.sendTransaction(I, s);
3348
3689
  }
3349
- if ($e.includes(r)) {
3690
+ if (et.includes(r)) {
3350
3691
  if (!a.calldata.fromAsset)
3351
3692
  throw new m("core_swap_asset_not_recognized");
3352
- const l = await v.fromString(a.calldata.fromAsset);
3353
- if (!l)
3693
+ const y = await v.fromString(a.calldata.fromAsset);
3694
+ if (!y)
3354
3695
  throw new m("core_swap_asset_not_recognized");
3355
- const { address: o } = await f(this, P).call(this, l.chain), {
3696
+ const { address: d } = await f(this, B).call(this, y.chain), {
3356
3697
  contract: c,
3357
- calldata: { expiration: h, amountIn: w, memo: R, memoStreamingSwap: O }
3358
- } = a, E = l.add(ue.fromBigInt(BigInt(w), l.decimal)), I = t && O || R;
3698
+ calldata: { expiration: _, amountIn: A, memo: R, memoStreamingSwap: g }
3699
+ } = a, E = y.add(Te.fromBigInt(BigInt(A), y.decimal)), I = t && g || R;
3359
3700
  return this.deposit({
3360
- expiration: h,
3701
+ expiration: _,
3361
3702
  assetValue: E,
3362
3703
  memo: I,
3363
- feeOptionKey: i,
3704
+ feeOptionKey: s,
3364
3705
  router: c,
3365
- recipient: o
3706
+ recipient: d
3366
3707
  });
3367
3708
  }
3368
- if (He.includes(r)) {
3369
- const { calldata: l, contract: o } = a;
3370
- if (!o)
3709
+ if (Ze.includes(r)) {
3710
+ const { calldata: y, contract: d } = a;
3711
+ if (!d)
3371
3712
  throw new m("core_swap_contract_not_found");
3372
- const c = this.connectedWallets[p], h = this.getAddress(p);
3373
- if (!(c != null && c.sendTransaction) || !h)
3713
+ const c = this.connectedWallets[o], _ = this.getAddress(o);
3714
+ if (!(c != null && c.sendTransaction) || !_)
3374
3715
  throw new m("core_wallet_connection_not_found");
3375
- const { getProvider: w, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), O = w(p), E = Ct[o.toLowerCase()];
3716
+ const { getProvider: A, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), g = A(o), E = rn[d.toLowerCase()];
3376
3717
  if (!E)
3377
- throw new m("core_swap_contract_not_supported", { contractAddress: o });
3378
- const S = await (await ((y = c.createContract) == null ? void 0 : y.call(c, o, E, O))).getFunction("swapIn").populateTransaction(
3379
- ...Nt({
3718
+ throw new m("core_swap_contract_not_supported", { contractAddress: d });
3719
+ const S = await (await ((u = c.createContract) == null ? void 0 : u.call(c, d, E, g))).getFunction("swapIn").populateTransaction(
3720
+ ...on({
3380
3721
  streamSwap: t,
3381
3722
  toChecksumAddress: R,
3382
- contractAddress: o,
3723
+ contractAddress: d,
3383
3724
  recipient: n,
3384
- calldata: l
3725
+ calldata: y
3385
3726
  }),
3386
- { from: h }
3727
+ { from: _ }
3387
3728
  );
3388
- return c.sendTransaction(S, i);
3729
+ return c.sendTransaction(S, s);
3389
3730
  }
3390
3731
  throw new m("core_swap_quote_mode_not_supported", { quoteMode: r });
3391
- } catch (l) {
3392
- throw new m("core_swap_transaction_error", l);
3732
+ } catch (y) {
3733
+ throw new m("core_swap_transaction_error", y);
3393
3734
  }
3394
3735
  });
3395
3736
  T(this, "getWalletByChain", async (t, n) => {
3396
- var r, p;
3737
+ var r, o;
3397
3738
  const a = this.getAddress(t);
3398
3739
  if (!a)
3399
3740
  return null;
3400
- const i = await ((r = this.getWallet(t)) == null ? void 0 : r.getBalance(a, n)) ?? [
3741
+ const s = await ((r = this.getWallet(t)) == null ? void 0 : r.getBalance(a, n)) ?? [
3401
3742
  v.fromChainOrSignature(t)
3402
3743
  ];
3403
3744
  return this.connectedChains[t] = {
3404
3745
  address: a,
3405
- balance: i,
3406
- walletType: (p = this.connectedChains[t]) == null ? void 0 : p.walletType
3746
+ balance: s,
3747
+ walletType: (o = this.connectedChains[t]) == null ? void 0 : o.walletType
3407
3748
  }, { ...this.connectedChains[t] };
3408
3749
  });
3409
- T(this, "approveAssetValue", (t, n) => f(this, K).call(this, { assetValue: t, type: "approve", contractAddress: n }));
3410
- T(this, "isAssetValueApproved", (t, n) => f(this, K).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
3750
+ T(this, "approveAssetValue", (t, n) => f(this, j).call(this, { assetValue: t, type: "approve", contractAddress: n }));
3751
+ T(this, "isAssetValueApproved", (t, n) => f(this, j).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
3411
3752
  T(this, "validateAddress", ({ address: t, chain: n }) => {
3412
- var a, i;
3413
- return (i = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : i.call(a, t);
3753
+ var a, s;
3754
+ return (s = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : s.call(a, t);
3414
3755
  });
3415
3756
  T(this, "transfer", async (t) => {
3416
3757
  const n = this.connectedWallets[t.assetValue.chain];
3417
3758
  if (!n)
3418
3759
  throw new m("core_wallet_connection_not_found");
3419
3760
  try {
3420
- return await n.transfer(f(this, X).call(this, t));
3761
+ return await n.transfer(f(this, K).call(this, t));
3421
3762
  } catch (a) {
3422
3763
  throw new m("core_swap_transaction_error", a);
3423
3764
  }
@@ -3426,46 +3767,46 @@ class en {
3426
3767
  assetValue: t,
3427
3768
  recipient: n,
3428
3769
  router: a,
3429
- ...i
3770
+ ...s
3430
3771
  }) => {
3431
- const { chain: r, symbol: p, ticker: d } = t, y = this.connectedWallets[r];
3432
- if (!y)
3772
+ const { chain: r, symbol: o, ticker: p } = t, u = this.connectedWallets[r];
3773
+ if (!u)
3433
3774
  throw new m("core_wallet_connection_not_found");
3434
- const l = f(this, X).call(this, { assetValue: t, recipient: n, router: a, ...i });
3775
+ const y = f(this, K).call(this, { assetValue: t, recipient: n, router: a, ...s });
3435
3776
  try {
3436
3777
  switch (r) {
3437
- case s.THORChain: {
3438
- const o = y;
3439
- return await (n === "" ? o.deposit(l) : o.transfer(l));
3778
+ case i.THORChain: {
3779
+ const d = u;
3780
+ return await (n === "" ? d.deposit(y) : d.transfer(y));
3440
3781
  }
3441
- case s.Ethereum:
3442
- case s.BinanceSmartChain:
3443
- case s.Avalanche: {
3444
- const { getChecksumAddressFromAsset: o } = await import("@swapkit/toolbox-evm"), c = r === s.Avalanche ? Pe : r === s.BinanceSmartChain ? Ve : Be;
3445
- return await y.call({
3782
+ case i.Ethereum:
3783
+ case i.BinanceSmartChain:
3784
+ case i.Avalanche: {
3785
+ const { getChecksumAddressFromAsset: d } = await import("@swapkit/toolbox-evm"), c = r === i.Avalanche ? Xe : r === i.BinanceSmartChain ? Je : Ke;
3786
+ return await u.call({
3446
3787
  abi: c,
3447
- contractAddress: a || (await f(this, P).call(this, r)).router,
3788
+ contractAddress: a || (await f(this, B).call(this, r)).router,
3448
3789
  funcName: "depositWithExpiry",
3449
3790
  funcParams: [
3450
3791
  n,
3451
- o({ chain: r, symbol: p, ticker: d }, r),
3792
+ d({ chain: r, symbol: o, ticker: p }, r),
3452
3793
  // TODO: (@Towan) Re-Check on that conversion 🙏
3453
3794
  t.getBaseValue("bigint").toString(),
3454
- l.memo,
3455
- i.expiration
3795
+ y.memo,
3796
+ s.expiration
3456
3797
  ],
3457
3798
  txOverrides: {
3458
- from: l.from,
3799
+ from: y.from,
3459
3800
  value: t.isGasAsset ? t.getBaseValue("bigint") : void 0
3460
3801
  }
3461
3802
  });
3462
3803
  }
3463
3804
  default:
3464
- return await y.transfer(l);
3805
+ return await u.transfer(y);
3465
3806
  }
3466
- } catch (o) {
3467
- const c = ((o == null ? void 0 : o.message) || (o == null ? void 0 : o.toString())).toLowerCase(), h = c == null ? void 0 : c.includes("insufficient funds"), w = c == null ? void 0 : c.includes("gas"), R = c == null ? void 0 : c.includes("server"), O = h ? "core_transaction_deposit_insufficient_funds_error" : w ? "core_transaction_deposit_gas_error" : R ? "core_transaction_deposit_server_error" : "core_transaction_deposit_error";
3468
- throw new m(O, o);
3807
+ } catch (d) {
3808
+ const c = ((d == null ? void 0 : d.message) || (d == null ? void 0 : d.toString())).toLowerCase(), _ = c == null ? void 0 : c.includes("insufficient funds"), A = c == null ? void 0 : c.includes("gas"), R = c == null ? void 0 : c.includes("server"), g = _ ? "core_transaction_deposit_insufficient_funds_error" : A ? "core_transaction_deposit_gas_error" : R ? "core_transaction_deposit_server_error" : "core_transaction_deposit_error";
3809
+ throw new m(g, d);
3469
3810
  }
3470
3811
  });
3471
3812
  /**
@@ -3477,11 +3818,11 @@ class en {
3477
3818
  }) => {
3478
3819
  if (t.lte(0) || n.lte(0))
3479
3820
  throw new m("core_transaction_create_liquidity_invalid_params");
3480
- let a = "", i = "";
3821
+ let a = "", s = "";
3481
3822
  try {
3482
3823
  a = await f(this, N).call(this, {
3483
3824
  assetValue: t,
3484
- memo: x(_.DEPOSIT, {
3825
+ memo: x(h.DEPOSIT, {
3485
3826
  ...n,
3486
3827
  address: this.getAddress(n.chain)
3487
3828
  })
@@ -3490,48 +3831,48 @@ class en {
3490
3831
  throw new m("core_transaction_create_liquidity_rune_error", r);
3491
3832
  }
3492
3833
  try {
3493
- i = await f(this, N).call(this, {
3834
+ s = await f(this, N).call(this, {
3494
3835
  assetValue: n,
3495
- memo: x(_.DEPOSIT, {
3836
+ memo: x(h.DEPOSIT, {
3496
3837
  ...n,
3497
- address: this.getAddress(s.THORChain)
3838
+ address: this.getAddress(i.THORChain)
3498
3839
  })
3499
3840
  });
3500
3841
  } catch (r) {
3501
3842
  throw new m("core_transaction_create_liquidity_asset_error", r);
3502
3843
  }
3503
- return { runeTx: a, assetTx: i };
3844
+ return { runeTx: a, assetTx: s };
3504
3845
  });
3505
3846
  T(this, "addLiquidity", async ({
3506
3847
  poolIdentifier: t,
3507
3848
  runeAssetValue: n,
3508
3849
  assetValue: a,
3509
- runeAddr: i,
3850
+ runeAddr: s,
3510
3851
  assetAddr: r,
3511
- isPendingSymmAsset: p,
3512
- mode: d = "sym"
3852
+ isPendingSymmAsset: o,
3853
+ mode: p = "sym"
3513
3854
  }) => {
3514
- const [y, ...l] = t.split("."), o = d === "sym", c = (n == null ? void 0 : n.gt(0)) && (o || d === "rune"), h = (a == null ? void 0 : a.gt(0)) && (o || d === "asset"), w = p || c, R = w ? i || this.getAddress(s.THORChain) : "", O = o || d === "asset" ? r || this.getAddress(y) : "";
3515
- if (!c && !h)
3855
+ const [u, ...y] = t.split("."), d = p === "sym", c = (n == null ? void 0 : n.gt(0)) && (d || p === "rune"), _ = (a == null ? void 0 : a.gt(0)) && (d || p === "asset"), A = o || c, R = A ? s || this.getAddress(i.THORChain) : "", g = d || p === "asset" ? r || this.getAddress(u) : "";
3856
+ if (!c && !_)
3516
3857
  throw new m("core_transaction_add_liquidity_invalid_params");
3517
- if (w && !R)
3858
+ if (A && !R)
3518
3859
  throw new m("core_transaction_add_liquidity_no_rune_address");
3519
3860
  let E, I;
3520
- const S = { chain: y, symbol: l.join(".") };
3861
+ const S = { chain: u, symbol: y.join(".") };
3521
3862
  if (c && n)
3522
3863
  try {
3523
3864
  E = await f(this, N).call(this, {
3524
3865
  assetValue: n,
3525
- memo: x(_.DEPOSIT, { ...S, address: O })
3866
+ memo: x(h.DEPOSIT, { ...S, address: g })
3526
3867
  });
3527
3868
  } catch (D) {
3528
3869
  throw new m("core_transaction_add_liquidity_rune_error", D);
3529
3870
  }
3530
- if (h && a)
3871
+ if (_ && a)
3531
3872
  try {
3532
3873
  I = await f(this, N).call(this, {
3533
3874
  assetValue: a,
3534
- memo: x(_.DEPOSIT, { ...S, address: R })
3875
+ memo: x(h.DEPOSIT, { ...S, address: R })
3535
3876
  });
3536
3877
  } catch (D) {
3537
3878
  throw new m("core_transaction_add_liquidity_asset_error", D);
@@ -3542,49 +3883,49 @@ class en {
3542
3883
  memo: t,
3543
3884
  assetValue: n,
3544
3885
  percent: a,
3545
- from: i,
3886
+ from: s,
3546
3887
  to: r
3547
3888
  }) => {
3548
- const p = r === "rune" ? v.fromChainOrSignature(s.THORChain) : i === "sym" && r === "sym" || i === "rune" || i === "asset" ? void 0 : n;
3889
+ const o = r === "rune" ? v.fromChainOrSignature(i.THORChain) : s === "sym" && r === "sym" || s === "rune" || s === "asset" ? void 0 : n;
3549
3890
  try {
3550
3891
  return await f(this, N).call(this, {
3551
- assetValue: _e(i === "asset" ? n.chain : s.THORChain),
3552
- memo: t || x(_.WITHDRAW, {
3892
+ assetValue: Ie(s === "asset" ? n.chain : i.THORChain),
3893
+ memo: t || x(h.WITHDRAW, {
3553
3894
  symbol: n.symbol,
3554
3895
  chain: n.chain,
3555
3896
  ticker: n.ticker,
3556
3897
  basisPoints: Math.max(1e4, Math.round(a * 100)),
3557
- targetAssetString: p == null ? void 0 : p.toString(),
3898
+ targetAssetString: o == null ? void 0 : o.toString(),
3558
3899
  singleSide: !1
3559
3900
  })
3560
3901
  });
3561
- } catch (d) {
3562
- throw new m("core_transaction_withdraw_error", d);
3902
+ } catch (p) {
3903
+ throw new m("core_transaction_withdraw_error", p);
3563
3904
  }
3564
3905
  });
3565
3906
  T(this, "savings", async ({
3566
3907
  assetValue: t,
3567
3908
  memo: n,
3568
3909
  percent: a,
3569
- type: i
3910
+ type: s
3570
3911
  }) => {
3571
- const r = i === "add" ? _.DEPOSIT : _.WITHDRAW, p = n || x(r, {
3912
+ const r = s === "add" ? h.DEPOSIT : h.WITHDRAW, o = n || x(r, {
3572
3913
  ticker: t.ticker,
3573
3914
  symbol: t.symbol,
3574
3915
  chain: t.chain,
3575
3916
  singleSide: !0,
3576
3917
  basisPoints: a ? Math.max(1e4, Math.round(a * 100)) : void 0
3577
3918
  });
3578
- return f(this, N).call(this, { assetValue: t, memo: p });
3919
+ return f(this, N).call(this, { assetValue: t, memo: o });
3579
3920
  });
3580
3921
  T(this, "loan", ({
3581
3922
  assetValue: t,
3582
3923
  memo: n,
3583
3924
  minAmount: a,
3584
- type: i
3925
+ type: s
3585
3926
  }) => f(this, N).call(this, {
3586
3927
  assetValue: t,
3587
- memo: n || x(i === "open" ? _.OPEN_LOAN : _.CLOSE_LOAN, {
3928
+ memo: n || x(s === "open" ? h.OPEN_LOAN : h.CLOSE_LOAN, {
3588
3929
  asset: t.toString(),
3589
3930
  minAmount: a.toString(),
3590
3931
  address: this.getAddress(t.chain)
@@ -3595,27 +3936,27 @@ class en {
3595
3936
  assetValue: n,
3596
3937
  address: a
3597
3938
  }) => {
3598
- const i = t === "bond" ? _.BOND : t === "unbond" ? _.UNBOND : _.LEAVE, r = x(i, {
3939
+ const s = t === "bond" ? h.BOND : t === "unbond" ? h.UNBOND : h.LEAVE, r = x(s, {
3599
3940
  address: a,
3600
3941
  unbondAmount: t === "unbond" ? n.baseValueNumber : void 0
3601
3942
  });
3602
3943
  return f(this, Y).call(this, {
3603
3944
  memo: r,
3604
- assetValue: t === "bond" ? n : _e(s.THORChain)
3945
+ assetValue: t === "bond" ? n : Ie(i.THORChain)
3605
3946
  });
3606
3947
  });
3607
3948
  T(this, "registerThorname", ({
3608
3949
  assetValue: t,
3609
3950
  ...n
3610
- }) => f(this, Y).call(this, { assetValue: t, memo: x(_.THORNAME_REGISTER, n) }));
3611
- T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: i = {} }) => {
3951
+ }) => f(this, Y).call(this, { assetValue: t, memo: x(h.THORNAME_REGISTER, n) }));
3952
+ T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: s = {} }) => {
3612
3953
  try {
3613
3954
  t.forEach((r) => {
3614
3955
  this[r.connectMethodName] = r.connect({
3615
- addChain: f(this, z),
3956
+ addChain: f(this, te),
3616
3957
  config: n || {},
3617
3958
  apis: a,
3618
- rpcUrls: i
3959
+ rpcUrls: s
3619
3960
  });
3620
3961
  });
3621
3962
  } catch (r) {
@@ -3628,28 +3969,28 @@ class en {
3628
3969
  }) => {
3629
3970
  const a = this.getWallet(t);
3630
3971
  switch (t) {
3631
- case s.Arbitrum:
3632
- case s.Avalanche:
3633
- case s.BinanceSmartChain:
3634
- case s.Ethereum:
3635
- case s.Optimism:
3636
- case s.Polygon: {
3637
- const { estimateMaxSendableAmount: i } = await import("@swapkit/toolbox-evm");
3638
- return i({
3972
+ case i.Arbitrum:
3973
+ case i.Avalanche:
3974
+ case i.BinanceSmartChain:
3975
+ case i.Ethereum:
3976
+ case i.Optimism:
3977
+ case i.Polygon: {
3978
+ const { estimateMaxSendableAmount: s } = await import("@swapkit/toolbox-evm");
3979
+ return s({
3639
3980
  ...n,
3640
3981
  toolbox: a
3641
3982
  });
3642
3983
  }
3643
- case s.Bitcoin:
3644
- case s.BitcoinCash:
3645
- case s.Dogecoin:
3646
- case s.Litecoin:
3984
+ case i.Bitcoin:
3985
+ case i.BitcoinCash:
3986
+ case i.Dogecoin:
3987
+ case i.Litecoin:
3647
3988
  return a.estimateMaxSendableAmount(n);
3648
- case s.Binance:
3649
- case s.THORChain:
3650
- case s.Cosmos: {
3651
- const { estimateMaxSendableAmount: i } = await import("@swapkit/toolbox-cosmos");
3652
- return i({
3989
+ case i.Binance:
3990
+ case i.THORChain:
3991
+ case i.Cosmos: {
3992
+ const { estimateMaxSendableAmount: s } = await import("@swapkit/toolbox-cosmos");
3993
+ return s({
3653
3994
  ...n,
3654
3995
  toolbox: a
3655
3996
  });
@@ -3688,72 +4029,72 @@ class en {
3688
4029
  T(this, "disconnectChain", (t) => {
3689
4030
  this.connectedChains[t] = null, this.connectedWallets[t] = null;
3690
4031
  });
3691
- B(this, P, async (t) => {
3692
- if (t === s.THORChain)
4032
+ P(this, B, async (t) => {
4033
+ if (t === i.THORChain)
3693
4034
  return {
3694
4035
  gas_rate: "0",
3695
4036
  router: "0",
3696
4037
  address: "",
3697
4038
  halted: !1,
3698
- chain: s.THORChain
4039
+ chain: i.THORChain
3699
4040
  };
3700
- const a = (await Bt(this.stagenet)).find((i) => i.chain === t);
4041
+ const a = (await un(this.stagenet)).find((s) => s.chain === t);
3701
4042
  if (!a)
3702
4043
  throw new m("core_inbound_data_not_found");
3703
4044
  if (a != null && a.halted)
3704
4045
  throw new m("core_chain_halted");
3705
4046
  return a;
3706
4047
  });
3707
- B(this, z, ({ chain: t, wallet: n, walletMethods: a }) => {
4048
+ P(this, te, ({ chain: t, wallet: n, walletMethods: a }) => {
3708
4049
  this.connectedChains[t] = n, this.connectedWallets[t] = a;
3709
4050
  });
3710
- B(this, K, async ({
3711
- assetValue: { baseValueBigInt: t, address: n, chain: a, isGasAsset: i, isSynthetic: r },
3712
- type: p = "checkOnly",
3713
- contractAddress: d
4051
+ P(this, j, async ({
4052
+ assetValue: { baseValueBigInt: t, address: n, chain: a, isGasAsset: s, isSynthetic: r },
4053
+ type: o = "checkOnly",
4054
+ contractAddress: p
3714
4055
  }) => {
3715
- const y = [s.Ethereum, s.Avalanche, s.BinanceSmartChain].includes(a);
3716
- if (y && i || !y || r)
4056
+ const u = [i.Ethereum, i.Avalanche, i.BinanceSmartChain].includes(a);
4057
+ if (u && s || !u || r)
3717
4058
  return !0;
3718
- const o = this.connectedWallets[a], c = p === "checkOnly" ? o == null ? void 0 : o.isApproved : o == null ? void 0 : o.approve;
4059
+ const d = this.connectedWallets[a], c = o === "checkOnly" ? d == null ? void 0 : d.isApproved : d == null ? void 0 : d.approve;
3719
4060
  if (!c)
3720
4061
  throw new m("core_wallet_connection_not_found");
3721
- const h = this.getAddress(a);
3722
- if (!n || !h)
4062
+ const _ = this.getAddress(a);
4063
+ if (!n || !_)
3723
4064
  throw new m("core_approve_asset_address_or_from_not_found");
3724
- const w = d || (await f(this, P).call(this, a)).router;
4065
+ const A = p || (await f(this, B).call(this, a)).router;
3725
4066
  return c({
3726
4067
  amount: t,
3727
4068
  assetAddress: n,
3728
- from: h,
3729
- spenderAddress: w
4069
+ from: _,
4070
+ spenderAddress: A
3730
4071
  });
3731
4072
  });
3732
- B(this, N, async ({
4073
+ P(this, N, async ({
3733
4074
  assetValue: t,
3734
4075
  memo: n,
3735
4076
  feeOptionKey: a = k.Fast
3736
4077
  }) => {
3737
4078
  const {
3738
- gas_rate: i,
4079
+ gas_rate: s,
3739
4080
  router: r,
3740
- address: p
3741
- } = await f(this, P).call(this, t.chain), d = (parseInt(i) || 0) * st[a];
4081
+ address: o
4082
+ } = await f(this, B).call(this, t.chain), p = (parseInt(s) || 0) * _t[a];
3742
4083
  return this.deposit({
3743
4084
  assetValue: t,
3744
- recipient: p,
4085
+ recipient: o,
3745
4086
  memo: n,
3746
4087
  router: r,
3747
- feeRate: d
4088
+ feeRate: p
3748
4089
  });
3749
4090
  });
3750
- B(this, Y, async ({ memo: t, assetValue: n }) => {
3751
- const a = await Pt(this.stagenet);
4091
+ P(this, Y, async ({ memo: t, assetValue: n }) => {
4092
+ const a = await ln(this.stagenet);
3752
4093
  if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
3753
4094
  throw new m("core_chain_halted");
3754
4095
  return this.deposit({ assetValue: n, recipient: "", memo: t });
3755
4096
  });
3756
- B(this, X, ({ assetValue: t, ...n }) => ({
4097
+ P(this, K, ({ assetValue: t, ...n }) => ({
3757
4098
  ...n,
3758
4099
  memo: n.memo || "",
3759
4100
  from: this.getAddress(t.chain),
@@ -3762,66 +4103,65 @@ class en {
3762
4103
  this.stagenet = !!t;
3763
4104
  }
3764
4105
  }
3765
- P = new WeakMap(), z = new WeakMap(), K = new WeakMap(), N = new WeakMap(), Y = new WeakMap(), X = new WeakMap();
4106
+ B = new WeakMap(), te = new WeakMap(), j = new WeakMap(), N = new WeakMap(), Y = new WeakMap(), K = new WeakMap();
3766
4107
  export {
3767
- Ue as AGG_SWAP,
3768
- be as ApiError,
4108
+ ze as AGG_SWAP,
4109
+ mn as ApiError,
3769
4110
  W as ApiUrl,
3770
4111
  v as AssetValue,
3771
4112
  b as BaseDecimal,
3772
- re as BigIntArithmetics,
3773
- s as Chain,
3774
- ye as ChainId,
3775
- Gt as ChainIdToChain,
3776
- Ke as ChainToChainId,
3777
- we as ChainToExplorerUrl,
3778
- Ft as ChainToHexChainId,
3779
- Ye as ChainToRPC,
3780
- Ge as ContractAddress,
3781
- kt as CosmosChainList,
3782
- We as DerivationPath,
3783
- u as ERROR_CODE,
3784
- ke as ERROR_MODULE,
3785
- fe as ERROR_TYPE,
3786
- Ht as EVMChainList,
3787
- Xe as ErrorCode,
4113
+ le as BigIntArithmetics,
4114
+ i as Chain,
4115
+ he as ChainId,
4116
+ wn as ChainIdToChain,
4117
+ rt as ChainToChainId,
4118
+ Ne as ChainToExplorerUrl,
4119
+ bn as ChainToHexChainId,
4120
+ ot as ChainToRPC,
4121
+ at as ContractAddress,
4122
+ fn as CosmosChainList,
4123
+ st as DerivationPath,
4124
+ l as ERROR_CODE,
4125
+ tt as ERROR_MODULE,
4126
+ ve as ERROR_TYPE,
4127
+ hn as EVMChainList,
4128
+ pt as ErrorCode,
3788
4129
  k as FeeOption,
3789
- _ as MemoType,
3790
- Ut as NetworkDerivationPath,
3791
- Le as QuoteMode,
3792
- Ae as RPCUrl,
3793
- He as SWAP_IN,
3794
- $e as SWAP_OUT,
3795
- en as SwapKitCore,
4130
+ h as MemoType,
4131
+ Tn as NetworkDerivationPath,
4132
+ Qe as QuoteMode,
4133
+ Me as RPCUrl,
4134
+ be as RequestClient,
4135
+ Ze as SWAP_IN,
4136
+ et as SWAP_OUT,
4137
+ Nn as SwapKitCore,
3796
4138
  m as SwapKitError,
3797
- ue as SwapKitNumber,
3798
- Pe as TCAvalancheDepositABI,
3799
- Ve as TCBscDepositABI,
3800
- Be as TCEthereumVaultAbi,
3801
- $t as UTXOChainList,
3802
- je as WalletOption,
3803
- Yt as assetFromString,
3804
- Kt as derivationPathToString,
3805
- Lt as erc20ABI,
3806
- Xt as filterAssets,
3807
- ge as formatBigIntToSafeValue,
3808
- st as gasFeeMultiplier,
3809
- pt as getAssetType,
3810
- ut as getAsymmetricAssetShare,
3811
- Qt as getAsymmetricAssetWithdrawAmount,
3812
- dt as getAsymmetricRuneShare,
3813
- jt as getAsymmetricRuneWithdrawAmount,
3814
- rt as getCommonAssetInfo,
3815
- Oe as getDecimal,
3816
- zt as getEstimatedPoolShare,
3817
- Zt as getLiquiditySlippage,
4139
+ Te as SwapKitNumber,
4140
+ Xe as TCAvalancheDepositABI,
4141
+ Je as TCBscDepositABI,
4142
+ Ke as TCEthereumVaultAbi,
4143
+ _n as UTXOChainList,
4144
+ dt as WalletOption,
4145
+ An as assetFromString,
4146
+ Mn as derivationPathToString,
4147
+ cn as erc20ABI,
4148
+ En as filterAssets,
4149
+ He as formatBigIntToSafeValue,
4150
+ _t as gasFeeMultiplier,
4151
+ wt as getAssetType,
4152
+ Rt as getAsymmetricAssetShare,
4153
+ gn as getAsymmetricAssetWithdrawAmount,
4154
+ Et as getAsymmetricRuneShare,
4155
+ Rn as getAsymmetricRuneWithdrawAmount,
4156
+ bt as getCommonAssetInfo,
4157
+ De as getDecimal,
4158
+ In as getEstimatedPoolShare,
4159
+ Sn as getLiquiditySlippage,
3818
4160
  x as getMemoFor,
3819
- _e as getMinAmountByChain,
3820
- Ee as getRequest,
3821
- yt as getSymmetricPoolShare,
3822
- Jt as getSymmetricWithdraw,
3823
- Wt as getTHORNameCost,
3824
- it as isGasAsset,
3825
- Ze as postRequest,
3826
- qt as validateTHORName
4161
+ Ie as getMinAmountByChain,
4162
+ gt as getSymmetricPoolShare,
4163
+ On as getSymmetricWithdraw,
4164
+ vn as getTHORNameCost,
4165
+ ft as isGasAsset,
4166
+ Cn as validateTHORName
3827
4167
  };