chore: refactor logging module, update genesis timestamp, remove model relationships, and reorganize routers

- Rename logging.py to logger.py and update import paths in poa.py and main.py
- Update devnet genesis timestamp to 1766828620
- Remove SQLModel Relationship declarations from Block, Transaction, and Receipt models
- Add SessionDep type alias and get_session dependency in coordinator-api deps
- Reorganize coordinator-api routers: replace explorer/registry with exchange, users, marketplace
This commit is contained in:
oib
2025-12-28 21:05:53 +01:00
parent 930ee31a8f
commit b3fd0ea05c
145 changed files with 33301 additions and 219 deletions

View File

@@ -1,4 +1,5 @@
import { fetchAddresses, type AddressSummary } from "../lib/mockData";
import { fetchAddresses } from "../lib/mockData";
import type { AddressSummary } from "../lib/models";
export const addressesTitle = "Addresses";
@@ -48,7 +49,7 @@ export async function initAddressesPage(): Promise<void> {
}
const addresses = await fetchAddresses();
if (addresses.length === 0) {
if (!addresses || addresses.length === 0) {
tbody.innerHTML = `
<tr>
<td class="placeholder" colspan="4">No mock addresses available.</td>

View File

@@ -1,4 +1,5 @@
import { fetchBlocks, type BlockSummary } from "../lib/mockData";
import { fetchBlocks } from "../lib/mockData";
import type { BlockSummary } from "../lib/models";
export const blocksTitle = "Blocks";
@@ -38,7 +39,7 @@ export async function initBlocksPage(): Promise<void> {
}
const blocks = await fetchBlocks();
if (blocks.length === 0) {
if (!blocks || blocks.length === 0) {
tbody.innerHTML = `
<tr>
<td class="placeholder" colspan="5">No mock blocks available.</td>

View File

@@ -44,12 +44,12 @@ export async function initOverviewPage(): Promise<void> {
"#overview-block-stats",
);
if (blockStats) {
if (blocks.length > 0) {
if (blocks && blocks.length > 0) {
const latest = blocks[0];
blockStats.innerHTML = `
<li><strong>Height:</strong> ${latest.height}</li>
<li><strong>Hash:</strong> ${latest.hash.slice(0, 18)}…</li>
<li><strong>Proposer:</strong> ${latest.proposer}</li>
<li><strong>Proposer:</strong> <code>${latest.proposer.slice(0, 18)}…</code></li>
<li><strong>Time:</strong> ${new Date(latest.timestamp).toLocaleString()}</li>
`;
} else {
@@ -60,7 +60,7 @@ export async function initOverviewPage(): Promise<void> {
}
const txStats = document.querySelector<HTMLUListElement>("#overview-transaction-stats");
if (txStats) {
if (transactions.length > 0) {
if (transactions && transactions.length > 0) {
const succeeded = transactions.filter((tx) => tx.status === "Succeeded");
txStats.innerHTML = `
<li><strong>Total Mock Tx:</strong> ${transactions.length}</li>
@@ -76,7 +76,7 @@ export async function initOverviewPage(): Promise<void> {
"#overview-receipt-stats",
);
if (receiptStats) {
if (receipts.length > 0) {
if (receipts && receipts.length > 0) {
const attested = receipts.filter((receipt) => receipt.status === "Attested");
receiptStats.innerHTML = `
<li><strong>Total Receipts:</strong> ${receipts.length}</li>

View File

@@ -1,4 +1,5 @@
import { fetchReceipts, type ReceiptSummary } from "../lib/mockData";
import { fetchReceipts } from "../lib/mockData";
import type { ReceiptSummary } from "../lib/models";
export const receiptsTitle = "Receipts";
@@ -50,7 +51,7 @@ export async function initReceiptsPage(): Promise<void> {
}
const receipts = await fetchReceipts();
if (receipts.length === 0) {
if (!receipts || receipts.length === 0) {
tbody.innerHTML = `
<tr>
<td class="placeholder" colspan="6">No mock receipts available.</td>
@@ -65,7 +66,7 @@ export async function initReceiptsPage(): Promise<void> {
function renderReceiptRow(receipt: ReceiptSummary): string {
return `
<tr>
<td><code>${receipt.jobId}</code></td>
<td><code>N/A</code></td>
<td><code>${receipt.receiptId}</code></td>
<td>${receipt.miner}</td>
<td>${receipt.coordinator}</td>

View File

@@ -1,7 +1,7 @@
import {
fetchTransactions,
type TransactionSummary,
} from "../lib/mockData";
import type { TransactionSummary } from "../lib/models";
export const transactionsTitle = "Transactions";
@@ -42,7 +42,7 @@ export async function initTransactionsPage(): Promise<void> {
}
const transactions = await fetchTransactions();
if (transactions.length === 0) {
if (!transactions || transactions.length === 0) {
tbody.innerHTML = `
<tr>
<td class="placeholder" colspan="6">No mock transactions available.</td>
@@ -60,7 +60,7 @@ function renderTransactionRow(tx: TransactionSummary): string {
<td><code>${tx.hash.slice(0, 18)}…</code></td>
<td>${tx.block}</td>
<td><code>${tx.from.slice(0, 12)}…</code></td>
<td><code>${tx.to.slice(0, 12)}</code></td>
<td><code>${tx.to ? tx.to.slice(0, 12) + '…' : 'null'}</code></td>
<td>${tx.value}</td>
<td>${tx.status}</td>
</tr>