mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 06:47:55 +00:00
debug: Add detailed logging for trust score fetch
Added comprehensive console logs to debug trust score fetching: - API readiness check - Account availability check - Query execution log - Detailed error logging with stack trace This will help identify the exact point of failure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -56,17 +56,31 @@ export const WalletModal: React.FC<WalletModalProps> = ({ isOpen, onClose }) =>
|
||||
// Fetch trust score from blockchain
|
||||
useEffect(() => {
|
||||
const fetchTrustScore = async () => {
|
||||
console.log('🔍 Fetching trust score...', {
|
||||
hasApi: !!api,
|
||||
isApiReady,
|
||||
hasAccount: !!selectedAccount,
|
||||
address: selectedAccount?.address
|
||||
});
|
||||
|
||||
if (!api || !isApiReady || !selectedAccount?.address) {
|
||||
console.log('⚠️ Cannot fetch trust score - missing requirements');
|
||||
setTrustScore('-');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('📡 Querying api.query.trust.trustScores...');
|
||||
const score = await api.query.trust.trustScores(selectedAccount.address);
|
||||
setTrustScore(score.toString());
|
||||
console.log('✅ Trust score fetched:', score.toString());
|
||||
const scoreStr = score.toString();
|
||||
setTrustScore(scoreStr);
|
||||
console.log('✅ Trust score fetched successfully:', scoreStr);
|
||||
} catch (err) {
|
||||
console.warn('Failed to fetch trust score:', err);
|
||||
console.error('❌ Failed to fetch trust score:', err);
|
||||
console.error('Error details:', {
|
||||
message: err instanceof Error ? err.message : String(err),
|
||||
stack: err instanceof Error ? err.stack : undefined
|
||||
});
|
||||
setTrustScore('-');
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user