fix: use getAllScoresWithFallback in Dashboard.tsx

Both AccountBalance.tsx and Dashboard.tsx now use the same
frontend fallback for trust score calculation until runtime upgrade.
This commit is contained in:
2026-02-07 01:48:06 +03:00
parent e787eaac15
commit e12d08d356
3 changed files with 6 additions and 97 deletions
+6 -6
View File
@@ -10,7 +10,7 @@ import { supabase } from '@/lib/supabase';
import { User, Mail, Phone, Globe, MapPin, Calendar, Shield, AlertCircle, ArrowLeft, Award, Users, TrendingUp, UserMinus, Play, Loader2 } from 'lucide-react';
import { useToast } from '@/hooks/use-toast';
import { fetchUserTikis, getPrimaryRole, getTikiDisplayName, getTikiColor, getTikiEmoji, getUserRoleCategories, getAllTikiNFTDetails, generateCitizenNumber, type TikiNFTDetails } from '@pezkuwi/lib/tiki';
import { getAllScores, getStakingScoreStatus, startScoreTracking, type UserScores, type StakingScoreStatus, formatDuration } from '@pezkuwi/lib/scores';
import { getAllScoresWithFallback, getStakingScoreStatus, startScoreTracking, type UserScores, type StakingScoreStatus, formatDuration } from '@pezkuwi/lib/scores';
import { web3FromAddress } from '@pezkuwi/extension-dapp';
import { getKycStatus } from '@pezkuwi/lib/kyc';
import { ReferralDashboard } from '@/components/referral/ReferralDashboard';
@@ -108,10 +108,10 @@ export default function Dashboard() {
setLoadingScores(true);
try {
// Fetch all scores from blockchain (includes trust, referral, staking, tiki)
// - Trust, referral, tiki, stakingScore: People Chain
// - Staking amount: Relay Chain (staking.ledger)
const allScores = await getAllScores(peopleApi, selectedAccount.address, api);
// Fetch all scores with frontend fallback (until runtime upgrade)
// - Trust, referral, tiki: People Chain (on-chain)
// - Staking: Relay Chain with frontend fallback
const allScores = await getAllScoresWithFallback(peopleApi, api, selectedAccount.address);
setScores(allScores);
// Fetch staking score tracking status
@@ -452,7 +452,7 @@ export default function Dashboard() {
{loadingScores ? '...' : scores.trustScore}
</div>
<p className="text-xs text-muted-foreground">
From pallet_trust
Frontend calculation
</p>
</CardContent>
</Card>