From 056b55e5d6c8ebe40d36caafbf5c1e5f94ab8827 Mon Sep 17 00:00:00 2001 From: aitbc Date: Thu, 16 Apr 2026 22:39:36 +0200 Subject: [PATCH] Fix explorer transaction field mapping to match blockchain RPC response - Update transaction field mapping: tx.hash -> tx.tx_hash, tx.type -> tx.payload?.type - Update sender/recipient fields: tx.from -> tx.sender, tx.to -> tx.recipient - Update amount/fee fields to use tx.payload?.amount/fee with fallbacks - This fixes the transaction detail rendering in the explorer modal --- apps/blockchain-explorer/main.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/apps/blockchain-explorer/main.py b/apps/blockchain-explorer/main.py index 3067fa97..9f0a5484 100755 --- a/apps/blockchain-explorer/main.py +++ b/apps/blockchain-explorer/main.py @@ -11,7 +11,7 @@ import csv import io from datetime import datetime, timedelta from typing import Dict, List, Optional, Any, Union -from fastapi import FastAPI, Request, HTTPException, Query, Response +from fastapi import FastAPI, HTTPException, Request, Query, Response from fastapi.responses import HTMLResponse, StreamingResponse from fastapi.staticfiles import StaticFiles from pydantic import BaseModel, Field @@ -628,11 +628,11 @@ HTML_TEMPLATE = r""" ${results.map(tx => ` - ${tx.hash || '-'} - ${tx.type || '-'} - ${tx.from || '-'} - ${tx.to || '-'} - ${tx.amount || '0'} + ${tx.tx_hash || '-'} + ${tx.payload?.type || '-'} + ${tx.sender || '-'} + ${tx.recipient || '-'} + ${tx.payload?.amount ?? tx.payload?.value ?? '0'} ${formatTimestamp(tx.timestamp)} `).join('')} @@ -677,27 +677,27 @@ HTML_TEMPLATE = r"""
Hash: - ${tx.hash || '-'} + ${tx.tx_hash || '-'}
Type: - ${tx.type || '-'} + ${tx.payload?.type || '-'}
From: - ${tx.from || '-'} + ${tx.sender || '-'}
To: - ${tx.to || '-'} + ${tx.recipient || '-'}
Amount: - ${tx.amount || '0'} + ${tx.payload?.amount ?? tx.payload?.value ?? '0'}
Fee: - ${tx.fee || '0'} + ${tx.payload?.fee ?? '0'}
Timestamp: @@ -842,7 +842,7 @@ HTML_TEMPLATE = r""" alert('Export failed. Please try again.'); } } - ${tx.fee || '0'} + ${tx.payload?.fee ?? '0'}
Block: