mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-27 19:38:00 +00:00
Initial commit - PezkuwiChain Web Governance App
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
// Identity verification types and utilities
|
||||
export interface IdentityProfile {
|
||||
address: string;
|
||||
verificationLevel: 'none' | 'basic' | 'advanced' | 'verified';
|
||||
kycStatus: 'pending' | 'approved' | 'rejected' | 'none';
|
||||
reputationScore: number;
|
||||
badges: Badge[];
|
||||
roles: Role[];
|
||||
verificationDate?: Date;
|
||||
privacySettings: PrivacySettings;
|
||||
}
|
||||
|
||||
export interface Badge {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
icon: string;
|
||||
color: string;
|
||||
earnedDate: Date;
|
||||
category: 'governance' | 'contribution' | 'verification' | 'achievement';
|
||||
}
|
||||
|
||||
export interface Role {
|
||||
id: string;
|
||||
name: string;
|
||||
permissions: string[];
|
||||
assignedDate: Date;
|
||||
expiryDate?: Date;
|
||||
}
|
||||
|
||||
export interface PrivacySettings {
|
||||
showRealName: boolean;
|
||||
showEmail: boolean;
|
||||
showCountry: boolean;
|
||||
useZKProof: boolean;
|
||||
}
|
||||
|
||||
export interface KYCData {
|
||||
firstName?: string;
|
||||
lastName?: string;
|
||||
email?: string;
|
||||
country?: string;
|
||||
documentType?: 'passport' | 'driver_license' | 'national_id';
|
||||
documentHash?: string;
|
||||
zkProof?: string;
|
||||
}
|
||||
|
||||
export const VERIFICATION_LEVELS = {
|
||||
none: { label: 'Unverified', color: 'gray', minScore: 0 },
|
||||
basic: { label: 'Basic', color: 'blue', minScore: 100 },
|
||||
advanced: { label: 'Advanced', color: 'purple', minScore: 500 },
|
||||
verified: { label: 'Verified', color: 'green', minScore: 1000 }
|
||||
};
|
||||
|
||||
export const DEFAULT_BADGES: Badge[] = [
|
||||
{
|
||||
id: 'early_adopter',
|
||||
name: 'Early Adopter',
|
||||
description: 'Joined during genesis phase',
|
||||
icon: '🚀',
|
||||
color: 'purple',
|
||||
earnedDate: new Date(),
|
||||
category: 'achievement'
|
||||
},
|
||||
{
|
||||
id: 'governance_participant',
|
||||
name: 'Active Voter',
|
||||
description: 'Participated in 10+ proposals',
|
||||
icon: '🗳️',
|
||||
color: 'blue',
|
||||
earnedDate: new Date(),
|
||||
category: 'governance'
|
||||
}
|
||||
];
|
||||
|
||||
export const ROLES = {
|
||||
validator: {
|
||||
id: 'validator',
|
||||
name: 'Validator',
|
||||
permissions: ['validate_blocks', 'propose_blocks', 'vote_proposals']
|
||||
},
|
||||
council_member: {
|
||||
id: 'council_member',
|
||||
name: 'Council Member',
|
||||
permissions: ['create_proposals', 'fast_track_proposals', 'emergency_actions']
|
||||
},
|
||||
verified_user: {
|
||||
id: 'verified_user',
|
||||
name: 'Verified User',
|
||||
permissions: ['vote_proposals', 'create_basic_proposals']
|
||||
}
|
||||
};
|
||||
|
||||
export function calculateReputationScore(
|
||||
activities: any[],
|
||||
verificationLevel: string,
|
||||
badges: Badge[]
|
||||
): number {
|
||||
let score = 0;
|
||||
|
||||
// Base score from verification
|
||||
switch (verificationLevel) {
|
||||
case 'basic': score += 100; break;
|
||||
case 'advanced': score += 500; break;
|
||||
case 'verified': score += 1000; break;
|
||||
}
|
||||
|
||||
// Score from badges
|
||||
score += badges.length * 50;
|
||||
|
||||
// Score from activities (placeholder)
|
||||
score += activities.length * 10;
|
||||
|
||||
return Math.min(score, 2000); // Cap at 2000
|
||||
}
|
||||
|
||||
export function generateZKProof(data: KYCData): string {
|
||||
// Simplified ZK proof generation (in production, use actual ZK library)
|
||||
const hash = btoa(JSON.stringify({
|
||||
...data,
|
||||
timestamp: Date.now(),
|
||||
nonce: Math.random()
|
||||
}));
|
||||
return `zk_${hash.substring(0, 32)}`;
|
||||
}
|
||||
|
||||
export function verifyZKProof(proof: string, expectedData?: any): boolean {
|
||||
// Simplified verification (in production, use actual ZK verification)
|
||||
return proof.startsWith('zk_') && proof.length > 32;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
|
||||
|
||||
// Initialize Supabase client
|
||||
// Using direct values from project configuration
|
||||
const supabaseUrl = 'https://vbhftvdayqfmcgmzdxfv.supabase.co';
|
||||
const supabaseKey = 'sb_publishable_Aq6cShprdtxYyUsohmsquQ_OurU7w07';
|
||||
const supabase = createClient(supabaseUrl, supabaseKey);
|
||||
|
||||
|
||||
export { supabase };
|
||||
@@ -0,0 +1,6 @@
|
||||
import { clsx, type ClassValue } from "clsx"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// Wallet configuration and utilities for PezkuwiChain
|
||||
export const PEZKUWICHAIN_NETWORK = {
|
||||
chainId: '0x2329', // 9001 in hex
|
||||
chainName: 'PezkuwiChain',
|
||||
nativeCurrency: {
|
||||
name: 'Pezkuwi',
|
||||
symbol: 'PZK',
|
||||
decimals: 18
|
||||
},
|
||||
rpcUrls: ['https://rpc.pezkuwichain.app'],
|
||||
blockExplorerUrls: ['https://explorer.pezkuwichain.app']
|
||||
};
|
||||
|
||||
export const WALLET_ERRORS = {
|
||||
NO_WALLET: 'No wallet detected. Please install MetaMask or use WalletConnect.',
|
||||
CONNECTION_FAILED: 'Failed to connect wallet. Please try again.',
|
||||
NETWORK_ERROR: 'Failed to switch network. Please add PezkuwiChain manually.',
|
||||
TRANSACTION_FAILED: 'Transaction failed. Please check your balance and try again.',
|
||||
USER_REJECTED: 'User rejected the request.'
|
||||
};
|
||||
|
||||
export const formatAddress = (address: string): string => {
|
||||
if (!address) return '';
|
||||
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
||||
};
|
||||
|
||||
export const formatBalance = (balance: string, decimals = 18): string => {
|
||||
if (!balance) return '0';
|
||||
const value = parseFloat(balance) / Math.pow(10, decimals);
|
||||
return value.toFixed(4);
|
||||
};
|
||||
|
||||
export interface WalletState {
|
||||
isConnected: boolean;
|
||||
address: string | null;
|
||||
balance: string;
|
||||
chainId: string | null;
|
||||
provider: any;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
export const initialWalletState: WalletState = {
|
||||
isConnected: false,
|
||||
address: null,
|
||||
balance: '0',
|
||||
chainId: null,
|
||||
provider: null,
|
||||
error: null
|
||||
};
|
||||
Reference in New Issue
Block a user