-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
56 lines (40 loc) · 1.28 KB
/
index.js
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
$('document').ready(function () {
txtSearch = $('#txtSearch');
btnSearch = $('#btnSearch');
btnSearch.click(async () => {
if (!txtSearch.val()) {
return;
}
console.log("Search for: ", txtSearch.val().trim());
let result = await search(txtSearch.val());
console.log('search results: ', result);
renderTransDetailCard(result.trans, result.block);
});
function renderLatestTransactions(blocks) {
$('#detail').hide();
createCardList($('#divLatestBlocks'), 'block', blocks);
createCardList($('#divLatestTrans'), 'transaction', blocks[0]);
$('#latest').show();
}
async function getLatestTransactiions() {
let data = await getLatestBlockData();
renderLatestTransactions(data);
}
/*
Event handlers
*/
// $('#latest').on('click', 'a.block-link', () => onBlockLinkClicked())
// async function onBlockLinkClicked() {
// let link = $('this');
// let blockNumber = link.prevObject[0].activeElement.innerText;
// console.log('block link clicked: ', blockNumber);
// let block = await findBlock(blockNumber);
// console.log('block: ', block);
// renderBlockDetailCard(block);
// }
// render default view
initWeb3().then(() => {
console.log('web3: ', web3);
getLatestTransactiions();
});
});