@ecency/wallets 1.5.4 → 1.5.6

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.
@@ -1501,6 +1501,9 @@ function useClaimRewards(username, auth, onSuccess) {
1501
1501
  queryClient.invalidateQueries({
1502
1502
  queryKey: sdk.getAccountFullQueryOptions(username).queryKey
1503
1503
  });
1504
+ queryClient.invalidateQueries({
1505
+ queryKey: getVisionPortfolioQueryOptions(username).queryKey
1506
+ });
1504
1507
  queryClient.invalidateQueries({
1505
1508
  queryKey: getHiveAssetGeneralInfoQueryOptions(username).queryKey
1506
1509
  });
@@ -1515,6 +1518,28 @@ function useClaimRewards(username, auth, onSuccess) {
1515
1518
  queryKey: ["ecency-wallets", "asset-info", username, asset]
1516
1519
  });
1517
1520
  });
1521
+ setTimeout(() => {
1522
+ queryClient.invalidateQueries({
1523
+ queryKey: sdk.getAccountFullQueryOptions(username).queryKey
1524
+ });
1525
+ queryClient.invalidateQueries({
1526
+ queryKey: getVisionPortfolioQueryOptions(username).queryKey
1527
+ });
1528
+ queryClient.invalidateQueries({
1529
+ queryKey: getHiveAssetGeneralInfoQueryOptions(username).queryKey
1530
+ });
1531
+ queryClient.invalidateQueries({
1532
+ queryKey: getHbdAssetGeneralInfoQueryOptions(username).queryKey
1533
+ });
1534
+ queryClient.invalidateQueries({
1535
+ queryKey: getHivePowerAssetGeneralInfoQueryOptions(username).queryKey
1536
+ });
1537
+ ["HIVE", "HBD", "HP"].forEach((asset) => {
1538
+ queryClient.invalidateQueries({
1539
+ queryKey: ["ecency-wallets", "asset-info", username, asset]
1540
+ });
1541
+ });
1542
+ }, 5e3);
1518
1543
  },
1519
1544
  auth
1520
1545
  );
@@ -2717,6 +2742,13 @@ function useClaimPoints(username, accessToken, onSuccess, onError) {
2717
2742
  );
2718
2743
  if (!response.ok) {
2719
2744
  const body = await response.text();
2745
+ if (response.status === 406) {
2746
+ try {
2747
+ return JSON.parse(body);
2748
+ } catch {
2749
+ return { message: body, code: response.status };
2750
+ }
2751
+ }
2720
2752
  throw new Error(
2721
2753
  `[SDK][Wallets][Assets][Points][Claim] \u2013 failed with status ${response.status}${body ? `: ${body}` : ""}`
2722
2754
  );
@@ -3135,6 +3167,7 @@ function parseToken(rawToken) {
3135
3167
  );
3136
3168
  const accountBalance = normalizeNumber(token.balance) ?? normalizeNumber(token.accountBalance) ?? normalizeNumber(token.totalBalance) ?? normalizeNumber(token.total) ?? normalizeNumber(token.amount) ?? (baseParts ? baseParts.reduce((total, part) => total + (part.balance ?? 0), 0) : parts ? parts.reduce((total, part) => total + (part.balance ?? 0), 0) : 0);
3137
3169
  const layer = normalizeString(token.layer) ?? normalizeString(token.chain) ?? normalizeString(token.category) ?? normalizeString(token.type);
3170
+ const pendingRewards = normalizeNumber(token.pendingRewards);
3138
3171
  return {
3139
3172
  symbol: normalizedSymbol,
3140
3173
  info: {
@@ -3144,6 +3177,7 @@ function parseToken(rawToken) {
3144
3177
  accountBalance,
3145
3178
  apr: apr ?? void 0,
3146
3179
  layer: layer ?? void 0,
3180
+ pendingRewards: pendingRewards ?? void 0,
3147
3181
  parts
3148
3182
  },
3149
3183
  operations: mapActions(
@@ -4291,6 +4325,12 @@ function useWalletOperation(username, asset, operation, auth) {
4291
4325
  5e3
4292
4326
  );
4293
4327
  });
4328
+ setTimeout(
4329
+ () => sdk.getQueryClient().invalidateQueries({
4330
+ queryKey: getVisionPortfolioQueryOptions(username).queryKey
4331
+ }),
4332
+ 4e3
4333
+ );
4294
4334
  }
4295
4335
  });
4296
4336
  }