Adding direct access link system('#') for smart contract page

This commit is contained in:
Vivek Teega 2020-06-22 15:50:01 +05:30
parent 6ef9218df1
commit 3d66053f98

View File

@ -1615,13 +1615,15 @@
} }
function splitContractNameAddress(value, index) { function splitContractNameAddress(value, index) {
var tempArray = []; var tempObj = {};
tempArray[0] = value.substring(0, index); tempObj['name'] = value.substring(0, index);
tempArray[1] = value.substring(index + 1); tempObj['address'] = value.substring(index + 1);
return tempArray return tempObj
} }
function categoriseText(text) { function categoriseText(text, metadata = null) {
debugger;
if (!isNaN(text) && isInt(Number(text))) { if (!isNaN(text) && isInt(Number(text))) {
//console.log('this is a block number'); //console.log('this is a block number');
@ -1648,24 +1650,29 @@
thisField: text, thisField: text,
} }
history.pushState(appState, null, `#${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'); //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('-'));
var contractSplit = splitContractNameAddress(window.ranchimallflo.smartcontractnameaddresslist[i], window.ranchimallflo.smartcontractnameaddresslist[i].lastIndexOf('-'));
if (window.ranchimallflo.smartcontractnamelist.includes(text)) {
render("contract_page", contract = { render("contract_page", contract = {
name: '', name: contractSplit.name,
address: '' address: contractSplit.address
}) })
appState = { appState = {
page: "contract_page", page: "contract_page",
thisField: text, thisField: text,
} }
history.pushState(appState, null, `#${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)) {
} }
} }*/
} else if (text.length == 64 && returnHexaNumber(text)) { } else if (text.length == 64 && returnHexaNumber(text)) {
@ -1724,9 +1731,10 @@
//console.log(ranchimallflo.smartcontractlist.length); //console.log(ranchimallflo.smartcontractlist.length);
for (var i = 0; i < ranchimallflo.smartcontractlist.length; i++) { for (var i = 0; i < ranchimallflo.smartcontractlist.length; i++) {
//ranchimallflo.smartcontractnamelist.append(ranchimallflo.smartcontractlist[i]['contractName']); //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.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++) { for (var i = 0; i < ranchimallflo.tokenlist.length; i++) {