mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-23 11:37:55 +00:00
Fix all shadow deprecation warnings across entire mobile app
- Replaced shadowColor/shadowOffset/shadowOpacity/shadowRadius with boxShadow - Fixed 28 files (21 screens + 7 components) - Preserved elevation for Android compatibility - All React Native Web deprecation warnings resolved Files fixed: - All screen components - All reusable components - Navigation components - Modal components
This commit is contained in:
+3
-3
@@ -2,7 +2,7 @@ import { useEffect, lazy, Suspense } from 'react';
|
||||
import { BrowserRouter as Router, Routes, Route, useLocation } from 'react-router-dom';
|
||||
import { ThemeProvider } from '@/components/theme-provider';
|
||||
import { AppProvider } from '@/contexts/AppContext';
|
||||
import { PolkadotProvider } from '@/contexts/PolkadotContext';
|
||||
import { PezkuwiProvider } from '@/contexts/PezkuwiContext';
|
||||
import { WalletProvider } from '@/contexts/WalletContext';
|
||||
import { WebSocketProvider } from '@/contexts/WebSocketContext';
|
||||
import { IdentityProvider } from '@/contexts/IdentityContext';
|
||||
@@ -102,7 +102,7 @@ function App() {
|
||||
<ErrorBoundary>
|
||||
<AuthProvider>
|
||||
<AppProvider>
|
||||
<PolkadotProvider endpoint={endpoint}>
|
||||
<PezkuwiProvider endpoint={endpoint}>
|
||||
<WalletProvider>
|
||||
<WebSocketProvider>
|
||||
<IdentityProvider>
|
||||
@@ -218,7 +218,7 @@ function App() {
|
||||
</IdentityProvider>
|
||||
</WebSocketProvider>
|
||||
</WalletProvider>
|
||||
</PolkadotProvider>
|
||||
</PezkuwiProvider>
|
||||
</AppProvider>
|
||||
</AuthProvider>
|
||||
<Toaster />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Wallet, TrendingUp, ArrowDownRight, RefreshCw, Award, Plus, Coins, Send, Shield, Users } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
@@ -18,7 +18,7 @@ interface TokenBalance {
|
||||
}
|
||||
|
||||
export const AccountBalance: React.FC = () => {
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const [balance, setBalance] = useState<{
|
||||
free: string;
|
||||
reserved: string;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { X, Plus, Info, AlertCircle } from 'lucide-react';
|
||||
import { web3FromAddress } from '@pezkuwi/extension-dapp';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
@@ -54,7 +54,7 @@ export const AddLiquidityModal: React.FC<AddLiquidityModalProps> = ({
|
||||
asset0 = 0, // Default to wHEZ
|
||||
asset1 = 1 // Default to PEZ
|
||||
}) => {
|
||||
const { api, selectedAccount, isApiReady } = usePolkadot();
|
||||
const { api, selectedAccount, isApiReady } = usePezkuwi();
|
||||
const { balances, refreshBalances } = useWallet();
|
||||
|
||||
const [amount0, setAmount0] = useState('');
|
||||
|
||||
@@ -28,7 +28,7 @@ import { StakingDashboard } from './staking/StakingDashboard';
|
||||
import { MultiSigWallet } from './wallet/MultiSigWallet';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { supabase } from '@/lib/supabase';
|
||||
import { PolkadotWalletButton } from './PolkadotWalletButton';
|
||||
import { PezkuwiWalletButton } from './PezkuwiWalletButton';
|
||||
import { DEXDashboard } from './dex/DEXDashboard';
|
||||
import { P2PDashboard } from './p2p/P2PDashboard';
|
||||
import EducationPlatform from '../pages/EducationPlatform';
|
||||
@@ -286,7 +286,7 @@ const AppLayout: React.FC = () => {
|
||||
|
||||
<NotificationBell />
|
||||
<LanguageSwitcher />
|
||||
<PolkadotWalletButton />
|
||||
<PezkuwiWalletButton />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ChevronRight, Shield } from 'lucide-react';
|
||||
import { usePolkadot } from '../contexts/PolkadotContext';
|
||||
import { ChevronRight, Shield, Smartphone } from 'lucide-react';
|
||||
import { usePezkuwi } from '../contexts/PezkuwiContext';
|
||||
import { useWallet } from '../contexts/WalletContext'; // Import useWallet
|
||||
import { formatBalance } from '@pezkuwi/lib/wallet';
|
||||
|
||||
const HeroSection: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
const { selectedAccount } = useWallet(); // Use selectedAccount from WalletContext
|
||||
const [stats, setStats] = useState({
|
||||
activeProposals: 0,
|
||||
totalVoters: 0,
|
||||
@@ -18,6 +20,20 @@ const HeroSection: React.FC = () => {
|
||||
const fetchStats = async () => {
|
||||
if (!api || !isApiReady) return;
|
||||
|
||||
let currentTrustScore = 0; // Default if not fetched or no account
|
||||
if (selectedAccount?.address) {
|
||||
try {
|
||||
// Assuming pallet-staking-score has a storage item for trust scores
|
||||
// The exact query might need adjustment based on chain metadata
|
||||
const rawTrustScore = await api.query.stakingScore.trustScore(selectedAccount.address);
|
||||
// Assuming trustScore is a simple number or a wrapper around it
|
||||
currentTrustScore = rawTrustScore.isSome ? rawTrustScore.unwrap().toNumber() : 0;
|
||||
} catch (err) {
|
||||
if (import.meta.env.DEV) console.warn('Failed to fetch trust score:', err);
|
||||
currentTrustScore = 0;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// Fetch active referenda
|
||||
let activeProposals = 0;
|
||||
@@ -60,13 +76,14 @@ const HeroSection: React.FC = () => {
|
||||
activeProposals,
|
||||
totalVoters,
|
||||
tokensStaked,
|
||||
trustScore: 0 // TODO: Calculate trust score
|
||||
trustScore: currentTrustScore
|
||||
});
|
||||
|
||||
if (import.meta.env.DEV) console.log('✅ Hero stats updated:', {
|
||||
activeProposals,
|
||||
totalVoters,
|
||||
tokensStaked
|
||||
tokensStaked,
|
||||
trustScore: currentTrustScore
|
||||
});
|
||||
} catch (error) {
|
||||
if (import.meta.env.DEV) console.error('Failed to fetch hero stats:', error);
|
||||
@@ -74,7 +91,7 @@ const HeroSection: React.FC = () => {
|
||||
};
|
||||
|
||||
fetchStats();
|
||||
}, [api, isApiReady]);
|
||||
}, [api, isApiReady, selectedAccount]); // Add selectedAccount to dependencies
|
||||
|
||||
return (
|
||||
<section className="relative min-h-screen flex items-center justify-start overflow-hidden bg-gray-950">
|
||||
@@ -133,6 +150,14 @@ const HeroSection: React.FC = () => {
|
||||
{t('hero.exploreGovernance', 'Explore Governance')}
|
||||
<ChevronRight className="ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform" />
|
||||
</button>
|
||||
<a
|
||||
href="/pezkuwi-wallet.apk"
|
||||
download="pezkuwi-wallet.apk"
|
||||
className="px-8 py-4 bg-gradient-to-r from-blue-600 to-blue-700 text-white font-bold rounded-lg hover:shadow-lg hover:shadow-blue-500/50 transition-all transform hover:scale-105 flex items-center justify-center group"
|
||||
>
|
||||
<Smartphone className="mr-2 w-5 h-5" />
|
||||
{t('hero.downloadWallet', 'Download Mobile Wallet')}
|
||||
</a>
|
||||
<button
|
||||
onClick={() => document.getElementById('governance')?.scrollIntoView({ behavior: 'smooth' })}
|
||||
className="px-8 py-4 bg-gray-900/80 backdrop-blur-sm text-white font-semibold rounded-lg border border-gray-700 hover:bg-gray-800 hover:border-gray-600 transition-all"
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Shield, Users, CheckCircle, XCircle, ExternalLink } from 'lucide-react'
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import {
|
||||
getMultisigMemberInfo,
|
||||
calculateMultisigAddress,
|
||||
@@ -31,7 +31,7 @@ export const MultisigMembers: React.FC<MultisigMembersProps> = ({
|
||||
specificAddresses = {},
|
||||
showMultisigAddress = true,
|
||||
}) => {
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
const [members, setMembers] = useState<MultisigMember[]>([]);
|
||||
const [multisigAddress, setMultisigAddress] = useState('');
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Activity, Wifi, WifiOff, Users, Box, TrendingUp } from 'lucide-react';
|
||||
|
||||
export const NetworkStats: React.FC = () => {
|
||||
const { api, isApiReady, error } = usePolkadot();
|
||||
const { api, isApiReady, error } = usePezkuwi();
|
||||
const [blockNumber, setBlockNumber] = useState<number>(0);
|
||||
const [blockHash, setBlockHash] = useState<string>('');
|
||||
const [finalizedBlock, setFinalizedBlock] = useState<number>(0);
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Loader2, Award, Crown, Shield, Users } from 'lucide-react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { getUserTikis } from '@pezkuwi/lib/citizenship-workflow';
|
||||
import type { TikiInfo } from '@pezkuwi/lib/citizenship-workflow';
|
||||
|
||||
@@ -39,7 +39,7 @@ const getRoleBadgeColor = (role: string) => {
|
||||
};
|
||||
|
||||
export const NftList: React.FC = () => {
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const [tikis, setTikis] = useState<TikiInfo[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
import React, { useState } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import {
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
import { Wallet, Check, ExternalLink, Copy, LogOut } from 'lucide-react';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
|
||||
export const PolkadotWalletButton: React.FC = () => {
|
||||
export const PezkuwiWalletButton: React.FC = () => {
|
||||
const {
|
||||
accounts,
|
||||
selectedAccount,
|
||||
@@ -20,7 +20,7 @@ export const PolkadotWalletButton: React.FC = () => {
|
||||
connectWallet,
|
||||
disconnectWallet,
|
||||
error
|
||||
} = usePolkadot();
|
||||
} = usePezkuwi();
|
||||
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const { toast } = useToast();
|
||||
@@ -6,7 +6,7 @@ import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { ASSET_IDS, getAssetSymbol } from '@pezkuwi/lib/wallet';
|
||||
import { AddLiquidityModal } from '@/components/AddLiquidityModal';
|
||||
import { RemoveLiquidityModal } from '@/components/RemoveLiquidityModal';
|
||||
@@ -43,7 +43,7 @@ interface LPPosition {
|
||||
}
|
||||
|
||||
const PoolDashboard = () => {
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
|
||||
const [poolData, setPoolData] = useState<PoolData | null>(null);
|
||||
const [lpPosition, setLPPosition] = useState<LPPosition | null>(null);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
import { useAuth } from '@/contexts/AuthContext';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { Loader2, Wallet } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
@@ -15,7 +15,7 @@ export const ProtectedRoute: React.FC<ProtectedRouteProps> = ({
|
||||
requireAdmin = false
|
||||
}) => {
|
||||
const { user, loading, isAdmin } = useAuth();
|
||||
const { selectedAccount, connectWallet } = usePolkadot();
|
||||
const { selectedAccount, connectWallet } = usePezkuwi();
|
||||
const [walletRestoreChecked, setWalletRestoreChecked] = useState(false);
|
||||
const [forceUpdate, setForceUpdate] = useState(0);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
@@ -18,7 +18,7 @@ interface ReceiveModalProps {
|
||||
}
|
||||
|
||||
export const ReceiveModal: React.FC<ReceiveModalProps> = ({ isOpen, onClose }) => {
|
||||
const { selectedAccount } = usePolkadot();
|
||||
const { selectedAccount } = usePezkuwi();
|
||||
const { toast } = useToast();
|
||||
const [copied, setCopied] = useState(false);
|
||||
const [qrCodeDataUrl, setQrCodeDataUrl] = useState<string>('');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { X, Minus, AlertCircle, Info } from 'lucide-react';
|
||||
import { web3FromAddress } from '@pezkuwi/extension-dapp';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
@@ -42,7 +42,7 @@ export const RemoveLiquidityModal: React.FC<RemoveLiquidityModalProps> = ({
|
||||
asset0,
|
||||
asset1,
|
||||
}) => {
|
||||
const { api, selectedAccount } = usePolkadot();
|
||||
const { api, selectedAccount } = usePezkuwi();
|
||||
const { refreshBalances } = useWallet();
|
||||
|
||||
const [percentage, setPercentage] = useState(100);
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Badge } from '@/components/ui/badge';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { getWUSDTTotalSupply, checkReserveHealth, formatWUSDT } from '@pezkuwi/lib/usdt';
|
||||
import { MultisigMembers } from './MultisigMembers';
|
||||
|
||||
@@ -18,7 +18,7 @@ export const ReservesDashboard: React.FC<ReservesDashboardProps> = ({
|
||||
specificAddresses = {},
|
||||
offChainReserveAmount = 0,
|
||||
}) => {
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
|
||||
const [wusdtSupply, setWusdtSupply] = useState(0);
|
||||
const [offChainReserve, setOffChainReserve] = useState(offChainReserveAmount);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import React, { useEffect, useState, ReactNode } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useAuth } from '@/contexts/AuthContext';
|
||||
import {
|
||||
checkCitizenStatus,
|
||||
@@ -59,7 +59,7 @@ export const CitizenRoute: React.FC<RouteGuardProps> = ({
|
||||
children,
|
||||
fallbackPath = '/be-citizen',
|
||||
}) => {
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const {} = useAuth();
|
||||
const [isCitizen, setIsCitizen] = useState<boolean | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -149,7 +149,7 @@ export const ValidatorRoute: React.FC<RouteGuardProps> = ({
|
||||
children,
|
||||
fallbackPath = '/staking',
|
||||
}) => {
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const [isValidator, setIsValidator] = useState<boolean | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
@@ -240,7 +240,7 @@ export const EducatorRoute: React.FC<RouteGuardProps> = ({
|
||||
children,
|
||||
fallbackPath = '/education',
|
||||
}) => {
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const [isEducator, setIsEducator] = useState<boolean | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
@@ -337,7 +337,7 @@ export const ModeratorRoute: React.FC<RouteGuardProps> = ({
|
||||
children,
|
||||
fallbackPath = '/',
|
||||
}) => {
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const [isModerator, setIsModerator] = useState<boolean | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { ASSET_IDS, formatBalance, parseAmount } from '@pezkuwi/lib/wallet';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
@@ -22,7 +22,7 @@ const AVAILABLE_TOKENS = [
|
||||
] as const;
|
||||
|
||||
const TokenSwap = () => {
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const { balances, refreshBalances } = useWallet();
|
||||
const { toast } = useToast();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
@@ -30,7 +30,7 @@ interface Transaction {
|
||||
}
|
||||
|
||||
export const TransactionHistory: React.FC<TransactionHistoryProps> = ({ isOpen, onClose }) => {
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const { toast } = useToast();
|
||||
const [transactions, setTransactions] = useState<Transaction[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
@@ -66,7 +66,7 @@ const TOKENS: Token[] = [
|
||||
];
|
||||
|
||||
export const TransferModal: React.FC<TransferModalProps> = ({ isOpen, onClose, selectedAsset }) => {
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const { toast } = useToast();
|
||||
|
||||
const [selectedToken, setSelectedToken] = useState<TokenType>('HEZ');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { X, ArrowDown, ArrowUp, AlertCircle, Info, Clock, CheckCircle2 } from 'lucide-react';
|
||||
import { web3FromAddress } from '@pezkuwi/extension-dapp';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
@@ -28,7 +28,7 @@ export const USDTBridge: React.FC<USDTBridgeProps> = ({
|
||||
onClose,
|
||||
specificAddresses = {},
|
||||
}) => {
|
||||
const { api, selectedAccount, isApiReady } = usePolkadot();
|
||||
const { api, selectedAccount, isApiReady } = usePezkuwi();
|
||||
const { refreshBalances } = useWallet();
|
||||
|
||||
const [depositAmount, setDepositAmount] = useState('');
|
||||
|
||||
@@ -3,13 +3,13 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { Loader2, Plus, CheckCircle, AlertTriangle, Shield } from 'lucide-react';
|
||||
import { COMMISSIONS } from '@/config/commissions';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
|
||||
export function CommissionSetupTab() {
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const { toast } = useToast();
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { Loader2, ThumbsUp, ThumbsDown, Clock, RefreshCw } from 'lucide-react';
|
||||
import {
|
||||
Table,
|
||||
@@ -26,7 +26,7 @@ interface Proposal {
|
||||
}
|
||||
|
||||
export function CommissionVotingTab() {
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const { toast } = useToast();
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { Loader2, CheckCircle, XCircle, Clock, User, Mail, FileText, AlertTriangle } from 'lucide-react';
|
||||
import { COMMISSIONS } from '@/config/commissions';
|
||||
import {
|
||||
@@ -37,7 +37,7 @@ interface IdentityInfo {
|
||||
}
|
||||
|
||||
export function KycApprovalTab() {
|
||||
const { api, isApiReady, selectedAccount, connectWallet } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount, connectWallet } = usePezkuwi();
|
||||
const { toast } = useToast();
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import {
|
||||
X,
|
||||
@@ -65,7 +65,7 @@ export const XCMConfigurationWizard: React.FC<XCMConfigurationWizardProps> = ({
|
||||
onClose,
|
||||
onSuccess,
|
||||
}) => {
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
const { account, signer } = useWallet();
|
||||
const { toast } = useToast();
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Label } from '@/components/ui/label';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Loader2, CheckCircle, AlertTriangle, Shield } from 'lucide-react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { verifyCitizenNumber } from '@pezkuwi/lib/tiki';
|
||||
import { generateAuthChallenge, signChallenge, verifySignature, saveCitizenSession } from '@pezkuwi/lib/citizenship-workflow';
|
||||
import type { AuthChallenge } from '@pezkuwi/lib/citizenship-workflow';
|
||||
@@ -15,7 +15,7 @@ interface ExistingCitizenAuthProps {
|
||||
}
|
||||
|
||||
export const ExistingCitizenAuth: React.FC<ExistingCitizenAuthProps> = ({ onClose }) => {
|
||||
const { api, isApiReady, selectedAccount, connectWallet } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount, connectWallet } = usePezkuwi();
|
||||
|
||||
const [citizenNumber, setCitizenNumber] = useState('');
|
||||
const [step, setStep] = useState<'input' | 'verifying' | 'signing' | 'success' | 'error'>('input');
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { Loader2, AlertTriangle, CheckCircle, User, Users as UsersIcon, MapPin, Briefcase, Mail, Check, X, AlertCircle } from 'lucide-react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import type { CitizenshipData, Region, MaritalStatus } from '@pezkuwi/lib/citizenship-workflow';
|
||||
import { FOUNDER_ADDRESS, submitKycApplication, subscribeToKycApproval, getKycStatus } from '@pezkuwi/lib/citizenship-workflow';
|
||||
import { generateCommitmentHash, generateNullifierHash, encryptData, saveLocalCitizenshipData, uploadToIPFS } from '@pezkuwi/lib/citizenship-workflow';
|
||||
@@ -22,7 +22,7 @@ interface NewCitizenApplicationProps {
|
||||
type FormData = Omit<CitizenshipData, 'walletAddress' | 'timestamp'>;
|
||||
|
||||
export const NewCitizenApplication: React.FC<NewCitizenApplicationProps> = ({ onClose, referrerAddress }) => {
|
||||
const { api, isApiReady, selectedAccount, connectWallet } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount, connectWallet } = usePezkuwi();
|
||||
const { register, handleSubmit, watch, setValue, formState: { errors } } = useForm<FormData>();
|
||||
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { Loader2, ThumbsUp, ThumbsDown, Vote } from 'lucide-react';
|
||||
|
||||
interface Proposal {
|
||||
@@ -17,7 +17,7 @@ interface Proposal {
|
||||
}
|
||||
|
||||
export function CommissionProposalsCard() {
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const { toast } = useToast();
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
@@ -10,13 +10,13 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@
|
||||
import { Users, TrendingUp, Shield, Clock, ChevronRight, Award, Activity } from 'lucide-react';
|
||||
import DelegateProfile from './DelegateProfile';
|
||||
import { useDelegation } from '@/hooks/useDelegation';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { formatNumber } from '@/lib/utils';
|
||||
import { LoadingState } from '@pezkuwi/components/AsyncComponent';
|
||||
|
||||
const DelegationManager: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
const { selectedAccount } = usePolkadot();
|
||||
const { selectedAccount } = usePezkuwi();
|
||||
const { delegates, userDelegations, stats, loading, error } = useDelegation(selectedAccount?.address);
|
||||
const [selectedDelegate, setSelectedDelegate] = useState<Record<string, unknown> | null>(null);
|
||||
const [delegationAmount, setDelegationAmount] = useState('');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { X, Plus, AlertCircle, Loader2, CheckCircle, Info } from 'lucide-react';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
@@ -21,7 +21,7 @@ export const AddLiquidityModal: React.FC<AddLiquidityModalProps> = ({
|
||||
onClose,
|
||||
onSuccess,
|
||||
}) => {
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
const { account, signer } = useWallet();
|
||||
|
||||
const [amount1Input, setAmount1Input] = useState('');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { X, Plus, AlertCircle, Loader2, CheckCircle } from 'lucide-react';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
@@ -20,7 +20,7 @@ export const CreatePoolModal: React.FC<CreatePoolModalProps> = ({
|
||||
onClose,
|
||||
onSuccess,
|
||||
}) => {
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
const { account, signer } = useWallet();
|
||||
|
||||
const [asset1Id, setAsset1Id] = useState<number | null>(null);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState } from 'react';
|
||||
// import { useNavigate } from 'react-router-dom';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import TokenSwap from '@/components/TokenSwap';
|
||||
import PoolDashboard from '@/components/PoolDashboard';
|
||||
@@ -14,7 +14,7 @@ import { isFounderWallet } from '@pezkuwi/utils/auth';
|
||||
|
||||
export const DEXDashboard: React.FC = () => {
|
||||
const { account } = useWallet();
|
||||
const { sudoKey } = usePolkadot();
|
||||
const { sudoKey } = usePezkuwi();
|
||||
const [activeTab, setActiveTab] = useState('swap');
|
||||
|
||||
// Admin modal states
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { X, AlertCircle, Loader2, CheckCircle, Info } from 'lucide-react';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
@@ -22,7 +22,7 @@ export const InitializeHezPoolModal: React.FC<InitializeHezPoolModalProps> = ({
|
||||
onClose,
|
||||
onSuccess,
|
||||
}) => {
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
const { account, signer } = useWallet();
|
||||
const { toast } = useToast();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { X, AlertCircle, Loader2, CheckCircle, Info } from 'lucide-react';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
@@ -25,7 +25,7 @@ export const InitializeUsdtModal: React.FC<InitializeUsdtModalProps> = ({
|
||||
onClose,
|
||||
onSuccess,
|
||||
}) => {
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
const { account, signer } = useWallet();
|
||||
const { toast } = useToast();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
@@ -22,7 +22,7 @@ export const PoolBrowser: React.FC<PoolBrowserProps> = ({
|
||||
onSwap,
|
||||
onCreatePool,
|
||||
}) => {
|
||||
const { api, isApiReady, sudoKey } = usePolkadot();
|
||||
const { api, isApiReady, sudoKey } = usePezkuwi();
|
||||
const { account } = useWallet();
|
||||
const [pools, setPools] = useState<PoolInfo[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { X, Minus, AlertCircle, Loader2, CheckCircle, Info } from 'lucide-react';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
@@ -21,7 +21,7 @@ export const RemoveLiquidityModal: React.FC<RemoveLiquidityModalProps> = ({
|
||||
onClose,
|
||||
onSuccess,
|
||||
}) => {
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
const { account, signer } = useWallet();
|
||||
|
||||
const [lpTokenBalance, setLpTokenBalance] = useState<string>('0');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { ArrowDownUp, AlertCircle, Loader2, Info, Settings, AlertTriangle } from 'lucide-react';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
@@ -32,7 +32,7 @@ const USER_TOKENS = [
|
||||
] as const;
|
||||
|
||||
export const SwapInterface: React.FC<SwapInterfaceProps> = ({ pools }) => {
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
const { account, signer } = useWallet();
|
||||
const { toast } = useToast();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Force reload for mock XCM update
|
||||
import React, { useState, useEffect, useCallback } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { X, AlertCircle, Loader2, CheckCircle, Info, ExternalLink, Zap } from 'lucide-react';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
@@ -34,7 +34,7 @@ export const XCMBridgeSetupModal: React.FC<XCMBridgeSetupModalProps> = ({
|
||||
onClose,
|
||||
onSuccess,
|
||||
}) => {
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
const { account, signer } = useWallet();
|
||||
const { toast } = useToast();
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Badge } from '@/components/ui/badge';
|
||||
import { Progress } from '@/components/ui/progress';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { Vote, Trophy, AlertCircle, CheckCircle, Users, Clock, Activity, Loader2 } from 'lucide-react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import {
|
||||
getActiveElections,
|
||||
@@ -28,7 +28,7 @@ interface ElectionWithCandidates extends ElectionInfo {
|
||||
}
|
||||
|
||||
const ElectionsInterface: React.FC = () => {
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
const { account, signer } = useWallet();
|
||||
const [elections, setElections] = useState<ElectionWithCandidates[]>([]);
|
||||
const [completedResults, setCompletedResults] = useState<ElectionResult[]>([]);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { FileText, Users, Trophy, CheckCircle, XCircle, Clock, Activity, Loader2, TrendingUp, Calendar } from 'lucide-react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import {
|
||||
getElectionResults,
|
||||
getGovernanceStats,
|
||||
@@ -25,7 +25,7 @@ interface CompletedProposal {
|
||||
}
|
||||
|
||||
const GovernanceHistory: React.FC = () => {
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
const [completedElections, setCompletedElections] = useState<ElectionResult[]>([]);
|
||||
const [completedProposals, setCompletedProposals] = useState<CompletedProposal[]>([]);
|
||||
const [stats, setStats] = useState<GovernanceMetrics | null>(null);
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '../ui/card';
|
||||
import { Badge } from '../ui/badge';
|
||||
import { Progress } from '../ui/progress';
|
||||
import { usePolkadot } from '../../contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '../../contexts/PezkuwiContext';
|
||||
import { formatBalance } from '@pezkuwi/lib/wallet';
|
||||
import { LoadingState } from '@pezkuwi/components/AsyncComponent';
|
||||
|
||||
@@ -23,7 +23,7 @@ interface GovernanceStats {
|
||||
}
|
||||
|
||||
const GovernanceOverview: React.FC = () => {
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
const [stats, setStats] = useState<GovernanceStats>({
|
||||
activeProposals: 0,
|
||||
activeElections: 0,
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { Vote, FileText, Users, CheckCircle, XCircle, Clock, Activity, Loader2, Wallet } from 'lucide-react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { formatNumber } from '@/lib/utils';
|
||||
|
||||
@@ -35,7 +35,7 @@ interface DelegationInfo {
|
||||
}
|
||||
|
||||
const MyVotes: React.FC = () => {
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
const { account, isConnected } = useWallet();
|
||||
const [proposalVotes, setProposalVotes] = useState<ProposalVote[]>([]);
|
||||
const [electionVotes, setElectionVotes] = useState<ElectionVote[]>([]);
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
QrCode,
|
||||
Wallet
|
||||
} from 'lucide-react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { toast } from 'sonner';
|
||||
import {
|
||||
@@ -46,7 +46,7 @@ interface DepositModalProps {
|
||||
type DepositStep = 'select' | 'send' | 'verify' | 'success';
|
||||
|
||||
export function DepositModal({ isOpen, onClose, onSuccess }: DepositModalProps) {
|
||||
const { api, selectedAccount } = usePolkadot();
|
||||
const { api, selectedAccount } = usePezkuwi();
|
||||
const { balances, signTransaction } = useWallet();
|
||||
|
||||
const [step, setStep] = useState<DepositStep>('select');
|
||||
|
||||
@@ -220,16 +220,22 @@ export function DisputeModal({
|
||||
reference_id: dispute.id,
|
||||
});
|
||||
|
||||
// Create notification for admin (user-100 / platform admin)
|
||||
// In production, this would be a specific admin role
|
||||
await supabase.from('p2p_notifications').insert({
|
||||
user_id: counterpartyId, // TODO: Replace with actual admin user ID
|
||||
type: 'dispute_opened',
|
||||
title: 'New Dispute Requires Attention',
|
||||
message: `Dispute #${dispute.id.slice(0, 8)} opened. Trade: ${tradeId.slice(0, 8)}`,
|
||||
reference_type: 'dispute',
|
||||
reference_id: dispute.id,
|
||||
});
|
||||
// Fetch admin user IDs and create notifications for each admin
|
||||
const { data: adminIds, error: adminError } = await supabase.rpc('get_admin_user_ids');
|
||||
if (adminError) {
|
||||
console.error('Failed to fetch admin IDs:', adminError);
|
||||
// Continue without admin notifications if fetching fails, but log the error
|
||||
} else if (adminIds && adminIds.length > 0) {
|
||||
const adminNotifications = adminIds.map((admin: { user_id: string }) => ({
|
||||
user_id: admin.user_id,
|
||||
type: 'dispute_opened',
|
||||
title: 'New Dispute Requires Attention',
|
||||
message: `Dispute #${dispute.id.slice(0, 8)} opened. Trade: ${tradeId.slice(0, 8)}`,
|
||||
reference_type: 'dispute',
|
||||
reference_id: dispute.id,
|
||||
}));
|
||||
await supabase.from('p2p_notifications').insert(adminNotifications);
|
||||
}
|
||||
|
||||
toast.success('Dispute opened successfully');
|
||||
onClose();
|
||||
|
||||
@@ -14,7 +14,7 @@ import { Label } from '@/components/ui/label';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
import { Loader2, AlertTriangle, Clock } from 'lucide-react';
|
||||
import { useAuth } from '@/contexts/AuthContext';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { toast } from 'sonner';
|
||||
import { acceptFiatOffer, type P2PFiatOffer } from '@shared/lib/p2p-fiat';
|
||||
|
||||
@@ -26,7 +26,7 @@ interface TradeModalProps {
|
||||
export function TradeModal({ offer, onClose }: TradeModalProps) {
|
||||
const navigate = useNavigate();
|
||||
const { user } = useAuth();
|
||||
const { api, selectedAccount } = usePolkadot();
|
||||
const { api, selectedAccount } = usePezkuwi();
|
||||
const [amount, setAmount] = useState('');
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
Clock,
|
||||
Info
|
||||
} from 'lucide-react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { toast } from 'sonner';
|
||||
import {
|
||||
getInternalBalances,
|
||||
@@ -48,7 +48,7 @@ interface WithdrawModalProps {
|
||||
type WithdrawStep = 'form' | 'confirm' | 'success';
|
||||
|
||||
export function WithdrawModal({ isOpen, onClose, onSuccess }: WithdrawModalProps) {
|
||||
const { selectedAccount } = usePolkadot();
|
||||
const { selectedAccount } = usePezkuwi();
|
||||
|
||||
const [step, setStep] = useState<WithdrawStep>('form');
|
||||
const [token, setToken] = useState<CryptoToken>('HEZ');
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { toast } from 'sonner';
|
||||
import { createCourse } from '@shared/lib/perwerde';
|
||||
import { uploadToIPFS } from '@shared/lib/ipfs';
|
||||
@@ -15,7 +15,7 @@ interface CourseCreatorProps {
|
||||
}
|
||||
|
||||
export function CourseCreator({ onCourseCreated }: CourseCreatorProps) {
|
||||
const { api, selectedAccount } = usePolkadot();
|
||||
const { api, selectedAccount } = usePezkuwi();
|
||||
const [name, setName] = useState('');
|
||||
const [description, setDescription] = useState('');
|
||||
const [content, setContent] = useState('');
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { GraduationCap, BookOpen, ExternalLink, Play } from 'lucide-react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { toast } from 'sonner';
|
||||
import { LoadingState } from '@shared/components/AsyncComponent';
|
||||
import { getCourses, enrollInCourse, type Course } from '@shared/lib/perwerde';
|
||||
@@ -15,7 +15,7 @@ interface CourseListProps {
|
||||
}
|
||||
|
||||
export function CourseList({ enrolledCourseIds, onEnroll }: CourseListProps) {
|
||||
const { api, selectedAccount } = usePolkadot();
|
||||
const { api, selectedAccount } = usePezkuwi();
|
||||
const [courses, setCourses] = useState<Course[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { BookOpen, CheckCircle, Award } from 'lucide-react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { toast } from 'sonner';
|
||||
import { LoadingState } from '@shared/components/AsyncComponent';
|
||||
import { completeCourse, type Enrollment } from '@shared/lib/perwerde';
|
||||
@@ -15,7 +15,7 @@ interface StudentDashboardProps {
|
||||
}
|
||||
|
||||
export function StudentDashboard({ enrollments, loading, onCourseCompleted }: StudentDashboardProps) {
|
||||
const { api, selectedAccount } = usePolkadot();
|
||||
const { api, selectedAccount } = usePezkuwi();
|
||||
|
||||
const handleComplete = async (courseId: number) => {
|
||||
if (!api || !selectedAccount) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } f
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import {
|
||||
Copy,
|
||||
Check,
|
||||
@@ -21,7 +21,7 @@ interface InviteUserModalProps {
|
||||
}
|
||||
|
||||
export const InviteUserModal: React.FC<InviteUserModalProps> = ({ isOpen, onClose }) => {
|
||||
const { api, selectedAccount } = usePolkadot();
|
||||
const { api, selectedAccount } = usePezkuwi();
|
||||
const [copied, setCopied] = useState(false);
|
||||
const [inviteeAddress, setInviteeAddress] = useState('');
|
||||
const [initiating, setInitiating] = useState(false);
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
// import { Badge } from '@/components/ui/badge';
|
||||
import { AlertCircle, CheckCircle2 } from 'lucide-react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { toast } from 'sonner';
|
||||
import { web3FromAddress } from '@pezkuwi/extension-dapp';
|
||||
@@ -25,7 +25,7 @@ import { ValidatorPoolDashboard } from './ValidatorPoolDashboard';
|
||||
import { handleBlockchainError, handleBlockchainSuccess } from '@pezkuwi/lib/error-handler';
|
||||
|
||||
export const StakingDashboard: React.FC = () => {
|
||||
const { api, selectedAccount, isApiReady } = usePolkadot();
|
||||
const { api, selectedAccount, isApiReady } = usePezkuwi();
|
||||
const { balances, refreshBalances } = useWallet();
|
||||
|
||||
const [stakingInfo, setStakingInfo] = useState<StakingInfo | null>(null);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect, useCallback } from 'react';
|
||||
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { toast } from 'sonner';
|
||||
import {
|
||||
getPoolMember,
|
||||
@@ -16,7 +16,7 @@ import { Loader2, Users, UserCheck, UserX } from 'lucide-react';
|
||||
import { PoolCategorySelector } from './PoolCategorySelector';
|
||||
|
||||
export function ValidatorPoolDashboard() {
|
||||
const { api, selectedAccount } = usePolkadot();
|
||||
const { api, selectedAccount } = usePezkuwi();
|
||||
const [poolMember, setPoolMember] = useState<ValidatorPoolCategory | null>(null);
|
||||
const [poolSize, setPoolSize] = useState(0);
|
||||
const [validatorCount, setValidatorCount] = useState(0);
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { formatAddress } from '@pezkuwi/lib/wallet';
|
||||
import { getAllScores, type UserScores } from '@pezkuwi/lib/scores';
|
||||
|
||||
@@ -27,7 +27,7 @@ export const WalletModal: React.FC<WalletModalProps> = ({ isOpen, onClose }) =>
|
||||
api,
|
||||
isApiReady,
|
||||
error
|
||||
} = usePolkadot();
|
||||
} = usePezkuwi();
|
||||
|
||||
const [copied, setCopied] = useState(false);
|
||||
const [scores, setScores] = useState<UserScores>({
|
||||
|
||||
@@ -178,7 +178,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
|
||||
setLoading(false);
|
||||
});
|
||||
|
||||
// Listen for wallet changes (from PolkadotContext)
|
||||
// Listen for wallet changes (from PezkuwiContext)
|
||||
const handleWalletChange = () => {
|
||||
checkAdminStatus();
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createContext, useContext, useState, useEffect, useCallback, ReactNode } from 'react';
|
||||
import { useAuth } from '@/contexts/AuthContext';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { supabase } from '@/lib/supabase';
|
||||
import { getAllTikiNFTDetails, generateCitizenNumber, type TikiNFTDetails } from '@pezkuwi/lib/tiki';
|
||||
import { getKycStatus } from '@pezkuwi/lib/kyc';
|
||||
@@ -17,7 +17,7 @@ const DashboardContext = createContext<DashboardData | undefined>(undefined);
|
||||
|
||||
export function DashboardProvider({ children }: { children: ReactNode }) {
|
||||
const { user } = useAuth();
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const [profile, setProfile] = useState<Record<string, unknown> | null>(null);
|
||||
const [nftDetails, setNftDetails] = useState<{ citizenNFT: TikiNFTDetails | null; roleNFTs: TikiNFTDetails[]; totalNFTs: number }>({
|
||||
citizenNFT: null,
|
||||
|
||||
@@ -2,9 +2,9 @@ import React, { createContext, useContext, useEffect, useState, ReactNode } from
|
||||
import { ApiPromise, WsProvider } from '@pezkuwi/api';
|
||||
import { web3Accounts, web3Enable } from '@pezkuwi/extension-dapp';
|
||||
import type { InjectedAccountWithMeta } from '@pezkuwi/extension-inject/types';
|
||||
import { DEFAULT_ENDPOINT } from '../../../shared/blockchain/polkadot';
|
||||
import { DEFAULT_ENDPOINT } from '../../../shared/blockchain/pezkuwi';
|
||||
|
||||
interface PolkadotContextType {
|
||||
interface PezkuwiContextType {
|
||||
api: ApiPromise | null;
|
||||
isApiReady: boolean;
|
||||
isConnected: boolean;
|
||||
@@ -17,14 +17,14 @@ interface PolkadotContextType {
|
||||
sudoKey: string | null;
|
||||
}
|
||||
|
||||
const PolkadotContext = createContext<PolkadotContextType | undefined>(undefined);
|
||||
const PezkuwiContext = createContext<PezkuwiContextType | undefined>(undefined);
|
||||
|
||||
interface PolkadotProviderProps {
|
||||
interface PezkuwiProviderProps {
|
||||
children: ReactNode;
|
||||
endpoint?: string;
|
||||
}
|
||||
|
||||
export const PolkadotProvider: React.FC<PolkadotProviderProps> = ({
|
||||
export const PezkuwiProvider: React.FC<PezkuwiProviderProps> = ({
|
||||
children,
|
||||
endpoint = DEFAULT_ENDPOINT // Beta testnet RPC from shared config
|
||||
}) => {
|
||||
@@ -50,7 +50,7 @@ export const PolkadotProvider: React.FC<PolkadotProviderProps> = ({
|
||||
}
|
||||
};
|
||||
|
||||
// Initialize Polkadot API with fallback endpoints
|
||||
// Initialize Pezkuwi API with fallback endpoints
|
||||
useEffect(() => {
|
||||
const FALLBACK_ENDPOINTS = [
|
||||
endpoint,
|
||||
@@ -161,7 +161,7 @@ export const PolkadotProvider: React.FC<PolkadotProviderProps> = ({
|
||||
restoreWallet();
|
||||
}, []);
|
||||
|
||||
// Connect wallet (Polkadot.js extension)
|
||||
// Connect wallet (Pezkuwi.js extension)
|
||||
const connectWallet = async () => {
|
||||
try {
|
||||
setError(null);
|
||||
@@ -170,20 +170,20 @@ export const PolkadotProvider: React.FC<PolkadotProviderProps> = ({
|
||||
const extensions = await web3Enable('PezkuwiChain');
|
||||
|
||||
if (extensions.length === 0) {
|
||||
setError('Please install Polkadot.js extension');
|
||||
window.open('https://polkadot.js.org/extension/', '_blank');
|
||||
setError('Please install Pezkuwi.js extension');
|
||||
window.open('https://js.pezkuwichain.io/extension/', '_blank');
|
||||
return;
|
||||
}
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
if (import.meta.env.DEV) console.log('✅ Polkadot.js extension enabled');
|
||||
if (import.meta.env.DEV) console.log('✅ Pezkuwi.js extension enabled');
|
||||
}
|
||||
|
||||
// Get accounts
|
||||
const allAccounts = await web3Accounts();
|
||||
|
||||
if (allAccounts.length === 0) {
|
||||
setError('No accounts found. Please create an account in Polkadot.js extension');
|
||||
setError('No accounts found. Please create an account in Pezkuwi.js extension');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ export const PolkadotProvider: React.FC<PolkadotProviderProps> = ({
|
||||
}
|
||||
};
|
||||
|
||||
const value: PolkadotContextType = {
|
||||
const value: PezkuwiContextType = {
|
||||
api,
|
||||
isApiReady,
|
||||
isConnected: isApiReady, // Alias for backward compatibility
|
||||
@@ -233,17 +233,17 @@ export const PolkadotProvider: React.FC<PolkadotProviderProps> = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<PolkadotContext.Provider value={value}>
|
||||
<PezkuwiContext.Provider value={value}>
|
||||
{children}
|
||||
</PolkadotContext.Provider>
|
||||
</PezkuwiContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
// Hook to use Polkadot context
|
||||
export const usePolkadot = (): PolkadotContextType => {
|
||||
const context = useContext(PolkadotContext);
|
||||
// Hook to use Pezkuwi context
|
||||
export const usePezkuwi = (): PezkuwiContextType => {
|
||||
const context = useContext(PezkuwiContext);
|
||||
if (!context) {
|
||||
throw new Error('usePolkadot must be used within PolkadotProvider');
|
||||
throw new Error('usePezkuwi must be used within PezkuwiProvider');
|
||||
}
|
||||
return context;
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createContext, useContext, useState, useEffect, ReactNode, useCallback } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import {
|
||||
@@ -21,7 +21,7 @@ interface ReferralContextValue {
|
||||
const ReferralContext = createContext<ReferralContextValue | undefined>(undefined);
|
||||
|
||||
export function ReferralProvider({ children }: { children: ReactNode }) {
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
const { account } = useWallet();
|
||||
const { toast } = useToast();
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// ========================================
|
||||
// WalletContext - Polkadot.js Wallet Integration
|
||||
// WalletContext - Pezkuwi.js Wallet Integration
|
||||
// ========================================
|
||||
// This context wraps PolkadotContext and provides wallet functionality
|
||||
// ⚠️ MIGRATION NOTE: This now uses Polkadot.js instead of MetaMask/Ethereum
|
||||
// This context wraps PezkuwiContext and provides wallet functionality
|
||||
// ⚠️ MIGRATION NOTE: This now uses Pezkuwi.js instead of MetaMask/Ethereum
|
||||
|
||||
import React, { createContext, useContext, useState, useEffect, useCallback } from 'react';
|
||||
import { usePolkadot } from './PolkadotContext';
|
||||
import { usePezkuwi } from './PezkuwiContext';
|
||||
import { WALLET_ERRORS, formatBalance, ASSET_IDS } from '@pezkuwi/lib/wallet';
|
||||
import type { InjectedAccountWithMeta } from '@pezkuwi/extension-inject/types';
|
||||
import type { Signer } from '@pezkuwi/api/types';
|
||||
@@ -25,7 +25,7 @@ interface WalletContextType {
|
||||
balance: string; // Legacy: HEZ balance
|
||||
balances: TokenBalances; // All token balances
|
||||
error: string | null;
|
||||
signer: Signer | null; // Polkadot.js signer for transactions
|
||||
signer: Signer | null; // Pezkuwi.js signer for transactions
|
||||
connectWallet: () => Promise<void>;
|
||||
disconnect: () => void;
|
||||
switchAccount: (account: InjectedAccountWithMeta) => void;
|
||||
@@ -37,13 +37,13 @@ interface WalletContextType {
|
||||
const WalletContext = createContext<WalletContextType | undefined>(undefined);
|
||||
|
||||
export const WalletProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
||||
const polkadot = usePolkadot();
|
||||
const pezkuwi = usePezkuwi();
|
||||
|
||||
if (import.meta.env.DEV) console.log('🎯 WalletProvider render:', {
|
||||
hasApi: !!polkadot.api,
|
||||
isApiReady: polkadot.isApiReady,
|
||||
selectedAccount: polkadot.selectedAccount?.address,
|
||||
accountsCount: polkadot.accounts.length
|
||||
hasApi: !!pezkuwi.api,
|
||||
isApiReady: pezkuwi.isApiReady,
|
||||
selectedAccount: pezkuwi.selectedAccount?.address,
|
||||
accountsCount: pezkuwi.accounts.length
|
||||
});
|
||||
|
||||
const [balance, setBalance] = useState<string>('0');
|
||||
@@ -53,7 +53,7 @@ export const WalletProvider: React.FC<{ children: React.ReactNode }> = ({ childr
|
||||
|
||||
// Fetch all token balances when account changes
|
||||
const updateBalance = useCallback(async (address: string) => {
|
||||
if (!polkadot.api || !polkadot.isApiReady) {
|
||||
if (!pezkuwi.api || !pezkuwi.isApiReady) {
|
||||
if (import.meta.env.DEV) console.warn('API not ready, cannot fetch balance');
|
||||
return;
|
||||
}
|
||||
@@ -62,14 +62,14 @@ export const WalletProvider: React.FC<{ children: React.ReactNode }> = ({ childr
|
||||
if (import.meta.env.DEV) console.log('💰 Fetching all token balances for:', address);
|
||||
|
||||
// Fetch HEZ (native token)
|
||||
const { data: nativeBalance } = await polkadot.api.query.system.account(address);
|
||||
const { data: nativeBalance } = await pezkuwi.api.query.system.account(address);
|
||||
const hezBalance = formatBalance(nativeBalance.free.toString());
|
||||
setBalance(hezBalance); // Legacy support
|
||||
|
||||
// Fetch PEZ (Asset ID: 1)
|
||||
let pezBalance = '0';
|
||||
try {
|
||||
const pezData = await polkadot.api.query.assets.account(ASSET_IDS.PEZ, address);
|
||||
const pezData = await pezkuwi.api.query.assets.account(ASSET_IDS.PEZ, address);
|
||||
if (import.meta.env.DEV) console.log('📊 Raw PEZ data:', pezData.toHuman());
|
||||
|
||||
if (pezData.isSome) {
|
||||
@@ -87,7 +87,7 @@ export const WalletProvider: React.FC<{ children: React.ReactNode }> = ({ childr
|
||||
// Fetch wHEZ (Asset ID: 0)
|
||||
let whezBalance = '0';
|
||||
try {
|
||||
const whezData = await polkadot.api.query.assets.account(ASSET_IDS.WHEZ, address);
|
||||
const whezData = await pezkuwi.api.query.assets.account(ASSET_IDS.WHEZ, address);
|
||||
if (import.meta.env.DEV) console.log('📊 Raw wHEZ data:', whezData.toHuman());
|
||||
|
||||
if (whezData.isSome) {
|
||||
@@ -105,7 +105,7 @@ export const WalletProvider: React.FC<{ children: React.ReactNode }> = ({ childr
|
||||
// Fetch wUSDT (Asset ID: 2) - IMPORTANT: wUSDT has 6 decimals, not 12!
|
||||
let wusdtBalance = '0';
|
||||
try {
|
||||
const wusdtData = await polkadot.api.query.assets.account(ASSET_IDS.WUSDT, address);
|
||||
const wusdtData = await pezkuwi.api.query.assets.account(ASSET_IDS.WUSDT, address);
|
||||
if (import.meta.env.DEV) console.log('📊 Raw wUSDT data:', wusdtData.toHuman());
|
||||
|
||||
if (wusdtData.isSome) {
|
||||
@@ -132,45 +132,45 @@ export const WalletProvider: React.FC<{ children: React.ReactNode }> = ({ childr
|
||||
if (import.meta.env.DEV) console.error('Failed to fetch balances:', err);
|
||||
setError('Failed to fetch balances');
|
||||
}
|
||||
}, [polkadot.api, polkadot.isApiReady]);
|
||||
}, [pezkuwi.api, pezkuwi.isApiReady]);
|
||||
|
||||
// Connect wallet (Polkadot.js extension)
|
||||
// Connect wallet (Pezkuwi.js extension)
|
||||
const connectWallet = useCallback(async () => {
|
||||
try {
|
||||
setError(null);
|
||||
await polkadot.connectWallet();
|
||||
await pezkuwi.connectWallet();
|
||||
} catch (err) {
|
||||
if (import.meta.env.DEV) console.error('Wallet connection failed:', err);
|
||||
const errorMessage = err instanceof Error ? err.message : WALLET_ERRORS.CONNECTION_FAILED;
|
||||
setError(errorMessage);
|
||||
}
|
||||
}, [polkadot]);
|
||||
}, [pezkuwi]);
|
||||
|
||||
// Disconnect wallet
|
||||
const disconnect = useCallback(() => {
|
||||
polkadot.disconnectWallet();
|
||||
pezkuwi.disconnectWallet();
|
||||
setBalance('0');
|
||||
setError(null);
|
||||
}, [polkadot]);
|
||||
}, [pezkuwi]);
|
||||
|
||||
// Switch account
|
||||
const switchAccount = useCallback((account: InjectedAccountWithMeta) => {
|
||||
polkadot.setSelectedAccount(account);
|
||||
}, [polkadot]);
|
||||
pezkuwi.setSelectedAccount(account);
|
||||
}, [pezkuwi]);
|
||||
|
||||
// Sign and submit transaction
|
||||
const signTransaction = useCallback(async (tx: unknown): Promise<string> => {
|
||||
if (!polkadot.api || !polkadot.selectedAccount) {
|
||||
if (!pezkuwi.api || !pezkuwi.selectedAccount) {
|
||||
throw new Error(WALLET_ERRORS.API_NOT_READY);
|
||||
}
|
||||
|
||||
try {
|
||||
const { web3FromAddress } = await import('@pezkuwi/extension-dapp');
|
||||
const injector = await web3FromAddress(polkadot.selectedAccount.address);
|
||||
const injector = await web3FromAddress(pezkuwi.selectedAccount.address);
|
||||
|
||||
// Sign and send transaction
|
||||
const hash = await tx.signAndSend(
|
||||
polkadot.selectedAccount.address,
|
||||
pezkuwi.selectedAccount.address,
|
||||
{ signer: injector.signer }
|
||||
);
|
||||
|
||||
@@ -179,24 +179,24 @@ export const WalletProvider: React.FC<{ children: React.ReactNode }> = ({ childr
|
||||
if (import.meta.env.DEV) console.error('Transaction failed:', error);
|
||||
throw new Error(error instanceof Error ? error.message : WALLET_ERRORS.TRANSACTION_FAILED);
|
||||
}
|
||||
}, [polkadot.api, polkadot.selectedAccount]);
|
||||
}, [pezkuwi.api, pezkuwi.selectedAccount]);
|
||||
|
||||
// Sign message
|
||||
const signMessage = useCallback(async (message: string): Promise<string> => {
|
||||
if (!polkadot.selectedAccount) {
|
||||
if (!pezkuwi.selectedAccount) {
|
||||
throw new Error('No account selected');
|
||||
}
|
||||
|
||||
try {
|
||||
const { web3FromAddress } = await import('@pezkuwi/extension-dapp');
|
||||
const injector = await web3FromAddress(polkadot.selectedAccount.address);
|
||||
const injector = await web3FromAddress(pezkuwi.selectedAccount.address);
|
||||
|
||||
if (!injector.signer.signRaw) {
|
||||
throw new Error('Wallet does not support message signing');
|
||||
}
|
||||
|
||||
const { signature } = await injector.signer.signRaw({
|
||||
address: polkadot.selectedAccount.address,
|
||||
address: pezkuwi.selectedAccount.address,
|
||||
data: message,
|
||||
type: 'bytes'
|
||||
});
|
||||
@@ -206,16 +206,16 @@ export const WalletProvider: React.FC<{ children: React.ReactNode }> = ({ childr
|
||||
if (import.meta.env.DEV) console.error('Message signing failed:', error);
|
||||
throw new Error(error instanceof Error ? error.message : 'Failed to sign message');
|
||||
}
|
||||
}, [polkadot.selectedAccount]);
|
||||
}, [pezkuwi.selectedAccount]);
|
||||
|
||||
// Get signer from extension when account changes
|
||||
useEffect(() => {
|
||||
const getSigner = async () => {
|
||||
if (polkadot.selectedAccount) {
|
||||
if (pezkuwi.selectedAccount) {
|
||||
try {
|
||||
const injector = await web3FromAddress(polkadot.selectedAccount.address);
|
||||
const injector = await web3FromAddress(pezkuwi.selectedAccount.address);
|
||||
setSigner(injector.signer);
|
||||
if (import.meta.env.DEV) console.log('✅ Signer obtained for', polkadot.selectedAccount.address);
|
||||
if (import.meta.env.DEV) console.log('✅ Signer obtained for', pezkuwi.selectedAccount.address);
|
||||
} catch (error) {
|
||||
if (import.meta.env.DEV) console.error('Failed to get signer:', error);
|
||||
setSigner(null);
|
||||
@@ -226,42 +226,42 @@ export const WalletProvider: React.FC<{ children: React.ReactNode }> = ({ childr
|
||||
};
|
||||
|
||||
getSigner();
|
||||
}, [polkadot.selectedAccount]);
|
||||
}, [pezkuwi.selectedAccount]);
|
||||
|
||||
// Update balance when selected account changes
|
||||
useEffect(() => {
|
||||
if (import.meta.env.DEV) console.log('🔄 WalletContext useEffect triggered!', {
|
||||
hasAccount: !!polkadot.selectedAccount,
|
||||
isApiReady: polkadot.isApiReady,
|
||||
address: polkadot.selectedAccount?.address
|
||||
hasAccount: !!pezkuwi.selectedAccount,
|
||||
isApiReady: pezkuwi.isApiReady,
|
||||
address: pezkuwi.selectedAccount?.address
|
||||
});
|
||||
|
||||
if (polkadot.selectedAccount && polkadot.isApiReady) {
|
||||
updateBalance(polkadot.selectedAccount.address);
|
||||
if (pezkuwi.selectedAccount && pezkuwi.isApiReady) {
|
||||
updateBalance(pezkuwi.selectedAccount.address);
|
||||
}
|
||||
}, [polkadot.selectedAccount, polkadot.isApiReady, updateBalance]);
|
||||
}, [pezkuwi.selectedAccount, pezkuwi.isApiReady, updateBalance]);
|
||||
|
||||
// Sync error state with PolkadotContext
|
||||
// Sync error state with PezkuwiContext
|
||||
useEffect(() => {
|
||||
if (polkadot.error) {
|
||||
setError(polkadot.error);
|
||||
if (pezkuwi.error) {
|
||||
setError(pezkuwi.error);
|
||||
}
|
||||
}, [polkadot.error]);
|
||||
}, [pezkuwi.error]);
|
||||
|
||||
// Refresh balances for current account
|
||||
const refreshBalances = useCallback(async () => {
|
||||
if (polkadot.selectedAccount) {
|
||||
await updateBalance(polkadot.selectedAccount.address);
|
||||
if (pezkuwi.selectedAccount) {
|
||||
await updateBalance(pezkuwi.selectedAccount.address);
|
||||
}
|
||||
}, [polkadot.selectedAccount, updateBalance]);
|
||||
}, [pezkuwi.selectedAccount, updateBalance]);
|
||||
|
||||
const value: WalletContextType = {
|
||||
isConnected: polkadot.accounts.length > 0,
|
||||
account: polkadot.selectedAccount?.address || null,
|
||||
accounts: polkadot.accounts,
|
||||
isConnected: pezkuwi.accounts.length > 0,
|
||||
account: pezkuwi.selectedAccount?.address || null,
|
||||
accounts: pezkuwi.accounts,
|
||||
balance,
|
||||
balances,
|
||||
error: error || polkadot.error,
|
||||
error: error || pezkuwi.error,
|
||||
signer,
|
||||
connectWallet,
|
||||
disconnect,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
|
||||
export interface Delegate {
|
||||
id: string;
|
||||
@@ -41,7 +41,7 @@ export interface DelegationStats {
|
||||
}
|
||||
|
||||
export function useDelegation(userAddress?: string) {
|
||||
const { api, isConnected } = usePolkadot();
|
||||
const { api, isConnected } = usePezkuwi();
|
||||
const [delegates, setDelegates] = useState<Delegate[]>([]);
|
||||
const [userDelegations, setUserDelegations] = useState<UserDelegation[]>([]);
|
||||
const [stats, setStats] = useState<DelegationStats>({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
|
||||
export interface Proposal {
|
||||
id: string;
|
||||
@@ -28,7 +28,7 @@ export interface Referendum {
|
||||
}
|
||||
|
||||
export function useGovernance() {
|
||||
const { api, isConnected } = usePolkadot();
|
||||
const { api, isConnected } = usePezkuwi();
|
||||
const [proposals, setProposals] = useState<Proposal[]>([]);
|
||||
const [referenda, setReferenda] = useState<Referendum[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
|
||||
export interface TreasuryMetrics {
|
||||
totalBalance: number;
|
||||
@@ -21,7 +21,7 @@ export interface TreasuryProposal {
|
||||
}
|
||||
|
||||
export function useTreasury() {
|
||||
const { api, isConnected } = usePolkadot();
|
||||
const { api, isConnected } = usePezkuwi();
|
||||
const [metrics, setMetrics] = useState<TreasuryMetrics>({
|
||||
totalBalance: 0,
|
||||
monthlyIncome: 0,
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from '@/components/ui/dialog';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useAuth } from '@/contexts/AuthContext';
|
||||
import { useDashboard } from '@/contexts/DashboardContext';
|
||||
import { FileText, Building2, Home, Bell, ChevronLeft, ChevronRight, Upload, User, Sun, ShieldCheck } from 'lucide-react';
|
||||
@@ -36,7 +36,7 @@ const announcements = [
|
||||
];
|
||||
|
||||
export default function Citizens() {
|
||||
const { selectedAccount } = usePolkadot();
|
||||
const { selectedAccount } = usePezkuwi();
|
||||
const { user } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
const { toast } = useToast();
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { useAuth } from '@/contexts/AuthContext';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { supabase } from '@/lib/supabase';
|
||||
import { User, Mail, Phone, Globe, MapPin, Calendar, Shield, AlertCircle, ArrowLeft, Award, Users, TrendingUp, UserMinus } from 'lucide-react';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
@@ -18,7 +18,7 @@ import { ReferralDashboard } from '@/components/referral/ReferralDashboard';
|
||||
|
||||
export default function Dashboard() {
|
||||
const { user } = useAuth();
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const navigate = useNavigate();
|
||||
const { toast } = useToast();
|
||||
const [profile, setProfile] = useState<Record<string, unknown> | null>(null);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect, useCallback } from 'react';
|
||||
import { GraduationCap } from 'lucide-react';
|
||||
import { useAuth } from '@/contexts/AuthContext';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { CourseList } from '@/components/perwerde/CourseList';
|
||||
import { StudentDashboard } from '@/components/perwerde/StudentDashboard';
|
||||
@@ -14,7 +14,7 @@ import { Button } from '@/components/ui/button';
|
||||
|
||||
export default function EducationPlatform() {
|
||||
const { user } = useAuth();
|
||||
const { selectedAccount } = usePolkadot();
|
||||
const { selectedAccount } = usePezkuwi();
|
||||
const [enrollments, setEnrollments] = useState<Enrollment[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [activeTab, setActiveTab] = useState('courses');
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
Scale,
|
||||
Building,
|
||||
} from 'lucide-react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { toast } from '@/components/ui/use-toast';
|
||||
import { LoadingState } from '@pezkuwi/components/AsyncComponent';
|
||||
import {
|
||||
@@ -50,7 +50,7 @@ import {
|
||||
// import { web3FromAddress } from '@pezkuwi/extension-dapp';
|
||||
|
||||
export default function Elections() {
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [elections, setElections] = useState<ElectionInfo[]>([]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect, useCallback } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import Layout from '@/components/Layout';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
@@ -64,7 +64,7 @@ interface NetworkStats {
|
||||
|
||||
const Explorer: React.FC = () => {
|
||||
const navigate = useNavigate();
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
|
||||
const [stats, setStats] = useState<NetworkStats>({
|
||||
bestBlock: 0,
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
|
||||
export default function GovEntrance() {
|
||||
// usePolkadot removed
|
||||
// usePezkuwi removed
|
||||
const { nftDetails, kycStatus, loading: dashboardLoading } = useDashboard();
|
||||
const navigate = useNavigate();
|
||||
const { toast } = useToast();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useAuth } from '@/contexts/AuthContext';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
@@ -16,7 +16,7 @@ import { useTranslation } from 'react-i18next';
|
||||
const Login: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const { connectWallet, selectedAccount } = usePolkadot();
|
||||
const { connectWallet, selectedAccount } = usePezkuwi();
|
||||
const { signIn, signUp } = useAuth();
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
const [rememberMe, setRememberMe] = useState(false);
|
||||
|
||||
@@ -33,7 +33,7 @@ import {
|
||||
Star,
|
||||
} from 'lucide-react';
|
||||
import { useAuth } from '@/contexts/AuthContext';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { toast } from 'sonner';
|
||||
import { supabase } from '@/lib/supabase';
|
||||
import {
|
||||
@@ -73,7 +73,7 @@ export default function P2PTrade() {
|
||||
const { tradeId } = useParams<{ tradeId: string }>();
|
||||
const navigate = useNavigate();
|
||||
const { user } = useAuth();
|
||||
const { api, selectedAccount } = usePolkadot();
|
||||
const { api, selectedAccount } = usePezkuwi();
|
||||
|
||||
const [trade, setTrade] = useState<TradeWithDetails | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
@@ -12,7 +12,7 @@ import { toast } from 'sonner';
|
||||
|
||||
export default function Presale() {
|
||||
const { t } = useTranslation();
|
||||
const { api, selectedAccount, isApiReady } = usePolkadot();
|
||||
const { api, selectedAccount, isApiReady } = usePezkuwi();
|
||||
const { balances } = useWallet();
|
||||
|
||||
const [wusdtAmount, setWusdtAmount] = useState('');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { AccountBalance } from '@/components/AccountBalance';
|
||||
import { TransferModal } from '@/components/TransferModal';
|
||||
import { ReceiveModal } from '@/components/ReceiveModal';
|
||||
@@ -24,7 +24,7 @@ interface Transaction {
|
||||
|
||||
const WalletDashboard: React.FC = () => {
|
||||
const navigate = useNavigate();
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const [isTransferModalOpen, setIsTransferModalOpen] = useState(false);
|
||||
const [isReceiveModalOpen, setIsReceiveModalOpen] = useState(false);
|
||||
const [isHistoryModalOpen, setIsHistoryModalOpen] = useState(false);
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Textarea } from '@/components/ui/textarea';
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from '@/components/ui/dialog';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useAuth } from '@/contexts/AuthContext';
|
||||
import { useDashboard } from '@/contexts/DashboardContext';
|
||||
import {
|
||||
@@ -86,7 +86,7 @@ interface LegislationProposal {
|
||||
}
|
||||
|
||||
export default function CitizensIssues() {
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const {} = useAuth();
|
||||
const {} = useDashboard();
|
||||
const navigate = useNavigate();
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Input } from '@/components/ui/input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from '@/components/ui/dialog';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useDashboard } from '@/contexts/DashboardContext';
|
||||
import {
|
||||
ArrowLeft,
|
||||
@@ -79,7 +79,7 @@ const GOVERNMENT_AUTHORIZED_TIKIS = [
|
||||
];
|
||||
|
||||
export default function GovernmentEntrance() {
|
||||
const { api, isApiReady, selectedAccount } = usePolkadot();
|
||||
const { api, isApiReady, selectedAccount } = usePezkuwi();
|
||||
const { nftDetails, loading: dashboardLoading } = useDashboard();
|
||||
const navigate = useNavigate();
|
||||
const { toast } = useToast();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
@@ -12,7 +12,7 @@ import { ArrowLeft, Loader2, AlertCircle, Rocket } from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
export default function CreatePresale() {
|
||||
const { api, selectedAccount } = usePolkadot();
|
||||
const { api, selectedAccount } = usePezkuwi();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [creating, setCreating] = useState(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useWallet } from '@/contexts/WalletContext';
|
||||
import { useParams, useNavigate } from 'react-router-dom';
|
||||
import { Card } from '@/components/ui/card';
|
||||
@@ -38,7 +38,7 @@ interface PresaleData {
|
||||
|
||||
export default function PresaleDetail() {
|
||||
const { id } = useParams();
|
||||
const { api, selectedAccount, isApiReady } = usePolkadot();
|
||||
const { api, selectedAccount, isApiReady } = usePezkuwi();
|
||||
const { balances } = useWallet();
|
||||
const navigate = useNavigate();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { usePolkadot } from '@/contexts/PolkadotContext';
|
||||
import { usePezkuwi } from '@/contexts/PezkuwiContext';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
@@ -29,7 +29,7 @@ interface PresaleInfo {
|
||||
|
||||
export default function PresaleList() {
|
||||
const { t } = useTranslation();
|
||||
const { api, isApiReady } = usePolkadot();
|
||||
const { api, isApiReady } = usePezkuwi();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [presales, setPresales] = useState<PresaleInfo[]>([]);
|
||||
|
||||
Reference in New Issue
Block a user