chore: move wallet to services

This commit is contained in:
Danish Arora 2025-09-02 10:21:08 +05:30
parent df1b052770
commit 9ade3efb10
No known key found for this signature in database
GPG Key ID: 1C6EF37CDAE1426E
11 changed files with 54 additions and 14 deletions

View File

@ -15,61 +15,73 @@ The OpChan application has successfully implemented most core functionality incl
### ✅ IMPLEMENTED
#### 1. Bitcoin Key Authentication
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/identity/wallets/ReOwnWalletService.ts`, `src/contexts/AuthContext.tsx`
- **Details**: Complete Bitcoin wallet integration with message signing capabilities
#### 2. Cell Creation Restrictions
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/forum/ForumActions.ts`, `src/components/CreateCellDialog.tsx`
- **Details**: Only users with Logos ordinal or ENS can create cells
#### 3. Content Visibility
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/contexts/ForumContext.tsx`, `src/components/PostList.tsx`
- **Details**: All users can view content regardless of authentication status
#### 4. Cell Listing
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/components/CellList.tsx`, `src/pages/Index.tsx`
- **Details**: Complete cell browsing with sorting and filtering
#### 5. Cell Creation
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/forum/ForumActions.ts`, `src/components/CreateCellDialog.tsx`
- **Details**: Name, description, and icon support with admin privileges
#### 6. Post Creation
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/forum/ForumActions.ts`, `src/components/PostList.tsx`
- **Details**: Title and body support with proper validation
#### 7. Comment System
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/forum/ForumActions.ts`, `src/components/PostDetail.tsx`
- **Details**: Nested commenting with proper threading
#### 8. Voting System
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/forum/ForumActions.ts`, `src/components/PostCard.tsx`
- **Details**: Upvote/downvote functionality with verification requirements
#### 9. Web3 Key Authentication
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/identity/wallets/ReOwnWalletService.ts`
- **Details**: Ethereum wallet support alongside Bitcoin
#### 10. Relevance Index System
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/forum/RelevanceCalculator.ts`, `src/lib/forum/transformers.ts`
- **Details**: Comprehensive scoring with verification bonuses and moderation penalties
#### 11. Moderation System
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/forum/ForumActions.ts`, `src/components/PostDetail.tsx`
- **Details**: Cell admin moderation for posts, comments, and users
#### 12. Anonymous Voting
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/forum/ForumActions.ts`
- **Details**: Anonymous users can vote with proper verification checks
@ -77,12 +89,14 @@ The OpChan application has successfully implemented most core functionality incl
### ⚠️ PARTIALLY IMPLEMENTED
#### 13. Call Sign Setup
- **Status**: ⚠️ Partially Implemented
- **Implementation**: `src/types/identity.ts` (interface defined)
- **Details**: Interface exists but no UI for setting up call signs
- **Missing**: User interface for call sign configuration
#### 14. Ordinal Avatar Display
- **Status**: ⚠️ Partially Implemented
- **Implementation**: `src/components/ui/author-display.tsx`
- **Details**: Basic ordinal detection but limited avatar display
@ -91,6 +105,7 @@ The OpChan application has successfully implemented most core functionality incl
### ❌ NOT IMPLEMENTED
#### 15. Bookmarking System
- **Status**: ❌ Not Implemented
- **Missing**: Local storage for bookmarked posts and topics
- **Impact**: Users cannot save content for later reference
@ -102,56 +117,67 @@ The OpChan application has successfully implemented most core functionality incl
### ✅ IMPLEMENTED
#### 1. Cross-Cell Topic Viewing
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/pages/FeedPage.tsx`, `src/components/ActivityFeed.tsx`
- **Details**: Global feed showing posts from all cells
#### 2. Active Member Count
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/forum/transformers.ts`
- **Details**: Calculated from post activity per cell
#### 3. Topic Sorting
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/utils/sorting.ts`, `src/components/CellList.tsx`
- **Details**: Sort by relevance (top) or time (new)
#### 4. User Identification
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/components/ui/author-display.tsx`
- **Details**: Ordinal pictures, ENS names, and custom nicknames
#### 5. Moderation Hiding
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/components/PostList.tsx`, `src/components/PostDetail.tsx`
- **Details**: Moderated content is hidden from regular users
#### 6. Key Delegation
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/services/CryptoService.ts`, `src/components/ui/wallet-wizard.tsx`
- **Details**: Browser key generation for improved UX
#### 7. Browser-Only Usage
- **Status**: ✅ Fully Implemented
- **Implementation**: React web application
- **Details**: No additional software required beyond browser
#### 8. Prototype UI
- **Status**: ✅ Fully Implemented
- **Implementation**: Complete React component library
- **Details**: Modern, responsive interface with cypherpunk theme
#### 9. Library API
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/` directory structure
- **Details**: Clear separation of concerns with well-defined interfaces
#### 10. ENS Display Integration
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/components/ui/author-display.tsx`
- **Details**: ENS holders can use ENS for display purposes
#### 11. Relevance-Based Ordering
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/forum/RelevanceCalculator.ts`
- **Details**: Posts and comments ordered by relevance score
@ -163,11 +189,13 @@ The OpChan application has successfully implemented most core functionality incl
### ✅ IMPLEMENTED
#### 1. Ephemeral Data Handling
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/waku/services/CacheService.ts`
- **Details**: Local caching with network synchronization
#### 2. End-to-End Reliability
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/waku/core/ReliableMessaging.ts`
- **Details**: Message acknowledgment and retry mechanisms
@ -179,6 +207,7 @@ The OpChan application has successfully implemented most core functionality incl
### ✅ IMPLEMENTED
#### 1. Efficient Message Handling
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/waku/services/CacheService.ts`
- **Details**: Optimized message processing and caching
@ -190,11 +219,13 @@ The OpChan application has successfully implemented most core functionality incl
### ✅ IMPLEMENTED
#### 1. Web Application
- **Status**: ✅ Fully Implemented
- **Implementation**: React-based SPA
- **Details**: Cross-platform web application
#### 2. Optional Wallet Support
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/contexts/AuthContext.tsx`
- **Details**: Bitcoin and Ethereum wallet integration
@ -206,11 +237,13 @@ The OpChan application has successfully implemented most core functionality incl
### ✅ IMPLEMENTED
#### 1. Centralized Ordinal API
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/identity/ordinal.ts`
- **Details**: Integration with Logos dashboard API
#### 2. Waku Network Integration
- **Status**: ✅ Fully Implemented
- **Implementation**: `src/lib/waku/` directory
- **Details**: Complete Waku protocol implementation
@ -265,14 +298,17 @@ The OpChan application has successfully implemented most core functionality incl
## Technical Debt & Improvements
### Code Quality
- **Status**: ✅ Good
- **Details**: Well-structured TypeScript with proper type safety
### Testing Coverage
- **Status**: ⚠️ Partial
- **Details**: Basic tests exist but coverage could be improved
### Documentation
- **Status**: ✅ Good
- **Details**: Comprehensive README and inline documentation
@ -283,6 +319,7 @@ The OpChan application has successfully implemented most core functionality incl
OpChan has successfully implemented the vast majority of FURPS requirements, providing a solid foundation for a decentralized forum application. The core functionality is robust and well-architected, with only a few user experience features remaining to be implemented.
**Key Strengths:**
- Complete authentication and authorization system
- Robust forum operations (cells, posts, comments, voting)
- Sophisticated relevance scoring algorithm
@ -290,6 +327,7 @@ OpChan has successfully implemented the vast majority of FURPS requirements, pro
- Professional-grade UI with cypherpunk aesthetic
**Areas for Improvement:**
- User personalization features (bookmarks, call signs)
- Enhanced ordinal integration
- Advanced search and filtering

View File

@ -23,9 +23,9 @@ import PostPage from './pages/PostPage';
import NotFound from './pages/NotFound';
import Dashboard from './pages/Dashboard';
import Index from './pages/Index';
import { appkitConfig } from './lib/identity/wallets/config';
import { appkitConfig } from './lib/services/WalletService/config';
import { WagmiProvider } from 'wagmi';
import { config } from './lib/identity/wallets/config';
import { config } from './lib/services/WalletService/config';
import { AppKitProvider } from '@reown/appkit/react';
// Create a client

View File

@ -3,8 +3,8 @@ import { Badge } from '@/components/ui/badge';
import { Shield, Crown } from 'lucide-react';
import { UserVerificationStatus } from '@/types/forum';
import { getEnsName } from '@wagmi/core';
import { config } from '@/lib/identity/wallets/config';
import { OrdinalAPI } from '@/lib/identity/ordinal';
import { config } from '@/lib/services/WalletService/config';
import { OrdinalAPI } from '@/lib/services/Ordinal';
interface AuthorDisplayProps {
address: string;

View File

@ -21,7 +21,7 @@ import { RelevanceCalculator } from '@/lib/forum/RelevanceCalculator';
import { UserVerificationStatus } from '@/types/forum';
import { CryptoService } from '@/lib/services';
import { getEnsName } from '@wagmi/core';
import { config } from '@/lib/identity/wallets/config';
import { config } from '@/lib/services/WalletService/config';
interface ForumContextType {
cells: Cell[];

View File

@ -1 +0,0 @@
export { ReOwnWalletService as WalletService } from './ReOwnWalletService';

View File

@ -1,9 +1,9 @@
import { WalletService } from '../identity/wallets/index';
import walletService from './WalletService';
import { UseAppKitAccountReturn } from '@reown/appkit/react';
import { AppKit } from '@reown/appkit';
import { CryptoService, DelegationDuration } from './CryptoService';
import { EVerificationStatus, User, DisplayPreference } from '@/types/identity';
import { WalletInfo } from '../identity/wallets/ReOwnWalletService';
import { WalletInfo } from './WalletService';
export interface AuthResult {
success: boolean;
@ -37,11 +37,11 @@ export interface AuthServiceInterface {
}
export class AuthService implements AuthServiceInterface {
private walletService: WalletService;
private walletService: typeof walletService;
private cryptoService: CryptoService;
constructor(cryptoService: CryptoService) {
this.walletService = new WalletService();
this.walletService = walletService;
this.cryptoService = cryptoService;
}

View File

@ -2,7 +2,7 @@ import { UseAppKitAccountReturn } from '@reown/appkit/react';
import {
CryptoService,
DelegationDuration,
} from '../../services/CryptoService';
} from '../CryptoService';
import { AppKit } from '@reown/appkit';
import { getEnsName } from '@wagmi/core';
import { ChainNamespace } from '@reown/appkit-common';
@ -16,7 +16,7 @@ export interface WalletInfo {
isConnected: boolean;
}
export class ReOwnWalletService {
class WalletService {
private cryptoService: CryptoService;
private bitcoinAccount?: UseAppKitAccountReturn;
private ethereumAccount?: UseAppKitAccountReturn;
@ -247,3 +247,6 @@ export class ReOwnWalletService {
return null;
}
}
const walletService = new WalletService();
export default walletService;