mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-23 02:27:55 +00:00
298ef7aa68
- Created useDelegation hook to fetch real delegation data from blockchain - Queries democracy.voting pallet for all delegations - Tracks delegate totals, delegator counts, and voting power - Calculates delegate performance metrics and success rates - Fetches user's own delegations with conviction levels - Auto-refreshes every 30 seconds for live updates - Provides delegateVotes and undelegateVotes transaction builders - Updated DelegationManager component to use live data - Replaced mock delegates with real blockchain delegates - Replaced mock delegations with user's actual delegations - Added loading states with spinner during data fetch - Added error handling with user-friendly messages - Added "Live Blockchain Data" badge for transparency - Formatted token amounts from blockchain units (12 decimals) - Show delegate addresses in monospace font - Display delegator count and conviction levels - Empty states for no delegates/delegations scenarios - Enhanced PolkadotContext with isConnected property - Added isConnected as alias for isApiReady - Maintains backward compatibility with existing hooks - Added formatNumber utility to lib/utils - Formats large numbers with K/M/B suffixes - Handles decimals and edge cases - Consistent formatting across all components All delegation data now comes from live blockchain queries.