diff --git a/index.html b/index.html
index 4bf1da8..5dd9084 100644
--- a/index.html
+++ b/index.html
@@ -786,7 +786,7 @@
function renderTransactions() { }
- window.addEventListener("load", () => {
+ window.addEventListener("load", async() => {
var hashvalue = location.hash.slice(1);
if(hashvalue==''){
@@ -797,7 +797,7 @@
}
else{
debugger;
- getAllSuggestions();
+ await getAllSuggestions();
categoriseText(hashvalue);
}
@@ -1546,36 +1546,33 @@
return tempArray
}
- function categoriseText(text, inputElement) {
+ function categoriseText(text) {
if (!isNaN(text) && isInt(Number(text))) {
//console.log('this is a block number');
- inputElement.value = '';
render("block_page", text);
appState = {
page: "block_page",
thisField: text,
}
- history.pushState(appState, null, null)
+ history.pushState(appState, null, `#${text}`)
} else if (typeof (text) == 'string') {
if (text.length == 34 && text[0] == 'F') {
//console.log('data entered is a FLO address');
- inputElement.value = '';
render("address_page", text)
appState = {
page: "address_page",
thisField: text,
}
- history.pushState(appState, null, null)
+ history.pushState(appState, null, `#${text}`)
} else if (window.ranchimallflo.tokenlist.includes(text)) {
//console.log('data entered is a token name');
- inputElement.value = '';
render("token_page", text)
appState = {
page: "token_page",
thisField: text,
}
- history.pushState(appState, null, null)
+ history.pushState(appState, null, `#${text}`)
} else if (window.ranchimallflo.smartcontractnamelist.includes(text)) {
//console.log('data entered is a smart contract name');
for (var i = 0; i < window.ranchimallflo.smartcontractnameaddresslist.length; i++) {
@@ -1583,7 +1580,6 @@
var contractSplit = splitContractNameAddress(window.ranchimallflo.smartcontractnameaddresslist[i], window.ranchimallflo.smartcontractnameaddresslist[i].lastIndexOf('-'));
if (window.ranchimallflo.smartcontractnamelist.includes(text)) {
- inputElement.value = '';
render("contract_page", contract = {
name: '',
address: ''
@@ -1592,7 +1588,7 @@
page: "contract_page",
thisField: text,
}
- history.pushState(appState, null, null)
+ history.pushState(appState, null, `#${text}`)
}
}
@@ -1606,22 +1602,20 @@
.then(function (myJson) {
if (myJson['type'] == 'transaction') {
//console.log('data entered is a transaction hash');
- inputElement.value = '';
render("transaction_page", text);
appState = {
page: "transaction_page",
thisField: text,
}
- history.pushState(appState, null, null)
+ history.pushState(appState, null, `#${text}`)
} else if (myJson['type'] == 'block') {
//console.log('data entered is a block hash');
- inputElement.value = '';
render("block_page", text)
appState = {
page: "block_page",
thisField: text,
}
- history.pushState(appState, null, null)
+ history.pushState(appState, null, `#${text}`)
} else {
//console.log('data entered is noise');
}
@@ -1643,11 +1637,11 @@
async function getAllSuggestions() {
window.data = [];
+ window.ranchimallflo = {};
let response = await fetch(`${window.tokenapiUrl}/api/v1.0/getTokenSmartContractList`);
let myJson = await response.json();
//console.log('first line of the fetch result');
- window.ranchimallflo = {};
ranchimallflo.tokenlist = myJson['tokens'];
ranchimallflo.smartcontractlist = myJson['smartContracts'];
ranchimallflo.smartcontractnamelist = [];