Skip to content

fix(wallet): load HIVE/HBD transaction history again - #3480

Merged
feruzm merged 4 commits into
developmentfrom
bugfix/wallet-transaction-history
Aug 11, 2026
Merged

fix(wallet): load HIVE/HBD transaction history again#3480
feruzm merged 4 commits into
developmentfrom
bugfix/wallet-transaction-history

Conversation

@feruzm

@feruzm feruzm commented Aug 11, 2026

Copy link
Copy Markdown
Member

Opening the HIVE or HBD token screen showed no transaction history.

Cause

useActivitiesQuery called getTransactionsInfiniteQueryOptions(username, 50) with no operation group, so the SDK fell back to ALL_ACCOUNT_OPERATIONS (30 op-type ids, including producer_reward and curation_reward) against hafah's REST /accounts/{name}/operations. That produced the symptom two ways:

Empty list on an HTTP 200. Measured on good-karma: the 30-id filter matches 5.86M operations, ~81% of them producer_reward. The newest page of 50 came back as 46 producer_reward + 4 curation_reward. producer_reward is not in transferTypes, and curation_reward grooms to "n HP", so HIVE and HBD rendered zero rows. Because the page added nothing, the list's content length never changed, onEndReached never re-fired, and the walk stalled ~62 pages short of the first transfer. HP still worked, which is why the report named HIVE and HBD only.

Query failure. The same wide predicate is expensive server-side. Cold, per node, for that exact request:

node good-karma (5.86M ops)
api.hive.blog HTTP 500 57014 canceling statement due to statement timeout @ 15.3s
rpc.mahdiyari.info 15.3s
api.syncad.com 7.4s
hiveapi.actifit.io HTTP 500 @ 15.1s
api.c0ff33a.uk 0.7s

sdk-config.ts sets a 10s client ceiling, and the REST pool is the SDK default order, so the walk starts on the two slowest hosts and gives up before reaching the fastest. Nothing surfaced the error, so a failed load looked identical to an empty one.

Change

Moves the Hive layer onto the per-asset SDK queries the web wallet already uses (condenser_api.get_account_history with a server-side operation bitmask) and requests only the operations each tab can actually render. Same account, same data: 0.2-1.5s instead of 2-28s, and every returned row is renderable (good-karma HIVE page 1 goes from 0 usable rows to 50).

Two SDK behaviours are overridden locally, both load-bearing:

  • initialData: { pages: [], pageParams: [] } exists for the web's prefetched pages. Against mobile's staleTime: 60_000 that empty seed reads as fresh data and suppresses the first fetch entirely.
  • getNextPageParam reads lastPage[lastPage.length - 1].num, but get_account_history returns a page in ascending num order, so that is the newest row. Verified live: page 1 and page 2 overlapped by 49 of 50 rows. At the end of history it yields -1, the "newest" sentinel, restarting the walk forever.

Also fixed along the way:

  • useActivitiesQuery now returns isError/error, and the list renders a real empty/failed state instead of a bare header.
  • Bounded auto-advance (max 5 pages) for when a page is legitimately filtered down to zero rows.
  • The HP tab accepts VESTS, so delegate_vesting_shares and fill_vesting_withdraw stop being dropped by the ticker match.
  • useRecurringActivitesQuery runs again: every caller passes the symbol ('HIVE') but it gated on ASSET_IDS.HIVE ('hive'), so it was permanently disabled and the coin summary was stuck on zero recurrent transfers.
  • Stable list keys, explicit section keys, onEndReachedThreshold, and a ref-backed AppState handler that no longer restarts an in-flight refetch.

Tests

New src/utils/walletHistory.test.ts (15 tests) covers the cursor direction and its termination at num === 0, the ticker match including VESTS on HP, a contract test asserting every requested operation name exists on-chain and is renderable by transferTypes + groomingTransactionData, and a witness-account fixture page asserting HIVE and HBD each yield rows and producer_reward never does.

yarn typecheck clean, yarn test:ci 753 passed / 1 skipped.

Follow-ups for @ecency/sdk

Not on the critical path, needs a separate release:

  • getNextPageParam in get-hive-asset-transactions-query-options.ts is wrong for web too (it currently re-fetches 49 duplicate rows per page).
  • ALL_ACCOUNT_OPERATIONS lists fill_recurrent_transfer twice and omits fill_transfer_from_savings.
  • The group-less default should drop producer_reward, or group should be required.
  • The per-asset select hard-drops fill_transfer_from_savings and escrow_* on HIVE/HBD even when explicitly requested, so those rows can't be shown from the client side.

Summary by CodeRabbit

  • New Features

    • Added improved wallet activity history for HIVE, HBD, and Hive Power.
    • Added automatic pagination to find matching wallet activity.
    • Added clearer empty-state and retry guidance when transaction history cannot be loaded.
  • Bug Fixes

    • Improved activity filtering and support for legacy asset formats.
    • Ensured wallet activity refreshes correctly when returning to the app.
    • Removed unsupported producer reward entries from wallet history.

The token history screen asked the node for *every* account operation and then
discarded almost all of it on device. `useActivitiesQuery` called
`getTransactionsInfiniteQueryOptions(username, 50)` with no operation group, so
the SDK fell back to ALL_ACCOUNT_OPERATIONS -- 30 op-type ids including
producer_reward and curation_reward -- against hafah's REST
/accounts/{name}/operations. That broke the screen two ways:

- Empty list on an HTTP 200. For a witness account the newest page of 50 measures
  ~46 producer_reward + 4 curation_reward. producer_reward is not in
  `transferTypes` and curation_reward grooms to "n HP", so HIVE and HBD render
  zero rows; the content length never changes, `onEndReached` never re-fires, and
  the walk stalls dozens of pages short of the first transfer.
- Query failure. The same wide predicate costs the server seconds to tens of
  seconds; cold, api.hive.blog and hiveapi.actifit.io answer HTTP 500 "canceling
  statement due to statement timeout" at ~15s, past the 10s client ceiling in
  sdk-config.ts. Nothing surfaced the error, so it read as "doesn't load".

Move the Hive layer onto the per-asset SDK queries the web wallet uses
(condenser_api.get_account_history with a server-side operation bitmask) and
request only the operations each tab can actually render. Same account, same
data, 0.2-1.5s instead of 2-28s, and every returned row is renderable.

Two SDK behaviours have to be overridden locally:

- `initialData: { pages: [], pageParams: [] }` exists for the web's prefetched
  pages; against mobile's staleTime of 60s that empty seed reads as fresh and
  suppresses the first fetch entirely.
- `getNextPageParam` reads `lastPage[lastPage.length - 1].num`, but
  get_account_history returns a page in ascending `num` order, so that is the
  newest row: pagination advanced one operation per page (49 of 50 rows
  duplicated) and yielded -1 at the end of history, the "newest" sentinel, which
  restarted the walk and never terminated.

Also in this change:

- Surface isError/error from the hook and render a real empty/failed state, so a
  failed load no longer looks identical to an empty history.
- Auto-advance up to 5 pages while nothing renders, for the case where a page is
  legitimately filtered down to zero rows.
- Accept VESTS on the HP tab, so delegate_vesting_shares and
  fill_vesting_withdraw stop being dropped by the ticker match.
- Enable useRecurringActivitesQuery again: callers pass the symbol ('HIVE') but
  it gated on ASSET_IDS.HIVE ('hive'), so it never ran and the coin summary was
  stuck on zero recurrent transfers.
- Stable list keys, explicit section keys, onEndReachedThreshold, and a
  ref-backed AppState handler that no longer restarts an in-flight refetch.

Known gaps left alone: the SDK's per-asset `select` still hard-drops
fill_transfer_from_savings and escrow_* on the HIVE/HBD tabs, and
ALL_ACCOUNT_OPERATIONS lists fill_recurrent_transfer twice while omitting
fill_transfer_from_savings. Both need an SDK release.
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@feruzm, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 72d59b6d-b7f9-41eb-bf15-ba61c45ebe4c

📥 Commits

Reviewing files that changed from the base of the PR and between 2430671 and abf0359.

📒 Files selected for processing (3)
  • src/providers/queries/walletQueries/walletQueries.ts
  • src/utils/walletHistory.test.ts
  • src/utils/walletHistory.ts
📝 Walkthrough

Walkthrough

Wallet history now uses asset-specific SDK queries and operation filters for HIVE, HBD, and Hive Power. It adds bounded pagination, explicit loading and failure states, stable activity keys, foreground refresh handling, localization, and wallet-history tests.

Changes

Wallet history activity flow

Layer / File(s) Summary
Asset history filters and validation
src/utils/walletHistory.ts, src/utils/walletHistory.test.ts
Defines asset-specific operation filters and ticker matching. Tests cover HIVE, HBD, HP, VESTS, fallback behavior, and excluded operations.
Asset-specific wallet queries
package.json, src/providers/queries/walletQueries/walletQueries.ts
Updates the SDK version and replaces generic transaction queries with asset-specific queries. Adds operation filtering, legacy page-shape support, bounded Hive pagination, and recurrent-transfer compatibility.
Activity refresh and request-state rendering
src/screens/assetDetails/screen/assetDetailsScreen.tsx, src/screens/assetDetails/children/activitiesList.tsx, src/config/locales/en-US.json, src/screens/assetDetails/children/children.styles.ts
Uses current refresh logic after foreground transitions. Renders loading, failure, and empty states with localized messages and stable keys.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AssetDetailsScreen
  participant walletQueries
  participant SDKTransactionQuery
  participant ActivitiesList
  AssetDetailsScreen->>walletQueries: request activity history
  walletQueries->>SDKTransactionQuery: query asset operations
  SDKTransactionQuery-->>walletQueries: return paged transactions
  walletQueries-->>AssetDetailsScreen: return activities and request state
  AssetDetailsScreen->>ActivitiesList: pass activities and failure state
  ActivitiesList-->>AssetDetailsScreen: render rows or status message
Loading

Poem

A rabbit checks the wallet trail,
HIVE and HBD appear in scale.
HP hops through VESTS with care,
Empty and failed states now share.
Stable rows sit in a neat array,
While fresh pages guide the way.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: restoring HIVE and HBD transaction history loading.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/wallet-transaction-history

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 55553d3feb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/utils/walletHistory.ts Outdated
];

export const HIVE_LAYER_HISTORY_OPS: Record<string, HiveOperationFilterValue[]> = {
HIVE: [...BASE_HISTORY_OPS, 'transfer_to_vesting', 'fill_order', 'fill_convert_request'],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include power-down payouts in the HIVE operation mask

When an account receives a normal power-down installment, fill_vesting_withdraw carries a HIVE-denominated deposited value that groomingTransactionData and the HIVE ticker filter can render. The new server-side mask requests this operation only for HP, so these liquid-HIVE credits—previously included by the ungrouped history query—disappear from the HIVE transaction history. Include fill_vesting_withdraw in the HIVE operation set as well.

Useful? React with 👍 / 👎.

const query = useQuery({
...getRecurrentTransfersQueryOptions(username || ''),
enabled: coinId === ASSET_IDS.HIVE && !!username, // Only fetch for HIVE and when username exists
enabled: isHiveAsset && !!username, // Only fetch for HIVE and when username exists

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Filter recurrent totals to the displayed asset

When an account has recurrent transfers in both HIVE and HBD, enabling this query for the HIVE symbol fetches every recurrent transfer because the SDK query is scoped only by username. The reducer below then sums parseFloat(item.amount) without checking its symbol, while CoinSummary labels the result as HIVE; for example, 1 HIVE plus 10 HBD is displayed as 11 HIVE, and the HIVE modal also exposes both assets. Filter the returned transfers by coinId before summing and exposing them.

Useful? React with 👍 / 👎.

@feruzm

feruzm commented Aug 11, 2026

Copy link
Copy Markdown
Member Author

SDK follow-ups are up as ecency/vision-web#1396 — cursor direction, the select dropping explicitly-requested operations, fill_transfer_from_savings missing from the transfers group, and initialData.

Once that ships, the two local overrides in useActivitiesQuery (initialData: undefined and getNextPageParam) become redundant rather than wrong — the SDK will do exactly what they do. Worth keeping until this repo's @ecency/sdk floor is raised past that release, since ^2.3.76 still resolves to versions with the old cursor.

fill_transfer_from_savings also becomes requestable on the HIVE/HBD tabs after that release, so BASE_HISTORY_OPS in src/utils/walletHistory.ts can pick it up then.

feruzm added 2 commits August 11, 2026 11:59
… override

2.3.80 (ecency/vision-web#1396) carries the account-history fixes this branch was
working around:

- The cursor now walks back from the OLDEST row on the page, so the local
  `getNextPageParam` override is redundant. Removed it, along with
  `getNextHistoryPageParam` and its tests -- the SDK owns and tests that contract
  now, and a second copy here could silently override a future SDK change.
- The per-asset `select` no longer discards operations the caller asked for by
  name, and `fill_transfer_from_savings` is back in the transfers group, so it is
  finally requestable. Added it to the HIVE/HBD set: `transferTypes` and
  `groomingTransactionData` already render it, so a completed savings withdrawal
  now shows up in the history instead of never arriving.

`initialData: undefined` stays. 2.3.80 removed the seed, but no SDK test pins its
absence and the failure it causes is invisible -- an empty list for the length of
staleTime, with no error -- so it is worth keeping as a guard. Comment reworded to
say so.

yarn typecheck clean, yarn test:ci 812 passed / 1 skipped.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/utils/walletHistory.test.ts (1)

25-40: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert savings-completion operation membership.

The tests verify that listed operations are valid. They do not verify that fill_transfer_from_savings remains in the HIVE and HBD sets. Removing that operation would still pass these tests and would reintroduce missing completed savings withdrawals.

Proposed test
+  it('includes completed savings withdrawals for liquid assets', () => {
+    expect(HIVE_LAYER_HISTORY_OPS.HIVE).toContain('fill_transfer_from_savings');
+    expect(HIVE_LAYER_HISTORY_OPS.HBD).toContain('fill_transfer_from_savings');
+  });
+
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/utils/walletHistory.test.ts` around lines 25 - 40, Update the tests for
HIVE_LAYER_HISTORY_OPS to explicitly assert that both the HIVE and HBD operation
sets contain fill_transfer_from_savings, while preserving the existing validity
and renderability checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/utils/walletHistory.ts`:
- Around line 64-70: Update matchesAssetTicker to normalize transfer_to_vesting
activity values from HIVE into HP before applying the existing ticker filtering,
so vesting amounts such as “10.000 HIVE” match the HP tab. Add a regression test
covering a transfer_to_vesting value with the HIVE ticker and asserting it
matches HP.

---

Nitpick comments:
In `@src/utils/walletHistory.test.ts`:
- Around line 25-40: Update the tests for HIVE_LAYER_HISTORY_OPS to explicitly
assert that both the HIVE and HBD operation sets contain
fill_transfer_from_savings, while preserving the existing validity and
renderability checks.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6c1cbc81-d25e-473d-b0de-7f274e724fe5

📥 Commits

Reviewing files that changed from the base of the PR and between 9aa896b and 2430671.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (8)
  • package.json
  • src/config/locales/en-US.json
  • src/providers/queries/walletQueries/walletQueries.ts
  • src/screens/assetDetails/children/activitiesList.tsx
  • src/screens/assetDetails/children/children.styles.ts
  • src/screens/assetDetails/screen/assetDetailsScreen.tsx
  • src/utils/walletHistory.test.ts
  • src/utils/walletHistory.ts

Comment thread src/utils/walletHistory.ts
Three findings, all real.

**Power-down payouts vanished from the HIVE tab (Codex P2).** A normal power-down
installment emits `fill_vesting_withdraw` whose `deposited` is HIVE-denominated,
and both `transferTypes` and the ticker match render it — the old ungrouped query
returned it, so those rows used to show on HIVE. The per-symbol mask requested op
56 only for HP, dropping them. Added it to the HIVE set; the routed-to-vesting
variant denominates `deposited` in VESTS, so the ticker match keeps sending that
one to HP.

**Power-ups never reached the HP tab (CodeRabbit).** `transfer_to_vesting` is
groomed to the HIVE amount that went in, so a ticker match alone excluded it from
HP even though the tab requests it — and web's HP view shows it. Added
STRUCTURAL_OPS for operations that belong to a tab by nature rather than by
denomination. Pre-existing, but the tab now pays to fetch the operation, so it
should render it.

**Recurrent-transfer totals mixed symbols (Codex P2).** The SDK query is scoped to
the account, not an asset, so it returns every schedule. The reducer sums bare
`parseFloat` values and CoinSummary labels the result HIVE: 1 HIVE plus 10 HBD
displayed as "11 HIVE", and the modal listed HBD schedules under HIVE. Latent
until the previous commit fixed the enable-gate, so this ships with it. Filtered
in `select` so both the total and the modal see only the tab's asset.

Tests cover each: op-set membership for both savings completions and power-down
payouts, a power-up matching HP and HIVE but not HBD, and each power-down variant
routing to the tab matching its denomination.

yarn typecheck clean, yarn test:ci 816 passed / 1 skipped.
@feruzm
feruzm merged commit 60455c1 into development Aug 11, 2026
10 checks passed
@feruzm
feruzm deleted the bugfix/wallet-transaction-history branch August 11, 2026 12:22
feruzm added a commit that referenced this pull request Aug 11, 2026
Picks up the account-history follow-ups from ecency/vision-web#1404, on top of
the pagination fix #3480 already relies on.

- the history walk can reach the head of an account's history instead of
  failing the node's `start >= limit - 1` assert on the last page
- `fill_transfer_from_savings` is filtered by asset, so the HIVE list no longer
  shows completed HBD savings withdrawals and the reverse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant