diff --git a/index.html b/index.html
index b8a679e..8110ca3 100644
--- a/index.html
+++ b/index.html
@@ -132,7 +132,7 @@
${topToken}
-
Latest transactions
+ Total transactions
${totalTransactions}
@@ -772,10 +772,11 @@
}
if (pageId === "block_page") {
- let blockInfo = await getBlockInfo(field);
+ let [blockInfo, blockTransactions] = await Promise.all([getBlockInfo(field), getBlockTransactions(field)])
pageContainer.append(create.blockPage(blockInfo));
pageTitle.textContent = "block";
loading()
+ appendTransactions('block_transaction_container', blockTransactions)
}
if (pageId === "homepage") {
@@ -1323,7 +1324,6 @@
const response = await fetch(`${tokenapiUrl}/api/v1.0/getTokenTransactions?token=` + tokenName),
transactions = await response.json()
return transactions.transactions
-
}
async function getBlockInfo(thisBlock) {
@@ -1341,6 +1341,13 @@
}
}
+
+ async function getBlockTransactions(thisBlock) {
+ const response = await fetch(`${tokenapiUrl}/api/v1.0/getBlockTransactions/${thisBlock}`),
+ transactions = await response.json()
+ return transactions.transactions
+ }
+
async function getContractInfo(contract) {
const response = await fetch(`${tokenapiUrl}/api/v1.0/getSmartContractInfo?contractName=${contract.name}&contractAddress=${contract.address}`),
info = await response.json(),
@@ -1399,28 +1406,16 @@
let transferType = txList[txids[i]]["parsedFloData"]["transferType"]
if (transferType == "token") {
let receiveraddress = "";
- for (
- let i = 0,
- voutlist =
- txList[txids[i]][
- "transactionDetails"
- ]["vout"]; i < voutlist.length; i++
- ) {
- if (
- voutlist[i]["scriptPubKey"]["addresses"][0] !=
- txList[txids[i]][
- "transactionDetails"
- ]["vin"][0]["addr"]
- ) {
- receiveraddress =
- voutlist[i]["scriptPubKey"]["addresses"][0];
- }
+ for (let i = 0, voutlist = txList[txids[i]]["transactionDetails"]["vout"]; i