diff --git a/src/components/AccountBalance.tsx b/src/components/AccountBalance.tsx index b390db6c..10d0921a 100644 --- a/src/components/AccountBalance.tsx +++ b/src/components/AccountBalance.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; import { usePolkadot } from '@/contexts/PolkadotContext'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; -import { Wallet, TrendingUp, ArrowUpRight, ArrowDownRight, RefreshCw } from 'lucide-react'; +import { Wallet, TrendingUp, ArrowUpRight, ArrowDownRight, RefreshCw, Award } from 'lucide-react'; import { Button } from '@/components/ui/button'; export const AccountBalance: React.FC = () => { @@ -16,6 +16,7 @@ export const AccountBalance: React.FC = () => { total: '0', }); const [pezBalance, setPezBalance] = useState('0'); + const [trustScore, setTrustScore] = useState('-'); const [isLoading, setIsLoading] = useState(false); const fetchBalance = async () => { @@ -69,6 +70,24 @@ export const AccountBalance: React.FC = () => { useEffect(() => { fetchBalance(); + // Fetch Trust Score + const fetchTrustScore = async () => { + if (!api || !isApiReady || !selectedAccount?.address) { + setTrustScore('-'); + return; + } + + try { + const score = await api.query.trust.trustScores(selectedAccount.address); + setTrustScore(score.toString()); + } catch (err) { + console.error('Failed to fetch trust score:', err); + setTrustScore('-'); + } + }; + + fetchTrustScore(); + // Subscribe to HEZ balance updates let unsubscribeHez: () => void; let unsubscribePez: () => void; @@ -235,6 +254,15 @@ export const AccountBalance: React.FC = () => { {selectedAccount.address.slice(0, 8)}...{selectedAccount.address.slice(-8)} +
+ + + Trust Score + + + {trustScore} + +