@swapkit/core 1.0.0-rc.12 → 1.0.0-rc.14

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 m = (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 A = (e, t, n) => (Ne(e, t, "read from private field"), n ? n.call(e) : t.get(e)), P = (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, C = (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
- ], Pe = [
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
- ], Be = [
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 be = /* @__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))(be || {}), 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 || {}), d = /* @__PURE__ */ ((e) => (e.INVALID_INPUT_PARAMETERS = "1000", e.UNKNOWN_PROVIDERS = "1001", e.CANNOT_FIND_INBOUND_ADDRESS = "1002", e.NO_INBOUND_ADDRESSES = "1003", e.CHAIN_HALTED_OR_UNSUPPORTED = "1004", e.MISSING_INPUT_PARAMETER = "1005", e.INVALID_TYPE_GENERIC = "1100", e.INVALID_NUMBER_STRING = "1101", e.INVALID_NUMBER = "1102", e.INVALID_BOOLEAN = "1103", e.INVALID_OBJECT = "1104", e.INVALID_ARRAY = "1105", e.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", e.SELL_BUY_ASSETS_ARE_THE_SAME = "2001", e.MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", e.AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", e.AFF_ADDRESS_TOO_LONG = "2004", e.AFF_BPS_INTEGER_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))(d || {});
628
- const Fe = {
629
- [d.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
630
- [d.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
631
- [d.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
632
- [d.NO_INBOUND_ADDRESSES]: "No inbound addresses.",
633
- [d.CHAIN_HALTED_OR_UNSUPPORTED]: "Chain {0} halted or unsupported.",
634
- [d.MISSING_INPUT_PARAMETER]: "Missing input parameter: {0}.",
635
- [d.INVALID_TYPE_GENERIC]: "Invalid type",
636
- [d.INVALID_NUMBER_STRING]: "Invalid number string.",
637
- [d.INVALID_NUMBER]: "Invalid number.",
638
- [d.INVALID_BOOLEAN]: "Invalid boolean.",
639
- [d.INVALID_OBJECT]: "Invalid object.",
640
- [d.INVALID_ARRAY]: "Invalid array.",
641
- [d.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Sell amount must be a positive integer.",
642
- [d.SELL_BUY_ASSETS_ARE_THE_SAME]: "Sell and buy assets are the same.",
643
- [d.MISSING_SOURCE_ADDRESS_FOR_SYNTH]: "Source address is required for synth quote.",
644
- [d.AFF_ADDRESS_AND_BPS_OR_NEITHER]: "Must provide affiliateAddress and affiliateBasisPoints params, or neither.",
645
- [d.AFF_ADDRESS_TOO_LONG]: "affiliateAddress too long: 3 characters max.",
646
- [d.AFF_BPS_INTEGER_0_100]: "affiliateBasisPoints must be an integer between 0 and 100.",
647
- [d.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN]: "Source address {0} invalid for sell chain.",
648
- [d.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN]: "Destination address {0} invalid for buy chain.",
649
- [d.PREFERRED_PROFVIDER_NOT_SUPPORTED]: "Preferred provider not supported.",
650
- [d.DESTINATION_ADDRESS_SMART_CONTRACT]: "Destination address is a smart contract.",
651
- [d.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Buy amount must be a positive integer.",
652
- [d.INVALID_PROVIDER]: "Invalid provider {0}.",
653
- [d.MISSING_CROSS_CHAIN_PROVIDER]: "Missing cross-chain provider.",
654
- [d.MISSING_AVAX_PROVIDER]: "Missing AVAX provider.",
655
- [d.MISSING_BSC_PROVIDER]: "Missing BSC provider.",
656
- [d.MISSING_ETH_PROVIDER]: "Missing ETH provider.",
657
- [d.MISSING_ARB_PROVIDER]: "Missing ARB provider.",
658
- [d.INVALID_PROVIDER_FOR_SWAP_OUT]: "Invalid provider for swap out.",
659
- [d.INVALID_CHAIN]: "Invalid chain {0}.",
660
- [d.INVALID_ASSET]: "Invalid asset {0}.",
661
- [d.UNSUPPORTED_CHAIN]: "Unsupported chain {0}.",
662
- [d.UNSUPPORTED_ASSET]: "Unsupported asset {0}.",
663
- [d.UNSUPPORTED_ASSET_FOR_SWAPOUT]: "Unsupported asset {0} for swap out.",
664
- [d.THORNODE_QUOTE_GENERIC_ERROR]: "ThorNode quote generic error.",
665
- [d.INVALID_SOURCE_ADDRESS]: "Invalid source address {0}",
666
- [d.INVALID_DESTINATION_ADDRESS]: "Invalid destination address {0}",
667
- [d.NOT_ENOUGH_SYNTH_BALANCE]: "Source address doesn't have enough synth balance for this quote.",
668
- [d.SYNTH_MINTING_CAP_REACHED]: "Synth minting cap reached.",
669
- [d.INVALID_QUOTE_MODE]: "Invalid quote mode.",
670
- [d.NO_QUOTES]: "No quotes to service this request.",
671
- [d.SERVICE_UNAVAILABLE_GENERIC]: "Service unavailable.",
672
- [d.MISSING_GAS_DATA_GENERIC]: "Missing gas data.",
673
- [d.MISSING_TOKEN_INFO_GENERIC]: "Missing token info.",
674
- [d.CANT_FIND_TOKEN_LIST]: "Can't find tokenlist {0}.",
675
- [d.NO_PRICE]: "No price for asset {0}.",
676
- [d.PRICE_IS_STALE]: "Price is stale for asset {0}.",
677
- [d.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
678
- [d.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
679
- }, te = (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 Ae 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: o, shouldThrow: y, shouldTrace: T } = {
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: u
698
+ displayMessageParams: d
699
699
  }) {
700
- const l = r || te(i, u || []) || "";
701
- super(l), 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 = l, this.display = te(i, u || []), this.code = i, this.type = p || be.UNHANDLED_ERROR, this.options = {
702
- shouldLog: o || !0,
703
- shouldTrace: T || !0,
704
- shouldThrow: y || !1
705
- }, this.displayMessageParams = u || [], 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 Ae(t);
708
+ return new Ce(t);
709
709
  }
710
710
  toErrorInfo() {
711
711
  return { ...this, identifier: this.identifier };
@@ -714,7 +714,7 @@ class Ae extends Error {
714
714
  return `${this.revision}-${this.type || "NO_TYPE"}-${this.module}-${this.code}`;
715
715
  }
716
716
  get displayMessage() {
717
- return te(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 Ae 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],
@@ -742,8 +742,8 @@ const Ut = {
742
742
  OP: [44, 60, 0, 0, 0],
743
743
  THOR: [44, 931, 0, 0, 0]
744
744
  };
745
- var E = /* @__PURE__ */ ((e) => (e[e.ARB = 18] = "ARB", e[e.AVAX = 18] = "AVAX", e[e.BCH = 8] = "BCH", e[e.BNB = 8] = "BNB", e[e.BSC = 18] = "BSC", e[e.BTC = 8] = "BTC", e[e.DASH = 8] = "DASH", e[e.DOGE = 8] = "DOGE", e[e.ETH = 18] = "ETH", e[e.GAIA = 6] = "GAIA", e[e.KUJI = 6] = "KUJI", e[e.LTC = 8] = "LTC", e[e.MATIC = 18] = "MATIC", e[e.MAYA = 10] = "MAYA", e[e.OP = 18] = "OP", e[e.THOR = 8] = "THOR", e))(E || {});
746
- const Ht = [
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 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 le = /* @__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))(le || {}), we = /* @__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))(we || {}), 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), ce = 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] = le[ce[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] = we[ce[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 = `${ce[t]}Hex`;
782
- return e[t] = le[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), ce = Z.reduce(
807
807
  "thorchain-stagenet-v2": "THOR",
808
808
  "thorchain-mainnet-v1": "THOR"
809
809
  /* THORChain */
810
- }, Ee = {
810
+ }, Ne = {
811
811
  ARB: "https://arbiscan.io",
812
812
  AVAX: "https://snowtrace.io",
813
813
  BSC: "https://bscscan.com",
@@ -824,207 +824,171 @@ const Z = Object.values(s), qe = Object.keys(s), ce = 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 || {}), f = /* @__PURE__ */ ((e) => (e.BOND = "BOND", e.DEPOSIT = "+", e.LEAVE = "LEAVE", e.THORNAME_REGISTER = "~", e.UNBOND = "UNBOND", e.WITHDRAW = "-", e.OPEN_LOAN = "$+", e.CLOSE_LOAN = "$-", e))(f || {}), 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, N = (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 || {}), $ = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))($ || {}), 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
- }, I = (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}`}`, Re = async (e, t) => {
845
- 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", Oe = async ({ chain: e, to: t }) => {
834
+ }, O = (e, t, n) => (yt(e, t, "access private method"), n);
835
+ const ct = "0x313ce567", xe = async ({ chain: e, to: t }) => {
870
836
  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
- return console.error(n), E[e];
848
+ return console.error(n), b[e];
885
849
  }
886
- }, tt = async (e) => {
887
- if (e === s.Ethereum)
888
- return E.ETH;
850
+ }, mt = async (e) => {
851
+ if (e === i.Ethereum)
852
+ return b.ETH;
889
853
  const [, t] = e.split("-");
890
- return t != null && t.startsWith("0x") ? Oe({ chain: s.Ethereum, to: t }) : E.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") ? Oe({ chain: s.Avalanche, to: t.toLowerCase() }) : E.AVAX;
894
- }, at = async (e) => (e === s.BinanceSmartChain, E.BSC), ge = 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
- return E[e];
867
+ return b[e];
904
868
  }
905
- }, st = {
906
- [k.Average]: 1.2,
907
- [k.Fast]: 1.5,
908
- [k.Fastest]: 2
909
- }, it = ({ chain: e, symbol: t }) => {
869
+ }, _t = {
870
+ [$.Average]: 1.2,
871
+ [$.Fast]: 1.5,
872
+ [$.Fastest]: 2
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:
942
- return { identifier: "GAIA.ATOM", decimal: E[e] };
943
- case s.THORChain:
944
- return { identifier: "THOR.RUNE", decimal: E[e] };
945
- case s.BinanceSmartChain:
946
- return { identifier: "BSC.BNB", decimal: E[e] };
947
- case s.Maya:
948
- return { identifier: "MAYA.CACAO", decimal: E.MAYA };
905
+ case i.Cosmos:
906
+ return { identifier: "GAIA.ATOM", decimal: b[e] };
907
+ case i.THORChain:
908
+ return { identifier: "THOR.RUNE", decimal: b[e] };
909
+ case i.BinanceSmartChain:
910
+ return { identifier: "BSC.BNB", decimal: b[e] };
911
+ case i.Maya:
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:
962
- return { identifier: `${e}.${e}`, decimal: E[e] };
963
- }
964
- }, pt = ({ chain: e, symbol: t }) => {
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:
926
+ return { identifier: `${e}.${e}`, decimal: b[e] };
927
+ }
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 = w(e), i = w(t), r = w(n), p = a.mul(r), o = i.mul(i).mul(2), y = i.mul(a).mul(2), T = a.mul(a), u = i.mul(i).mul(i);
1009
- return p.mul(o.sub(y).add(T)).div(u);
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 = w(e), i = w(t), r = w(n), p = a.mul(r), o = i.mul(i).mul(2), y = i.mul(a).mul(2), T = a.mul(a), u = p.mul(o.sub(y).add(T)), l = i.mul(i).mul(i);
1016
- return u.div(l);
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), w = (e) => new ye({ value: e, decimal: E.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,
@@ -1032,112 +996,479 @@ const Wt = (e) => {
1032
996
  }) => ({
1033
997
  assetAmount: w(a).mul(e).div(t),
1034
998
  runeAmount: w(n).mul(e).div(t)
1035
- }), Jt = ({
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 = w(e), o = w(n), y = w(t), T = w(i), u = w(r), l = T.mul(o), h = u.mul(p), _ = T.mul(u), R = p.mul(o), O = y.mul(l.add(h.add(_.mul(2)))), S = l.add(h.add(R.mul(2))), g = O.div(S), b = w(a).add(g);
1054
- if (g.baseValueNumber === 0)
1055
- return b.div(y).baseValueNumber;
1056
- const M = y.add(b);
1057
- return b.div(M).baseValueNumber;
1058
- }, Zt = ({
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);
1018
+ if (I.baseValueNumber === 0)
1019
+ return S.div(u).baseValueNumber;
1020
+ const D = u.add(S);
1021
+ return S.div(D).baseValueNumber;
1022
+ }, Sn = ({
1059
1023
  runeAmount: e,
1060
1024
  assetAmount: t,
1061
1025
  runeDepth: n,
1062
1026
  assetDepth: a
1063
1027
  }) => {
1064
- const i = w(n), r = w(a), p = w(t), o = w(e), y = p.mul(i).sub(r.mul(o)), T = r.mul(o).add(i.mul(r));
1065
- return Math.abs(y.div(T).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
- }) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e, D = (e, t) => {
1034
+ }) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e, x = (e, t) => {
1071
1035
  switch (e) {
1072
- case f.LEAVE:
1073
- case f.BOND: {
1036
+ case h.LEAVE:
1037
+ case h.BOND: {
1074
1038
  const { address: n } = t;
1075
1039
  return `${e}:${n}`;
1076
1040
  }
1077
- case f.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 f.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 f.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 f.WITHDRAW: {
1090
- const { chain: n, ticker: a, symbol: i, basisPoints: r, targetAssetString: p, singleSide: o } = t, y = !o && p ? `:${p}` : "", T = lt({ chain: n, symbol: i, ticker: a });
1091
- return `${e}:${n}${o ? "/" : "."}${T}:${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 f.OPEN_LOAN:
1094
- case f.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
- }, me = 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
+ }, kt = re(), $t = kt, Ee = $t.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 (me.includes(n))
1434
+ if (Re.includes(n))
1104
1435
  return !0;
1105
1436
  const [a] = t.split("/");
1106
- if (me.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 Ie({
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 o = i.slice(-n);
1123
- return parseInt(o[t]) >= 5 ? o = `${o.substring(0, t - 1)}${(parseInt(o[t - 1]) + 1).toString()}` : o = o.substring(0, t), `${a ? "-" : ""}${i.slice(0, p)}.${o}`.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, $, ae, Se, se, Te, Q, ie, H, G, J, re;
1129
- const mt = class j {
1459
+ var L, k, oe, ke, pe, ge, Z, de, H, G, ee, ue;
1460
+ const Gt = class Q {
1130
1461
  constructor(t) {
1131
- V(this, L), V(this, ae), V(this, se), V(this, Q), V(this, H), V(this, J), N(this, "decimalMultiplier", 10n ** 8n), N(this, "bigIntValue", 0n), N(this, "decimal");
1132
- const n = oe(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(I(this, J, re).call(this, I(this, H, G).call(this, n)), this.decimal || 0)
1135
- ), I(this, ae, Se).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, ke).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: Ie({ 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 I(this, L, $).call(this, "add", ...t);
1506
+ return O(this, L, k).call(this, "add", ...t);
1176
1507
  }
1177
1508
  sub(...t) {
1178
- return I(this, L, $).call(this, "sub", ...t);
1509
+ return O(this, L, k).call(this, "sub", ...t);
1179
1510
  }
1180
1511
  mul(...t) {
1181
- return I(this, L, $).call(this, "mul", ...t);
1512
+ return O(this, L, k).call(this, "mul", ...t);
1182
1513
  }
1183
1514
  div(...t) {
1184
- return I(this, L, $).call(this, "div", ...t);
1515
+ return O(this, L, k).call(this, "div", ...t);
1185
1516
  }
1186
1517
  gt(t) {
1187
1518
  return this.bigIntValue > this.getBigIntValue(t);
@@ -1209,126 +1540,126 @@ const mt = class j {
1209
1540
  case "string":
1210
1541
  return n;
1211
1542
  default:
1212
- return this.bigIntValue;
1543
+ return this.bigIntValue * BigInt(this.decimal || 8n) / this.decimalMultiplier;
1213
1544
  }
1214
1545
  }
1215
1546
  getBaseValue(t) {
1216
- const n = this.decimalMultiplier / U(this.decimal || 0), a = this.bigIntValue / n;
1547
+ const n = this.decimalMultiplier / U(this.decimal || b.THOR), a = this.bigIntValue / n;
1217
1548
  switch (t) {
1218
1549
  case "number":
1219
1550
  return Number(a);
1220
1551
  case "string":
1221
1552
  return a.toString();
1222
1553
  default:
1223
- return this.bigIntValue;
1554
+ return a;
1224
1555
  }
1225
1556
  }
1226
1557
  getBigIntValue(t, n) {
1227
1558
  if (!n && typeof t == "object")
1228
1559
  return t.bigIntValue;
1229
- const a = oe(t), i = I(this, H, G).call(this, a);
1230
- return i === "0" || i === "undefined" ? 0n : I(this, Q, ie).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), o = i - (p.length - 1), y = o > 0 ? "0".repeat(o) + p : p, T = y.length - i;
1237
- let u = y.slice(-i);
1238
- return parseInt(u[a]) >= 5 ? u = `${u.substring(0, a - 1)}${(parseInt(u[a - 1]) + 1).toString()}` : u = u.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
- T
1241
- )}.${u}`.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 o = parseInt(r), y = `${o}`.slice(0, t);
1255
- return `0.${y.padStart(
1256
- r.length - `${o}`.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,
1257
1588
  "0"
1258
1589
  )}`;
1259
1590
  }
1260
1591
  };
1261
- L = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
1262
- const n = I(this, se, Te).call(this, this, ...t), a = U(n), i = t.reduce(
1263
- (p, o) => {
1264
- const y = this.getBigIntValue(o, n);
1592
+ L = /* @__PURE__ */ new WeakSet(), k = function(e, ...t) {
1593
+ const n = O(this, pe, ge).call(this, this, ...t), a = U(n), s = t.reduce(
1594
+ (o, p) => {
1595
+ const u = this.getBigIntValue(p, n);
1265
1596
  switch (e) {
1266
1597
  case "add":
1267
- return p + y;
1598
+ return o + u;
1268
1599
  case "sub":
1269
- return p - y;
1600
+ return o - u;
1270
1601
  case "mul":
1271
- return p * y / a;
1602
+ return o * u / a;
1272
1603
  case "div": {
1273
- if (y === 0n)
1604
+ if (u === 0n)
1274
1605
  throw new RangeError("Division by zero");
1275
- return p * a / y;
1606
+ return o * a / u;
1276
1607
  }
1277
1608
  default:
1278
- return p;
1609
+ return o;
1279
1610
  }
1280
1611
  },
1281
1612
  //normalize is to precision multiplier base
1282
1613
  this.bigIntValue * a / this.decimalMultiplier
1283
- ), r = Ie({
1614
+ ), r = He({
1284
1615
  bigIntDecimal: n,
1285
1616
  decimal: Math.max(n, F(this.decimalMultiplier)),
1286
- value: i
1617
+ value: s
1287
1618
  });
1288
1619
  return new this.constructor({ decimal: this.decimal, value: r, identifier: this.toString() });
1289
- }, ae = /* @__PURE__ */ new WeakSet(), Se = function(e) {
1290
- const t = I(this, H, G).call(this, e) || "0";
1291
- this.bigIntValue = I(this, Q, ie).call(this, t);
1292
- }, se = /* @__PURE__ */ new WeakSet(), Te = function(...e) {
1620
+ }, oe = /* @__PURE__ */ new WeakSet(), ke = function(e) {
1621
+ const t = O(this, H, G).call(this, e) || "0";
1622
+ this.bigIntValue = O(this, Z, de).call(this, t);
1623
+ }, pe = /* @__PURE__ */ new WeakSet(), ge = function(...e) {
1293
1624
  const t = e.map(
1294
- (n) => typeof n == "object" ? n.decimal || F(n.decimalMultiplier) : I(this, J, re).call(this, I(this, H, G).call(this, n))
1625
+ (n) => typeof n == "object" ? n.decimal || F(n.decimalMultiplier) : O(this, ee, ue).call(this, O(this, H, G).call(this, n))
1295
1626
  ).filter(Boolean);
1296
1627
  return Math.max(...t, q);
1297
- }, Q = /* @__PURE__ */ new WeakSet(), ie = 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")}`);
1628
+ }, Z = /* @__PURE__ */ new WeakSet(), de = function(e, t) {
1629
+ const n = t ? U(t) : this.decimalMultiplier, a = F(n), [s = "", r = ""] = e.split(".");
1630
+ return BigInt(`${s}${r.padEnd(a, "0")}`);
1300
1631
  }, H = /* @__PURE__ */ new WeakSet(), G = function(e) {
1301
1632
  const t = `${typeof e == "number" ? Number(e).toLocaleString("fullwide", {
1302
1633
  useGrouping: !1,
1303
1634
  maximumFractionDigits: 20
1304
- }) : oe(e)}`.replaceAll(",", ".").split(".");
1635
+ }) : ye(e)}`.replaceAll(",", ".").split(".");
1305
1636
  return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
1306
- }, J = /* @__PURE__ */ new WeakSet(), re = function(e) {
1637
+ }, ee = /* @__PURE__ */ new WeakSet(), ue = function(e) {
1307
1638
  var t;
1308
1639
  const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
1309
1640
  return Math.max(n, q);
1310
1641
  };
1311
- let pe = mt;
1312
- function oe(e) {
1642
+ let le = Gt;
1643
+ function ye(e) {
1313
1644
  return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
1314
1645
  }
1315
- let de;
1316
- const ne = (e) => {
1317
- if (!de)
1646
+ let ce;
1647
+ const ie = (e) => {
1648
+ if (!ce)
1318
1649
  throw new Error("Static assets not loaded, call await AssetValue.loadStaticAssets() first");
1319
- return de.get(e.toUpperCase()) || { decimal: E.THOR, identifier: "" };
1320
- }, _e = async (e, t = 0) => {
1321
- ct(e);
1322
- const n = await ge(ue(e));
1650
+ return ce.get(e.toUpperCase()) || { decimal: b.THOR, identifier: "" };
1651
+ }, Oe = async (e, t = 0) => {
1652
+ Ft(e);
1653
+ const n = await De(me(e));
1323
1654
  return new v({ decimal: n, value: t, identifier: e });
1324
1655
  };
1325
- class v extends pe {
1656
+ class v extends le {
1326
1657
  constructor(t) {
1327
1658
  super(
1328
- t.value instanceof pe ? t.value : { decimal: t.decimal, value: t.value }
1329
- ), N(this, "address"), N(this, "chain"), N(this, "isSynthetic", !1), N(this, "isGasAsset", !1), N(this, "symbol"), N(this, "ticker"), N(this, "type");
1330
- const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a = ue(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;
1659
+ t.value instanceof le ? t.value : { decimal: t.decimal, value: t.value }
1660
+ ), M(this, "address"), M(this, "chain"), M(this, "isSynthetic", !1), M(this, "isGasAsset", !1), M(this, "symbol"), M(this, "ticker"), M(this, "type");
1661
+ const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a = me(n);
1662
+ 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
1663
  }
1333
1664
  get assetValue() {
1334
1665
  return `${this.getValue("string")} ${this.ticker}`;
@@ -1344,36 +1675,36 @@ class v extends pe {
1344
1675
  return this.chain === t && this.symbol === n;
1345
1676
  }
1346
1677
  static async fromString(t, n = 0) {
1347
- return _e(t, n);
1678
+ return Oe(t, n);
1348
1679
  }
1349
1680
  static fromStringSync(t, n = 0) {
1350
- const { decimal: a, identifier: i } = ne(
1681
+ const { decimal: a, identifier: s } = ie(
1351
1682
  t
1352
1683
  );
1353
- return i ? new v({ decimal: a, identifier: i, value: n }) : void 0;
1684
+ return s ? new v({ decimal: a, identifier: s, value: n }) : void 0;
1354
1685
  }
1355
1686
  static async fromIdentifier(t, n = 0) {
1356
- return _e(t, n);
1687
+ return Oe(t, n);
1357
1688
  }
1358
1689
  static fromIdentifierSync(t, n = 0) {
1359
- const { decimal: a, identifier: i } = ne(t);
1360
- return new v({ decimal: a, identifier: i, value: n });
1690
+ const { decimal: a, identifier: s } = ie(t);
1691
+ return new v({ decimal: a, identifier: s, value: n });
1361
1692
  }
1362
1693
  static fromChainOrSignature(t, n = 0) {
1363
- const { decimal: a, identifier: i } = rt(t);
1364
- return new v({ value: n, decimal: a, identifier: i });
1694
+ const { decimal: a, identifier: s } = bt(t);
1695
+ return new v({ value: n, decimal: a, identifier: s });
1365
1696
  }
1366
1697
  static async fromTCQuote(t, n = 0) {
1367
- const a = await ge(ue(t)), i = this.shiftDecimals({ value: n, from: E.THOR, to: a });
1368
- return new v({ value: i, identifier: t, decimal: a });
1698
+ const a = await De(me(t)), s = this.shiftDecimals({ value: n, from: b.THOR, to: a });
1699
+ return new v({ value: s, identifier: t, decimal: a });
1369
1700
  }
1370
1701
  static fromTCQuoteStatic(t, n = 0) {
1371
- const a = ne(t), i = this.shiftDecimals({
1702
+ const a = ie(t), s = this.shiftDecimals({
1372
1703
  value: n,
1373
- from: E.THOR,
1704
+ from: b.THOR,
1374
1705
  to: a.decimal
1375
1706
  });
1376
- return new v({ ...a, value: i });
1707
+ return new v({ ...a, value: s });
1377
1708
  }
1378
1709
  static async loadStaticAssets() {
1379
1710
  return new Promise(
@@ -1383,14 +1714,14 @@ class v extends pe {
1383
1714
  // Omit ThorchainList from import to avoid decimals conflict (TC uses 8 for all)
1384
1715
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1385
1716
  ThorchainList: a,
1386
- NativeList: i,
1717
+ NativeList: s,
1387
1718
  ...r
1388
1719
  } = await import("@swapkit/tokens");
1389
- de = [i, ...Object.values(r)].reduce(
1390
- (p, { tokens: o }) => (o.forEach(({ identifier: y, chain: T, ...u }) => {
1391
- const l = "decimals" in u ? u.decimals : E[T];
1392
- p.set(y, { identifier: y, decimal: l });
1393
- }), p),
1720
+ ce = [s, ...Object.values(r)].reduce(
1721
+ (o, { tokens: p }) => (p.forEach(({ identifier: u, chain: y, ...d }) => {
1722
+ const c = "decimals" in d ? d.decimals : b[y];
1723
+ o.set(u, { identifier: u, decimal: c });
1724
+ }), o),
1394
1725
  /* @__PURE__ */ new Map()
1395
1726
  ), t({ ok: !0 });
1396
1727
  } catch (a) {
@@ -1404,35 +1735,35 @@ class v extends pe {
1404
1735
  );
1405
1736
  }
1406
1737
  }
1407
- const he = (e) => {
1738
+ const Ie = (e) => {
1408
1739
  const t = v.fromChainOrSignature(e);
1409
1740
  switch (e) {
1410
- case s.Bitcoin:
1411
- case s.Litecoin:
1412
- case s.BitcoinCash:
1741
+ case i.Bitcoin:
1742
+ case i.Litecoin:
1743
+ case i.BitcoinCash:
1413
1744
  return t.add(10001);
1414
- case s.Dogecoin:
1745
+ case i.Dogecoin:
1415
1746
  return t.add(100000001);
1416
- case s.Avalanche:
1417
- case s.Ethereum:
1747
+ case i.Avalanche:
1748
+ case i.Ethereum:
1418
1749
  return t.add(10 * 10 ** 9);
1419
- case s.THORChain:
1420
- case s.Maya:
1750
+ case i.THORChain:
1751
+ case i.Maya:
1421
1752
  return t.add(0);
1422
1753
  default:
1423
1754
  return t.add(1);
1424
1755
  }
1425
- }, ue = (e) => {
1426
- const t = e.slice(0, 14).includes("/"), n = e.includes(".") ? e : `${s.THORChain}.${e}`, [a, i] = n.split("."), [r, p] = i.split("-");
1756
+ }, me = (e) => {
1757
+ const t = e.slice(0, 14).includes("/"), n = e.includes(".") ? e : `${i.THORChain}.${e}`, [a, s] = n.split("."), [r, o] = s.split("-");
1427
1758
  return {
1428
- address: p == null ? void 0 : p.toLowerCase(),
1759
+ address: o == null ? void 0 : o.toLowerCase(),
1429
1760
  chain: a,
1430
- isGasAsset: it({ chain: a, symbol: i }),
1761
+ isGasAsset: ft({ chain: a, symbol: s }),
1431
1762
  isSynthetic: t,
1432
- symbol: p ? `${r}-${(p == null ? void 0 : p.toLowerCase()) ?? ""}` : i,
1433
- ticker: t ? i : r
1763
+ symbol: o ? `${r}-${(o == null ? void 0 : o.toLowerCase()) ?? ""}` : s,
1764
+ ticker: t ? s : r
1434
1765
  };
1435
- }, Tt = {
1766
+ }, Wt = {
1436
1767
  /**
1437
1768
  * Core
1438
1769
  */
@@ -1489,17 +1820,17 @@ const he = (e) => {
1489
1820
  */
1490
1821
  helpers_number_different_decimals: 99101
1491
1822
  };
1492
- class c extends Error {
1823
+ class m extends Error {
1493
1824
  constructor(t, n) {
1494
- console.error(n), super(t, { cause: { code: Tt[t], message: t } }), Object.setPrototypeOf(this, c.prototype);
1825
+ console.error(n), super(t, { cause: { code: Wt[t], message: t } }), Object.setPrototypeOf(this, m.prototype);
1495
1826
  }
1496
1827
  }
1497
- class ye extends pe {
1828
+ class Te extends le {
1498
1829
  eq(t) {
1499
1830
  return this.eqValue(t);
1500
1831
  }
1501
1832
  }
1502
- const _t = [
1833
+ const qt = [
1503
1834
  {
1504
1835
  inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
1505
1836
  stateMutability: "nonpayable",
@@ -1590,7 +1921,7 @@ const _t = [
1590
1921
  type: "function"
1591
1922
  },
1592
1923
  { stateMutability: "payable", type: "receive" }
1593
- ], ht = [
1924
+ ], jt = [
1594
1925
  {
1595
1926
  inputs: [
1596
1927
  { internalType: "address", name: "_ttp", type: "address" },
@@ -1734,7 +2065,7 @@ const _t = [
1734
2065
  type: "function"
1735
2066
  },
1736
2067
  { stateMutability: "payable", type: "receive" }
1737
- ], ft = [
2068
+ ], Yt = [
1738
2069
  {
1739
2070
  inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
1740
2071
  stateMutability: "nonpayable",
@@ -1839,7 +2170,7 @@ const _t = [
1839
2170
  type: "function"
1840
2171
  },
1841
2172
  { stateMutability: "payable", type: "receive" }
1842
- ], bt = [
2173
+ ], Kt = [
1843
2174
  {
1844
2175
  inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
1845
2176
  stateMutability: "nonpayable",
@@ -1930,7 +2261,7 @@ const _t = [
1930
2261
  type: "function"
1931
2262
  },
1932
2263
  { stateMutability: "payable", type: "receive" }
1933
- ], At = [
2264
+ ], Xt = [
1934
2265
  {
1935
2266
  inputs: [
1936
2267
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2074,7 +2405,7 @@ const _t = [
2074
2405
  type: "function"
2075
2406
  },
2076
2407
  { stateMutability: "payable", type: "receive" }
2077
- ], wt = [
2408
+ ], Jt = [
2078
2409
  {
2079
2410
  inputs: [
2080
2411
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2193,7 +2524,7 @@ const _t = [
2193
2524
  type: "function"
2194
2525
  },
2195
2526
  { stateMutability: "payable", type: "receive" }
2196
- ], Et = [
2527
+ ], Qt = [
2197
2528
  {
2198
2529
  inputs: [
2199
2530
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2312,7 +2643,7 @@ const _t = [
2312
2643
  type: "function"
2313
2644
  },
2314
2645
  { stateMutability: "payable", type: "receive" }
2315
- ], Rt = [
2646
+ ], zt = [
2316
2647
  {
2317
2648
  inputs: [
2318
2649
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2431,7 +2762,7 @@ const _t = [
2431
2762
  type: "function"
2432
2763
  },
2433
2764
  { stateMutability: "payable", type: "receive" }
2434
- ], Ot = [
2765
+ ], Zt = [
2435
2766
  {
2436
2767
  inputs: [
2437
2768
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2550,7 +2881,7 @@ const _t = [
2550
2881
  type: "function"
2551
2882
  },
2552
2883
  { stateMutability: "payable", type: "receive" }
2553
- ], gt = [
2884
+ ], en = [
2554
2885
  {
2555
2886
  inputs: [
2556
2887
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2677,7 +3008,7 @@ const _t = [
2677
3008
  type: "function"
2678
3009
  },
2679
3010
  { stateMutability: "payable", type: "receive" }
2680
- ], It = [
3011
+ ], tn = [
2681
3012
  {
2682
3013
  inputs: [
2683
3014
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2804,7 +3135,7 @@ const _t = [
2804
3135
  type: "function"
2805
3136
  },
2806
3137
  { stateMutability: "payable", type: "receive" }
2807
- ], St = [
3138
+ ], nn = [
2808
3139
  {
2809
3140
  inputs: [
2810
3141
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2931,7 +3262,7 @@ const _t = [
2931
3262
  type: "function"
2932
3263
  },
2933
3264
  { stateMutability: "payable", type: "receive" }
2934
- ], vt = [
3265
+ ], an = [
2935
3266
  {
2936
3267
  inputs: [
2937
3268
  { internalType: "address", name: "_ttp", type: "address" },
@@ -3058,7 +3389,7 @@ const _t = [
3058
3389
  type: "function"
3059
3390
  },
3060
3391
  { stateMutability: "payable", type: "receive" }
3061
- ], Mt = [
3392
+ ], sn = [
3062
3393
  {
3063
3394
  inputs: [
3064
3395
  { internalType: "address", name: "_ttp", type: "address" },
@@ -3185,566 +3516,575 @@ const _t = [
3185
3516
  type: "function"
3186
3517
  },
3187
3518
  { stateMutability: "payable", type: "receive" }
3188
- ], ve = {
3189
- ["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: _t,
3190
- ["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: ft,
3191
- ["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: bt
3192
- }, Ct = {
3193
- ...ve,
3519
+ ], $e = {
3520
+ ["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: qt,
3521
+ ["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: Yt,
3522
+ ["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: Kt
3523
+ }, rn = {
3524
+ ...$e,
3194
3525
  // AVAX
3195
- ["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: wt,
3196
- ["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: ht,
3197
- ["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: Rt,
3526
+ ["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: Jt,
3527
+ ["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: jt,
3528
+ ["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: zt,
3198
3529
  // BSC
3199
- ["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: At,
3530
+ ["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: Xt,
3200
3531
  // 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 = ({
3532
+ ["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: Qt,
3533
+ ["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: Zt,
3534
+ ["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: en,
3535
+ ["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: tn,
3536
+ ["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: nn,
3537
+ ["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: an,
3538
+ ["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: sn
3539
+ }, on = ({
3209
3540
  streamSwap: e,
3210
3541
  contractAddress: t,
3211
3542
  recipient: n,
3212
3543
  toChecksumAddress: a,
3213
3544
  calldata: {
3214
- amount: i,
3545
+ amount: s,
3215
3546
  amountOutMin: r = "",
3216
- data: p = "",
3217
- deadline: o,
3218
- memo: y,
3219
- router: T,
3220
- memoStreamingSwap: u,
3221
- tcMemo: l,
3222
- tcRouter: h,
3223
- tcVault: _,
3547
+ data: o = "",
3548
+ deadline: p,
3549
+ memo: u,
3550
+ router: y,
3551
+ memoStreamingSwap: d,
3552
+ tcMemo: c,
3553
+ tcRouter: _,
3554
+ tcVault: A,
3224
3555
  vault: R,
3225
- token: O
3556
+ token: g
3226
3557
  }
3227
3558
  }) => {
3228
- const S = !!ve[t.toLowerCase()];
3229
- if (S && !T)
3559
+ const E = !!$e[t.toLowerCase()];
3560
+ if (E && !y)
3230
3561
  throw new Error("Router is required on calldata for swapIn with GenericContract");
3231
- const g = l || y, b = e && u || g;
3232
- if (!_ && !R)
3562
+ const I = c || u, S = e && d || I;
3563
+ if (!A && !R)
3233
3564
  throw new Error("TC Vault is required on calldata");
3234
- if (!h && !T)
3565
+ if (!_ && !y)
3235
3566
  throw new Error("TC Router is required on calldata");
3236
- if (!b)
3567
+ if (!S)
3237
3568
  throw new Error("TC Memo is required on calldata");
3238
- if (!O)
3569
+ if (!g)
3239
3570
  throw new Error("Token is required on calldata");
3240
- const M = [
3571
+ const D = [
3241
3572
  // v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
3242
- a(h || T),
3243
- a(_ || R),
3244
- b.replace("{recipientAddress}", n),
3245
- a(O),
3246
- i
3247
- ], ee = S ? [a(T), p, o] : [r, o];
3248
- return [...M, ...ee];
3249
- }, xt = ({ chain: e, txHash: t }) => {
3250
- const n = Ee[e];
3573
+ a(_ || y),
3574
+ a(A || R),
3575
+ S.replace("{recipientAddress}", n),
3576
+ a(g),
3577
+ s
3578
+ ], Fe = E ? [a(y), o, p] : [r, p];
3579
+ return [...D, ...Fe];
3580
+ }, pn = ({ chain: e, txHash: t }) => {
3581
+ const n = Ne[e];
3251
3582
  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:
3583
+ case i.Binance:
3584
+ case i.Bitcoin:
3585
+ case i.BitcoinCash:
3586
+ case i.Maya:
3587
+ case i.Kujira:
3588
+ case i.THORChain:
3258
3589
  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:
3590
+ case i.Arbitrum:
3591
+ case i.Avalanche:
3592
+ case i.BinanceSmartChain:
3593
+ case i.Ethereum:
3594
+ case i.Optimism:
3595
+ case i.Polygon:
3265
3596
  return `${n}/tx/${t.startsWith("0x") ? t : `0x${t}`}`;
3266
- case s.Cosmos:
3597
+ case i.Cosmos:
3267
3598
  return `${n}/transactions/${t}`;
3268
- case s.Dogecoin:
3599
+ case i.Dogecoin:
3269
3600
  return `${n}/transaction/${t.toLowerCase()}`;
3270
- case s.Litecoin:
3601
+ case i.Litecoin:
3271
3602
  return `${n}/${t}`;
3272
3603
  default:
3273
3604
  throw new Error(`Unsupported chain: ${e}`);
3274
3605
  }
3275
- }, Dt = ({ chain: e, address: t }) => {
3276
- const n = Ee[e];
3606
+ }, dn = ({ chain: e, address: t }) => {
3607
+ const n = Ne[e];
3277
3608
  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:
3609
+ case i.Arbitrum:
3610
+ case i.Avalanche:
3611
+ case i.Binance:
3612
+ case i.BinanceSmartChain:
3613
+ case i.Bitcoin:
3614
+ case i.BitcoinCash:
3615
+ case i.Dogecoin:
3616
+ case i.Ethereum:
3617
+ case i.Maya:
3618
+ case i.Optimism:
3619
+ case i.Polygon:
3620
+ case i.Kujira:
3621
+ case i.THORChain:
3291
3622
  return `${n}/address/${t}`;
3292
- case s.Cosmos:
3623
+ case i.Cosmos:
3293
3624
  return `${n}/account/${t}`;
3294
- case s.Litecoin:
3625
+ case i.Litecoin:
3295
3626
  return `${n}/${t}`;
3296
3627
  default:
3297
3628
  throw new Error(`Unsupported chain: ${e}`);
3298
3629
  }
3299
- }, Pt = (e) => {
3630
+ }, un = (e) => {
3300
3631
  const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
3301
- return Re(`${t}/thorchain/inbound_addresses`);
3302
- }, Bt = (e) => {
3632
+ return be.get(`${t}/thorchain/inbound_addresses`);
3633
+ }, ln = (e) => {
3303
3634
  const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
3304
- return Re(`${t}/thorchain/mimir`);
3305
- }, fe = () => Object.values(s).reduce(
3635
+ return be.get(`${t}/thorchain/mimir`);
3636
+ }, Se = () => Object.values(i).reduce(
3306
3637
  (e, t) => (e[t] = null, e),
3307
3638
  {}
3308
3639
  );
3309
- var B, z, K, x, Y, X;
3310
- class en {
3640
+ var B, te, j, N, Y, K;
3641
+ class Nn {
3311
3642
  constructor({ stagenet: t } = {}) {
3312
- m(this, "connectedChains", fe());
3313
- m(this, "connectedWallets", fe());
3314
- m(this, "stagenet", !1);
3315
- m(this, "getAddress", (t) => {
3643
+ T(this, "connectedChains", Se());
3644
+ T(this, "connectedWallets", Se());
3645
+ T(this, "stagenet", !1);
3646
+ T(this, "getAddress", (t) => {
3316
3647
  var n;
3317
3648
  return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
3318
3649
  });
3319
- m(this, "getExplorerTxUrl", (t, n) => xt({ chain: t, txHash: n }));
3320
- m(this, "getWallet", (t) => this.connectedWallets[t]);
3321
- m(this, "getExplorerAddressUrl", (t, n) => Dt({ chain: t, address: n }));
3322
- m(this, "getBalance", async (t, n) => {
3650
+ T(this, "getExplorerTxUrl", (t, n) => pn({ chain: t, txHash: n }));
3651
+ T(this, "getWallet", (t) => this.connectedWallets[t]);
3652
+ T(this, "getExplorerAddressUrl", (t, n) => dn({ chain: t, address: n }));
3653
+ T(this, "getBalance", async (t, n) => {
3323
3654
  const a = await this.getWalletByChain(t, n);
3324
3655
  return (a == null ? void 0 : a.balance) || [];
3325
3656
  });
3326
- m(this, "swap", async ({ streamSwap: t, recipient: n, route: a, feeOptionKey: i }) => {
3327
- var o, y, T, u;
3328
- const { quoteMode: r } = a.meta, p = r.startsWith("ERC20-") ? s.Ethereum : r.startsWith("ARC20-") ? s.Avalanche : s.BinanceSmartChain;
3657
+ T(this, "swap", async ({ streamSwap: t, recipient: n, route: a, feeOptionKey: s }) => {
3658
+ var p, u;
3659
+ const { quoteMode: r } = a.meta, o = r.startsWith("ERC20-") ? i.Ethereum : r.startsWith("ARC20-") ? i.Avalanche : i.BinanceSmartChain;
3329
3660
  if (!a.complete)
3330
- throw new c("core_swap_route_not_complete");
3661
+ throw new m("core_swap_route_not_complete");
3331
3662
  try {
3332
- if (Ue.includes(r)) {
3333
- const l = this.connectedWallets[p];
3334
- if (!(l != null && l.sendTransaction))
3335
- throw new c("core_wallet_connection_not_found");
3336
- if (!(t ? (o = a == null ? void 0 : a.streamingSwap) == null ? void 0 : o.transaction : a == null ? void 0 : a.transaction))
3337
- throw new c("core_swap_route_transaction_not_found");
3338
- const { isHexString: _, parseUnits: R } = await import("./index-cf1865cd.js"), { data: O, from: S, to: g, value: b } = a.transaction, M = {
3339
- data: O,
3340
- from: S,
3663
+ if (ze.includes(r)) {
3664
+ const y = this.connectedWallets[o];
3665
+ if (!(y != null && y.sendTransaction))
3666
+ throw new m("core_wallet_connection_not_found");
3667
+ if (!(t ? (p = a == null ? void 0 : a.streamingSwap) == null ? void 0 : p.transaction : a == null ? void 0 : a.transaction))
3668
+ throw new m("core_swap_route_transaction_not_found");
3669
+ const { isHexString: c, parseUnits: _ } = await import("./index-cf1865cd.js"), { data: A, from: R, to: g, value: E } = a.transaction, I = {
3670
+ data: A,
3671
+ from: R,
3341
3672
  to: g.toLowerCase(),
3342
- chainId: BigInt(Ke[p]),
3343
- value: b ? new ye({
3344
- value: _(b) ? b : R(b, "wei").toString(16)
3673
+ chainId: BigInt(rt[o]),
3674
+ value: E ? new Te({
3675
+ value: c(E) ? E : _(E, "wei").toString(16)
3345
3676
  }).baseValueBigInt : 0n
3346
3677
  };
3347
- return l.sendTransaction(M, i);
3678
+ return y.sendTransaction(I, s);
3348
3679
  }
3349
- if ($e.includes(r)) {
3680
+ if (et.includes(r)) {
3350
3681
  if (!a.calldata.fromAsset)
3351
- throw new c("core_swap_asset_not_recognized");
3352
- const l = await v.fromString(a.calldata.fromAsset);
3353
- if (!l)
3354
- throw new c("core_swap_asset_not_recognized");
3355
- const { address: h } = await A(this, B).call(this, l.chain), {
3356
- contract: _,
3357
- calldata: { amountIn: R, memo: O, memoStreamingSwap: S }
3358
- } = a, g = l.add(ye.fromBigInt(BigInt(R), l.decimal)), b = t && S || O;
3359
- return this.deposit({ assetValue: g, memo: b, feeOptionKey: i, router: _, recipient: h });
3682
+ throw new m("core_swap_asset_not_recognized");
3683
+ const y = await v.fromString(a.calldata.fromAsset);
3684
+ if (!y)
3685
+ throw new m("core_swap_asset_not_recognized");
3686
+ const { address: d } = await f(this, B).call(this, y.chain), {
3687
+ contract: c,
3688
+ calldata: { expiration: _, amountIn: A, memo: R, memoStreamingSwap: g }
3689
+ } = a, E = y.add(Te.fromBigInt(BigInt(A), y.decimal)), I = t && g || R;
3690
+ return this.deposit({
3691
+ expiration: _,
3692
+ assetValue: E,
3693
+ memo: I,
3694
+ feeOptionKey: s,
3695
+ router: c,
3696
+ recipient: d
3697
+ });
3360
3698
  }
3361
- if (He.includes(r)) {
3362
- const { calldata: l, contract: h } = a;
3363
- if (!h)
3364
- throw new c("core_swap_contract_not_found");
3365
- const _ = this.connectedWallets[p], R = this.getAddress(p);
3366
- if (!(_ != null && _.sendTransaction) || !R)
3367
- throw new c("core_wallet_connection_not_found");
3368
- const { getProvider: O, toChecksumAddress: S } = await import("@swapkit/toolbox-evm"), g = O(p), b = Ct[h.toLowerCase()];
3369
- if (!b)
3370
- throw new c("core_swap_contract_not_supported", { contractAddress: h });
3371
- const ee = await ((u = (T = (await ((y = _.createContract) == null ? void 0 : y.call(_, h, b, g))).populateTransaction).swapIn) == null ? void 0 : u.call(
3372
- T,
3373
- ...Nt({
3699
+ if (Ze.includes(r)) {
3700
+ const { calldata: y, contract: d } = a;
3701
+ if (!d)
3702
+ throw new m("core_swap_contract_not_found");
3703
+ const c = this.connectedWallets[o], _ = this.getAddress(o);
3704
+ if (!(c != null && c.sendTransaction) || !_)
3705
+ throw new m("core_wallet_connection_not_found");
3706
+ const { getProvider: A, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), g = A(o), E = rn[d.toLowerCase()];
3707
+ if (!E)
3708
+ throw new m("core_swap_contract_not_supported", { contractAddress: d });
3709
+ const S = await (await ((u = c.createContract) == null ? void 0 : u.call(c, d, E, g))).getFunction("swapIn").populateTransaction(
3710
+ ...on({
3374
3711
  streamSwap: t,
3375
- toChecksumAddress: S,
3376
- contractAddress: h,
3712
+ toChecksumAddress: R,
3713
+ contractAddress: d,
3377
3714
  recipient: n,
3378
- calldata: l
3715
+ calldata: y
3379
3716
  }),
3380
- { from: R }
3381
- ));
3382
- return _.sendTransaction(ee, i);
3717
+ { from: _ }
3718
+ );
3719
+ return c.sendTransaction(S, s);
3383
3720
  }
3384
- throw new c("core_swap_quote_mode_not_supported", { quoteMode: r });
3385
- } catch (l) {
3386
- throw new c("core_swap_transaction_error", l);
3721
+ throw new m("core_swap_quote_mode_not_supported", { quoteMode: r });
3722
+ } catch (y) {
3723
+ throw new m("core_swap_transaction_error", y);
3387
3724
  }
3388
3725
  });
3389
- m(this, "getWalletByChain", async (t, n) => {
3390
- var r, p;
3726
+ T(this, "getWalletByChain", async (t, n) => {
3727
+ var r, o;
3391
3728
  const a = this.getAddress(t);
3392
3729
  if (!a)
3393
3730
  return null;
3394
- const i = await ((r = this.getWallet(t)) == null ? void 0 : r.getBalance(a, n)) ?? [
3731
+ const s = await ((r = this.getWallet(t)) == null ? void 0 : r.getBalance(a, n)) ?? [
3395
3732
  v.fromChainOrSignature(t)
3396
3733
  ];
3397
3734
  return this.connectedChains[t] = {
3398
3735
  address: a,
3399
- balance: i,
3400
- walletType: (p = this.connectedChains[t]) == null ? void 0 : p.walletType
3736
+ balance: s,
3737
+ walletType: (o = this.connectedChains[t]) == null ? void 0 : o.walletType
3401
3738
  }, { ...this.connectedChains[t] };
3402
3739
  });
3403
- m(this, "approveAssetValue", (t, n) => A(this, K).call(this, { assetValue: t, type: "approve", contractAddress: n }));
3404
- m(this, "isAssetValueApproved", (t, n) => A(this, K).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
3405
- m(this, "validateAddress", ({ address: t, chain: n }) => {
3406
- var a, i;
3407
- return (i = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : i.call(a, t);
3740
+ T(this, "approveAssetValue", (t, n) => f(this, j).call(this, { assetValue: t, type: "approve", contractAddress: n }));
3741
+ T(this, "isAssetValueApproved", (t, n) => f(this, j).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
3742
+ T(this, "validateAddress", ({ address: t, chain: n }) => {
3743
+ var a, s;
3744
+ return (s = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : s.call(a, t);
3408
3745
  });
3409
- m(this, "transfer", async (t) => {
3746
+ T(this, "transfer", async (t) => {
3410
3747
  const n = this.connectedWallets[t.assetValue.chain];
3411
3748
  if (!n)
3412
- throw new c("core_wallet_connection_not_found");
3749
+ throw new m("core_wallet_connection_not_found");
3413
3750
  try {
3414
- return await n.transfer(A(this, X).call(this, t));
3751
+ return await n.transfer(f(this, K).call(this, t));
3415
3752
  } catch (a) {
3416
- throw new c("core_swap_transaction_error", a);
3753
+ throw new m("core_swap_transaction_error", a);
3417
3754
  }
3418
3755
  });
3419
- m(this, "deposit", async ({
3756
+ T(this, "deposit", async ({
3420
3757
  assetValue: t,
3421
3758
  recipient: n,
3422
3759
  router: a,
3423
- ...i
3760
+ ...s
3424
3761
  }) => {
3425
- const { chain: r, symbol: p, ticker: o } = t, y = this.connectedWallets[r];
3426
- if (!y)
3427
- throw new c("core_wallet_connection_not_found");
3428
- const T = A(this, X).call(this, { assetValue: t, recipient: n, router: a, ...i });
3762
+ const { chain: r, symbol: o, ticker: p } = t, u = this.connectedWallets[r];
3763
+ if (!u)
3764
+ throw new m("core_wallet_connection_not_found");
3765
+ const y = f(this, K).call(this, { assetValue: t, recipient: n, router: a, ...s });
3429
3766
  try {
3430
3767
  switch (r) {
3431
- case s.THORChain: {
3432
- const u = y;
3433
- return await (n === "" ? u.deposit(T) : u.transfer(T));
3768
+ case i.THORChain: {
3769
+ const d = u;
3770
+ return await (n === "" ? d.deposit(y) : d.transfer(y));
3434
3771
  }
3435
- case s.Ethereum:
3436
- case s.BinanceSmartChain:
3437
- case s.Avalanche: {
3438
- const { getChecksumAddressFromAsset: u } = await import("@swapkit/toolbox-evm"), l = r === s.Avalanche ? Be : r === s.BinanceSmartChain ? Ve : Pe;
3439
- return await y.call({
3440
- abi: l,
3441
- contractAddress: a || (await A(this, B).call(this, r)).router,
3772
+ case i.Ethereum:
3773
+ case i.BinanceSmartChain:
3774
+ case i.Avalanche: {
3775
+ const { getChecksumAddressFromAsset: d } = await import("@swapkit/toolbox-evm"), c = r === i.Avalanche ? Xe : r === i.BinanceSmartChain ? Je : Ke;
3776
+ return await u.call({
3777
+ abi: c,
3778
+ contractAddress: a || (await f(this, B).call(this, r)).router,
3442
3779
  funcName: "depositWithExpiry",
3443
3780
  funcParams: [
3444
3781
  n,
3445
- u({ chain: r, symbol: p, ticker: o }, r),
3782
+ d({ chain: r, symbol: o, ticker: p }, r),
3446
3783
  // TODO: (@Towan) Re-Check on that conversion 🙏
3447
- t.baseValueBigInt.toString(),
3448
- T.memo,
3449
- i.expiration
3784
+ t.getBaseValue("bigint").toString(),
3785
+ y.memo,
3786
+ s.expiration
3450
3787
  ],
3451
- txOverrides: { from: T.from, value: t.baseValueBigInt }
3788
+ txOverrides: {
3789
+ from: y.from,
3790
+ value: t.isGasAsset ? t.getBaseValue("bigint") : void 0
3791
+ }
3452
3792
  });
3453
3793
  }
3454
3794
  default:
3455
- return await y.transfer(T);
3795
+ return await u.transfer(y);
3456
3796
  }
3457
- } catch (u) {
3458
- const l = ((u == null ? void 0 : u.message) || (u == null ? void 0 : u.toString())).toLowerCase(), h = l == null ? void 0 : l.includes("insufficient funds"), _ = l == null ? void 0 : l.includes("gas"), R = l == null ? void 0 : l.includes("server"), O = h ? "core_transaction_deposit_insufficient_funds_error" : _ ? "core_transaction_deposit_gas_error" : R ? "core_transaction_deposit_server_error" : "core_transaction_deposit_error";
3459
- throw new c(O, u);
3797
+ } catch (d) {
3798
+ 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";
3799
+ throw new m(g, d);
3460
3800
  }
3461
3801
  });
3462
3802
  /**
3463
3803
  * TC related Methods
3464
3804
  */
3465
- m(this, "createLiquidity", async ({
3805
+ T(this, "createLiquidity", async ({
3466
3806
  runeAssetValue: t,
3467
3807
  assetValue: n
3468
3808
  }) => {
3469
3809
  if (t.lte(0) || n.lte(0))
3470
- throw new c("core_transaction_create_liquidity_invalid_params");
3471
- let a = "", i = "";
3810
+ throw new m("core_transaction_create_liquidity_invalid_params");
3811
+ let a = "", s = "";
3472
3812
  try {
3473
- a = await A(this, x).call(this, {
3813
+ a = await f(this, N).call(this, {
3474
3814
  assetValue: t,
3475
- memo: D(f.DEPOSIT, {
3815
+ memo: x(h.DEPOSIT, {
3476
3816
  ...n,
3477
3817
  address: this.getAddress(n.chain)
3478
3818
  })
3479
3819
  });
3480
3820
  } catch (r) {
3481
- throw new c("core_transaction_create_liquidity_rune_error", r);
3821
+ throw new m("core_transaction_create_liquidity_rune_error", r);
3482
3822
  }
3483
3823
  try {
3484
- i = await A(this, x).call(this, {
3824
+ s = await f(this, N).call(this, {
3485
3825
  assetValue: n,
3486
- memo: D(f.DEPOSIT, {
3826
+ memo: x(h.DEPOSIT, {
3487
3827
  ...n,
3488
- address: this.getAddress(s.THORChain)
3828
+ address: this.getAddress(i.THORChain)
3489
3829
  })
3490
3830
  });
3491
3831
  } catch (r) {
3492
- throw new c("core_transaction_create_liquidity_asset_error", r);
3832
+ throw new m("core_transaction_create_liquidity_asset_error", r);
3493
3833
  }
3494
- return { runeTx: a, assetTx: i };
3834
+ return { runeTx: a, assetTx: s };
3495
3835
  });
3496
- m(this, "addLiquidity", async ({
3836
+ T(this, "addLiquidity", async ({
3497
3837
  poolIdentifier: t,
3498
3838
  runeAssetValue: n,
3499
3839
  assetValue: a,
3500
- runeAddr: i,
3840
+ runeAddr: s,
3501
3841
  assetAddr: r,
3502
- isPendingSymmAsset: p,
3503
- mode: o = "sym"
3842
+ isPendingSymmAsset: o,
3843
+ mode: p = "sym"
3504
3844
  }) => {
3505
- const [y, ...T] = t.split("."), u = o === "sym", l = (n == null ? void 0 : n.gt(0)) && (u || o === "rune"), h = (a == null ? void 0 : a.gt(0)) && (u || o === "asset"), _ = p || l, R = _ ? i || this.getAddress(s.THORChain) : "", O = u || o === "asset" ? r || this.getAddress(y) : "";
3506
- if (!l && !h)
3507
- throw new c("core_transaction_add_liquidity_invalid_params");
3508
- if (_ && !R)
3509
- throw new c("core_transaction_add_liquidity_no_rune_address");
3510
- let S, g;
3511
- const b = { chain: y, symbol: T.join(".") };
3512
- if (l && n)
3845
+ 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) : "";
3846
+ if (!c && !_)
3847
+ throw new m("core_transaction_add_liquidity_invalid_params");
3848
+ if (A && !R)
3849
+ throw new m("core_transaction_add_liquidity_no_rune_address");
3850
+ let E, I;
3851
+ const S = { chain: u, symbol: y.join(".") };
3852
+ if (c && n)
3513
3853
  try {
3514
- S = await A(this, x).call(this, {
3854
+ E = await f(this, N).call(this, {
3515
3855
  assetValue: n,
3516
- memo: D(f.DEPOSIT, { ...b, address: O })
3856
+ memo: x(h.DEPOSIT, { ...S, address: g })
3517
3857
  });
3518
- } catch (M) {
3519
- throw new c("core_transaction_add_liquidity_rune_error", M);
3858
+ } catch (D) {
3859
+ throw new m("core_transaction_add_liquidity_rune_error", D);
3520
3860
  }
3521
- if (h && a)
3861
+ if (_ && a)
3522
3862
  try {
3523
- g = await A(this, x).call(this, {
3863
+ I = await f(this, N).call(this, {
3524
3864
  assetValue: a,
3525
- memo: D(f.DEPOSIT, { ...b, address: R })
3865
+ memo: x(h.DEPOSIT, { ...S, address: R })
3526
3866
  });
3527
- } catch (M) {
3528
- throw new c("core_transaction_add_liquidity_asset_error", M);
3867
+ } catch (D) {
3868
+ throw new m("core_transaction_add_liquidity_asset_error", D);
3529
3869
  }
3530
- return { runeTx: S, assetTx: g };
3870
+ return { runeTx: E, assetTx: I };
3531
3871
  });
3532
- m(this, "withdraw", async ({
3872
+ T(this, "withdraw", async ({
3533
3873
  memo: t,
3534
3874
  assetValue: n,
3535
3875
  percent: a,
3536
- from: i,
3876
+ from: s,
3537
3877
  to: r
3538
3878
  }) => {
3539
- const p = r === "rune" ? v.fromChainOrSignature(s.THORChain) : i === "sym" && r === "sym" || i === "rune" || i === "asset" ? void 0 : n;
3879
+ const o = r === "rune" ? v.fromChainOrSignature(i.THORChain) : s === "sym" && r === "sym" || s === "rune" || s === "asset" ? void 0 : n;
3540
3880
  try {
3541
- return await A(this, x).call(this, {
3542
- assetValue: he(i === "asset" ? n.chain : s.THORChain),
3543
- memo: t || D(f.WITHDRAW, {
3881
+ return await f(this, N).call(this, {
3882
+ assetValue: Ie(s === "asset" ? n.chain : i.THORChain),
3883
+ memo: t || x(h.WITHDRAW, {
3544
3884
  symbol: n.symbol,
3545
3885
  chain: n.chain,
3546
3886
  ticker: n.ticker,
3547
3887
  basisPoints: Math.max(1e4, Math.round(a * 100)),
3548
- targetAssetString: p == null ? void 0 : p.toString(),
3888
+ targetAssetString: o == null ? void 0 : o.toString(),
3549
3889
  singleSide: !1
3550
3890
  })
3551
3891
  });
3552
- } catch (o) {
3553
- throw new c("core_transaction_withdraw_error", o);
3892
+ } catch (p) {
3893
+ throw new m("core_transaction_withdraw_error", p);
3554
3894
  }
3555
3895
  });
3556
- m(this, "savings", async ({
3896
+ T(this, "savings", async ({
3557
3897
  assetValue: t,
3558
3898
  memo: n,
3559
3899
  percent: a,
3560
- type: i
3900
+ type: s
3561
3901
  }) => {
3562
- const r = i === "add" ? f.DEPOSIT : f.WITHDRAW, p = n || D(r, {
3902
+ const r = s === "add" ? h.DEPOSIT : h.WITHDRAW, o = n || x(r, {
3563
3903
  ticker: t.ticker,
3564
3904
  symbol: t.symbol,
3565
3905
  chain: t.chain,
3566
3906
  singleSide: !0,
3567
3907
  basisPoints: a ? Math.max(1e4, Math.round(a * 100)) : void 0
3568
3908
  });
3569
- return A(this, x).call(this, { assetValue: t, memo: p });
3909
+ return f(this, N).call(this, { assetValue: t, memo: o });
3570
3910
  });
3571
- m(this, "loan", ({
3911
+ T(this, "loan", ({
3572
3912
  assetValue: t,
3573
3913
  memo: n,
3574
3914
  minAmount: a,
3575
- type: i
3576
- }) => A(this, x).call(this, {
3915
+ type: s
3916
+ }) => f(this, N).call(this, {
3577
3917
  assetValue: t,
3578
- memo: n || D(i === "open" ? f.OPEN_LOAN : f.CLOSE_LOAN, {
3918
+ memo: n || x(s === "open" ? h.OPEN_LOAN : h.CLOSE_LOAN, {
3579
3919
  asset: t.toString(),
3580
3920
  minAmount: a.toString(),
3581
3921
  address: this.getAddress(t.chain)
3582
3922
  })
3583
3923
  }));
3584
- m(this, "nodeAction", ({
3924
+ T(this, "nodeAction", ({
3585
3925
  type: t,
3586
3926
  assetValue: n,
3587
3927
  address: a
3588
3928
  }) => {
3589
- const i = t === "bond" ? f.BOND : t === "unbond" ? f.UNBOND : f.LEAVE, r = D(i, {
3929
+ const s = t === "bond" ? h.BOND : t === "unbond" ? h.UNBOND : h.LEAVE, r = x(s, {
3590
3930
  address: a,
3591
3931
  unbondAmount: t === "unbond" ? n.baseValueNumber : void 0
3592
3932
  });
3593
- return A(this, Y).call(this, {
3933
+ return f(this, Y).call(this, {
3594
3934
  memo: r,
3595
- assetValue: t === "bond" ? n : he(s.THORChain)
3935
+ assetValue: t === "bond" ? n : Ie(i.THORChain)
3596
3936
  });
3597
3937
  });
3598
- m(this, "registerThorname", ({
3938
+ T(this, "registerThorname", ({
3599
3939
  assetValue: t,
3600
3940
  ...n
3601
- }) => A(this, Y).call(this, { assetValue: t, memo: D(f.THORNAME_REGISTER, n) }));
3602
- m(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: i = {} }) => {
3941
+ }) => f(this, Y).call(this, { assetValue: t, memo: x(h.THORNAME_REGISTER, n) }));
3942
+ T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: s = {} }) => {
3603
3943
  try {
3604
3944
  t.forEach((r) => {
3605
3945
  this[r.connectMethodName] = r.connect({
3606
- addChain: A(this, z),
3946
+ addChain: f(this, te),
3607
3947
  config: n || {},
3608
3948
  apis: a,
3609
- rpcUrls: i
3949
+ rpcUrls: s
3610
3950
  });
3611
3951
  });
3612
3952
  } catch (r) {
3613
- throw new c("core_extend_error", r);
3953
+ throw new m("core_extend_error", r);
3614
3954
  }
3615
3955
  });
3616
- m(this, "estimateMaxSendableAmount", async ({
3956
+ T(this, "estimateMaxSendableAmount", async ({
3617
3957
  chain: t,
3618
3958
  params: n
3619
3959
  }) => {
3620
3960
  const a = this.getWallet(t);
3621
3961
  switch (t) {
3622
- case s.Arbitrum:
3623
- case s.Avalanche:
3624
- case s.BinanceSmartChain:
3625
- case s.Ethereum:
3626
- case s.Optimism:
3627
- case s.Polygon: {
3628
- const { estimateMaxSendableAmount: i } = await import("@swapkit/toolbox-evm");
3629
- return i({
3962
+ case i.Arbitrum:
3963
+ case i.Avalanche:
3964
+ case i.BinanceSmartChain:
3965
+ case i.Ethereum:
3966
+ case i.Optimism:
3967
+ case i.Polygon: {
3968
+ const { estimateMaxSendableAmount: s } = await import("@swapkit/toolbox-evm");
3969
+ return s({
3630
3970
  ...n,
3631
3971
  toolbox: a
3632
3972
  });
3633
3973
  }
3634
- case s.Bitcoin:
3635
- case s.BitcoinCash:
3636
- case s.Dogecoin:
3637
- case s.Litecoin:
3974
+ case i.Bitcoin:
3975
+ case i.BitcoinCash:
3976
+ case i.Dogecoin:
3977
+ case i.Litecoin:
3638
3978
  return a.estimateMaxSendableAmount(n);
3639
- case s.Binance:
3640
- case s.THORChain:
3641
- case s.Cosmos: {
3642
- const { estimateMaxSendableAmount: i } = await import("@swapkit/toolbox-cosmos");
3643
- return i({
3979
+ case i.Binance:
3980
+ case i.THORChain:
3981
+ case i.Cosmos: {
3982
+ const { estimateMaxSendableAmount: s } = await import("@swapkit/toolbox-cosmos");
3983
+ return s({
3644
3984
  ...n,
3645
3985
  toolbox: a
3646
3986
  });
3647
3987
  }
3648
3988
  default:
3649
- throw new c("core_estimated_max_spendable_chain_not_supported");
3989
+ throw new m("core_estimated_max_spendable_chain_not_supported");
3650
3990
  }
3651
3991
  });
3652
3992
  /**
3653
3993
  * Wallet connection methods
3654
3994
  */
3655
- m(this, "connectXDEFI", async (t) => {
3656
- throw new c("core_wallet_xdefi_not_installed");
3995
+ T(this, "connectXDEFI", async (t) => {
3996
+ throw new m("core_wallet_xdefi_not_installed");
3657
3997
  });
3658
- m(this, "connectEVMWallet", async (t, n) => {
3659
- throw new c("core_wallet_evmwallet_not_installed");
3998
+ T(this, "connectEVMWallet", async (t, n) => {
3999
+ throw new m("core_wallet_evmwallet_not_installed");
3660
4000
  });
3661
- m(this, "connectWalletconnect", async (t, n) => {
3662
- throw new c("core_wallet_walletconnect_not_installed");
4001
+ T(this, "connectWalletconnect", async (t, n) => {
4002
+ throw new m("core_wallet_walletconnect_not_installed");
3663
4003
  });
3664
- m(this, "connectKeystore", async (t, n) => {
3665
- throw new c("core_wallet_keystore_not_installed");
4004
+ T(this, "connectKeystore", async (t, n) => {
4005
+ throw new m("core_wallet_keystore_not_installed");
3666
4006
  });
3667
- m(this, "connectLedger", async (t, n) => {
3668
- throw new c("core_wallet_ledger_not_installed");
4007
+ T(this, "connectLedger", async (t, n) => {
4008
+ throw new m("core_wallet_ledger_not_installed");
3669
4009
  });
3670
- m(this, "connectTrezor", async (t, n) => {
3671
- throw new c("core_wallet_trezor_not_installed");
4010
+ T(this, "connectTrezor", async (t, n) => {
4011
+ throw new m("core_wallet_trezor_not_installed");
3672
4012
  });
3673
- m(this, "connectKeplr", async (t) => {
3674
- throw new c("core_wallet_keplr_not_installed");
4013
+ T(this, "connectKeplr", async (t) => {
4014
+ throw new m("core_wallet_keplr_not_installed");
3675
4015
  });
3676
- m(this, "connectOkx", async (t) => {
3677
- throw new c("core_wallet_okx_not_installed");
4016
+ T(this, "connectOkx", async (t) => {
4017
+ throw new m("core_wallet_okx_not_installed");
3678
4018
  });
3679
- m(this, "disconnectChain", (t) => {
4019
+ T(this, "disconnectChain", (t) => {
3680
4020
  this.connectedChains[t] = null, this.connectedWallets[t] = null;
3681
4021
  });
3682
4022
  P(this, B, async (t) => {
3683
- if (t === s.THORChain)
4023
+ if (t === i.THORChain)
3684
4024
  return {
3685
4025
  gas_rate: "0",
3686
4026
  router: "0",
3687
4027
  address: "",
3688
4028
  halted: !1,
3689
- chain: s.THORChain
4029
+ chain: i.THORChain
3690
4030
  };
3691
- const a = (await Pt(this.stagenet)).find((i) => i.chain === t);
4031
+ const a = (await un(this.stagenet)).find((s) => s.chain === t);
3692
4032
  if (!a)
3693
- throw new c("core_inbound_data_not_found");
4033
+ throw new m("core_inbound_data_not_found");
3694
4034
  if (a != null && a.halted)
3695
- throw new c("core_chain_halted");
4035
+ throw new m("core_chain_halted");
3696
4036
  return a;
3697
4037
  });
3698
- P(this, z, ({ chain: t, wallet: n, walletMethods: a }) => {
4038
+ P(this, te, ({ chain: t, wallet: n, walletMethods: a }) => {
3699
4039
  this.connectedChains[t] = n, this.connectedWallets[t] = a;
3700
4040
  });
3701
- P(this, K, async ({
3702
- assetValue: { baseValueBigInt: t, address: n, chain: a, isGasAsset: i, isSynthetic: r },
3703
- type: p = "checkOnly",
3704
- contractAddress: o
4041
+ P(this, j, async ({
4042
+ assetValue: { baseValueBigInt: t, address: n, chain: a, isGasAsset: s, isSynthetic: r },
4043
+ type: o = "checkOnly",
4044
+ contractAddress: p
3705
4045
  }) => {
3706
- const y = [s.Ethereum, s.Avalanche, s.BinanceSmartChain].includes(a);
3707
- if (y && i || !y || r)
4046
+ const u = [i.Ethereum, i.Avalanche, i.BinanceSmartChain].includes(a);
4047
+ if (u && s || !u || r)
3708
4048
  return !0;
3709
- const u = this.connectedWallets[a], l = p === "checkOnly" ? u == null ? void 0 : u.isApproved : u == null ? void 0 : u.approve;
3710
- if (!l)
3711
- throw new c("core_wallet_connection_not_found");
3712
- const h = this.getAddress(a);
3713
- if (!n || !h)
3714
- throw new c("core_approve_asset_address_or_from_not_found");
3715
- const _ = o || (await A(this, B).call(this, a)).router;
3716
- return l({
4049
+ const d = this.connectedWallets[a], c = o === "checkOnly" ? d == null ? void 0 : d.isApproved : d == null ? void 0 : d.approve;
4050
+ if (!c)
4051
+ throw new m("core_wallet_connection_not_found");
4052
+ const _ = this.getAddress(a);
4053
+ if (!n || !_)
4054
+ throw new m("core_approve_asset_address_or_from_not_found");
4055
+ const A = p || (await f(this, B).call(this, a)).router;
4056
+ return c({
3717
4057
  amount: t,
3718
4058
  assetAddress: n,
3719
- from: h,
3720
- spenderAddress: _
4059
+ from: _,
4060
+ spenderAddress: A
3721
4061
  });
3722
4062
  });
3723
- P(this, x, async ({
4063
+ P(this, N, async ({
3724
4064
  assetValue: t,
3725
4065
  memo: n,
3726
- feeOptionKey: a = k.Fast
4066
+ feeOptionKey: a = $.Fast
3727
4067
  }) => {
3728
4068
  const {
3729
- gas_rate: i,
4069
+ gas_rate: s,
3730
4070
  router: r,
3731
- address: p
3732
- } = await A(this, B).call(this, t.chain), o = (parseInt(i) || 0) * st[a];
4071
+ address: o
4072
+ } = await f(this, B).call(this, t.chain), p = (parseInt(s) || 0) * _t[a];
3733
4073
  return this.deposit({
3734
4074
  assetValue: t,
3735
- recipient: p,
4075
+ recipient: o,
3736
4076
  memo: n,
3737
4077
  router: r,
3738
- feeRate: o
4078
+ feeRate: p
3739
4079
  });
3740
4080
  });
3741
4081
  P(this, Y, async ({ memo: t, assetValue: n }) => {
3742
- const a = await Bt(this.stagenet);
4082
+ const a = await ln(this.stagenet);
3743
4083
  if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
3744
- throw new c("core_chain_halted");
4084
+ throw new m("core_chain_halted");
3745
4085
  return this.deposit({ assetValue: n, recipient: "", memo: t });
3746
4086
  });
3747
- P(this, X, ({ assetValue: t, ...n }) => ({
4087
+ P(this, K, ({ assetValue: t, ...n }) => ({
3748
4088
  ...n,
3749
4089
  memo: n.memo || "",
3750
4090
  from: this.getAddress(t.chain),
@@ -3753,66 +4093,65 @@ class en {
3753
4093
  this.stagenet = !!t;
3754
4094
  }
3755
4095
  }
3756
- B = new WeakMap(), z = new WeakMap(), K = new WeakMap(), x = new WeakMap(), Y = new WeakMap(), X = new WeakMap();
4096
+ B = new WeakMap(), te = new WeakMap(), j = new WeakMap(), N = new WeakMap(), Y = new WeakMap(), K = new WeakMap();
3757
4097
  export {
3758
- Ue as AGG_SWAP,
3759
- Ae as ApiError,
4098
+ ze as AGG_SWAP,
4099
+ mn as ApiError,
3760
4100
  W as ApiUrl,
3761
4101
  v as AssetValue,
3762
- E as BaseDecimal,
3763
- pe as BigIntArithmetics,
3764
- s as Chain,
3765
- le as ChainId,
3766
- Gt as ChainIdToChain,
3767
- Ke as ChainToChainId,
3768
- Ee as ChainToExplorerUrl,
3769
- Ft as ChainToHexChainId,
3770
- Ye as ChainToRPC,
3771
- Ge as ContractAddress,
3772
- kt as CosmosChainList,
3773
- We as DerivationPath,
3774
- d as ERROR_CODE,
3775
- ke as ERROR_MODULE,
3776
- be as ERROR_TYPE,
3777
- Ht as EVMChainList,
3778
- Xe as ErrorCode,
3779
- k as FeeOption,
3780
- f as MemoType,
3781
- Ut as NetworkDerivationPath,
3782
- Le as QuoteMode,
3783
- we as RPCUrl,
3784
- He as SWAP_IN,
3785
- $e as SWAP_OUT,
3786
- en as SwapKitCore,
3787
- c as SwapKitError,
3788
- ye as SwapKitNumber,
3789
- Be as TCAvalancheDepositABI,
3790
- Ve as TCBscDepositABI,
3791
- Pe as TCEthereumVaultAbi,
3792
- $t as UTXOChainList,
3793
- je as WalletOption,
3794
- Yt as assetFromString,
3795
- Kt as derivationPathToString,
3796
- Lt as erc20ABI,
3797
- Xt as filterAssets,
3798
- Ie as formatBigIntToSafeValue,
3799
- st as gasFeeMultiplier,
3800
- pt as getAssetType,
3801
- ut as getAsymmetricAssetShare,
3802
- Qt as getAsymmetricAssetWithdrawAmount,
3803
- dt as getAsymmetricRuneShare,
3804
- jt as getAsymmetricRuneWithdrawAmount,
3805
- rt as getCommonAssetInfo,
3806
- ge as getDecimal,
3807
- zt as getEstimatedPoolShare,
3808
- Zt as getLiquiditySlippage,
3809
- D as getMemoFor,
3810
- he as getMinAmountByChain,
3811
- Re as getRequest,
3812
- yt as getSymmetricPoolShare,
3813
- Jt as getSymmetricWithdraw,
3814
- Wt as getTHORNameCost,
3815
- it as isGasAsset,
3816
- Ze as postRequest,
3817
- qt as validateTHORName
4102
+ b as BaseDecimal,
4103
+ le as BigIntArithmetics,
4104
+ i as Chain,
4105
+ he as ChainId,
4106
+ wn as ChainIdToChain,
4107
+ rt as ChainToChainId,
4108
+ Ne as ChainToExplorerUrl,
4109
+ bn as ChainToHexChainId,
4110
+ ot as ChainToRPC,
4111
+ at as ContractAddress,
4112
+ fn as CosmosChainList,
4113
+ st as DerivationPath,
4114
+ l as ERROR_CODE,
4115
+ tt as ERROR_MODULE,
4116
+ ve as ERROR_TYPE,
4117
+ hn as EVMChainList,
4118
+ pt as ErrorCode,
4119
+ $ as FeeOption,
4120
+ h as MemoType,
4121
+ Tn as NetworkDerivationPath,
4122
+ Qe as QuoteMode,
4123
+ Me as RPCUrl,
4124
+ be as RequestClient,
4125
+ Ze as SWAP_IN,
4126
+ et as SWAP_OUT,
4127
+ Nn as SwapKitCore,
4128
+ m as SwapKitError,
4129
+ Te as SwapKitNumber,
4130
+ Xe as TCAvalancheDepositABI,
4131
+ Je as TCBscDepositABI,
4132
+ Ke as TCEthereumVaultAbi,
4133
+ _n as UTXOChainList,
4134
+ dt as WalletOption,
4135
+ An as assetFromString,
4136
+ Mn as derivationPathToString,
4137
+ cn as erc20ABI,
4138
+ En as filterAssets,
4139
+ He as formatBigIntToSafeValue,
4140
+ _t as gasFeeMultiplier,
4141
+ wt as getAssetType,
4142
+ Rt as getAsymmetricAssetShare,
4143
+ gn as getAsymmetricAssetWithdrawAmount,
4144
+ Et as getAsymmetricRuneShare,
4145
+ Rn as getAsymmetricRuneWithdrawAmount,
4146
+ bt as getCommonAssetInfo,
4147
+ De as getDecimal,
4148
+ In as getEstimatedPoolShare,
4149
+ Sn as getLiquiditySlippage,
4150
+ x as getMemoFor,
4151
+ Ie as getMinAmountByChain,
4152
+ gt as getSymmetricPoolShare,
4153
+ On as getSymmetricWithdraw,
4154
+ vn as getTHORNameCost,
4155
+ ft as isGasAsset,
4156
+ Cn as validateTHORName
3818
4157
  };