@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.
@@ -697,6 +697,7 @@ interface GeneralAssetInfo {
697
697
  accountBalance: number;
698
698
  apr?: string;
699
699
  layer?: string;
700
+ pendingRewards?: number;
700
701
  parts?: {
701
702
  name: string;
702
703
  balance: number;
@@ -1476,6 +1476,9 @@ function useClaimRewards(username, auth, onSuccess) {
1476
1476
  queryClient.invalidateQueries({
1477
1477
  queryKey: getAccountFullQueryOptions(username).queryKey
1478
1478
  });
1479
+ queryClient.invalidateQueries({
1480
+ queryKey: getVisionPortfolioQueryOptions(username).queryKey
1481
+ });
1479
1482
  queryClient.invalidateQueries({
1480
1483
  queryKey: getHiveAssetGeneralInfoQueryOptions(username).queryKey
1481
1484
  });
@@ -1490,6 +1493,28 @@ function useClaimRewards(username, auth, onSuccess) {
1490
1493
  queryKey: ["ecency-wallets", "asset-info", username, asset]
1491
1494
  });
1492
1495
  });
1496
+ setTimeout(() => {
1497
+ queryClient.invalidateQueries({
1498
+ queryKey: getAccountFullQueryOptions(username).queryKey
1499
+ });
1500
+ queryClient.invalidateQueries({
1501
+ queryKey: getVisionPortfolioQueryOptions(username).queryKey
1502
+ });
1503
+ queryClient.invalidateQueries({
1504
+ queryKey: getHiveAssetGeneralInfoQueryOptions(username).queryKey
1505
+ });
1506
+ queryClient.invalidateQueries({
1507
+ queryKey: getHbdAssetGeneralInfoQueryOptions(username).queryKey
1508
+ });
1509
+ queryClient.invalidateQueries({
1510
+ queryKey: getHivePowerAssetGeneralInfoQueryOptions(username).queryKey
1511
+ });
1512
+ ["HIVE", "HBD", "HP"].forEach((asset) => {
1513
+ queryClient.invalidateQueries({
1514
+ queryKey: ["ecency-wallets", "asset-info", username, asset]
1515
+ });
1516
+ });
1517
+ }, 5e3);
1493
1518
  },
1494
1519
  auth
1495
1520
  );
@@ -2692,6 +2717,13 @@ function useClaimPoints(username, accessToken, onSuccess, onError) {
2692
2717
  );
2693
2718
  if (!response.ok) {
2694
2719
  const body = await response.text();
2720
+ if (response.status === 406) {
2721
+ try {
2722
+ return JSON.parse(body);
2723
+ } catch {
2724
+ return { message: body, code: response.status };
2725
+ }
2726
+ }
2695
2727
  throw new Error(
2696
2728
  `[SDK][Wallets][Assets][Points][Claim] \u2013 failed with status ${response.status}${body ? `: ${body}` : ""}`
2697
2729
  );
@@ -3110,6 +3142,7 @@ function parseToken(rawToken) {
3110
3142
  );
3111
3143
  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);
3112
3144
  const layer = normalizeString(token.layer) ?? normalizeString(token.chain) ?? normalizeString(token.category) ?? normalizeString(token.type);
3145
+ const pendingRewards = normalizeNumber(token.pendingRewards);
3113
3146
  return {
3114
3147
  symbol: normalizedSymbol,
3115
3148
  info: {
@@ -3119,6 +3152,7 @@ function parseToken(rawToken) {
3119
3152
  accountBalance,
3120
3153
  apr: apr ?? void 0,
3121
3154
  layer: layer ?? void 0,
3155
+ pendingRewards: pendingRewards ?? void 0,
3122
3156
  parts
3123
3157
  },
3124
3158
  operations: mapActions(
@@ -4266,6 +4300,12 @@ function useWalletOperation(username, asset, operation, auth) {
4266
4300
  5e3
4267
4301
  );
4268
4302
  });
4303
+ setTimeout(
4304
+ () => getQueryClient().invalidateQueries({
4305
+ queryKey: getVisionPortfolioQueryOptions(username).queryKey
4306
+ }),
4307
+ 4e3
4308
+ );
4269
4309
  }
4270
4310
  });
4271
4311
  }