Skip to content

Add historical chart of total voting weight over time - #555

Merged
thegreatfeez merged 1 commit into
Ac0rdP:mainfrom
Silver36-ship-it:AddaHistoricalChartOfTotalVotingWeightOverTime
Aug 31, 2026
Merged

Add historical chart of total voting weight over time#555
thegreatfeez merged 1 commit into
Ac0rdP:mainfrom
Silver36-ship-it:AddaHistoricalChartOfTotalVotingWeightOverTime

Conversation

@Silver36-ship-it

Copy link
Copy Markdown
Contributor

Closes #404

  • Add getHistoricalWeightChangeEvents() to fetch all owner weight change events
  • Add reconstructTotalWeightHistory() to reconstruct weight at each point in time
  • Create HistoricalWeightChart component using Recharts
  • Integrate chart into DashboardPage between GovernanceHealthWidget and Due Schedules
  • Chart shows weight progression with loading, error, and empty states
  • Supports sparse history and gracefully handles missing data

Summary

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor

Related Issue

Closes #

Testing Checklist

  • Existing tests pass locally
  • New tests added to cover this change (where applicable)
  • Manually verified the change works as expected
  • Lint / type checks pass

Add Historical Chart of Total Voting Weight Over Time

PR Description

This PR adds a time-series chart to the dashboard that visualizes how the multisig's total voting weight has changed over time. Owners can now see historical trends by examining weight changes reconstructed from on-chain events.

What's Changed

  • New function getHistoricalWeightChangeEvents() in contract.ts

    • Fetches all available owner weight-change events from contract history (up to 100 events from last 10k ledgers)
    • Returns events sorted chronologically from oldest to newest
    • Gracefully handles fetch failures
  • New function reconstructTotalWeightHistory() in contract.ts

    • Reconstructs total voting weight at each point in time from individual owner weight changes
    • Uses reported newTotalWeight when available; calculates deltas when not
    • Prevents negative weights with floor at 0
    • Returns array of WeightHistoryPoint objects with timestamp, ledger, totalWeight, and Date
  • New type WeightHistoryPoint in contract.ts

    • Represents a single data point in weight history
    • Includes: timestamp (string), ledger (number), totalWeight (number), date (Date)
  • New component HistoricalWeightChart in HistoricalWeightChart.tsx

    • React component using Recharts for visualization
    • Displays interactive line chart with green line showing weight progression
    • X-axis shows dates parsed from event timestamps
    • Y-axis shows total weight values
    • Includes loading, error, and empty states
    • Adds current total weight as final data point if different from last historical point
    • Shows event count and current weight metadata
  • Updated DashboardPage in DashboardPage.tsx

    • Added import for HistoricalWeightChart
    • Integrated chart component between GovernanceHealthWidget and "Due Schedules" section
    • Passes currentTotalWeight and loading props

Why These Changes

The contract emits events for every owner weight change, providing a complete audit trail. This feature leverages that on-chain history to give owners visibility into how governance power has been distributed over time, enabling better financial oversight and trust.

Acceptance Criteria

  • A chart shows how total voting weight has changed over time
  • The series is derived from on-chain event history, not hard-coded values
  • With little or no history, the chart shows a sensible empty or single-point state
  • Chart gracefully handles missing data and sparse histories
  • Loading and error states are properly handled
  • Component integrates cleanly into existing dashboard layout

Testing

  1. With history: Verify chart displays correctly when weight change events exist
  2. Without history: Verify empty state message displays gracefully
  3. Loading state: Verify loading spinner/message shows while fetching events
  4. Error state: Verify error message displays if event fetch fails
  5. Current weight: Verify current total weight is added as final data point
  6. Responsive: Verify chart resizes correctly on different screen sizes

Dependencies

Requires installation of Recharts charting library:

npm install recharts

Technical Notes

  • Events are fetched from last 10,000 ledgers (~1.4 hours of Stellar history)
  • Timestamp parsing handles formatted dates like "Aug 31, 2026"
  • X-axis labels intelligently sample events to avoid crowding (shows ~5 dates)
  • Chart data includes both historical events and current state for complete picture
  • All parsing errors are caught and logged without breaking the component

Related Issue

Closes dashboard analytics feature request for historical weight visibility.

- Add getHistoricalWeightChangeEvents() to fetch all owner weight change events
- Add reconstructTotalWeightHistory() to reconstruct weight at each point in time
- Create HistoricalWeightChart component using Recharts
- Integrate chart into DashboardPage between GovernanceHealthWidget and Due Schedules
- Chart shows weight progression with loading, error, and empty states
- Supports sparse history and gracefully handles missing data
@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

@Silver36-ship-it is attempting to deploy a commit to the thegreatfeez's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@Silver36-ship-it 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! 🚀

Learn more about application limits

@thegreatfeez
thegreatfeez merged commit ec6459b into Ac0rdP:main Aug 31, 2026
1 check failed
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.

Add a historical chart of total voting weight over time, derived from owner-weight-change and proposal-creation event history

2 participants