-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
22 lines (21 loc) · 931 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
document.addEventListener('DOMContentLoaded', () => {
fetch('https://api.zircuit.com/transactions/recent')
.then(response => response.json())
.then(data => displayTransactions(data))
.catch(error => console.error('Error fetching transactions:', error));
});
function displayTransactions(transactions) {
const container = document.getElementById('transactions');
transactions.forEach(tx => {
const txElement = document.createElement('div');
txElement.className = 'transaction';
txElement.innerHTML = `
<p><strong>Hash:</strong> ${tx.hash}</p>
<p><strong>From:</strong> ${tx.from}</p>
<p><strong>To:</strong> ${tx.to}</p>
<p><strong>Amount:</strong> ${tx.amount} ETH</p>
<p><strong>Timestamp:</strong> ${new Date(tx.timestamp).toLocaleString()}</p>
`;
container.appendChild(txElement);
});
}