mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 04:27:56 +00:00
a7727a9029
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.
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import React, { useEffect, useState } from 'react';
|
|
import { View, ActivityIndicator, StyleSheet } from 'react-native';
|
|
import { StatusBar } from 'expo-status-bar';
|
|
import { initializeI18n } from './src/i18n';
|
|
import { LanguageProvider } from './src/contexts/LanguageContext';
|
|
import { PolkadotProvider } from './src/contexts/PolkadotContext';
|
|
import AppNavigator from './src/navigation/AppNavigator';
|
|
import { KurdistanColors } from './src/theme/colors';
|
|
|
|
export default function App() {
|
|
const [isI18nInitialized, setIsI18nInitialized] = useState(false);
|
|
|
|
useEffect(() => {
|
|
// Initialize i18n on app start
|
|
const initApp = async () => {
|
|
try {
|
|
await initializeI18n();
|
|
setIsI18nInitialized(true);
|
|
} catch (error) {
|
|
console.error('Failed to initialize i18n:', error);
|
|
// Fallback: Still show app but with default language
|
|
setIsI18nInitialized(true);
|
|
}
|
|
};
|
|
|
|
initApp();
|
|
}, []);
|
|
|
|
if (!isI18nInitialized) {
|
|
return (
|
|
<View style={styles.loadingContainer}>
|
|
<ActivityIndicator size="large" color={KurdistanColors.kesk} />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<PolkadotProvider>
|
|
<LanguageProvider>
|
|
<StatusBar style="auto" />
|
|
<AppNavigator />
|
|
</LanguageProvider>
|
|
</PolkadotProvider>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
loadingContainer: {
|
|
flex: 1,
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
backgroundColor: KurdistanColors.spi,
|
|
},
|
|
});
|
|
|