Repository navigation
feat(staking): add pagination, date filtering, and historical fiat CS… - #997
Merged
k-deejah merged 1 commit intoOct 17, 2026
Merged
Conversation
…V export to RewardHistory (Sorokit#934)
|
@Ariyagold Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
Author
|
@k-deejah , pls review pr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #934
This PR adds client-side pagination, date-range filtering, and historical fiat (USD) value estimation with CSV export support to
RewardHistory, along with comprehensive unit test coverage for empty states, date filtering, pagination, and CSV generation.Why This Was Needed
RewardHistorypreviously rendered up to 50 rows directly into the DOM without pagination controls, and lacked pagination for accounts with hundreds of daily reward payouts.RewardHistory.test.tsxlacked dedicated unit tests for date-range filtering, pagination controls, CSV exports with fiat columns, and filtered empty states.What Changed & How It Was Implemented
1. Historical Fiat Value Estimation (
src/lib/staking.ts)RewardEventwith optionalpriceUsdandusdValuefields.DEFAULT_XLM_PRICE_USD,estimateHistoricalXlmPriceUsd(dateStr), andestimateRewardUsdValue(event)utilities to deterministically resolve or estimate historical XLM price and USD value at the time of distribution.generateMockRewardHistory()to populatepriceUsdandusdValueon generated reward events.2. Pagination, Date Filtering & CSV Export (
src/components/RewardHistory.tsx)pageSizeprop (defaulting to10rows per page) withPrev/Nextcontrols and page status indicator (Page X of Y), ensuring only the current page's rows are mounted in the DOM.From(Start date) andTo(End date) date inputs (plus aClearaction) that filter both theRewardBarChartdaily buckets and the reward events table, automatically resetting pagination to page 1 when filters change.Est. USDcolumn to the reward events table.generateRewardHistoryCsv()and anExport CSVbutton (supporting both DOMBlobdownload and an optionalonExportcallback) that outputs:Date,Validator,Amount (XLM),XLM Price (USD),Estimated Value (USD),Transaction Hash.3. Public Exports (
src/components/index.ts)generateRewardHistoryCsv,DEFAULT_XLM_PRICE_USD,estimateHistoricalXlmPriceUsd, andestimateRewardUsdValue.4. Unit Tests (
src/components/RewardHistory.test.tsx,src/lib/staking.test.ts,src/__tests__/exports.test.ts)dailyRewardsandevents, zero XLM summary state, hidden table/export controls, and empty filtered states when a date range excludes all events.pageSizerows in the DOM, navigating forward/backward withNextandPrev, and hiding pagination when all events fit on one page.XLM Price (USD)andEstimated Value (USD)headers and row values,onExportcallback invocation, and DOM download fallback.Acceptance Criteria Checklist
XLM Price (USD)and\Closes #934
Closes #933
Closes #932
Closes #931