1186 lines
50 KiB
HTML
1186 lines
50 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>FLO Scout</title>
|
|
<link rel="stylesheet" href="css/main.css" />
|
|
</head>
|
|
|
|
<body data-theme="dark">
|
|
<div id="loader_page" class="hide-completely">
|
|
<svg id="loader" class="icon" viewBox="0 0 64 64">
|
|
<title>Loading</title>
|
|
<circle cx="32" cy="32" r="32" />
|
|
</svg>
|
|
<h4>Loading</h4>
|
|
</div>
|
|
<header id="page_header" class="flex margin">
|
|
<h3 id="page_title">Block</h3>
|
|
<svg id="secondary_search_btn" class="icon margin-left-auto hover" viewBox="0 0 64 64">
|
|
<title>
|
|
search for block, transactions, address, token or contract
|
|
</title>
|
|
<circle cx="25.34" cy="25.34" r="24.84" />
|
|
<line x1="63.65" y1="63.65" x2="42.91" y2="42.91" />
|
|
</svg>
|
|
</header>
|
|
<main id="page_container">
|
|
<!--<div id="search_page" class="page hide-completely">
|
|
<label id="secondary_search" class="input">
|
|
<svg class="icon" viewBox="0 0 64 64">
|
|
<title>search icon</title>
|
|
<circle cx="25.34" cy="25.34" r="24.84"/>
|
|
<line x1="63.65" y1="63.65" x2="42.91" y2="42.91"/>
|
|
</svg>
|
|
<input type="search" placeholder="Search block, transactions, address, token or contract">
|
|
</label>
|
|
</div>
|
|
<div id="all_transations" class="">
|
|
|
|
</div>
|
|
<div id="all_blocks" class="">
|
|
|
|
</div> -->
|
|
</main>
|
|
<script>
|
|
let frag = document.createDocumentFragment();
|
|
const create = {
|
|
homepage(obj) {
|
|
let {topToken,totalTransactions,walletAddresses,topContract,} = obj,
|
|
page = document.createElement("div");
|
|
page.classList.add("page");
|
|
page.id = "homepage";
|
|
page.innerHTML = `
|
|
<section id="first_section">
|
|
<header class="header flex">
|
|
<div id="logo">
|
|
<svg id="main_logo" viewBox="0 0 27.25 32">
|
|
<title>RanchiMall</title>
|
|
<path d="M27.14,30.86c-.74-2.48-3-4.36-8.25-6.94a20,20,0,0,1-4.2-2.49,6,6,0,0,1-1.25-1.67,4,4,0,0,1,0-2.26c.37-1.08.79-1.57,3.89-4.55a11.66,11.66,0,0,0,3.34-4.67,6.54,6.54,0,0,0,.05-2.82C20,3.6,18.58,2,16.16.49c-.89-.56-1.29-.64-1.3-.24a3,3,0,0,1-.3.72l-.3.55L13.42.94C13,.62,12.4.26,12.19.15c-.4-.2-.73-.18-.72.05a9.39,9.39,0,0,1-.61,1.33s-.14,0-.27-.13C8.76.09,8-.27,8,.23A11.73,11.73,0,0,1,6.76,2.6C4.81,5.87,2.83,7.49.77,7.49c-.89,0-.88,0-.61,1,.22.85.33.92,1.09.69A5.29,5.29,0,0,0,3,8.33c.23-.17.45-.29.49-.26a2,2,0,0,1,.22.63A1.31,1.31,0,0,0,4,9.34a5.62,5.62,0,0,0,2.27-.87L7,8l.13.55c.19.74.32.82,1,.65a7.06,7.06,0,0,0,3.46-2.47l.6-.71-.06.64c-.17,1.63-1.3,3.42-3.39,5.42L6.73,14c-3.21,3.06-3,5.59.6,8a46.77,46.77,0,0,0,4.6,2.41c.28.13,1,.52,1.59.87,3.31,2,4.95,3.92,4.95,5.93a2.49,2.49,0,0,0,.07.77h0c.09.09,0,.1.9-.14a2.61,2.61,0,0,0,.83-.32,3.69,3.69,0,0,0-.55-1.83A11.14,11.14,0,0,0,17,26.81a35.7,35.7,0,0,0-5.1-2.91C9.37,22.64,8.38,22,7.52,21.17a3.53,3.53,0,0,1-1.18-2.48c0-1.38.71-2.58,2.5-4.23,2.84-2.6,3.92-3.91,4.67-5.65a3.64,3.64,0,0,0,.42-2A3.37,3.37,0,0,0,13.61,5l-.32-.74.29-.48c.17-.27.37-.63.46-.8l.15-.3.44.64a5.92,5.92,0,0,1,1,2.81,5.86,5.86,0,0,1-.42,1.94c0,.12-.12.3-.15.4a9.49,9.49,0,0,1-.67,1.1,28,28,0,0,1-4,4.29C8.62,15.49,8.05,16.44,8,17.78a3.28,3.28,0,0,0,1.11,2.76c.95,1,2.07,1.74,5.25,3.32,3.64,1.82,5.22,2.9,6.41,4.38A4.78,4.78,0,0,1,21.94,31a3.21,3.21,0,0,0,.14.92,1.06,1.06,0,0,0,.43-.05l.83-.22.46-.12-.06-.46c-.21-1.53-1.62-3.25-3.94-4.8a37.57,37.57,0,0,0-5.22-2.82A13.36,13.36,0,0,1,11,21.19a3.36,3.36,0,0,1-.8-4.19c.41-.85.83-1.31,3.77-4.15,2.39-2.31,3.43-4.13,3.43-6a5.85,5.85,0,0,0-2.08-4.29c-.23-.21-.44-.43-.65-.65A2.5,2.5,0,0,1,15.27.69a10.6,10.6,0,0,1,2.91,2.78A4.16,4.16,0,0,1,19,6.16a4.91,4.91,0,0,1-.87,3c-.71,1.22-1.26,1.82-4.27,4.67a9.47,9.47,0,0,0-2.07,2.6,2.76,2.76,0,0,0-.33,1.54,2.76,2.76,0,0,0,.29,1.47c.57,1.21,2.23,2.55,4.65,3.73a32.41,32.41,0,0,1,5.82,3.24c2.16,1.6,3.2,3.16,3.2,4.8a1.94,1.94,0,0,0,.09.76,4.54,4.54,0,0,0,1.66-.4C27.29,31.42,27.29,31.37,27.14,30.86ZM6.1,7h0a3.77,3.77,0,0,1-1.46.45L4,7.51l.68-.83a25.09,25.09,0,0,0,3-4.82A12,12,0,0,1,8.28.76c.11-.12.77.32,1.53,1l.63.58-.57.84A10.34,10.34,0,0,1,6.1,7Zm5.71-1.78A9.77,9.77,0,0,1,9.24,7.18h0a5.25,5.25,0,0,1-1.17.28l-.58,0,.65-.78a21.29,21.29,0,0,0,2.1-3.12c.22-.41.42-.76.44-.79s.5.43.9,1.24L12,5ZM13.41,3a2.84,2.84,0,0,1-.45.64,11,11,0,0,1-.9-.91l-.84-.9.19-.45c.34-.79.39-.8,1-.31A9.4,9.4,0,0,1,13.8,2.33q-.18.34-.39.69Z"/>
|
|
</svg>
|
|
<h4>RanchiMall</h4>
|
|
</div>
|
|
<label class="toggle" style="margin-left: auto" title="Change theme">
|
|
<input type="checkbox" name="theme toggle" id="theme_toggle">
|
|
<div class="switch">
|
|
<svg class="circle" viewBox="0 0 64 64">
|
|
<title>dark theme</title>
|
|
<path d="M48.25,45.45A27.26,27.26,0,0,1,20.82,18.37,26.75,26.75,0,0,1,27.47.71a31.71,31.71,0,0,0-27,31.2,31.8,31.8,0,0,0,32,31.59A32,32,0,0,0,63.12,41.12,27.59,27.59,0,0,1,48.25,45.45Z" transform="translate(0 0)"/>
|
|
</svg>
|
|
<svg class="circle" viewBox="0 0 64 64">
|
|
<title>light theme</title>
|
|
<circle cx="32" cy="32" r="13.9"/>
|
|
<line x1="32" y1="6.86" x2="32"/>
|
|
<line x1="32" y1="64" x2="32" y2="57.14"/>
|
|
<line x1="57.14" y1="32" x2="64" y2="32"/>
|
|
<line y1="32" x2="6.86" y2="32"/>
|
|
<line x1="49.78" y1="14.22" x2="54.63" y2="9.37"/>
|
|
<line x1="9.37" y1="54.63" x2="14.22" y2="49.78"/>
|
|
<line x1="49.78" y1="49.78" x2="54.63" y2="54.63"/>
|
|
<line x1="9.37" y1="9.37" x2="14.22" y2="14.22"/>
|
|
</svg>
|
|
</div>
|
|
</label>
|
|
</header>
|
|
<div id="main_search">
|
|
<h1 class="other-font">FLO SCOUT</h1>
|
|
<h3>Search for<br>block, transaction, address,<br>token and contract</h3>
|
|
<label id="primary_search" class="input">
|
|
<svg class="icon" viewBox="0 0 64 64">
|
|
<title>search icon</title>
|
|
<circle cx="25.34" cy="25.34" r="24.84"/>
|
|
<line x1="63.65" y1="63.65" x2="42.91" y2="42.91"/>
|
|
</svg>
|
|
<input type="search" placeholder="Search">
|
|
</label>
|
|
</div>
|
|
<div id="highlights">
|
|
<div class="highlight-item">
|
|
<h4 class="label">top token</h4>
|
|
<h2 class="token">${topToken}</h2>
|
|
</div>
|
|
<div class="highlight-item">
|
|
<h4 class="label">total transactions</h4>
|
|
<h2>${totalTransactions}</h2>
|
|
</div>
|
|
<div class="highlight-item">
|
|
<h4 class="label">Wallet addresses</h4>
|
|
<h2>${walletAddresses}</h2>
|
|
</div>
|
|
<div class="highlight-item">
|
|
<h4 class="label">top contract</h4>
|
|
<h2 class="contract">${topContract}</h2>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<section id="latest_transaction_section">
|
|
<header class="grid grid-2 header">
|
|
<h3 class="heading">Latest transactions</h3>
|
|
<button id='all_trans_btn' class="margin-left-auto">view all</button>
|
|
</header>
|
|
<div id="top_transaction_container">
|
|
</div>
|
|
</section>
|
|
<section id="latest_blocks_section">
|
|
<header class="grid grid-2 header">
|
|
<h3 class="heading">Latest blocks</h3>
|
|
<button id='all_blocks_btn' class="margin-left-auto">view all</button>
|
|
</header>
|
|
<div id="top_blocks_container">
|
|
</div>
|
|
</section>
|
|
`;
|
|
return page;
|
|
},
|
|
blockPage(obj) {
|
|
let {blockHeight,size,transactions,reward,hash,difficulty,nonce,
|
|
} = obj,
|
|
page = document.createElement("div"),
|
|
wordForm = "transaction";
|
|
if (transactions > 1) wordForm = "transactions";
|
|
page.classList.add("page");
|
|
page.id = "block_page";
|
|
|
|
page.innerHTML = `
|
|
<h5 class="label">Block Height</h5>
|
|
<h2 class="block-height">${blockHeight}</h2>
|
|
<div class="card">
|
|
<h4>1 ${wordForm}</h4>
|
|
<h5 class="label">${size}</h5>
|
|
<h5 class="label">Reward</h5>
|
|
<h4>${reward}</h4>
|
|
<h5 class="label">Hash</h5>
|
|
<h4 class="breakable hash">${hash}</h4>
|
|
<h5 class="label">Difficulty</h5>
|
|
<h4>${difficulty}</h4>
|
|
<h5 class="label">Nonce</h5>
|
|
<h4>${nonce}</h4>
|
|
</div>
|
|
<h3 class="heading">Transactions</h3>
|
|
<div id="block_transaction_container" class="top-bottom-padding">
|
|
</div>`;
|
|
return page;
|
|
},
|
|
addressPage(obj) {
|
|
let { balance, address } = obj,
|
|
page = document.createElement("div");
|
|
page.classList.add("page");
|
|
page.id = "address_page";
|
|
page.innerHTML = `
|
|
<div class="balance-card">
|
|
<svg class="flo-logo" viewBox="0 0 48 48">
|
|
<path d="M34.2,32.4c0,0,3.75-0.18,7.41-3.86c2.96-2.98,3.65-6.66,3.99-8.52c-11.04-0.63-12.36,0.99-13.71,1.68
|
|
c-1.19,0.61-5.33,4.55-5.33,4.55s3.06-3.13,3.2-9.94c0.09-4.54-1.02-7.39-2.72-10.64C25.29,2.33,22.79,0,22.79,0l0.01,4.97
|
|
c0,0,4.35,2.84,4.35,11.84c0,6.52-4.35,11.02-4.35,11.02s-4.35-4.5-4.35-11.02c0-9.01,4.35-11.84,4.35-11.84L22.79,0
|
|
c0,0-2.48,2.33-4.23,5.67c-1.7,3.25-2.81,6.1-2.72,10.64c0.13,6.81,3.2,9.94,3.2,9.94s-4.14-3.95-5.33-4.55
|
|
c-1.35-0.69-2.67-2.31-13.71-1.68c0.34,1.86,1.03,5.54,3.99,8.52c3.66,3.68,7.41,3.86,7.41,3.86s-5.05-2.03-7.15-9.45
|
|
c0,0,5.76-0.7,9.63,1.87c2.52,1.67,4.86,4.26,6.79,6.01c0,0-2.58-0.04-6.81,1.88c-2.54,1.15-3.92,2.84-4.44,4.38
|
|
c-0.36,1.06-0.2,2.27-0.2,2.27s3.31,0.31,5.94,0c1.99-0.23,3.42-2.16,3.42-2.16s-2,0.78-3.95,0.78c-2.06,0-2.67-0.66-2.67-0.66
|
|
c0.98-3.64,8.68-5.19,8.68-5.19s-1.34,2.6-1.42,6.5c-0.1,4.79,3.57,8.52,3.57,8.45c0,0.07,3.67-3.66,3.57-8.45
|
|
c-0.08-3.9-1.42-6.5-1.42-6.5s7.71,1.55,8.68,5.19c0,0-0.61,0.66-2.67,0.66c-1.95,0-3.95-0.78-3.95-0.78s1.43,1.93,3.42,2.16
|
|
c2.63,0.31,5.94,0,5.94,0s0.16-1.21-0.2-2.27c-0.52-1.54-1.9-3.23-4.44-4.38c-4.23-1.92-6.81-1.88-6.81-1.88
|
|
c1.93-1.76,4.27-4.34,6.79-6.01c3.87-2.57,9.63-1.87,9.63-1.87C39.26,30.38,34.2,32.4,34.2,32.4z M22.8,43.06
|
|
c-0.95-1.37-1.47-2.13-1.47-4.26c0-2.4,1.12-4.61,1.47-5.14c0.35,0.52,1.47,2.74,1.47,5.14C24.27,40.92,23.75,41.69,22.8,43.06z"/>
|
|
</svg>
|
|
<h5 class="label">Balance</h5>
|
|
<h2>${balance}</h2><h4>FLO</h4>
|
|
<p class="breakable">${address}</p>
|
|
</div>
|
|
<h3 class="heading">Transactions</h3>
|
|
<div id="address_transaction_container" class="top-bottom-padding">
|
|
</div>`;
|
|
return page;
|
|
},
|
|
transactionPage(obj) {
|
|
let {type,name,blockHeight,amount,sender,receiver,floData,hash,confirmations,} = obj,
|
|
page = document.createElement("div");
|
|
page.classList.add("page");
|
|
page.id = "transaction_page";
|
|
page.innerHTML = `
|
|
<div class="grid grid-2">
|
|
<div>
|
|
<h5 class="label">${type}</h5>
|
|
<h2 class="token">${name}</h2>
|
|
</div>
|
|
<div class="status done">
|
|
<svg class="icon" viewBox="0 0 64 42">
|
|
<title>Success</title>
|
|
<polyline points="0.35 19.41 22.4 41.29 63.65 0.35"/>
|
|
</svg>
|
|
Success
|
|
</div>
|
|
</div>
|
|
<div class="card">
|
|
<h5 class="label">Block</h5>
|
|
<h4 class="block-height">${blockHeight}</h4>
|
|
<h5 class="label">Amount</h5>
|
|
<h4>${amount}</h4>
|
|
<h5 class="label">Sender</h5>
|
|
<h4 class="address">${sender}</h4>
|
|
<h5 class="label">Reciever</h5>
|
|
<h4 class="address">${receiver}</h4>
|
|
</div>
|
|
<div class="card">
|
|
<h5 class="label">FLO Data</h5>
|
|
<p>${floData}</p>
|
|
<h5 class="label">Hash</h5>
|
|
<h4 class="breakable hash">${hash}</h4>
|
|
<h5 class="label">Block Confirmations</h5>
|
|
<h4>${confirmations}</h4>
|
|
</div>
|
|
`;
|
|
return page;
|
|
},
|
|
tokenPage(obj) {
|
|
let { token, supply, incAddress } = obj;
|
|
let page = document.createElement("div");
|
|
page.classList.add("page");
|
|
page.id = "token_page";
|
|
page.innerHTML = `
|
|
<div class="card">
|
|
<h2 class="uppercase">${token}</h2>
|
|
<h5 class="label">Supply</h5>
|
|
<h4>${supply}</h4>
|
|
<h5 class="label">Incorporation Address</h5>
|
|
<h4 class="breakable">${incAddress}</h4>
|
|
</div>
|
|
<div class="tabs">
|
|
<h4 class="tab active" data-rank="1" data-target="token_balance_container">Top Balances</h4>
|
|
<h4 class="tab" data-rank="2" data-target="token_transaction_container">Top Transactions</h4>
|
|
<div class="line"></div>
|
|
</div>
|
|
<ul id="token_balance_container" data-tab-group="token" class="card">
|
|
<li class="balance" >
|
|
<h5 class="breakable label">F6EMAHjivqrcrdAHNABq2R1FLNkx8xfEaT</h5>
|
|
<h4>0.0000023333 RMT</h4>
|
|
</li>
|
|
<li class="balance">
|
|
<h5 class="breakable label">F6EMAHjivqrcrdAHNABq2R1FLNkx8xfEaT</h5>
|
|
<h4>0.0000023333 RMT</h4>
|
|
</li>
|
|
</ul>
|
|
<ul id="token_transaction_container" data-tab-group="token" class="card hide-completely">
|
|
<li class="balance" >
|
|
<h5 class="breakable label">F6EMAHjivqrcrdAHNABq2R1FLNkx8xfEaT</h5>
|
|
<h4>0.0000023333 RMT</h4>
|
|
</li>
|
|
</ul>
|
|
`;
|
|
return page;
|
|
},
|
|
contractPage(obj) {
|
|
let {status,contract,contractType,incAddress,expiration,token,participationFees} = obj,
|
|
page = document.createElement("div");
|
|
page.classList.add("page");
|
|
page.id = "contract_page";
|
|
page.innerHTML = `
|
|
<div class="status closed">Closed</div>
|
|
<h2 class="uppercase">${contract}</h2>
|
|
<div class="card">
|
|
<h5 class="label">Contract Type</h5>
|
|
<h4>${contractType}</h4>
|
|
<h5 class="label">Incorporation Address</h5>
|
|
<h4 class="address">${incAddress}</h4>
|
|
<h5 class="label">Expiration</h5>
|
|
<h4>${expiration}</h4>
|
|
<h5 class="label">Token Used</h5>
|
|
<h4 class="uppercase">${token}</h4>
|
|
<h5 class="label">Participation Amount</h5>
|
|
<h4>${participationFees}</h4>
|
|
</div>
|
|
<h3 class="heading">User Choices</h3>
|
|
<ul class="card" type='circle'>
|
|
<li>Narendra Modi Wins</li>
|
|
<li>Narendra Modi Loses</li>
|
|
</ul>
|
|
<div class="tabs">
|
|
<h4 class="tab active" data-rank="1" data-target="participant_container">Participants</h4>
|
|
<h4 class="tab" data-rank="2" data-target="winners_container">Winners</h4>
|
|
<h4 class="tab" data-rank="3" data-target="losers_container">losers</h4>
|
|
<div class="line"></div>
|
|
</div>
|
|
<ul id="participant_container" data-tab-group="token" class="card">
|
|
<li class="contract-choice" >
|
|
<h5 class="breakable label">F6EMAHjivqrcrdAHNABq2R1FLNkx8xfEaT</h5>
|
|
<h3>narendra modi wins</h3>
|
|
<h4>0.0000023333 RMT</h4>
|
|
</li>
|
|
<li class="balance">
|
|
<h5 class="breakable label">F6EMAHjivqrcrdAHNABq2R1FLNkx8xfEaT</h5>
|
|
<h4>0.0000023333 RMT</h4>
|
|
</li>
|
|
</ul>
|
|
<ul id="winners_container" data-tab-group="token" class="card hide-completely">
|
|
<li class="contract-choice winner" >
|
|
<h5 class="breakable label">F6EMAHjivqrcrdAHNABq2R1FLNkx8xfEaT</h5>
|
|
<h3>narendra modi wins</h3>
|
|
<h4>0.0000023333 RMT</h4>
|
|
</li>
|
|
</ul>
|
|
<ul id="losers_container" data-tab-group="token" class="card hide-completely">
|
|
<li class="contract-choice winner" >
|
|
<h5 class="breakable label">F6EMAHjivqrcrdAHNABq2R1FLNkx8xfEaT</h5>
|
|
<h3>narendra modi wins</h3>
|
|
<h4>0.0000023333 RMT</h4>
|
|
</li>
|
|
</ul>
|
|
`;
|
|
return page;
|
|
},
|
|
contractTransferCard(obj) {
|
|
let {hash,blockHeight,token,sender,receiver,amount,contractName,userChoice} = obj,
|
|
card = document.createElement("div");
|
|
card.classList.add("transaction", "token-transfer");
|
|
card.id = hash;
|
|
card.innerHTML = `
|
|
<h5 class="label block-height">${blockHeight}</h5>
|
|
<div class="contract-type">
|
|
<h5 class="label">Smart Contract Transfer</h5>
|
|
<h4 class="token uppercase">${token}</h4>
|
|
</div>
|
|
<div class="contract-info">
|
|
<h5 class="label">Sender</h5>
|
|
<h4 class="address">${sender}</h4>
|
|
<h5 class="label">receiver</h5>
|
|
<h4 class="address">${receiver}</h4>
|
|
<h5 class="label">amount</h5>
|
|
<h4>${amount} ${token}</h4>
|
|
<h5 class="label">Contract name</h5>
|
|
<h4>${contractName}</h4>`;
|
|
if (userChoice)
|
|
card.innerHTML += `
|
|
<h5 class="label">User Choice</h5>
|
|
<h4>${userChoice}</h4>`;
|
|
|
|
card.innerHTML += `</div>`;
|
|
return card;
|
|
},
|
|
tokenTransferCard(obj) {
|
|
let { hash, blockHeight, token, sender, receiver, amount } = obj,
|
|
card = document.createElement("div");
|
|
card.classList.add("transaction", "token-transfer");
|
|
card.id = hash;
|
|
card.innerHTML = `
|
|
<h5 class="label block-height">${blockHeight}</h5>
|
|
<div class="contract-type">
|
|
<h5 class="label">Token transfer</h5>
|
|
<h4 class="token uppercase">${token}</h4>
|
|
</div>
|
|
<div class="contract-info">
|
|
<h5 class="label">Sender</h5>
|
|
<h4 class="address">${sender}</h4>
|
|
<h5 class="label">receiver</h5>
|
|
<h4 class="address">${receiver}</h4>
|
|
<h5 class="label">amount</h5>
|
|
<h4>${amount} ${token}</h4>
|
|
</div>`;
|
|
return card;
|
|
},
|
|
tokenCreationCard(obj) {
|
|
let { hash, blockHeight, token, incAddress, supply } = obj,
|
|
card = document.createElement("div");
|
|
card.classList.add("transaction", "token-creation");
|
|
card.id = hash;
|
|
card.innerHTML = `
|
|
<h5 class="label block-height">${blockHeight}</h5>
|
|
<div class="contract-type">
|
|
<h5 class="label">token creation</h5>
|
|
<h4 class="token uppercase">${token}</h4>
|
|
</div>
|
|
<div class="contract-info">
|
|
<h5 class="label">Incorporation address</h5>
|
|
<h4>${incAddress}</h4>
|
|
<h5 class="label">token name</h5>
|
|
<h4 class="uppercase">${token}</h4>
|
|
<h5 class="label">supply</h5>
|
|
<h4>${supply}</h4>
|
|
</div>`;
|
|
return card;
|
|
},
|
|
contractTriggerCard(obj) {
|
|
let {hash,blockHeight,contractName,contractAddress,winningChoice,committeeAddress} = obj,
|
|
card = document.createElement("div");
|
|
card.classList.add("transaction", "contract-trigger");
|
|
card.id = hash;
|
|
card.innerHTML = `
|
|
<h5 class="label block-height">${blockHeight}</h5>
|
|
<div class="contract-type">
|
|
<h4 class="token uppercase">smart contract trigger</h4>
|
|
</div>
|
|
<div class="contract-info">
|
|
<h5 class="label">Contract name</h5>
|
|
<h4>${contractName}</h4>
|
|
<h5 class="label">contract address</h5>
|
|
<h4 class="address">${contractAddress}</h4>
|
|
<h5 class="label">Winning Choice</h5>
|
|
<h4>${winningChoice}</h4>
|
|
<h5 class="label">committee address</h5>
|
|
<h4>${committeeAddress}</h4>
|
|
</div>`;
|
|
return card;
|
|
},
|
|
contractCreationCard(obj) {
|
|
let {hash,blockHeight,token,contractName,incAddress,contractType,expiration,participationFees,availableChoices} = obj,
|
|
card = document.createElement("div");
|
|
card.classList.add("transaction", "contract-creation");
|
|
card.id = hash;
|
|
card.innerHTML = `
|
|
<h5 class="label block-height">${blockHeight}</h5>
|
|
<div class="contract-type">
|
|
<h5 class="label">Smart Contract creation</h5>
|
|
<h4 class="token uppercase">${token}</h4>
|
|
</div>
|
|
<div class="contract-info">
|
|
<h5 class="label">Contract name</h5>
|
|
<h4>${contractName}</h4>
|
|
<h5 class="label">Incorporation address</h5>
|
|
<h4>${incAddress}</h4>
|
|
<h5 class="label">token used</h5>
|
|
<h4 class="uppercase">${token}</h4>
|
|
<h5 class="label">contract type</h5>
|
|
<h4>${contractType}</h4>
|
|
<h5 class="label">expiration</h5>
|
|
<h4 class="address">${expiration}</h4>
|
|
<h5 class="label">participation amount</h5>
|
|
<h4>${participationFees} ${token}</h4>
|
|
<h5 class="label">user Choices</h5>
|
|
<div class="choices-container">`;
|
|
if (availableChoices)
|
|
availableChoices.forEach((choice) => {
|
|
card.innerHTML += `<div class="choice">${choice}</div>`;
|
|
});
|
|
card.innerHTML += ` </div>
|
|
</div>`;
|
|
return card;
|
|
},
|
|
};
|
|
|
|
const pageTitle = document.getElementById("page_title"),
|
|
pageContainer = document.getElementById("page_container"),
|
|
pageHeader = document.getElementById("page_header");
|
|
let currentPage = "homepage",
|
|
prevField = "";
|
|
|
|
function removePage() {
|
|
if (pageContainer.firstElementChild)
|
|
pageContainer.firstElementChild.remove();
|
|
}
|
|
|
|
function replaceDash(string) {
|
|
return string.replace(/-/g, " ");
|
|
}
|
|
|
|
let appState = {
|
|
page: "homepage",
|
|
thisField: null,
|
|
};
|
|
|
|
window.onpopstate = (e) => {
|
|
if (e.state !== null) {
|
|
let { page, thisField } = e.state;
|
|
render(page, thisField);
|
|
}
|
|
};
|
|
|
|
async function render(pageId, field) {
|
|
if ("scrollRestoration" in history) {
|
|
history.scrollRestoration = "manual";
|
|
}
|
|
window.scrollTo(0, 0);
|
|
loading(true)
|
|
removePage(currentPage);
|
|
|
|
if (pageId === "address_page") {
|
|
let addressInfo = await getAddressInfo(field);
|
|
let addressBalance = await getAddressBalance(field);
|
|
let addressTxs = await getAddressTxs(field);
|
|
pageContainer.append(create.addressPage(addressBalance))
|
|
pageTitle.textContent = 'Address'
|
|
loading()
|
|
}
|
|
|
|
if (pageId === "token_page") {
|
|
let tokenInfo = await getTokenInfo(field);
|
|
pageContainer.append(create.tokenPage(tokenInfo));
|
|
pageTitle.textContent = "Token";
|
|
loading()
|
|
}
|
|
|
|
if (pageId === "contract_page") {
|
|
// todo: load contract variable dynamically
|
|
let contract = {
|
|
name: "india-elections-2019",
|
|
address: "F7osBpjDDV1mSSnMNrLudEQQ3cwDJ2dPR1",
|
|
};
|
|
|
|
let contractInfo = await getContractInfo(contract);
|
|
// todo : check the type of contract & then further checks like fetching details of contractParticipant
|
|
let contractTransactions = await getContractTransactions(contract);
|
|
let contractParticipants = await getContractParticipants(contract);
|
|
let obj = {
|
|
status: "closed",
|
|
contract: "india-elections-2019",
|
|
contractType: "one-time-event",
|
|
incAddress: "F7osBpjDDV1mSSnMNrLudEQQ3cwDJ2dPR1",
|
|
expiration: "wed may 22 2019 21:00:00 gmt+0530",
|
|
token: "rmt",
|
|
participationFees: "0.001 RMT",
|
|
};
|
|
pageContainer.append(create.contractPage(obj));
|
|
pageTitle.textContent = "Contract";
|
|
loading()
|
|
}
|
|
|
|
if (pageId === "block_page") {
|
|
let blockInfo = await getBlockInfo(field);
|
|
pageContainer.append(create.blockPage(blockInfo));
|
|
pageTitle.textContent = "block";
|
|
loading()
|
|
}
|
|
|
|
if (pageId === "homepage") {
|
|
// banner
|
|
pageHeader.classList.add("hide-completely");
|
|
let data = await getBannerData();
|
|
pageContainer.append(create.homepage(data));
|
|
loading()
|
|
let themeToggler = document.getElementById("theme_toggle"),
|
|
body = document.querySelector("body");
|
|
if (localStorage.theme === "dark") {
|
|
nightlight();
|
|
themeToggler.checked = true;
|
|
} else {
|
|
daylight();
|
|
themeToggler.checked = false;
|
|
}
|
|
function daylight() {
|
|
body.setAttribute("data-theme", "light");
|
|
}
|
|
function nightlight() {
|
|
body.setAttribute("data-theme", "dark");
|
|
}
|
|
themeToggler.addEventListener("change", () => {
|
|
if (themeToggler.checked) {
|
|
nightlight();
|
|
localStorage.setItem("theme", "dark");
|
|
} else {
|
|
daylight();
|
|
localStorage.setItem("theme", "light");
|
|
}
|
|
});
|
|
// Latest transactions
|
|
let latestTxs = await getLatestTxs();
|
|
|
|
for (let i = 0; i < latestTxs.length; i++) {
|
|
if (latestTxs[i]["type"] == "tokentransfer") {
|
|
frag.append(create.tokenTransferCard(latestTxs[i]));
|
|
} else if (latestTxs[i]["type"] == "contracttransfer") {
|
|
frag.append(create.contractTransferCard(latestTxs[i]));
|
|
}
|
|
}
|
|
document.getElementById("top_transaction_container").append(frag);
|
|
|
|
// todo - add latest blocks
|
|
let latestBlocks = await getLatestBlocks();
|
|
} else pageHeader.classList.remove("hide-completely");
|
|
|
|
if (pageId === "viewallblocks") {
|
|
let latest100blocks = await getLatestBlocks();
|
|
loading()
|
|
}
|
|
|
|
if (pageId === "viewalltxs") {
|
|
let latest100txs = await getViewallTxs();
|
|
loading()
|
|
|
|
}
|
|
|
|
if (pageId === "transaction_page") {
|
|
let latest100txs = await getTxDetafils();
|
|
loading()
|
|
}
|
|
|
|
currentPage = pageId;
|
|
prevField = field;
|
|
if(pageContainer.querySelector('.tab.active'))
|
|
pageContainer.querySelector('.tab.active').click()
|
|
tabMounted = false;
|
|
}
|
|
|
|
function renderTransactions() {}
|
|
|
|
window.addEventListener("load", () => {
|
|
render("homepage");
|
|
history.pushState(appState, null, null);
|
|
|
|
document.querySelector("main").addEventListener("click", (e) => {
|
|
if (e.target.closest(".address") && prevField !== e.target.textContent){
|
|
render("address_page", e.target.textContent)
|
|
appState = {
|
|
page: "address_page",
|
|
thisField: e.target.textContent,
|
|
};
|
|
history.pushState(appState,null,null)
|
|
}
|
|
if (e.target.closest(".token") && prevField !== e.target.textContent) {
|
|
render("token_page", e.target.textContent);
|
|
appState = { page: "token_page", thisField: e.target.textContent };
|
|
history.pushState(appState, null, null)
|
|
}
|
|
if (e.target.closest(".hash") && prevField !== e.target.textContent) {
|
|
render("transaction_page", e.target.textContent);
|
|
appState = {
|
|
page: "transaction_page",
|
|
thisField: e.target.textContent,
|
|
};
|
|
history.pushState(appState, null, null)
|
|
}
|
|
if (e.target.closest(".block-height") && prevField !== e.target.textContent) {
|
|
render("block_page", e.target.textContent);
|
|
appState = { page: "block_page", thisField: e.target.textContent };
|
|
history.pushState(appState, null, null);
|
|
}
|
|
if (e.target.closest(".contract") && prevField !== e.target.textContent) {
|
|
render("contract_page", e.target.textContent)
|
|
appState = {
|
|
page: "contract_page",
|
|
thisField: e.target.textContent,
|
|
}
|
|
history.pushState(appState, null, null)
|
|
}
|
|
if (e.target.closest(".tab")) {
|
|
showTab(e.target.closest(".tab"));
|
|
}
|
|
if (e.target.closest("#secondary_search")) {
|
|
render("homepage");
|
|
document.getElementById("primary_search").click();
|
|
}
|
|
});
|
|
});
|
|
|
|
let tabMounted = false;
|
|
function showTab(tab){
|
|
let targetTab = tab.getAttribute('data-target'),
|
|
activeTabRank = parseInt(tab.parentNode.querySelector('.active').dataset.rank),
|
|
currentTabRank = parseInt(tab.dataset.rank),
|
|
currentBody = document.getElementById(tab.parentNode.querySelector('.active').dataset.target),
|
|
targetBody = document.getElementById(targetTab),
|
|
targetGroup = targetBody.dataset.tabGroup,
|
|
tabGroupMembers = document.querySelectorAll(`[data-tab-group = '${targetGroup}']`),
|
|
allTabs = tab.parentNode.querySelectorAll('.tab'),
|
|
line = tab.parentNode.querySelector('.line')
|
|
if(tabMounted && currentBody.isEqualNode(targetBody))
|
|
return
|
|
if(activeTabRank < currentTabRank){
|
|
targetBody.classList.add('fly-in-from-right')
|
|
currentBody.classList.add('fly-out-to-left')
|
|
}
|
|
else{
|
|
targetBody.classList.add('fly-in-from-left')
|
|
currentBody.classList.add('fly-out-to-right')
|
|
}
|
|
setTimeout(() => {
|
|
tabGroupMembers.forEach(member => {
|
|
member.classList.add('hide-completely')
|
|
})
|
|
targetBody.classList.remove('hide-completely')
|
|
currentBody.classList.remove('fly-out-to-right', 'fly-out-to-left')
|
|
},200)
|
|
setTimeout(() => {
|
|
targetBody.classList.remove('fly-in-from-right', 'fly-in-from-left')
|
|
},400)
|
|
allTabs.forEach(thisTab => {
|
|
thisTab.classList.remove('active')
|
|
})
|
|
tab.classList.add('active')
|
|
line.setAttribute('style', `transform: translateX(${tab.offsetLeft}px); width: ${tab.getBoundingClientRect().width}px`)
|
|
tabMounted = true;
|
|
}
|
|
|
|
let loader = document.getElementById("loader_page");
|
|
|
|
function loading(status) {
|
|
if (status) loader.classList.remove("hide-completely");
|
|
else loader.classList.add("hide-completely");
|
|
}
|
|
|
|
async function getBannerData() {
|
|
return fetch("https://ranchimallflo.duckdns.org/api/v1.0/getSystemData")
|
|
.then(function (response) {
|
|
return response.json();
|
|
})
|
|
.then(function (systemdata) {
|
|
let obj = {
|
|
topToken: "RMT",
|
|
totalTransactions: systemdata["systemTransactionCount"],
|
|
walletAddresses: systemdata["systemAddressCount"],
|
|
topContract: "India Election 2019",
|
|
};
|
|
return obj;
|
|
});
|
|
}
|
|
|
|
async function getLatestTxs() {
|
|
return fetch(
|
|
"https://ranchimallflo.duckdns.org/api/v1.0/getLatestTransactionDetails?numberOfLatestBlocks=4"
|
|
)
|
|
.then(function (response) {
|
|
return response.json();
|
|
})
|
|
.then(function (latestTxs) {
|
|
latestTxArray = [];
|
|
|
|
let txids = Object.keys(latestTxs["latestTransactions"]);
|
|
for (let i = 0; i < txids.length; i++) {
|
|
// determine txhash and blockHeight
|
|
let obj = {
|
|
hash:
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"transactionDetails"
|
|
]["txid"],
|
|
blockHeight:
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"transactionDetails"
|
|
]["blockheight"],
|
|
};
|
|
|
|
let txtype =
|
|
latestTxs["latestTransactions"][txids[i]]["parsedFloData"][
|
|
"type"
|
|
];
|
|
|
|
if (txtype != "smartContractPays") {
|
|
// determine token
|
|
obj["token"] =
|
|
latestTxs["latestTransactions"][txids[i]]["parsedFloData"][
|
|
"tokenIdentification"
|
|
];
|
|
|
|
if (txtype == "transfer") {
|
|
if (
|
|
latestTxs["latestTransactions"][txids[i]]["parsedFloData"][
|
|
"transferType"
|
|
] == "token"
|
|
) {
|
|
// token transfer
|
|
/* tokenTransferCard
|
|
hash, blockHeight, token, sender, receiver, amount */
|
|
|
|
let receiveraddress = "";
|
|
for (
|
|
let i = 0,
|
|
voutlist =
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"transactionDetails"
|
|
]["vout"];
|
|
i < voutlist.length;
|
|
i++
|
|
) {
|
|
if (
|
|
voutlist[i]["scriptPubKey"]["addresses"][0] !=
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"transactionDetails"
|
|
]["vin"][0]["addr"]
|
|
) {
|
|
receiveraddress =
|
|
voutlist[i]["scriptPubKey"]["addresses"][0];
|
|
}
|
|
}
|
|
|
|
obj = Object.assign({}, obj, {
|
|
sender:
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"transactionDetails"
|
|
]["vin"][0]["addr"],
|
|
receiver: receiveraddress,
|
|
amount: `${
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"parsedFloData"
|
|
]["tokenAmount"]
|
|
}`,
|
|
type: "tokentransfer",
|
|
});
|
|
latestTxArray.push(obj);
|
|
} else if (
|
|
latestTxs["latestTransactions"][txids[i]]["parsedFloData"][
|
|
"transferType"
|
|
] == "smartContract"
|
|
) {
|
|
// smart contract transfer
|
|
let receiveraddress = "";
|
|
for (
|
|
let i = 0,
|
|
voutlist =
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"transactionDetails"
|
|
]["vout"];
|
|
i < voutlist.length;
|
|
i++
|
|
) {
|
|
if (
|
|
voutlist[i]["scriptPubKey"]["addresses"][0] !=
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"transactionDetails"
|
|
]["vin"][0]["addr"]
|
|
) {
|
|
receiveraddress =
|
|
voutlist[i]["scriptPubKey"]["addresses"][0];
|
|
}
|
|
}
|
|
|
|
obj = Object.assign({}, obj, {
|
|
sender:
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"transactionDetails"
|
|
]["vin"][0]["addr"],
|
|
receiver: receiveraddress,
|
|
amount: `${
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"parsedFloData"
|
|
]["tokenAmount"]
|
|
}`,
|
|
contractName: `${
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"parsedFloData"
|
|
]["contractName"]
|
|
}`,
|
|
userChoice: `${
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"parsedFloData"
|
|
]["userChoice"]
|
|
}`,
|
|
type: "contracttransfer",
|
|
});
|
|
latestTxArray.push(obj);
|
|
}
|
|
} else if (
|
|
latestTxs["latestTransactions"][txids[i]]["parsedFloData"][
|
|
"type"
|
|
] == "smartContractIncorporation"
|
|
) {
|
|
// smart contract incorporation
|
|
// todo : add checks to determine obj for different types of smart contract incorporation
|
|
obj = Object.assign({}, obj, {
|
|
contractName:
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"parsedFloData"
|
|
]["contractName"],
|
|
incAddress:
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"parsedFloData"
|
|
]["contractAddress"],
|
|
contractType:
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"parsedFloData"
|
|
]["contractType"],
|
|
expiration:
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"parsedFloData"
|
|
]["contractConditions"]["expiryTime"],
|
|
participationFees:
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"parsedFloData"
|
|
]["contractConditions"]["contractAmount"],
|
|
availableChoices: "",
|
|
type: "contractincorp",
|
|
});
|
|
latestTxArray.push(obj);
|
|
} else if (
|
|
latestTxs["latestTransactions"][txids[i]]["parsedFloData"][
|
|
"type"
|
|
] == "tokenIncorporation"
|
|
) {
|
|
// token incorporation
|
|
// smart contract incorporation
|
|
obj = Object.assign({}, obj, {
|
|
incAddress:
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"transactionDetails"
|
|
]["vin"][0]["addr"],
|
|
supply:
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"parsedFloData"
|
|
]["tokenAmount"],
|
|
type: "tokenincorp",
|
|
});
|
|
latestTxArray.push(obj);
|
|
}
|
|
} else {
|
|
// smart contract committee trigger
|
|
// smart contract incorporation
|
|
let receiveraddress = "";
|
|
for (
|
|
let i = 0,
|
|
voutlist =
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"transactionDetails"
|
|
]["vout"];
|
|
i < voutlist.length;
|
|
i++
|
|
) {
|
|
if (
|
|
voutlist[i]["scriptPubKey"]["addresses"][0] !=
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"transactionDetails"
|
|
]["vin"][0]["addr"]
|
|
) {
|
|
receiveraddress =
|
|
voutlist[i]["scriptPubKey"]["addresses"][0];
|
|
}
|
|
}
|
|
obj = Object.assign({}, obj, {
|
|
contractName:
|
|
latestTxs["latestTransactions"][txids[i]]["parsedFloData"][
|
|
"contractName"
|
|
],
|
|
contractAddress: receiveraddress,
|
|
winningChoice:
|
|
latestTxs["latestTransactions"][txids[i]]["parsedFloData"][
|
|
"triggerCondition"
|
|
],
|
|
committeeAddress:
|
|
latestTxs["latestTransactions"][txids[i]][
|
|
"transactionDetails"
|
|
]["vin"][0]["addr"],
|
|
type: "contracttrigger",
|
|
});
|
|
latestTxArray.push(obj);
|
|
}
|
|
}
|
|
|
|
return latestTxArray;
|
|
});
|
|
}
|
|
|
|
async function getLatestBlocks() {
|
|
return fetch(
|
|
`https://ranchimallflo.duckdns.org/api/v1.0/getLatestBlockDetails?numberOfLatestBlocks=4`
|
|
)
|
|
.then(function (response) {
|
|
return response.json();
|
|
})
|
|
.then(function (latestBlocks) {
|
|
let obj = {};
|
|
return obj;
|
|
});
|
|
}
|
|
|
|
async function getAddressBalanceInfo(thisAddress) {
|
|
return fetch(
|
|
`https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressInfo?floAddress=${thisAddress}`
|
|
)
|
|
.then(function (response) {
|
|
return response.json();
|
|
})
|
|
.then(function (tokenInfo) {
|
|
let obj = { balance: "0.0001", address: thisAddress };
|
|
return obj;
|
|
});
|
|
}
|
|
|
|
async function getTokenInfo(thisToken) {
|
|
return fetch(
|
|
`https://ranchimallflo.duckdns.org/api/v1.0/getTokenInfo?token=${thisToken.toLowerCase()}`
|
|
)
|
|
.then(function (response) {
|
|
return response.json();
|
|
})
|
|
.then(function (tokenInfo) {
|
|
let obj = {
|
|
token: tokenInfo["token"],
|
|
supply: tokenInfo["tokenSupply"],
|
|
incAddress: tokenInfo["incorporationAddress"],
|
|
};
|
|
return obj;
|
|
});
|
|
}
|
|
|
|
function getBlockInfo(thisBlock) {
|
|
return fetch(
|
|
`https://ranchimallflo.duckdns.org/api/v1.0/getBlockDetails/${thisBlock}`
|
|
)
|
|
.then(function (response) {
|
|
return response.json();
|
|
})
|
|
.then(function (blockInfo) {
|
|
let obj = {
|
|
blockHeight: blockInfo["height"],
|
|
size: blockInfo["size"],
|
|
transactions: "",
|
|
reward: blockInfo["reward"],
|
|
hash: blockInfo["hash"],
|
|
difficulty: blockInfo["difficulty"],
|
|
nonce: blockInfo["nonce"],
|
|
};
|
|
return obj;
|
|
});
|
|
}
|
|
|
|
async function getContractInfo(contract) {
|
|
return fetch(
|
|
`https://ranchimallflo.duckdns.org/api/v1.0/getSmartContractInfo?contractName=${contract.name}&contractAddress=${contract.address}`
|
|
)
|
|
.then(function (response) {
|
|
return response.json();
|
|
})
|
|
.then(function (contractInfo) {
|
|
let obj = {
|
|
blockHeight: blockInfo["height"],
|
|
size: blockInfo["size"],
|
|
transactions: "",
|
|
reward: blockInfo["reward"],
|
|
hash: blockInfo["hash"],
|
|
difficulty: blockInfo["difficulty"],
|
|
nonce: blockInfo["nonce"],
|
|
};
|
|
return obj;
|
|
});
|
|
}
|
|
|
|
async function getContractParticipants(contract) {
|
|
return fetch(
|
|
`https://ranchimallflo.duckdns.org/api/v1.0/getSmartContractParticipants?contractName=${contract.name}&contractAddress=${contract.address}`
|
|
)
|
|
.then(function (response) {
|
|
return response.json();
|
|
})
|
|
.then(function (contractParticipants) {
|
|
let obj = {
|
|
blockHeight: blockInfo["height"],
|
|
size: blockInfo["size"],
|
|
transactions: "",
|
|
reward: blockInfo["reward"],
|
|
hash: blockInfo["hash"],
|
|
difficulty: blockInfo["difficulty"],
|
|
nonce: blockInfo["nonce"],
|
|
};
|
|
return obj;
|
|
});
|
|
}
|
|
|
|
async function getContractTransactions(contract) {
|
|
return fetch(
|
|
`https://ranchimallflo.duckdns.org/api/v1.0/getBlockDetails/${thisBlock}`
|
|
)
|
|
.then(function (response) {
|
|
return response.json();
|
|
})
|
|
.then(function (contractTxs) {
|
|
let obj = {
|
|
blockHeight: blockInfo["height"],
|
|
size: blockInfo["size"],
|
|
transactions: "",
|
|
reward: blockInfo["reward"],
|
|
hash: blockInfo["hash"],
|
|
difficulty: blockInfo["difficulty"],
|
|
nonce: blockInfo["nonce"],
|
|
};
|
|
return obj;
|
|
});
|
|
}
|
|
|
|
async function getViewallBlocks() {
|
|
return fetch(
|
|
`https://ranchimallflo.duckdns.org/api/v1.0/getLatestBlockDetails?limit=100`
|
|
)
|
|
.then(function (response) {
|
|
return response.json();
|
|
})
|
|
.then(function (contractTxs) {
|
|
let obj = {
|
|
blockHeight: blockInfo["height"],
|
|
size: blockInfo["size"],
|
|
transactions: "",
|
|
reward: blockInfo["reward"],
|
|
hash: blockInfo["hash"],
|
|
difficulty: blockInfo["difficulty"],
|
|
nonce: blockInfo["nonce"],
|
|
};
|
|
return obj;
|
|
});
|
|
}
|
|
|
|
async function getViewallTxs() {
|
|
return fetch(
|
|
`https://ranchimallflo.duckdns.org/api/v1.0/getLatestTransactionDetails?limit=200`
|
|
)
|
|
.then(function (response) {
|
|
return response.json();
|
|
})
|
|
.then(function (contractTxs) {
|
|
let obj = {
|
|
blockHeight: blockInfo["height"],
|
|
size: blockInfo["size"],
|
|
transactions: "",
|
|
reward: blockInfo["reward"],
|
|
hash: blockInfo["hash"],
|
|
difficulty: blockInfo["difficulty"],
|
|
nonce: blockInfo["nonce"],
|
|
};
|
|
return obj;
|
|
});
|
|
|
|
}
|
|
|
|
async function getAddressInfo(address){
|
|
return fetch(
|
|
`https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressInfo?floAddress=${address}`
|
|
)
|
|
.then(function (response) {
|
|
return response.json();
|
|
}).then(console.log)
|
|
/*.then(function (addressInfo) {
|
|
let obj = {
|
|
blockHeight: blockInfo["height"],
|
|
size: blockInfo["size"],
|
|
transactions: "",
|
|
reward: blockInfo["reward"],
|
|
hash: blockInfo["hash"],
|
|
difficulty: blockInfo["difficulty"],
|
|
nonce: blockInfo["nonce"],
|
|
};
|
|
return obj;
|
|
});*/
|
|
}
|
|
|
|
async function getAddressBalance(address){
|
|
return fetch(
|
|
`https://flosight.duckdns.org/api/addr/${address}/balance`
|
|
)
|
|
.then(function (response) {
|
|
return response.json();
|
|
})
|
|
.then(function (addressBalance) {
|
|
let obj = {
|
|
balance: addressBalance,
|
|
address: address,
|
|
};
|
|
return obj;
|
|
});
|
|
}
|
|
|
|
async function getAddressTxs(address){
|
|
return fetch(
|
|
`https://ranchimallflo.duckdns.org/api/v1.0/getFloAddressTransactions?floAddress=${address}`
|
|
)
|
|
.then(function (response) {
|
|
return response.json();
|
|
}).then(console.log)
|
|
/*.then(function (addressBalance) {
|
|
let obj = {
|
|
blockHeight: blockInfo["height"],
|
|
size: blockInfo["size"],
|
|
transactions: "",
|
|
reward: blockInfo["reward"],
|
|
hash: blockInfo["hash"],
|
|
difficulty: blockInfo["difficulty"],
|
|
nonce: blockInfo["nonce"],
|
|
};
|
|
return obj;
|
|
});*/
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|