This commit implements the complete blockchain integration for the mobile app's wallet functionality:
**Polkadot.js Integration:**
- Created PolkadotContext for mobile with full blockchain connectivity
- Implemented wallet creation with mnemonic seed phrases
- Added secure key management with AsyncStorage
- Connected to Pezkuwi testnet (wss://beta-rpc.pezkuwi.art)
**WalletScreen Enhancements:**
- Live blockchain balance fetching for HEZ (native token)
- Live balance fetching for PEZ and wUSDT (assets)
- Real-time balance updates every 30 seconds
- Actual send transactions using api.tx.balances.transfer (HEZ)
- Actual send transactions using api.tx.assets.transfer (PEZ, wUSDT)
- Transaction signing with user's keypair
- Loading states and error handling
- Wallet creation flow for new users
- Connect/disconnect wallet functionality
**Bottom Navigation:**
- Created BottomTabNavigator with 5 tabs
- Added WalletScreen with live blockchain integration
- Added BeCitizenScreen (citizenship application)
- Added ReferralScreen (referral program)
- Renamed SettingsScreen to ProfileScreen
- Custom center button for "Be Citizen" feature
**App Structure:**
- Wrapped app with PolkadotProvider in App.tsx
- Updated AppNavigator to use BottomTabNavigator
- Integrated language selection flow with blockchain features
All wallet features now use live blockchain data instead of mock data.
Built complete React Native mobile app from scratch with ZERO hard-coded language:
🌍 LANGUAGE SYSTEM (6 Languages):
- EN (English), TR (Türkçe), KMR (Kurmancî), CKB (سۆرانی), AR (العربية), FA (فارسی)
- User selects language on welcome screen
- Language choice persists throughout entire app lifecycle
- Settings screen allows language change anytime
- NO hard-coded strings - all text uses i18next t() function
- RTL support for Arabic, Sorani, and Persian
- AsyncStorage saves user preference permanently
✅ IMPLEMENTED FEATURES:
- Welcome screen with beautiful language picker (Kurdistan gradient)
- Sign In screen (fully localized)
- Sign Up screen (fully localized)
- Dashboard with quick access to all features
- Settings screen with language switcher
- Navigation system with conditional routing
- Kurdistan flag colors throughout (Kesk/Sor/Zer/Spi/Reş)
📱 SCREENS:
- WelcomeScreen.tsx - Language selection with 6 options
- SignInScreen.tsx - Email/password login
- SignUpScreen.tsx - Registration with validation
- DashboardScreen.tsx - Main hub with balance, stats, quick actions
- SettingsScreen.tsx - Language change, theme, security, logout
🛠 TECH STACK:
- React Native + Expo (TypeScript)
- react-i18next for translations
- @react-native-async-storage/async-storage for persistence
- @react-navigation/native for navigation
- expo-linear-gradient for beautiful gradients
- Custom Kurdistan color system
🎨 UI/UX:
- Professional, modern design
- Kurdistan flag colors consistently used
- Smooth transitions and animations
- Responsive layouts
- Beautiful gradients and shadows
📂 STRUCTURE:
- src/i18n/ - i18n config + 6 language JSON files
- src/screens/ - All app screens
- src/navigation/ - Navigation logic
- src/contexts/ - Language context with AsyncStorage
- src/theme/ - Kurdistan colors
- App.tsx - Main entry with i18n initialization
✨ USER FLOW:
1. App starts → Welcome screen
2. User selects language → Saved to AsyncStorage
3. User signs in/up → Language follows through
4. Dashboard loads → Everything in selected language
5. User can change language in Settings anytime
This is a production-ready mobile app foundation with world-class
internationalization. Every single text element adapts to user's
chosen language. Perfect execution of the requirement:
"user selects language once, entire app uses that language forever
(until they change it in settings)".
- Updated ProposalsList to use useGovernance hook
- Fetches treasury proposals and democracy referenda from blockchain
- Displays both proposal types in unified list:
- Treasury proposals: Show requested amount, beneficiary, proposer
- Democracy referenda: Show aye/nay votes, voting threshold, end block
- Added loading state with spinner
- Added error handling with user-friendly messages
- Added "Live Blockchain Data" badge
- Format token amounts from blockchain units (12 decimals to HEZ)
- Empty state when no proposals exist
- Token symbol consistency: All amounts show as HEZ
- Auto-refreshes every 30 seconds via useGovernance hook
All proposals and referenda now display live blockchain data.
Changed all references to the project token from PZKW/PZK to HEZ:
- DelegationManager.tsx: Updated token symbol in comments, delegate cards, and user delegations
- DelegateProfile.tsx: Updated min/max delegation placeholders and display
- ProposalWizard.tsx: Updated budget input placeholder and review display
- TreasuryOverview.tsx: Updated treasury balance display
- TransactionModal.tsx: Updated send transaction title, description, and amount label
- WalletButton.tsx: Updated balance display in button and dropdown
All components now consistently use HEZ as the token symbol.
- 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.
- Redesigned ForumOverview with modern, professional UI
- Added admin announcements banner with 4 priority types (info/warning/success/critical)
- Implemented upvote/downvote system with real-time updates
- Added forum statistics dashboard showing discussions, categories, users, replies
- Created category grid with visual icons and discussion counts
- Enhanced discussion cards with pin/lock/trending badges
- Integrated search, filtering, and sorting functionality
- Added comprehensive moderation panel with:
- Reports queue management
- Auto-moderation settings with AI sentiment analysis
- User management with warn/suspend/ban actions
- Moderation stats dashboard
- Created useForum hook with real-time Supabase subscriptions
- All data connected to Supabase with RLS policies for security
This completes the modern forum implementation as requested.
Added:
- useGovernance hook: Fetches live proposals and referenda from blockchain
- useTreasury hook: Fetches live treasury balance and proposals
- TreasuryOverview: Now uses real blockchain data with loading/error states
- Forum database schema: Admin announcements, categories, discussions, replies, reactions
Features:
- Live data badge shows active blockchain connection
- Automatic refresh every 30 seconds for treasury data
- Secure RLS policies for forum access control
- Admin announcements system with priority and expiry
- Forum reactions (upvote/downvote) support
Next: Complete forum UI with admin banner and moderation panel
Changes:
- Update Pezkuwi endpoint color to Kurdistan Green (Kesk: #00A94F)
- Document complete Kurdistan color palette in README:
* Kesk (Green): #00A94F - Primary color
* Sor (Red): #EE2A35 - Accent color
* Zer (Gold): #FFD700 - Secondary accent
* Spi (White): #FFFFFF - Backgrounds
* Black: #000000 - Text
- Add comprehensive logo update instructions
- Add TODO comment for logo replacement after build:images
Next step: Replace pezkuwichain_logo.png and run yarn build:images
- Clone Polkadot.js Apps repository
- Update package.json with Pezkuwi branding
- Add Pezkuwi endpoint to production chains (wss://pezkuwichain.app:9944)
- Create comprehensive README for SDK UI
- Set up project structure with all packages
Next steps:
- Apply Kurdistan colors (Kesk, Sor, Zer, Spi + Black) to UI theme
- Replace logos with Pezkuwi branding
- Test build and deployment
Restructured the project to support multiple frontend applications:
- Move web app to web/ directory
- Create pezkuwi-sdk-ui/ for Polkadot SDK clone (planned)
- Create mobile/ directory for mobile app development
- Add shared/ directory with common utilities, types, and blockchain code
- Update README.md with comprehensive documentation
- Remove obsolete DKSweb/ directory
This monorepo structure enables better code sharing and organized
development across web, mobile, and SDK UI projects.
- Removed Pool button (was redirecting to home page - confusing UX)
- Changed button grid from 4 to 3 columns (Send, Receive, History)
- Made Recent Activity section functional with live blockchain data
- Fetches last 5 transactions from blockchain (balances.transfer & assets.transfer)
- Displays transaction details: type, amount, block number, timestamp
- Added refresh button for Recent Activity section
- Shows incoming (green) vs outgoing (yellow) transactions with icons
Benefits:
- No more confusing Pool button navigation
- Users see real transaction history instead of placeholder
- Cleaner UI with 3-column button layout
- Live data from blockchain ensures accuracy
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Removed /pool route from App.tsx (redundant with DEX Pools tab)
- Deleted pages/PoolDashboard.tsx (functionality in DEXDashboard)
- Removed TokenSwap modal from AppLayout (redundant with DEX Swap tab)
- Updated WalletDashboard Pool button to navigate to home page
Benefits:
- Reduces code duplication
- Provides consistent user experience through single DEX interface
- Simplifies maintenance
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Added comprehensive documentation to staking score calculation
- Clarified that frontend calculation MUST match pallet_staking_score
- Documented score formula and multiplier tiers
- Verified with tests that frontend === pallet calculation (all scenarios pass)
- Updated MONTH_IN_BLOCKS comment to show exact value (432,000)
This ensures the score displayed to users matches exactly what the
blockchain pallet calculates and reports to pallet_pez_rewards.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Changed warning message calculation from ~{bondingDuration} days to ~{Math.floor(bondingDuration / 4)} days
- Correct conversion: 4 eras = 1 day (1 era = 6 hours)
- Example: 112 eras now correctly shows as ~28 days instead of ~112 days
- Location: src/components/staking/StakingDashboard.tsx:661
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Root cause: Token symbol mismatch between TokenSwap component and WalletContext
- WalletContext stored balance with key 'USDT'
- TokenSwap used symbol 'wUSDT' for lookups
- This caused balances['wUSDT'] to return undefined
- Triggered false "insufficient balance" errors
Changes:
- Updated TokenSwap.tsx to use 'USDT' symbol consistently
- Fixed token symbol in AVAILABLE_TOKENS array
- Updated asset ID mapping in swap transaction logic
- Fixed swap history token display
Also includes:
- Added new DEX components (SwapInterface, PoolBrowser, etc.)
- Added TypeScript type definitions for DEX
- Added DEX utility functions
- Removed obsolete test scripts
- Updated WalletContext with USDT balance support
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Make AddLiquidityModal dynamic to support all pool combinations (HEZ-PEZ, HEZ-USDT, PEZ-USDT)
- Pass asset0 and asset1 props from PoolDashboard to AddLiquidityModal
- Rename balance key from wUSDT to USDT in WalletContext for user-facing consistency
- Display USDT instead of wUSDT in PriceChart for better UX
- Backend still uses wUSDT (Asset ID 2), but frontend shows USDT to users
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- check-asset-state.mjs: Asset state verification
- check-balances.mjs: Balance checking utilities
- check-founder-balances.mjs: Founder account balance checks
- check-hez-balance.mjs: HEZ token balance verification
- check-pool-balances-detailed.mjs: Detailed pool balance analysis
- create-all-pools.mjs: Automated pool creation
- create-pez-wusdt-pool.mjs: PEZ/wUSDT pool setup
- mint-and-create-pools.mjs: Mint tokens and create pools
- mint-whez.mjs: wHEZ minting utility
- verify-pool-state.mjs: Pool state verification
- wrap-hez-and-create-all-pools.mjs: HEZ wrapping and pool setup
These scripts support DEX pool management and testing for beta testnet.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
Major improvements to wallet dashboard and DEX functionality:
## USDT Integration
- Add wUSDT (Asset ID 2) support with 6 decimal precision
- Display USDT balances in wallet dashboard
- Integrate USDT into swap and pool interfaces
## Dynamic Token Pricing
- Fetch real-time HEZ and PEZ prices from liquidity pools
- Calculate USD values using pool reserve ratios
- Display live USD equivalent for token balances
## User Experience Improvements
- Hide wrapped tokens (wHEZ, wUSDT) from user interface
- Show only HEZ, PEZ, USDT as user-facing tokens
- Handle wrapping/unwrapping transparently in backend
- Add balance validation before swap transactions
- Prevent insufficient balance swaps with clear warnings
## Pool Dashboard Enhancements
- Support multiple pool pairs (HEZ/PEZ, HEZ/USDT, PEZ/USDT)
- Dynamic pool selection interface
- User-friendly token names throughout pool interface
## Technical Improvements
- Correct decimal handling (6 for USDT, 12 for others)
- Proper pool account ID derivation using blake2 hash
- Balance subscriptions for real-time updates
- Custom token support with Add Token modal
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Switch pool display from wHEZ/PEZ to PEZ/wUSDT
- Fix wUSDT decimal conversion (1e6 instead of 1e12)
- Update TokenSwap to support beta testnet endpoint
- Add wallet reconnection on network change
- Update API endpoint to wss://beta.pezkuwichain.com
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- README_DEX_IMPROVEMENTS.md: Belgekirin û rave kirinên DEX
- check-pool.mjs: Amûra kontrolkirina rewşa pool
- create-beta-pool.mjs: Script ji bo çêkirina pool li beta testnet
- create-beta-pool.js: Versiyona JavaScript ya scripta çêkirina pool
Ev pel ji bo pêşkeftin û testing in.
🤖 Bi [Claude Code](https://claude.com/claude-code) re hate çêkirin
Co-Authored-By: Claude <noreply@anthropic.com>
- poolAccountIds fonksiyona API tune ne, ji ber vê hataye derket
- Niha pool account bi AccountIdConverter û blake2 hash tê hesabkirin
- PalletId "py/ascon" bi (u32, u32) poolId re tê hash kirin
- Ev guhertin hem ji bo AddLiquidityModal û hem jî PoolDashboard
Taybetmendî:
✅ Add liquidity niha bi rast dixebite
✅ Pool metrics rast têne xuyakirin
✅ Reserve balances rast têne hesabkirin
✅ LP position tracking çêbû
🤖 Bi [Claude Code](https://claude.com/claude-code) re hate çêkirin
Co-Authored-By: Claude <noreply@anthropic.com>
- Add AddLiquidityModal with automatic HEZ to wHEZ wrapping and 10% slippage tolerance
- Add RemoveLiquidityModal with automatic wHEZ to HEZ unwrapping
- Add PoolDashboard component with metrics, APR calculation, and impermanent loss calculator
- Add /pool route and integrate Pool button in WalletDashboard
- Display real-time pool reserves, TVL, and user positions
- Support batched transactions for optimal UX
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Changed default endpoint from ws://127.0.0.1:9944 to wss://beta.pezkuwichain.io
- Preparing for multi-validator beta testnet deployment
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
The path is an array of tuples [[assetId, amount], [assetId, amount]],
not an array of objects. Fixed to access asset ID at index 0 of each tuple.
Previous code was trying to access object properties (nativeOrAsset.asset)
which don't exist on arrays, causing all swaps to default to HEZ→HEZ.
The SwapExecuted event has 5 fields (who, send_to, amountIn, amountOut, path),
not 4. The old code was missing send_to, which caused the path (asset array)
to be assigned the recipient address instead, resulting in all swaps showing
as HEZ→HEZ regardless of actual token pairs.
This fixes the swap history display to show correct token symbols.
- Fixed path array parsing for SwapExecuted events
- Handle different Polkadot.js enum formats (nativeOrAsset vs NativeOrAsset)
- Added toJSON() conversion for proper array parsing
- Now correctly shows HEZ↔PEZ swaps instead of HEZ→HEZ
- Applied fix to both initial history load and post-swap refresh
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Reduced file size from 719KB to 243KB (66% reduction)
- Updated DKstate.png with optimized version
- Improved page load performance
Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Added DKstate.png to public folder (719KB PNG)
- Replaced Kurdish Flag CDN image with local DKstate background
- Updated alt text to "DKstate Background"
- Maintained gradient overlay styling
Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Added PezkuwiChain logo to public folder (179KB PNG)
- Replaced CDN image with local logo in RewardDistribution component
- Updated alt text to "PezkuwiChain Logo"
Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fetch trust score from blockchain via api.query.trust.trustScores
- Display trust score in AccountBalance component (Account Info card)
- Show between Address and Source fields with Award icon
- Use purple-cyan gradient styling for visual consistency
Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added comprehensive console logs to debug trust score fetching:
- API readiness check
- Account availability check
- Query execution log
- Detailed error logging with stack trace
This will help identify the exact point of failure.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Changed from `trustScoreOf` to `trustScores` to match the actual
storage item name in pallet_trust. Polkadot.js API uses storage names,
not getter function names.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fetch trust score from pallet_trust via API
- Display score in WalletModal with Award icon
- Shows user's current trust score from blockchain
- Gradient styling (purple to cyan) for visual appeal
- Fallback to '-' when API not ready or score unavailable
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fetch total staked tokens from pallet_staking.erasTotalStake()
- Count unique voters from pallet_conviction_voting.votingFor.keys()
- Display real-time data instead of hardcoded values
- Shows '-' when data is unavailable (e.g. no current era)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Updated HeroSection to fetch real governance data:
- Active Proposals from pallet_referenda (was hardcoded to 127)
- Replaced all hardcoded stats with dynamic blockchain queries
- Shows "-" for unavailable data (totalVoters, tokensStaked, trustScore)
- Real-time updates using PolkadotContext API
Now homepage shows actual on-chain referendum count instead of mock data.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Connected governance overview to actual blockchain data:
- Active proposals from pallet_referenda
- Treasury balance from treasury account
- Parliament (Council) members from pallet_collective
- Real-time data fetching using PolkadotContext API
- Replaced mock data with live blockchain queries
Todo: Add total voters and participation rate calculation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added Pezkuwi whitepaper PDF to repository and updated navigation:
- Added public/Whitepaper.pdf (738KB)
- Updated Docs links to download whitepaper from GitHub
- Both header and footer navigation now link to GitHub raw PDF
- Users can download whitepaper by clicking Docs
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added animated Kurdistan-themed loading indicator that displays during swap transactions:
- KurdistanSun component with 21 rays (Kurdistan flag symbolism)
- White center sun with glow effects
- Rotating colored halos: green (outer), red (middle), yellow (inner)
- Full-screen overlay with backdrop blur during processing
- Fixed timing: dialog closes before animation shows
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>