@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.
- package/dist/browser/index.js +40 -19
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +40 -19
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +40 -19
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -3055,6 +3055,12 @@ function getVisionPortfolioQueryOptions(username) {
|
|
|
3055
3055
|
}
|
|
3056
3056
|
|
|
3057
3057
|
// src/modules/wallets/queries/use-get-account-wallet-list-query.ts
|
|
3058
|
+
var BASIC_TOKENS = [
|
|
3059
|
+
"POINTS" /* Points */,
|
|
3060
|
+
"HIVE" /* Hive */,
|
|
3061
|
+
"HP" /* HivePower */,
|
|
3062
|
+
"HBD" /* HiveDollar */
|
|
3063
|
+
];
|
|
3058
3064
|
function getAccountWalletListQueryOptions(username) {
|
|
3059
3065
|
return reactQuery.queryOptions({
|
|
3060
3066
|
queryKey: ["ecency-wallets", "list", username],
|
|
@@ -3062,39 +3068,54 @@ function getAccountWalletListQueryOptions(username) {
|
|
|
3062
3068
|
queryFn: async () => {
|
|
3063
3069
|
const portfolioQuery = getVisionPortfolioQueryOptions(username);
|
|
3064
3070
|
const queryClient = sdk.getQueryClient();
|
|
3071
|
+
const accountQuery = sdk.getAccountFullQueryOptions(username);
|
|
3072
|
+
let account;
|
|
3073
|
+
try {
|
|
3074
|
+
account = await queryClient.fetchQuery(accountQuery);
|
|
3075
|
+
} catch {
|
|
3076
|
+
}
|
|
3077
|
+
const tokenVisibility = /* @__PURE__ */ new Map();
|
|
3078
|
+
account?.profile?.tokens?.forEach((token) => {
|
|
3079
|
+
const symbol = token.symbol?.toUpperCase?.();
|
|
3080
|
+
if (!symbol) {
|
|
3081
|
+
return;
|
|
3082
|
+
}
|
|
3083
|
+
const showValue = token?.meta?.show;
|
|
3084
|
+
if (typeof showValue === "boolean") {
|
|
3085
|
+
tokenVisibility.set(symbol, showValue);
|
|
3086
|
+
}
|
|
3087
|
+
});
|
|
3088
|
+
const isTokenVisible = (symbol) => {
|
|
3089
|
+
const normalized = symbol?.toUpperCase();
|
|
3090
|
+
if (!normalized) {
|
|
3091
|
+
return false;
|
|
3092
|
+
}
|
|
3093
|
+
if (BASIC_TOKENS.includes(normalized)) {
|
|
3094
|
+
return true;
|
|
3095
|
+
}
|
|
3096
|
+
return tokenVisibility.get(normalized) === true;
|
|
3097
|
+
};
|
|
3065
3098
|
try {
|
|
3066
3099
|
const portfolio = await queryClient.fetchQuery(portfolioQuery);
|
|
3067
3100
|
const tokensFromPortfolio = portfolio.wallets.map(
|
|
3068
3101
|
(asset) => asset.info.name
|
|
3069
3102
|
);
|
|
3070
3103
|
if (tokensFromPortfolio.length > 0) {
|
|
3071
|
-
|
|
3104
|
+
const visibleTokens = tokensFromPortfolio.map((token) => token?.toUpperCase?.()).filter((token) => Boolean(token)).filter(isTokenVisible);
|
|
3105
|
+
if (visibleTokens.length > 0) {
|
|
3106
|
+
return Array.from(new Set(visibleTokens));
|
|
3107
|
+
}
|
|
3072
3108
|
}
|
|
3073
3109
|
} catch {
|
|
3074
3110
|
}
|
|
3075
|
-
const accountQuery = sdk.getAccountFullQueryOptions(username);
|
|
3076
|
-
await queryClient.fetchQuery({
|
|
3077
|
-
queryKey: accountQuery.queryKey
|
|
3078
|
-
});
|
|
3079
|
-
const account = queryClient.getQueryData(
|
|
3080
|
-
accountQuery.queryKey
|
|
3081
|
-
);
|
|
3082
3111
|
if (account?.profile?.tokens instanceof Array) {
|
|
3083
3112
|
const list = [
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
"HP" /* HivePower */,
|
|
3087
|
-
"HBD" /* HiveDollar */,
|
|
3088
|
-
...account.profile.tokens.filter(({ meta }) => !!meta?.show).map((token) => token.symbol)
|
|
3113
|
+
...BASIC_TOKENS,
|
|
3114
|
+
...account.profile.tokens.map((token) => token.symbol).filter(isTokenVisible)
|
|
3089
3115
|
];
|
|
3090
3116
|
return Array.from(new Set(list).values());
|
|
3091
3117
|
}
|
|
3092
|
-
return [
|
|
3093
|
-
"POINTS" /* Points */,
|
|
3094
|
-
"HIVE" /* Hive */,
|
|
3095
|
-
"HP" /* HivePower */,
|
|
3096
|
-
"HBD" /* HiveDollar */
|
|
3097
|
-
];
|
|
3118
|
+
return [...BASIC_TOKENS];
|
|
3098
3119
|
}
|
|
3099
3120
|
});
|
|
3100
3121
|
}
|