Skip to content

Balance analytics, unified polls#765

Merged
feruzm merged 8 commits intodevelopfrom
rest
Apr 27, 2026
Merged

Balance analytics, unified polls#765
feruzm merged 8 commits intodevelopfrom
rest

Conversation

@feruzm
Copy link
Copy Markdown
Member

@feruzm feruzm commented Apr 27, 2026

Summary by CodeRabbit

  • New Features

    • Wallet pages: Yearly summary card and interactive balance history charts for HIVE, HBD and HP.
    • Witnesses: clickable voter counts and a Voters dialog with search, sorting, pagination.
    • Polls: richer poll types and in-app voting support.
  • Improvements

    • More reliable REST-backed data fetching and pagination across the app.
    • Safer chat image rendering via proxied and validated URLs.
  • Localization

    • Added labels for wallet analytics and witness voter views.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 746e969e-6c63-4a0f-b9d7-0274eca9cdda

📥 Commits

Reviewing files that changed from the base of the PR and between e7f6b0d and 8f3368d.

⛔ Files ignored due to path filters (6)
  • packages/sdk/dist/browser/index.js is excluded by !**/dist/**
  • packages/sdk/dist/browser/index.js.map is excluded by !**/dist/**, !**/*.map
  • packages/sdk/dist/node/index.cjs is excluded by !**/dist/**
  • packages/sdk/dist/node/index.cjs.map is excluded by !**/dist/**, !**/*.map
  • packages/sdk/dist/node/index.mjs is excluded by !**/dist/**
  • packages/sdk/dist/node/index.mjs.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (7)
  • apps/web/src/app/(dynamicPages)/profile/[username]/wallet/(token)/_components/balance-history-chart.tsx
  • apps/web/src/app/api/auth-api/hs-token-refresh/route.ts
  • packages/sdk/CHANGELOG.md
  • packages/sdk/package.json
  • packages/sdk/src/modules/accounts/utils/account-power.ts
  • packages/wallets/CHANGELOG.md
  • packages/wallets/package.json

📝 Walkthrough

Walkthrough

Adds wallet analytics UI (aggregated yearly balance card and balance history chart), witness voter browsing (voters dialog + column), a new polls module and poll vote mutation, multiple SDK REST-backed query helpers/types and query-key updates, dynamic-props/hardfork propagation, chat image safety, and assorted import/fixture/test updates.

Changes

Cohort / File(s) Summary
Wallet Analytics Components
apps/web/src/app/(dynamicPages)/profile/[username]/wallet/(token)/_components/aggregated-balance-card.tsx, apps/web/src/app/(dynamicPages)/profile/[username]/wallet/(token)/_components/balance-history-chart.tsx, apps/web/src/app/(dynamicPages)/profile/[username]/wallet/(token)/_components/index.ts
Add client components that query aggregated yearly balances and paginated balance history (React Query + new SDK query options), convert VESTS→HP, render summary card and lightweight-charts time series; export from barrel.
Wallet Page Integration
apps/web/src/app/(dynamicPages)/profile/[username]/wallet/(token)/hive/_page.tsx, .../hbd/_page.tsx, .../hp/_page.tsx
Normalize route username (decode + strip @) and inject the aggregated-balance card and balance-history chart into HIVE/HBD/HP pages before transaction history.
SDK: Balance History & Aggregated
packages/sdk/src/modules/accounts/queries/get-balance-history-query-options.ts, .../get-aggregated-balance-query-options.ts, packages/sdk/src/modules/accounts/types/balance-history.ts, packages/sdk/src/modules/accounts/queries/index.ts, packages/sdk/src/modules/accounts/types/index.ts
Add REST-backed React Query option builders and TS types for paginated balance history and aggregated daily balances; re-export in module indices.
SDK: Transactions & Reputation
packages/sdk/src/modules/accounts/queries/get-transactions-infinite-query-options.ts, packages/sdk/src/modules/accounts/queries/get-account-full-query-options.ts
Migrate transaction and reputation fetching to REST endpoints (hafah /accounts/{name}/operations and /accounts/{name}/reputation), normalize shapes, and update pagination/cursor logic.
Witness Voter Features
apps/web/src/app/witnesses/_components/witness-voters-dialog.tsx, .../witness-card.tsx, .../witnesses-list.tsx, .../transform.ts, apps/web/src/app/witnesses/page.scss
Add voters column and clickable voters count, modal to browse/search/sort/paginate voters (SDK queries for voters/count), propagate voters count in transforms, and add column styling.
Polls Module & Query Keys
packages/sdk/src/modules/polls/**, packages/sdk/src/modules/core/query-keys.ts, packages/sdk/src/modules/core/config.ts, packages/sdk/src/index.ts
Introduce polls types, poll-details query against polls API, poll-vote broadcast hook, QueryKeys.polls.details and new wallet/witness keys, CONFIG.pollsApiHost setter; re-export polls from SDK barrel.
React Query Key Migration (web)
apps/web/src/core/react-query/index.ts, apps/web/src/features/polls/api/*, apps/web/src/app/publish/_api/use-publish.ts, apps/web/src/app/submit/_api/publish.ts
Remove legacy QueryIdentifiers.POLL_DETAILS usage and migrate cache reads/writes to QueryKeys.polls.details(...); update cached poll types to SDK Poll.
Entities & Locales
apps/web/src/entities/hive/witness.ts, apps/web/src/entities/witness-transformed.ts, apps/web/src/features/i18n/locales/en-US.json
Extend witness entities with rank/voters_num/votersNum and add i18n keys for balance history and witness voters UI.
Dynamic Props & Voting Logic
packages/sdk/src/modules/core/queries/get-dynamic-props-query-options.ts, packages/sdk/src/modules/core/types/dynamic-props.ts, apps/web/src/consts/default-dynamic-props.ts, apps/web/src/entities/dynamic-props.ts, packages/sdk/src/modules/accounts/utils/account-power.ts, packages/sdk/src/modules/accounts/utils/account-power.spec.ts
Derive and expose additional dynamic-props (hardfork and stable-vote fields), update types/defaults, add hardfork-aware voting rshares logic and tests.
Chat Image Safety & Tests
apps/web/src/features/chat/hooks/use-message-rendering.tsx, apps/web/src/specs/features/chat/use-message-rendering.spec.tsx
Add getSafeChatImageUrl to allow only absolute http(s) images, change proxification behavior and rendering fallbacks, and add tests.
Self-hosted import adjustments
apps/self-hosted/hosting/api/src/payment-listener.ts, .../routes/auth.ts, .../services/tenant-service.ts
Change hive-tx config imports to @ecency/sdk/hive (aliased config) in self-hosted API modules; preserve node overrides.
Misc. barrels, tests, and package bumps
packages/sdk/src/index.ts, packages/sdk/src/modules/*/index.ts, apps/web/src/specs/test-helper.ts, packages/sdk/CHANGELOG.md, packages/sdk/package.json, packages/wallets/*
Add re-exports, update test fixtures for new dynamic props, bump SDK and wallets package versions and changelogs.

Sequence Diagram(s)

sequenceDiagram
    participant UI as BalanceHistoryChart (Client)
    participant RQ as React Query
    participant API as hafah REST API
    participant Transform as Converter (vestsToHp / parse)
    participant Chart as lightweight-charts

    UI->>RQ: useInfiniteQuery(getBalanceHistoryInfiniteQueryOptions(username, coinType))
    activate RQ
    RQ->>API: GET /accounts/{username}/operations?page=...
    API-->>RQ: paginated BalanceHistoryEntry pages
    RQ-->>UI: pages + meta
    deactivate RQ

    UI->>Transform: map entries -> { time, value } (vests→HP or raw/1000)
    Transform-->>UI: chartData[]
    UI->>Chart: create chart + line series
    Chart-->>UI: chart instance ready
    UI->>Chart: setData(chartData)
    Note over UI,Chart: subscribe visibleRange changes
    alt user scrolls near left edge
        UI->>RQ: fetchNextPage()
        RQ->>API: GET /accounts/{username}/operations?page=next
        API-->>RQ: next page
        RQ-->>UI: appended pages
        UI->>Chart: updateData + fitContent()
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested labels

minor:sdk

Poem

🐰
I hopped through ledgers, charts in hand,
Counted voters across the land,
Polls and queries, keys unrolled,
REST calls sing, new features told,
A rabbit cheers — the code is grand!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Balance analytics, unified polls' accurately captures the two main themes of this changeset: balance history/aggregated balance analytics and unified poll system integration via SDK.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 rest

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 and usage tips.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@feruzm feruzm added the patch Bug fixes and patches (1.0.0 → 1.0.1), add this only if any packages/ have patch changes in PR label Apr 27, 2026
@feruzm feruzm merged commit de60689 into develop Apr 27, 2026
1 check was pending
@feruzm feruzm deleted the rest branch April 27, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Bug fixes and patches (1.0.0 → 1.0.1), add this only if any packages/ have patch changes in PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant