Claude f6ea4e327f
feat: Complete Polymarket wallet integration with UI components
Backend Integration:
- Update config.ts to add Polymarket wallet configuration (proxy/safe)
- Integrate UnifiedWalletManager into PolymarketService
- Add API endpoints for wallet info, wallet switching, and comparison
- Support dynamic wallet type selection at runtime

Frontend Components:
- Create PolymarketWalletSelector.tsx for web dashboard
- Add wallet type cards with pros/cons comparison
- Implement real-time wallet switching with visual feedback
- Add responsive design with glassmorphism styling

Mobile App:
- Create PolymarketWalletScreen.tsx for React Native
- Add mobile-optimized wallet selector with touch interactions
- Implement pull-to-refresh and loading states
- Add wallet comparison toggle with expandable content
- Update App.tsx navigation to include new screen

Features:
- Switch between Proxy (email-based) and Safe (browser wallet) wallets
- View detailed wallet comparison with recommendations
- Real-time wallet status and initialization state
- Seamless wallet type migration
- Error handling and user feedback
2025-11-12 14:14:39 +00:00

126 lines
3.6 KiB
TypeScript

/**
* Immortal AI Trading Bot - Mobile App
* React Native app for monitoring and controlling the trading bot
*/
import React, { useEffect, useState } from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import * as Notifications from 'expo-notifications';
// Screens
import DashboardScreen from './src/screens/DashboardScreen';
import TradesScreen from './src/screens/TradesScreen';
import SettingsScreen from './src/screens/SettingsScreen';
import BotControlScreen from './src/screens/BotControlScreen';
import PortfolioScreen from './src/screens/PortfolioScreen';
import AnalyticsScreen from './src/screens/AnalyticsScreen';
import OpportunitiesScreen from './src/screens/OpportunitiesScreen';
import PolymarketWalletScreen from './src/screens/PolymarketWalletScreen';
// Configure notifications
Notifications.setNotificationHandler({
handleNotification: async () => ({
shouldShowAlert: true,
shouldPlaySound: true,
shouldSetBadge: true,
}),
});
const Stack = createStackNavigator();
export default function App() {
const [expoPushToken, setExpoPushToken] = useState('');
useEffect(() => {
// Register for push notifications
registerForPushNotificationsAsync().then(token => setExpoPushToken(token || ''));
// Listen for notifications
const subscription = Notifications.addNotificationReceivedListener(notification => {
console.log('Notification received:', notification);
});
return () => subscription.remove();
}, []);
return (
<NavigationContainer>
<Stack.Navigator
initialRouteName="Dashboard"
screenOptions={{
headerStyle: {
backgroundColor: '#000',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold',
},
}}
>
<Stack.Screen
name="Dashboard"
component={DashboardScreen}
options={{ title: 'Immortal Bot Dashboard' }}
/>
<Stack.Screen
name="BotControl"
component={BotControlScreen}
options={{ title: 'Bot Control' }}
/>
<Stack.Screen
name="Trades"
component={TradesScreen}
options={{ title: 'Trade History' }}
/>
<Stack.Screen
name="Settings"
component={SettingsScreen}
options={{ title: 'Settings' }}
/>
<Stack.Screen
name="Portfolio"
component={PortfolioScreen}
options={{ title: 'Portfolio' }}
/>
<Stack.Screen
name="Analytics"
component={AnalyticsScreen}
options={{ title: 'Analytics' }}
/>
<Stack.Screen
name="Opportunities"
component={OpportunitiesScreen}
options={{ title: 'Opportunities' }}
/>
<Stack.Screen
name="PolymarketWallet"
component={PolymarketWalletScreen}
options={{ title: 'Polymarket Wallet' }}
/>
</Stack.Navigator>
</NavigationContainer>
);
}
async function registerForPushNotificationsAsync() {
let token;
const { status: existingStatus } = await Notifications.getPermissionsAsync();
let finalStatus = existingStatus;
if (existingStatus !== 'granted') {
const { status } = await Notifications.requestPermissionsAsync();
finalStatus = status;
}
if (finalStatus !== 'granted') {
alert('Failed to get push token for push notification!');
return;
}
token = (await Notifications.getExpoPushTokenAsync()).data;
console.log('Push token:', token);
return token;
}