Complete wallet connection and onboarding flow for Creditra Frontend with:
✅ Wallet connection modal with Freighter, Albedo, xBull & Rabet support
✅ Real wallet icons from Stellar ecosystem
✅ First-time user onboarding (3-step flow)
✅ Connection status indicators
✅ Error handling (wallet not found, connection failed, wrong network)
✅ Success states with animations
✅ Persistent wallet preference (localStorage)
✅ Auto-reconnect for returning users
✅ Disconnect functionality
✅ Responsive design with dark theme
src/
├── components/
│ ├── WalletConnectionModal.tsx # Main connection modal
│ ├── WalletConnectionModal.css # Modal styles
│ ├── OnboardingFlow.tsx # 3-step onboarding
│ ├── OnboardingFlow.css # Onboarding styles
│ ├── WalletButton.tsx # Header wallet button
│ └── WalletButton.css # Button styles
├── context/
│ └── WalletContext.tsx # Global wallet state
├── types/
│ └── wallet.ts # TypeScript types
└── utils/
└── wallet.ts # Wallet utilities
Documentation:
├── WALLET_IMPLEMENTATION.md # Complete implementation docs
└── USER_FLOWS.md # Visual flow diagrams
- Start the dev server:
npm run dev-
Test wallet connection:
- Click "Connect Wallet" button in header
- Select Freighter or Albedo
- See loading state
- See success confirmation
- Onboarding flow appears (first time only)
-
Test error states:
- Try connecting without wallet installed → See "wallet not found" error
- Reject connection in wallet → See "connection failed" error
-
Test persistence:
- Connect wallet
- Refresh page
- Wallet should auto-reconnect
-
Test disconnect:
- Click connected wallet address
- Click "Disconnect" in dropdown
- Button returns to "Connect Wallet"
- Background:
#0d1117 - Surface:
#161b22 - Accent:
#58a6ff(blue) - Success:
#3fb950(green) - Error:
#f85149(red)
- Modal: Fade in + slide up
- Success icon: Scale in with bounce
- Loading: Spinning border
- Status dot: Pulse animation
- Disconnected: Blue "Connect Wallet" button
- Connecting: Loading spinner on selected wallet
- Connected: Address display with green pulse dot
- Error: Red error banner with message
Currently uses mock wallet detection. To integrate real wallets:
npm install @stellar/freighter-apiUpdate src/utils/wallet.ts:
import { isConnected, getPublicKey, getNetwork } from "@stellar/freighter-api";npm install @albedo-link/intentUpdate src/utils/wallet.ts:
import albedo from '@albedo-link/intent';- Mobile-friendly modal (90% width, max 480px)
- Touch-friendly buttons (min 44px height)
- Readable text sizes (0.85rem - 1.5rem)
- Proper spacing and padding
- Keyboard navigation support
- Focus states on interactive elements
- Semantic HTML structure
- ARIA labels (can be enhanced)
- Color contrast meets WCAG AA
- Connect with Freighter
- Connect with Albedo
- Wallet not found error
- Connection rejected error
- Wrong network error
- Success state displays
- Onboarding shows (first time)
- Onboarding skips (returning user)
- Auto-reconnect works
- Disconnect works
- Dropdown menu works
- Mobile responsive
- Animations smooth
- WALLET_IMPLEMENTATION.md: Complete technical documentation
- USER_FLOWS.md: Visual flow diagrams for all scenarios
- This file: Quick start guide
- Install real wallet SDKs (Freighter, Albedo)
- Test with actual wallets on Stellar testnet
- Add transaction signing capabilities
- Implement credit evaluation after wallet connection
- Add wallet balance display
- Add network switching UI
import { useWallet } from './context/WalletContext';
function MyComponent() {
const { wallet, status, connect, disconnect } = useWallet();
if (status === 'connected' && wallet) {
return (
<div>
<p>Connected: {wallet.publicKey}</p>
<p>Network: {wallet.network}</p>
<button onClick={disconnect}>Disconnect</button>
</div>
);
}
return <button onClick={() => connect('freighter')}>Connect</button>;
}- Mock wallet detection (needs real SDK integration)
- No transaction signing yet
- No multi-wallet support
- No wallet switching without disconnect
- No mobile wallet deep linking
For questions or issues:
- Check WALLET_IMPLEMENTATION.md for detailed docs
- Review USER_FLOWS.md for flow diagrams
- Check browser console for errors
- Verify wallet extensions are installed
Built with: React 18, TypeScript, Vite
Design: GitHub dark theme inspired
Wallets: Freighter, Albedo (Stellar)