@ecency/wallets 1.4.30 → 1.4.31

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.
@@ -3566,6 +3566,16 @@ function getAccountWalletAssetInfoQueryOptions(username, asset, options2 = { ref
3566
3566
  }
3567
3567
  });
3568
3568
  }
3569
+ function normalizePartKey2(value) {
3570
+ return value.trim().toLowerCase().replace(/[\s-]+/g, "_");
3571
+ }
3572
+ function hasNonZeroSavingsBalance(parts) {
3573
+ return Boolean(
3574
+ parts?.some(
3575
+ (part) => normalizePartKey2(part.name) === "savings" && Number(part.balance) > 0
3576
+ )
3577
+ );
3578
+ }
3569
3579
  function getTokenOperationsQueryOptions(token, username, isForOwner = false) {
3570
3580
  return queryOptions({
3571
3581
  queryKey: ["wallets", "token-operations", token, username, isForOwner],
@@ -3582,7 +3592,19 @@ function getTokenOperationsQueryOptions(token, username, isForOwner = false) {
3582
3592
  const assetEntry = portfolio.wallets.find(
3583
3593
  (assetItem) => assetItem.info.name === normalizedToken
3584
3594
  );
3585
- return assetEntry?.operations ?? [];
3595
+ if (!assetEntry) {
3596
+ return [];
3597
+ }
3598
+ const operations = assetEntry.operations ?? [];
3599
+ const isHiveOrHbd = ["HIVE", "HBD"].includes(
3600
+ assetEntry.info.name.toUpperCase()
3601
+ );
3602
+ if (isHiveOrHbd && !hasNonZeroSavingsBalance(assetEntry.info.parts)) {
3603
+ return operations.filter(
3604
+ (operation) => operation !== "withdraw-saving" /* WithdrawFromSavings */
3605
+ );
3606
+ }
3607
+ return operations;
3586
3608
  } catch {
3587
3609
  return [];
3588
3610
  }