diff --git a/index.html b/index.html index 1006d30..3933f41 100644 --- a/index.html +++ b/index.html @@ -110,7 +110,7 @@

${topToken}

-

total transactions

+

Latest transactions

${totalTransactions}

@@ -166,7 +166,7 @@
${size}
Reward

${reward}

-
Hash
+
Transaction ID

${hash}

Difficulty

${difficulty}

@@ -233,7 +233,7 @@
${type}

${name}

-
Hash
+
Transaction ID

${hash}

@@ -425,14 +425,7 @@

${token}

` contractInfo.innerHTML = ` -
Hash
-
-

${hash}

- - Copy - - -
+
Sender

${sender}

receiver
@@ -440,7 +433,15 @@
amount

${amount} ${token}

Contract name
-

${contractName}

`; +

${contractName}

+
Transaction ID
+
+
${hash}
+ + Copy + + +
`; card.append(contractInfo) return card; }, @@ -465,21 +466,22 @@

${token}

-
Hash
-
-

${hash}

- - Copy - - -
+
Sender

${sender}

receiver

${receiver}

amount
-

${amount} ${token}

-
`; +

${amount} ${token}

+
Transaction ID
+
+
${hash}
+ + Copy + + +
+
`; return card; }, tokenCreationCard(obj) { @@ -505,21 +507,22 @@

${token}

-
Hash
-
-

${hash}

- - Copy - - -
+
Incorporation address

${incAddress}

token name

${token}

supply
-

${supply}

-
`; +

${supply}

+
Transaction ID
+
+
${hash}
+ + Copy + + +
+ `; return card; }, contractTriggerCard(obj) { @@ -542,15 +545,9 @@
smart contract

trigger

-
Hash
+
-
-

${hash}

- - Copy - - -
+
Contract name

${contractName}

contract address
@@ -558,7 +555,15 @@
Winning Choice

${winningChoice}

committee address
-

${committeeAddress}

+

${committeeAddress}

+
Transaction ID
+
+
${hash}
+ + Copy + + +
`; return card; }, @@ -582,14 +587,7 @@

${token}

-
Hash
-
-

${hash}

- - Copy - - -
+
Contract name

${contractName}

Contract address
@@ -602,6 +600,14 @@

${expiration}

participation amount

${participationFees} ${token}

+
Transaction ID
+
+
${hash}
+ + Copy + + +
`; return card; }, @@ -852,14 +858,20 @@ window.addEventListener("load", async () => { + //debugger; + var hashvalue = location.hash.slice(1); if (hashvalue == '') { render("homepage"); - history.pushState(appState, null, ''); getAllSuggestions(); } else { await getAllSuggestions(); + appState = { + page: "homepage", + thisField: null, + }; + history.pushState(appState, null, ''); categoriseText(hashvalue); } @@ -873,12 +885,13 @@ history.pushState(appState, null, `#${e.target.textContent}`) } if (e.target.closest(".token") && prevField !== e.target.textContent) { - render("token_page", e.target.textContent.toLowerCase()); + let tokenname = e.target.textContent.toLowerCase(); + render("token_page", tokenname); appState = { page: "token_page", - thisField: e.target.textContent + thisField: tokenname }; - history.pushState(appState, null, `#${e.target.textContent}`) + history.pushState(appState, null, `#${tokenname}`) } if (e.target.closest(".hash") && prevField !== e.target.textContent) { render("transaction_page", e.target.closest(".transaction").id); @@ -897,17 +910,21 @@ history.pushState(appState, null, `#${e.target.textContent}`); } if (e.target.closest(".contract") && prevField !== e.target.textContent) { - render("contract_page", { name: replaceSpace(e.target.textContent), address: e.target.dataset.contractAddress }) + let contract = { + name: e.target.textContent.split(' ').join('-'), + address: e.target.dataset.contractAddress + } + render("contract_page", { name: contract.name, address: contract.address }) appState = { page: "contract_page", - thisField: { name: replaceSpace(e.target.textContent), address: e.target.dataset.contractAddress }, + thisField: { name: contract.name, address: contract.address }, } - history.pushState(appState, null, `#${e.target.textContent}`) + history.pushState(appState, null, `#${contract.name}-${contract.address}`) } if (e.target.closest(".tab")) { showTab(e.target.closest(".tab")); } - if (e.target.closest("#secondary_search_btn")) { + if (e.target.closest("#secondary_search_btn") || e.target.closest("#primary_search")) { render("search_page") appState = { page: "search_page", @@ -1615,13 +1632,15 @@ } function splitContractNameAddress(value, index) { - var tempArray = []; - tempArray[0] = value.substring(0, index); - tempArray[1] = value.substring(index + 1); - return tempArray + var tempObj = {}; + tempObj['name'] = value.substring(0, index); + tempObj['address'] = value.substring(index + 1); + return tempObj } - function categoriseText(text) { + function categoriseText(text, metadata = null) { + + //debugger; if (!isNaN(text) && isInt(Number(text))) { //console.log('this is a block number'); @@ -1640,32 +1659,38 @@ thisField: text, } history.pushState(appState, null, `#${text}`) - } else if (window.ranchimallflo.tokenlist.includes(text)) { + } else if (window.ranchimallflo.tokenlist.includes(text.toLowerCase())) { //console.log('data entered is a token name'); + text = text.toLowerCase() render("token_page", text) appState = { page: "token_page", thisField: text, } history.pushState(appState, null, `#${text}`) - } else if (window.ranchimallflo.smartcontractnamelist.includes(text)) { + } else if (window.ranchimallflo.smartcontractnameaddresslist.includes(text)) { + //console.log('data entered is a smart contract name'); - for (var i = 0; i < window.ranchimallflo.smartcontractnameaddresslist.length; i++) { + //debugger; + var contractSplit = splitContractNameAddress(text, text.lastIndexOf('-')); + + render("contract_page", contract = { + name: contractSplit, + address: contractSplit[1] + }) + appState = { + page: "contract_page", + thisField: text, + } + history.pushState(appState, null, `#${text}`) + /*for (var i = 0; i < window.ranchimallflo.smartcontractnameaddresslist.length; i++) { var contractSplit = splitContractNameAddress(window.ranchimallflo.smartcontractnameaddresslist[i], window.ranchimallflo.smartcontractnameaddresslist[i].lastIndexOf('-')); if (window.ranchimallflo.smartcontractnamelist.includes(text)) { - render("contract_page", contract = { - name: '', - address: '' - }) - appState = { - page: "contract_page", - thisField: text, - } - history.pushState(appState, null, `#${text}`) + } - } + }*/ } else if (text.length == 64 && returnHexaNumber(text)) { @@ -1724,9 +1749,10 @@ //console.log(ranchimallflo.smartcontractlist.length); for (var i = 0; i < ranchimallflo.smartcontractlist.length; i++) { //ranchimallflo.smartcontractnamelist.append(ranchimallflo.smartcontractlist[i]['contractName']); - data.push(ranchimallflo.smartcontractlist[i]['contractName']); + //debugger; + data.push(`${ranchimallflo.smartcontractlist[i]['contractName']}-${ranchimallflo.smartcontractlist[i]['contractAddress']}`); ranchimallflo.smartcontractnamelist.push(ranchimallflo.smartcontractlist[i]['contractName']); - ranchimallflo.smartcontractnameaddresslist.push(ranchimallflo.smartcontractlist[i]['contractName'] + '-' + ranchimallflo.smartcontractlist[i]['contractAddress']); + ranchimallflo.smartcontractnameaddresslist.push(`${ranchimallflo.smartcontractlist[i]['contractName']}-${ranchimallflo.smartcontractlist[i]['contractAddress']}`); } for (var i = 0; i < ranchimallflo.tokenlist.length; i++) { @@ -1756,8 +1782,6 @@ - - - \ No newline at end of file