@ecency/wallets 1.4.33 → 1.4.35

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.
@@ -3041,6 +3041,17 @@ function getVisionPortfolioQueryOptions(username) {
3041
3041
  }
3042
3042
 
3043
3043
  // src/modules/wallets/queries/use-get-account-wallet-list-query.ts
3044
+ function normalizeAccountTokens(tokens) {
3045
+ if (Array.isArray(tokens)) {
3046
+ return tokens.filter(Boolean);
3047
+ }
3048
+ if (tokens && typeof tokens === "object") {
3049
+ return Object.values(tokens).flatMap(
3050
+ (value) => Array.isArray(value) ? value.filter(Boolean) : []
3051
+ );
3052
+ }
3053
+ return [];
3054
+ }
3044
3055
  var BASIC_TOKENS = [
3045
3056
  "POINTS" /* Points */,
3046
3057
  "HIVE" /* Hive */,
@@ -3061,7 +3072,8 @@ function getAccountWalletListQueryOptions(username) {
3061
3072
  } catch {
3062
3073
  }
3063
3074
  const tokenVisibility = /* @__PURE__ */ new Map();
3064
- account?.profile?.tokens?.forEach((token) => {
3075
+ const accountTokens = normalizeAccountTokens(account?.profile?.tokens);
3076
+ accountTokens.forEach((token) => {
3065
3077
  const symbol = token.symbol?.toUpperCase?.();
3066
3078
  if (!symbol) {
3067
3079
  return;
@@ -3094,10 +3106,10 @@ function getAccountWalletListQueryOptions(username) {
3094
3106
  }
3095
3107
  } catch {
3096
3108
  }
3097
- if (account?.profile?.tokens instanceof Array) {
3109
+ if (accountTokens.length > 0) {
3098
3110
  const list = [
3099
3111
  ...BASIC_TOKENS,
3100
- ...account.profile.tokens.map((token) => token.symbol).filter(isTokenVisible)
3112
+ ...accountTokens.map((token) => token.symbol).filter(isTokenVisible)
3101
3113
  ];
3102
3114
  return Array.from(new Set(list).values());
3103
3115
  }