@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.cjs
CHANGED
|
@@ -1502,7 +1502,7 @@ function useClaimRewards(username, auth, onSuccess) {
|
|
|
1502
1502
|
queryKey: sdk.getAccountFullQueryOptions(username).queryKey
|
|
1503
1503
|
});
|
|
1504
1504
|
queryClient.invalidateQueries({
|
|
1505
|
-
queryKey:
|
|
1505
|
+
queryKey: ["ecency-wallets", "portfolio", "v2", username]
|
|
1506
1506
|
});
|
|
1507
1507
|
queryClient.invalidateQueries({
|
|
1508
1508
|
queryKey: getHiveAssetGeneralInfoQueryOptions(username).queryKey
|
|
@@ -1523,7 +1523,7 @@ function useClaimRewards(username, auth, onSuccess) {
|
|
|
1523
1523
|
queryKey: sdk.getAccountFullQueryOptions(username).queryKey
|
|
1524
1524
|
});
|
|
1525
1525
|
queryClient.invalidateQueries({
|
|
1526
|
-
queryKey:
|
|
1526
|
+
queryKey: ["ecency-wallets", "portfolio", "v2", username]
|
|
1527
1527
|
});
|
|
1528
1528
|
queryClient.invalidateQueries({
|
|
1529
1529
|
queryKey: getHiveAssetGeneralInfoQueryOptions(username).queryKey
|
|
@@ -3150,9 +3150,7 @@ function parseToken(rawToken) {
|
|
|
3150
3150
|
}
|
|
3151
3151
|
const normalizedSymbol = symbol.toUpperCase();
|
|
3152
3152
|
const title = normalizeString(token.title) ?? normalizeString(token.display) ?? normalizeString(token.label) ?? normalizeString(token.friendlyName) ?? normalizeString(token.name) ?? normalizedSymbol;
|
|
3153
|
-
const price = normalizeNumber(token.fiatRate) ??
|
|
3154
|
-
token.metrics?.priceUsd
|
|
3155
|
-
) ?? 0;
|
|
3153
|
+
const price = normalizeNumber(token.fiatRate) ?? 0;
|
|
3156
3154
|
const apr = normalizeApr(token.apr) ?? normalizeApr(token.aprPercent) ?? normalizeApr(token.metrics?.apr) ?? normalizeApr(
|
|
3157
3155
|
token.metrics?.aprPercent
|
|
3158
3156
|
);
|
|
@@ -3229,14 +3227,15 @@ function resolveUsername(payload) {
|
|
|
3229
3227
|
const record = payload;
|
|
3230
3228
|
return normalizeString(record.username) ?? normalizeString(record.name) ?? normalizeString(record.account);
|
|
3231
3229
|
}
|
|
3232
|
-
function getVisionPortfolioQueryOptions(username) {
|
|
3230
|
+
function getVisionPortfolioQueryOptions(username, currency = "usd") {
|
|
3233
3231
|
return reactQuery.queryOptions({
|
|
3234
3232
|
queryKey: [
|
|
3235
3233
|
"ecency-wallets",
|
|
3236
3234
|
"portfolio",
|
|
3237
3235
|
"v2",
|
|
3238
3236
|
username,
|
|
3239
|
-
"only-enabled"
|
|
3237
|
+
"only-enabled",
|
|
3238
|
+
currency
|
|
3240
3239
|
],
|
|
3241
3240
|
enabled: Boolean(username),
|
|
3242
3241
|
staleTime: 6e4,
|
|
@@ -3257,7 +3256,7 @@ function getVisionPortfolioQueryOptions(username) {
|
|
|
3257
3256
|
Accept: "application/json",
|
|
3258
3257
|
"Content-Type": "application/json"
|
|
3259
3258
|
},
|
|
3260
|
-
body: JSON.stringify({ username, onlyEnabled: true })
|
|
3259
|
+
body: JSON.stringify({ username, onlyEnabled: true, currency })
|
|
3261
3260
|
});
|
|
3262
3261
|
if (!response.ok) {
|
|
3263
3262
|
throw new Error(
|
|
@@ -3274,7 +3273,7 @@ function getVisionPortfolioQueryOptions(username) {
|
|
|
3274
3273
|
return {
|
|
3275
3274
|
username: resolveUsername(payload) ?? username,
|
|
3276
3275
|
currency: normalizeString(
|
|
3277
|
-
payload?.currency
|
|
3276
|
+
payload?.fiatCurrency ?? payload?.currency
|
|
3278
3277
|
)?.toUpperCase(),
|
|
3279
3278
|
wallets: tokens
|
|
3280
3279
|
};
|
|
@@ -3300,12 +3299,12 @@ var BASIC_TOKENS = [
|
|
|
3300
3299
|
"HP" /* HivePower */,
|
|
3301
3300
|
"HBD" /* HiveDollar */
|
|
3302
3301
|
];
|
|
3303
|
-
function getAccountWalletListQueryOptions(username) {
|
|
3302
|
+
function getAccountWalletListQueryOptions(username, currency = "usd") {
|
|
3304
3303
|
return reactQuery.queryOptions({
|
|
3305
|
-
queryKey: ["ecency-wallets", "list", username],
|
|
3304
|
+
queryKey: ["ecency-wallets", "list", username, currency],
|
|
3306
3305
|
enabled: !!username,
|
|
3307
3306
|
queryFn: async () => {
|
|
3308
|
-
const portfolioQuery = getVisionPortfolioQueryOptions(username);
|
|
3307
|
+
const portfolioQuery = getVisionPortfolioQueryOptions(username, currency);
|
|
3309
3308
|
const queryClient = sdk.getQueryClient();
|
|
3310
3309
|
const accountQuery = sdk.getAccountFullQueryOptions(username);
|
|
3311
3310
|
let account;
|
|
@@ -3783,6 +3782,7 @@ function getTronAssetGeneralInfoQueryOptions(username) {
|
|
|
3783
3782
|
// src/modules/wallets/queries/get-account-wallet-asset-info-query-options.ts
|
|
3784
3783
|
function getAccountWalletAssetInfoQueryOptions(username, asset, options2 = { refetch: false }) {
|
|
3785
3784
|
const queryClient = sdk.getQueryClient();
|
|
3785
|
+
const currency = options2.currency ?? "usd";
|
|
3786
3786
|
const fetchQuery = async (queryOptions43) => {
|
|
3787
3787
|
if (options2.refetch) {
|
|
3788
3788
|
await queryClient.fetchQuery(queryOptions43);
|
|
@@ -3791,7 +3791,7 @@ function getAccountWalletAssetInfoQueryOptions(username, asset, options2 = { ref
|
|
|
3791
3791
|
}
|
|
3792
3792
|
return queryClient.getQueryData(queryOptions43.queryKey);
|
|
3793
3793
|
};
|
|
3794
|
-
const portfolioQuery = getVisionPortfolioQueryOptions(username);
|
|
3794
|
+
const portfolioQuery = getVisionPortfolioQueryOptions(username, currency);
|
|
3795
3795
|
const getPortfolioAssetInfo = async () => {
|
|
3796
3796
|
try {
|
|
3797
3797
|
const portfolio = await queryClient.fetchQuery(portfolioQuery);
|
|
@@ -3799,12 +3799,12 @@ function getAccountWalletAssetInfoQueryOptions(username, asset, options2 = { ref
|
|
|
3799
3799
|
(assetItem) => assetItem.info.name === asset.toUpperCase()
|
|
3800
3800
|
);
|
|
3801
3801
|
return assetInfo?.info;
|
|
3802
|
-
} catch {
|
|
3802
|
+
} catch (e) {
|
|
3803
3803
|
return void 0;
|
|
3804
3804
|
}
|
|
3805
3805
|
};
|
|
3806
3806
|
return reactQuery.queryOptions({
|
|
3807
|
-
queryKey: ["ecency-wallets", "asset-info", username, asset],
|
|
3807
|
+
queryKey: ["ecency-wallets", "asset-info", username, asset, currency],
|
|
3808
3808
|
queryFn: async () => {
|
|
3809
3809
|
const portfolioAssetInfo = await getPortfolioAssetInfo();
|
|
3810
3810
|
if (portfolioAssetInfo) {
|
|
@@ -3864,9 +3864,9 @@ function hasNonZeroSavingsBalance(parts) {
|
|
|
3864
3864
|
)
|
|
3865
3865
|
);
|
|
3866
3866
|
}
|
|
3867
|
-
function getTokenOperationsQueryOptions(token, username, isForOwner = false) {
|
|
3867
|
+
function getTokenOperationsQueryOptions(token, username, isForOwner = false, currency = "usd") {
|
|
3868
3868
|
return reactQuery.queryOptions({
|
|
3869
|
-
queryKey: ["wallets", "token-operations", token, username, isForOwner],
|
|
3869
|
+
queryKey: ["wallets", "token-operations", token, username, isForOwner, currency],
|
|
3870
3870
|
queryFn: async () => {
|
|
3871
3871
|
const queryClient = sdk.getQueryClient();
|
|
3872
3872
|
const normalizedToken = token.toUpperCase();
|
|
@@ -3875,7 +3875,7 @@ function getTokenOperationsQueryOptions(token, username, isForOwner = false) {
|
|
|
3875
3875
|
}
|
|
3876
3876
|
try {
|
|
3877
3877
|
const portfolio = await queryClient.fetchQuery(
|
|
3878
|
-
getVisionPortfolioQueryOptions(username)
|
|
3878
|
+
getVisionPortfolioQueryOptions(username, currency)
|
|
3879
3879
|
);
|
|
3880
3880
|
const assetEntry = portfolio.wallets.find(
|
|
3881
3881
|
(assetItem) => assetItem.info.name === normalizedToken
|
|
@@ -4327,7 +4327,7 @@ function useWalletOperation(username, asset, operation, auth) {
|
|
|
4327
4327
|
});
|
|
4328
4328
|
setTimeout(
|
|
4329
4329
|
() => sdk.getQueryClient().invalidateQueries({
|
|
4330
|
-
queryKey:
|
|
4330
|
+
queryKey: ["ecency-wallets", "portfolio", "v2", username]
|
|
4331
4331
|
}),
|
|
4332
4332
|
4e3
|
|
4333
4333
|
);
|