@ecency/wallets 1.5.6 → 1.5.8
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.d.ts +4 -3
- package/dist/browser/index.js +19 -19
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +19 -19
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +19 -19
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -1475,7 +1475,7 @@ function useClaimRewards(username, auth, onSuccess) {
|
|
|
1475
1475
|
queryKey: getAccountFullQueryOptions(username).queryKey
|
|
1476
1476
|
});
|
|
1477
1477
|
queryClient.invalidateQueries({
|
|
1478
|
-
queryKey:
|
|
1478
|
+
queryKey: ["ecency-wallets", "portfolio", "v2", username]
|
|
1479
1479
|
});
|
|
1480
1480
|
queryClient.invalidateQueries({
|
|
1481
1481
|
queryKey: getHiveAssetGeneralInfoQueryOptions(username).queryKey
|
|
@@ -1496,7 +1496,7 @@ function useClaimRewards(username, auth, onSuccess) {
|
|
|
1496
1496
|
queryKey: getAccountFullQueryOptions(username).queryKey
|
|
1497
1497
|
});
|
|
1498
1498
|
queryClient.invalidateQueries({
|
|
1499
|
-
queryKey:
|
|
1499
|
+
queryKey: ["ecency-wallets", "portfolio", "v2", username]
|
|
1500
1500
|
});
|
|
1501
1501
|
queryClient.invalidateQueries({
|
|
1502
1502
|
queryKey: getHiveAssetGeneralInfoQueryOptions(username).queryKey
|
|
@@ -3123,9 +3123,7 @@ function parseToken(rawToken) {
|
|
|
3123
3123
|
}
|
|
3124
3124
|
const normalizedSymbol = symbol.toUpperCase();
|
|
3125
3125
|
const title = normalizeString(token.title) ?? normalizeString(token.display) ?? normalizeString(token.label) ?? normalizeString(token.friendlyName) ?? normalizeString(token.name) ?? normalizedSymbol;
|
|
3126
|
-
const price = normalizeNumber(token.fiatRate) ??
|
|
3127
|
-
token.metrics?.priceUsd
|
|
3128
|
-
) ?? 0;
|
|
3126
|
+
const price = normalizeNumber(token.fiatRate) ?? 0;
|
|
3129
3127
|
const apr = normalizeApr(token.apr) ?? normalizeApr(token.aprPercent) ?? normalizeApr(token.metrics?.apr) ?? normalizeApr(
|
|
3130
3128
|
token.metrics?.aprPercent
|
|
3131
3129
|
);
|
|
@@ -3202,14 +3200,15 @@ function resolveUsername(payload) {
|
|
|
3202
3200
|
const record = payload;
|
|
3203
3201
|
return normalizeString(record.username) ?? normalizeString(record.name) ?? normalizeString(record.account);
|
|
3204
3202
|
}
|
|
3205
|
-
function getVisionPortfolioQueryOptions(username) {
|
|
3203
|
+
function getVisionPortfolioQueryOptions(username, currency = "usd") {
|
|
3206
3204
|
return queryOptions({
|
|
3207
3205
|
queryKey: [
|
|
3208
3206
|
"ecency-wallets",
|
|
3209
3207
|
"portfolio",
|
|
3210
3208
|
"v2",
|
|
3211
3209
|
username,
|
|
3212
|
-
"only-enabled"
|
|
3210
|
+
"only-enabled",
|
|
3211
|
+
currency
|
|
3213
3212
|
],
|
|
3214
3213
|
enabled: Boolean(username),
|
|
3215
3214
|
staleTime: 6e4,
|
|
@@ -3230,7 +3229,7 @@ function getVisionPortfolioQueryOptions(username) {
|
|
|
3230
3229
|
Accept: "application/json",
|
|
3231
3230
|
"Content-Type": "application/json"
|
|
3232
3231
|
},
|
|
3233
|
-
body: JSON.stringify({ username, onlyEnabled: true })
|
|
3232
|
+
body: JSON.stringify({ username, onlyEnabled: true, currency })
|
|
3234
3233
|
});
|
|
3235
3234
|
if (!response.ok) {
|
|
3236
3235
|
throw new Error(
|
|
@@ -3247,7 +3246,7 @@ function getVisionPortfolioQueryOptions(username) {
|
|
|
3247
3246
|
return {
|
|
3248
3247
|
username: resolveUsername(payload) ?? username,
|
|
3249
3248
|
currency: normalizeString(
|
|
3250
|
-
payload?.currency
|
|
3249
|
+
payload?.fiatCurrency ?? payload?.currency
|
|
3251
3250
|
)?.toUpperCase(),
|
|
3252
3251
|
wallets: tokens
|
|
3253
3252
|
};
|
|
@@ -3273,12 +3272,12 @@ var BASIC_TOKENS = [
|
|
|
3273
3272
|
"HP" /* HivePower */,
|
|
3274
3273
|
"HBD" /* HiveDollar */
|
|
3275
3274
|
];
|
|
3276
|
-
function getAccountWalletListQueryOptions(username) {
|
|
3275
|
+
function getAccountWalletListQueryOptions(username, currency = "usd") {
|
|
3277
3276
|
return queryOptions({
|
|
3278
|
-
queryKey: ["ecency-wallets", "list", username],
|
|
3277
|
+
queryKey: ["ecency-wallets", "list", username, currency],
|
|
3279
3278
|
enabled: !!username,
|
|
3280
3279
|
queryFn: async () => {
|
|
3281
|
-
const portfolioQuery = getVisionPortfolioQueryOptions(username);
|
|
3280
|
+
const portfolioQuery = getVisionPortfolioQueryOptions(username, currency);
|
|
3282
3281
|
const queryClient = getQueryClient();
|
|
3283
3282
|
const accountQuery = getAccountFullQueryOptions(username);
|
|
3284
3283
|
let account;
|
|
@@ -3756,6 +3755,7 @@ function getTronAssetGeneralInfoQueryOptions(username) {
|
|
|
3756
3755
|
// src/modules/wallets/queries/get-account-wallet-asset-info-query-options.ts
|
|
3757
3756
|
function getAccountWalletAssetInfoQueryOptions(username, asset, options2 = { refetch: false }) {
|
|
3758
3757
|
const queryClient = getQueryClient();
|
|
3758
|
+
const currency = options2.currency ?? "usd";
|
|
3759
3759
|
const fetchQuery = async (queryOptions43) => {
|
|
3760
3760
|
if (options2.refetch) {
|
|
3761
3761
|
await queryClient.fetchQuery(queryOptions43);
|
|
@@ -3764,7 +3764,7 @@ function getAccountWalletAssetInfoQueryOptions(username, asset, options2 = { ref
|
|
|
3764
3764
|
}
|
|
3765
3765
|
return queryClient.getQueryData(queryOptions43.queryKey);
|
|
3766
3766
|
};
|
|
3767
|
-
const portfolioQuery = getVisionPortfolioQueryOptions(username);
|
|
3767
|
+
const portfolioQuery = getVisionPortfolioQueryOptions(username, currency);
|
|
3768
3768
|
const getPortfolioAssetInfo = async () => {
|
|
3769
3769
|
try {
|
|
3770
3770
|
const portfolio = await queryClient.fetchQuery(portfolioQuery);
|
|
@@ -3772,12 +3772,12 @@ function getAccountWalletAssetInfoQueryOptions(username, asset, options2 = { ref
|
|
|
3772
3772
|
(assetItem) => assetItem.info.name === asset.toUpperCase()
|
|
3773
3773
|
);
|
|
3774
3774
|
return assetInfo?.info;
|
|
3775
|
-
} catch {
|
|
3775
|
+
} catch (e) {
|
|
3776
3776
|
return void 0;
|
|
3777
3777
|
}
|
|
3778
3778
|
};
|
|
3779
3779
|
return queryOptions({
|
|
3780
|
-
queryKey: ["ecency-wallets", "asset-info", username, asset],
|
|
3780
|
+
queryKey: ["ecency-wallets", "asset-info", username, asset, currency],
|
|
3781
3781
|
queryFn: async () => {
|
|
3782
3782
|
const portfolioAssetInfo = await getPortfolioAssetInfo();
|
|
3783
3783
|
if (portfolioAssetInfo) {
|
|
@@ -3837,9 +3837,9 @@ function hasNonZeroSavingsBalance(parts) {
|
|
|
3837
3837
|
)
|
|
3838
3838
|
);
|
|
3839
3839
|
}
|
|
3840
|
-
function getTokenOperationsQueryOptions(token, username, isForOwner = false) {
|
|
3840
|
+
function getTokenOperationsQueryOptions(token, username, isForOwner = false, currency = "usd") {
|
|
3841
3841
|
return queryOptions({
|
|
3842
|
-
queryKey: ["wallets", "token-operations", token, username, isForOwner],
|
|
3842
|
+
queryKey: ["wallets", "token-operations", token, username, isForOwner, currency],
|
|
3843
3843
|
queryFn: async () => {
|
|
3844
3844
|
const queryClient = getQueryClient();
|
|
3845
3845
|
const normalizedToken = token.toUpperCase();
|
|
@@ -3848,7 +3848,7 @@ function getTokenOperationsQueryOptions(token, username, isForOwner = false) {
|
|
|
3848
3848
|
}
|
|
3849
3849
|
try {
|
|
3850
3850
|
const portfolio = await queryClient.fetchQuery(
|
|
3851
|
-
getVisionPortfolioQueryOptions(username)
|
|
3851
|
+
getVisionPortfolioQueryOptions(username, currency)
|
|
3852
3852
|
);
|
|
3853
3853
|
const assetEntry = portfolio.wallets.find(
|
|
3854
3854
|
(assetItem) => assetItem.info.name === normalizedToken
|
|
@@ -4300,7 +4300,7 @@ function useWalletOperation(username, asset, operation, auth) {
|
|
|
4300
4300
|
});
|
|
4301
4301
|
setTimeout(
|
|
4302
4302
|
() => getQueryClient().invalidateQueries({
|
|
4303
|
-
queryKey:
|
|
4303
|
+
queryKey: ["ecency-wallets", "portfolio", "v2", username]
|
|
4304
4304
|
}),
|
|
4305
4305
|
4e3
|
|
4306
4306
|
);
|