mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-06-17 22:51:01 +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
|
// Fetch trust score from blockchain
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchTrustScore = async () => {
|
const fetchTrustScore = async () => {
|
||||||
|
console.log('🔍 Fetching trust score...', {
|
||||||
|
hasApi: !!api,
|
||||||
|
isApiReady,
|
||||||
|
hasAccount: !!selectedAccount,
|
||||||
|
address: selectedAccount?.address
|
||||||
|
});
|
||||||
|
|
||||||
if (!api || !isApiReady || !selectedAccount?.address) {
|
if (!api || !isApiReady || !selectedAccount?.address) {
|
||||||
|
console.log('⚠️ Cannot fetch trust score - missing requirements');
|
||||||
setTrustScore('-');
|
setTrustScore('-');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
console.log('📡 Querying api.query.trust.trustScores...');
|
||||||
const score = await api.query.trust.trustScores(selectedAccount.address);
|
const score = await api.query.trust.trustScores(selectedAccount.address);
|
||||||
setTrustScore(score.toString());
|
const scoreStr = score.toString();
|
||||||
console.log('✅ Trust score fetched:', score.toString());
|
setTrustScore(scoreStr);
|
||||||
|
console.log('✅ Trust score fetched successfully:', scoreStr);
|
||||||
} catch (err) {
|
} 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('-');
|
setTrustScore('-');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user