@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.
@@ -1474,6 +1474,9 @@ function useClaimRewards(username, auth, onSuccess) {
1474
1474
  queryClient.invalidateQueries({
1475
1475
  queryKey: getAccountFullQueryOptions(username).queryKey
1476
1476
  });
1477
+ queryClient.invalidateQueries({
1478
+ queryKey: getVisionPortfolioQueryOptions(username).queryKey
1479
+ });
1477
1480
  queryClient.invalidateQueries({
1478
1481
  queryKey: getHiveAssetGeneralInfoQueryOptions(username).queryKey
1479
1482
  });
@@ -1488,6 +1491,28 @@ function useClaimRewards(username, auth, onSuccess) {
1488
1491
  queryKey: ["ecency-wallets", "asset-info", username, asset]
1489
1492
  });
1490
1493
  });
1494
+ setTimeout(() => {
1495
+ queryClient.invalidateQueries({
1496
+ queryKey: getAccountFullQueryOptions(username).queryKey
1497
+ });
1498
+ queryClient.invalidateQueries({
1499
+ queryKey: getVisionPortfolioQueryOptions(username).queryKey
1500
+ });
1501
+ queryClient.invalidateQueries({
1502
+ queryKey: getHiveAssetGeneralInfoQueryOptions(username).queryKey
1503
+ });
1504
+ queryClient.invalidateQueries({
1505
+ queryKey: getHbdAssetGeneralInfoQueryOptions(username).queryKey
1506
+ });
1507
+ queryClient.invalidateQueries({
1508
+ queryKey: getHivePowerAssetGeneralInfoQueryOptions(username).queryKey
1509
+ });
1510
+ ["HIVE", "HBD", "HP"].forEach((asset) => {
1511
+ queryClient.invalidateQueries({
1512
+ queryKey: ["ecency-wallets", "asset-info", username, asset]
1513
+ });
1514
+ });
1515
+ }, 5e3);
1491
1516
  },
1492
1517
  auth
1493
1518
  );
@@ -2690,6 +2715,13 @@ function useClaimPoints(username, accessToken, onSuccess, onError) {
2690
2715
  );
2691
2716
  if (!response.ok) {
2692
2717
  const body = await response.text();
2718
+ if (response.status === 406) {
2719
+ try {
2720
+ return JSON.parse(body);
2721
+ } catch {
2722
+ return { message: body, code: response.status };
2723
+ }
2724
+ }
2693
2725
  throw new Error(
2694
2726
  `[SDK][Wallets][Assets][Points][Claim] \u2013 failed with status ${response.status}${body ? `: ${body}` : ""}`
2695
2727
  );
@@ -3108,6 +3140,7 @@ function parseToken(rawToken) {
3108
3140
  );
3109
3141
  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);
3110
3142
  const layer = normalizeString(token.layer) ?? normalizeString(token.chain) ?? normalizeString(token.category) ?? normalizeString(token.type);
3143
+ const pendingRewards = normalizeNumber(token.pendingRewards);
3111
3144
  return {
3112
3145
  symbol: normalizedSymbol,
3113
3146
  info: {
@@ -3117,6 +3150,7 @@ function parseToken(rawToken) {
3117
3150
  accountBalance,
3118
3151
  apr: apr ?? void 0,
3119
3152
  layer: layer ?? void 0,
3153
+ pendingRewards: pendingRewards ?? void 0,
3120
3154
  parts
3121
3155
  },
3122
3156
  operations: mapActions(
@@ -4264,6 +4298,12 @@ function useWalletOperation(username, asset, operation, auth) {
4264
4298
  5e3
4265
4299
  );
4266
4300
  });
4301
+ setTimeout(
4302
+ () => getQueryClient().invalidateQueries({
4303
+ queryKey: getVisionPortfolioQueryOptions(username).queryKey
4304
+ }),
4305
+ 4e3
4306
+ );
4267
4307
  }
4268
4308
  });
4269
4309
  }