@swapkit/core 1.0.0-rc.2 → 1.0.0-rc.21

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