```
chore: remove obsolete payment architecture and integration test documentation - Remove AITBC_PAYMENT_ARCHITECTURE.md (dual-currency system documentation) - Remove IMPLEMENTATION_COMPLETE_SUMMARY.md (integration test completion summary) - Remove INTEGRATION_TEST_FIXES.md (test fixes documentation) - Remove INTEGRATION_TEST_UPDATES.md (real features implementation notes) - Remove PAYMENT_INTEGRATION_COMPLETE.md (wallet-coordinator integration docs) - Remove WALLET_COORDINATOR_INTEGRATION.md (payment
This commit is contained in:
195
apps/blockchain-explorer/assets/index.js
Normal file
195
apps/blockchain-explorer/assets/index.js
Normal file
@@ -0,0 +1,195 @@
|
||||
import { createApp } from 'https://unpkg.com/vue@3/dist/vue.esm-browser.js'
|
||||
|
||||
const API_BASE = '/api/v1'
|
||||
|
||||
const app = createApp({
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
chainInfo: {
|
||||
height: 0,
|
||||
hash: '',
|
||||
timestamp: null,
|
||||
tx_count: 0
|
||||
},
|
||||
latestBlocks: [],
|
||||
stats: {
|
||||
totalBlocks: 0,
|
||||
totalTransactions: 0,
|
||||
avgBlockTime: 2.0,
|
||||
hashRate: '0 H/s'
|
||||
},
|
||||
error: null
|
||||
}
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
await this.loadChainData()
|
||||
setInterval(this.loadChainData, 5000)
|
||||
},
|
||||
|
||||
methods: {
|
||||
async loadChainData() {
|
||||
try {
|
||||
this.error = null
|
||||
|
||||
// Load chain head
|
||||
const headResponse = await fetch(`${API_BASE}/chain/head`)
|
||||
if (headResponse.ok) {
|
||||
this.chainInfo = await headResponse.json()
|
||||
}
|
||||
|
||||
// Load latest blocks
|
||||
const blocksResponse = await fetch(`${API_BASE}/chain/blocks?limit=10`)
|
||||
if (blocksResponse.ok) {
|
||||
this.latestBlocks = await blocksResponse.json()
|
||||
}
|
||||
|
||||
// Calculate stats
|
||||
this.stats.totalBlocks = this.chainInfo.height || 0
|
||||
this.stats.totalTransactions = this.latestBlocks.reduce((sum, block) => sum + (block.tx_count || 0), 0)
|
||||
|
||||
this.loading = false
|
||||
} catch (error) {
|
||||
console.error('Failed to load chain data:', error)
|
||||
this.error = 'Failed to connect to blockchain node'
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
|
||||
formatHash(hash) {
|
||||
if (!hash) return '-'
|
||||
return hash.substring(0, 10) + '...' + hash.substring(hash.length - 8)
|
||||
},
|
||||
|
||||
formatTime(timestamp) {
|
||||
if (!timestamp) return '-'
|
||||
return new Date(timestamp * 1000).toLocaleString()
|
||||
},
|
||||
|
||||
formatNumber(num) {
|
||||
if (!num) return '0'
|
||||
return num.toLocaleString()
|
||||
},
|
||||
|
||||
getBlockType(block) {
|
||||
if (!block) return 'unknown'
|
||||
return block.tx_count > 0 ? 'with-tx' : 'empty'
|
||||
}
|
||||
},
|
||||
|
||||
template: `
|
||||
<div class="app">
|
||||
<!-- Header -->
|
||||
<header class="header">
|
||||
<div class="container">
|
||||
<div class="header-content">
|
||||
<div class="logo">
|
||||
<svg class="logo-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
|
||||
<path d="M12 2L2 7L12 12L22 7L12 2Z"></path>
|
||||
<path d="M2 17L12 22L22 17"></path>
|
||||
<path d="M2 12L12 17L22 12"></path>
|
||||
</svg>
|
||||
<h1>AITBC Explorer</h1>
|
||||
</div>
|
||||
<div class="header-stats">
|
||||
<div class="stat">
|
||||
<span class="stat-label">Height</span>
|
||||
<span class="stat-value">{{ formatNumber(chainInfo.height) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Main Content -->
|
||||
<main class="main">
|
||||
<div class="container">
|
||||
<!-- Loading State -->
|
||||
<div v-if="loading" class="loading">
|
||||
<div class="spinner"></div>
|
||||
<p>Loading blockchain data...</p>
|
||||
</div>
|
||||
|
||||
<!-- Error State -->
|
||||
<div v-else-if="error" class="error">
|
||||
<svg class="error-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
|
||||
<circle cx="12" cy="12" r="10"></circle>
|
||||
<line x1="12" y1="8" x2="12" y2="12"></line>
|
||||
<line x1="12" y1="16" x2="12.01" y2="16"></line>
|
||||
</svg>
|
||||
<p>{{ error }}</p>
|
||||
<button @click="loadChainData" class="retry-btn">Retry</button>
|
||||
</div>
|
||||
|
||||
<!-- Chain Overview -->
|
||||
<div v-else class="overview">
|
||||
<div class="cards">
|
||||
<div class="card">
|
||||
<div class="card-icon">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
|
||||
<path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<h3>Current Height</h3>
|
||||
<p class="card-value">{{ formatNumber(chainInfo.height) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-icon">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
|
||||
<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<h3>Latest Block</h3>
|
||||
<p class="card-value hash">{{ formatHash(chainInfo.hash) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-icon">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
|
||||
<path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<h3>Total Transactions</h3>
|
||||
<p class="card-value">{{ formatNumber(stats.totalTransactions) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Latest Blocks -->
|
||||
<div v-if="!loading && !error" class="blocks-section">
|
||||
<h2>Latest Blocks</h2>
|
||||
<div class="blocks-list">
|
||||
<div v-for="block in latestBlocks" :key="block.height"
|
||||
class="block-item" :class="getBlockType(block)">
|
||||
<div class="block-height">
|
||||
<span class="height">{{ formatNumber(block.height) }}</span>
|
||||
<span v-if="block.tx_count > 0" class="tx-badge">{{ block.tx_count }} tx</span>
|
||||
</div>
|
||||
<div class="block-details">
|
||||
<div class="block-hash">
|
||||
<span class="label">Hash:</span>
|
||||
<span class="value">{{ formatHash(block.hash) }}</span>
|
||||
</div>
|
||||
<div class="block-time">
|
||||
<span class="label">Time:</span>
|
||||
<span class="value">{{ formatTime(block.timestamp) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
|
||||
app.mount('#app')
|
||||
315
apps/blockchain-explorer/assets/style.css
Normal file
315
apps/blockchain-explorer/assets/style.css
Normal file
@@ -0,0 +1,315 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
:root {
|
||||
--primary-color: #3b82f6;
|
||||
--primary-dark: #2563eb;
|
||||
--secondary-color: #10b981;
|
||||
--background: #f9fafb;
|
||||
--surface: #ffffff;
|
||||
--text-primary: #111827;
|
||||
--text-secondary: #6b7280;
|
||||
--border-color: #e5e7eb;
|
||||
--error-color: #ef4444;
|
||||
--success-color: #22c55e;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||
background-color: var(--background);
|
||||
color: var(--text-primary);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
.header {
|
||||
background: var(--surface);
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 1rem 0;
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.logo-icon {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.logo h1 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.header-stats {
|
||||
display: flex;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.stat {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
/* Main Content */
|
||||
.main {
|
||||
padding: 2rem 0;
|
||||
min-height: calc(100vh - 80px);
|
||||
}
|
||||
|
||||
/* Loading State */
|
||||
.loading {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 4rem 0;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 3rem;
|
||||
height: 3rem;
|
||||
border: 3px solid var(--border-color);
|
||||
border-top-color: var(--primary-color);
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* Error State */
|
||||
.error {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 4rem 0;
|
||||
color: var(--error-color);
|
||||
}
|
||||
|
||||
.error-icon {
|
||||
width: 3rem;
|
||||
height: 3rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.retry-btn {
|
||||
margin-top: 1rem;
|
||||
padding: 0.5rem 1rem;
|
||||
background: var(--primary-color);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 0.375rem;
|
||||
font-size: 0.875rem;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.retry-btn:hover {
|
||||
background: var(--primary-dark);
|
||||
}
|
||||
|
||||
/* Overview Cards */
|
||||
.overview {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.cards {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: var(--surface);
|
||||
border-radius: 0.75rem;
|
||||
padding: 1.5rem;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
transition: transform 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.card-icon {
|
||||
width: 3rem;
|
||||
height: 3rem;
|
||||
background: var(--primary-color);
|
||||
color: white;
|
||||
border-radius: 0.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.card-icon svg {
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
}
|
||||
|
||||
.card-content h3 {
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.card-value {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.card-value.hash {
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
/* Blocks Section */
|
||||
.blocks-section h2 {
|
||||
font-size: 1.5rem;
|
||||
margin-bottom: 1rem;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.blocks-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.block-item {
|
||||
background: var(--surface);
|
||||
border-radius: 0.5rem;
|
||||
padding: 1rem;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
transition: transform 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.block-item:hover {
|
||||
transform: translateX(4px);
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.block-item.empty {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.block-height {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
min-width: 80px;
|
||||
}
|
||||
|
||||
.height {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.tx-badge {
|
||||
margin-top: 0.25rem;
|
||||
padding: 0.125rem 0.5rem;
|
||||
background: var(--success-color);
|
||||
color: white;
|
||||
border-radius: 9999px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.block-details {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.block-hash,
|
||||
.block-time {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.label {
|
||||
color: var(--text-secondary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.value {
|
||||
color: var(--text-primary);
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 768px) {
|
||||
.header-content {
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.cards {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.block-item {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.block-height {
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user