-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
157 lines (138 loc) · 6.29 KB
/
index.html
File metadata and controls
157 lines (138 loc) · 6.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AvesCoin Reduction Countdown</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
<style>
body {
background: linear-gradient(135deg, #f6f8f9 0%, #e5ebee 100%);
font-family: 'Inter', sans-serif;
}
.glassy-card {
backdrop-filter: blur(10px);
background: rgba(255, 255, 255, 0.8);
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
transition: all 0.3s ease;
}
.glassy-card:hover {
transform: translateY(-5px);
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}
.pulse-animation {
animation: pulse 2s infinite;
}
@keyframes pulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.05); }
}
</style>
</head>
<body class="min-h-screen flex items-center justify-center p-4">
<div class="container mx-auto max-w-4xl space-y-6">
<div class="glassy-card rounded-2xl p-8 text-center">
<h1 class="text-3xl font-bold mb-6 text-gray-800">AvesCoin Reduction Countdown</h1>
<div class="grid md:grid-cols-3 gap-6">
<div class="bg-blue-50 rounded-xl p-6 pulse-animation">
<i class="fas fa-clock text-4xl text-blue-500 mb-4 block"></i>
<h2 class="font-semibold text-gray-700 mb-2">Time Remaining</h2>
<div id="countdown" class="text-2xl font-bold text-blue-600"></div>
</div>
<div class="bg-green-50 rounded-xl p-6">
<i class="fas fa-cubes text-4xl text-green-500 mb-4 block"></i>
<h2 class="font-semibold text-gray-700 mb-2">Block Information</h2>
<div id="block-info" class="text-xl font-medium text-green-600"></div>
</div>
<div class="bg-purple-50 rounded-xl p-6">
<i class="fas fa-calendar-day text-4xl text-purple-500 mb-4 block"></i>
<h2 class="font-semibold text-gray-700 mb-2">Halving Details</h2>
<div id="halving-info" class="text-xl font-medium text-purple-600"></div>
</div>
</div>
</div>
<div class="glassy-card rounded-2xl p-6 text-center">
<h2 class="text-2xl font-bold mb-4 text-gray-800">Network Statistics</h2>
<div id="avg-blocks-per-sec" class="text-xl font-semibold text-gray-700"></div>
</div>
</div>
<script>
// Same JavaScript as the original, with minor formatting adjustments
var rpcUrl = "https://rpc.avescoin.io";
var halvingBlock = 6000000;
async function getCurrentBlockNumber() {
try {
var response = await fetch(rpcUrl, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
jsonrpc: "2.0",
method: "eth_blockNumber",
params: [],
id: 1
})
});
var data = await response.json();
return parseInt(data.result, 16);
} catch (error) {
console.error("Error fetching current block number:", error);
return null;
}
}
async function updateCountdown() {
var currentBlock = await getCurrentBlockNumber();
var blockTimeSeconds = await getBlockTime();
if (currentBlock !== null) {
var blocksRemaining = halvingBlock - currentBlock;
var timeRemainingSeconds = blocksRemaining * blockTimeSeconds;
var days = Math.floor(timeRemainingSeconds / 86400);
var hours = Math.floor((timeRemainingSeconds % 86400) / 3600);
var minutes = Math.floor((timeRemainingSeconds % 3600) / 60);
var seconds = Math.floor(timeRemainingSeconds % 60);
document.getElementById("countdown").innerHTML =
days + "d " +
hours + "h " +
minutes + "m " +
seconds + "s";
document.getElementById("block-info").innerHTML =
"Current: " + currentBlock +
"<br>Remaining: " + blocksRemaining;
document.getElementById("halving-info").innerHTML =
"Halving Block: " + halvingBlock;
}
}
async function calculateAvgBlocksPerSec() {
try {
var response = await fetch('https://avescan.io/api/v2/stats');
var data = await response.json();
var averageBlockTime = data.average_block_time / 1000;
var avgBlocksPerSec = averageBlockTime;
document.getElementById("avg-blocks-per-sec").innerHTML =
"Average Block Time: " + avgBlocksPerSec.toFixed(2) + "s";
} catch (error) {
console.error("Error calculating average blocks per second:", error);
document.getElementById("avg-blocks-per-sec").innerHTML =
"Unable to fetch network statistics";
}
}
async function getBlockTime() {
try {
var response = await fetch('https://avescan.io/api/v2/stats');
var data = await response.json();
return data.average_block_time / 1000;
} catch (error) {
console.error("Error calculating average blocks per second:", error);
return 15; // Fallback average block time
}
}
updateCountdown();
calculateAvgBlocksPerSec();
setInterval(updateCountdown, 1000);
setInterval(calculateAvgBlocksPerSec, 5000);
</script>
</body>
</html>