@ecency/wallets 1.4.31 → 1.4.32

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.
@@ -3028,6 +3028,12 @@ function getVisionPortfolioQueryOptions(username) {
3028
3028
  }
3029
3029
 
3030
3030
  // src/modules/wallets/queries/use-get-account-wallet-list-query.ts
3031
+ var BASIC_TOKENS = [
3032
+ "POINTS" /* Points */,
3033
+ "HIVE" /* Hive */,
3034
+ "HP" /* HivePower */,
3035
+ "HBD" /* HiveDollar */
3036
+ ];
3031
3037
  function getAccountWalletListQueryOptions(username) {
3032
3038
  return queryOptions({
3033
3039
  queryKey: ["ecency-wallets", "list", username],
@@ -3035,39 +3041,54 @@ function getAccountWalletListQueryOptions(username) {
3035
3041
  queryFn: async () => {
3036
3042
  const portfolioQuery = getVisionPortfolioQueryOptions(username);
3037
3043
  const queryClient = getQueryClient();
3044
+ const accountQuery = getAccountFullQueryOptions(username);
3045
+ let account;
3046
+ try {
3047
+ account = await queryClient.fetchQuery(accountQuery);
3048
+ } catch {
3049
+ }
3050
+ const tokenVisibility = /* @__PURE__ */ new Map();
3051
+ account?.profile?.tokens?.forEach((token) => {
3052
+ const symbol = token.symbol?.toUpperCase?.();
3053
+ if (!symbol) {
3054
+ return;
3055
+ }
3056
+ const showValue = token?.meta?.show;
3057
+ if (typeof showValue === "boolean") {
3058
+ tokenVisibility.set(symbol, showValue);
3059
+ }
3060
+ });
3061
+ const isTokenVisible = (symbol) => {
3062
+ const normalized = symbol?.toUpperCase();
3063
+ if (!normalized) {
3064
+ return false;
3065
+ }
3066
+ if (BASIC_TOKENS.includes(normalized)) {
3067
+ return true;
3068
+ }
3069
+ return tokenVisibility.get(normalized) === true;
3070
+ };
3038
3071
  try {
3039
3072
  const portfolio = await queryClient.fetchQuery(portfolioQuery);
3040
3073
  const tokensFromPortfolio = portfolio.wallets.map(
3041
3074
  (asset) => asset.info.name
3042
3075
  );
3043
3076
  if (tokensFromPortfolio.length > 0) {
3044
- return Array.from(new Set(tokensFromPortfolio));
3077
+ const visibleTokens = tokensFromPortfolio.map((token) => token?.toUpperCase?.()).filter((token) => Boolean(token)).filter(isTokenVisible);
3078
+ if (visibleTokens.length > 0) {
3079
+ return Array.from(new Set(visibleTokens));
3080
+ }
3045
3081
  }
3046
3082
  } catch {
3047
3083
  }
3048
- const accountQuery = getAccountFullQueryOptions(username);
3049
- await queryClient.fetchQuery({
3050
- queryKey: accountQuery.queryKey
3051
- });
3052
- const account = queryClient.getQueryData(
3053
- accountQuery.queryKey
3054
- );
3055
3084
  if (account?.profile?.tokens instanceof Array) {
3056
3085
  const list = [
3057
- "POINTS" /* Points */,
3058
- "HIVE" /* Hive */,
3059
- "HP" /* HivePower */,
3060
- "HBD" /* HiveDollar */,
3061
- ...account.profile.tokens.filter(({ meta }) => !!meta?.show).map((token) => token.symbol)
3086
+ ...BASIC_TOKENS,
3087
+ ...account.profile.tokens.map((token) => token.symbol).filter(isTokenVisible)
3062
3088
  ];
3063
3089
  return Array.from(new Set(list).values());
3064
3090
  }
3065
- return [
3066
- "POINTS" /* Points */,
3067
- "HIVE" /* Hive */,
3068
- "HP" /* HivePower */,
3069
- "HBD" /* HiveDollar */
3070
- ];
3091
+ return [...BASIC_TOKENS];
3071
3092
  }
3072
3093
  });
3073
3094
  }