Update FLO_webWallet_mainnet.html
This commit is contained in:
parent
cea5861e63
commit
d5544cb0f8
@ -1,11 +1,74 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>FLO walletless</title>
|
<title>FLO webWallet</title>
|
||||||
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
table, th, td {
|
|
||||||
border: 1px solid black;
|
|
||||||
|
@import url('https://fonts.googleapis.com/css?family=Titillium+Web');
|
||||||
|
|
||||||
|
body {
|
||||||
|
position:relative;
|
||||||
|
font-family: 'Titillium Web', sans-serif;
|
||||||
|
font-weight: 300;
|
||||||
|
font-size: 1.05em;
|
||||||
|
margin: 40px;
|
||||||
|
text-align:justify;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
table, tr, th, td {
|
||||||
|
border: 1px solid #e3e3e3;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
background-color: #4CAF50; /* Green */
|
||||||
|
border: none;
|
||||||
|
color: white;
|
||||||
|
padding: 15px 32px;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 16px;
|
||||||
|
margin: 4px 2px;
|
||||||
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-transition-duration: 0.4s; /* Safari */
|
||||||
|
transition-duration: 0.4s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activeButton {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:hover {
|
||||||
|
box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24),0 17px 50px 0 rgba(0,0,0,0.19);
|
||||||
|
}
|
||||||
|
|
||||||
|
.firstColumn {
|
||||||
|
position: absolute;;
|
||||||
|
left:200px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.secondColumn {
|
||||||
|
position: absolute;
|
||||||
|
left:450px;
|
||||||
|
top:194px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dispBalTable {
|
||||||
|
border: 1px solid #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -20,9 +83,28 @@ table, th, td {
|
|||||||
const fee = 0.0005;
|
const fee = 0.0005;
|
||||||
</script>
|
</script>
|
||||||
<h1>FLO</h1>
|
<h1>FLO</h1>
|
||||||
<button id="addrGenBtn" onclick="addrGenMode();">Address Generator</button>
|
<button id="getDataBtn" onclick="showSection(this,getDataMode);">Monitor FLO Data</button>
|
||||||
<button id="sendDataBtn" onclick="sendDataMode();">Send FLO Data</button>
|
<button id="sendDataBtn" onclick="showSection(this,sendDataMode);">Send FLO Data</button>
|
||||||
<button id="getDataBtn" onclick="getDataMode();">Monitor FLO Data</button>
|
<button id="addrGenBtn" onclick="showSection(this,addrGenMode);">Address Generator</button>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var mainButtonList = [];mainButtonList.push(document.getElementById("getDataBtn"));
|
||||||
|
document.getElementById("getDataBtn").classList.add('activeButton');
|
||||||
|
|
||||||
|
function showSection(that,callback) {
|
||||||
|
|
||||||
|
if (!(mainButtonList.length == 0 )) {
|
||||||
|
var x = mainButtonList.pop();
|
||||||
|
x.classList.remove('activeButton');
|
||||||
|
}
|
||||||
|
that.classList.add('activeButton');
|
||||||
|
mainButtonList.push(that)
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<div id="addrGen">
|
<div id="addrGen">
|
||||||
|
|
||||||
@ -37,11 +119,11 @@ table, th, td {
|
|||||||
<div id="sendData">
|
<div id="sendData">
|
||||||
<h2>Send FLO Data</h2>
|
<h2>Send FLO Data</h2>
|
||||||
<label for="getBal_addr">Enter sender address : </label>
|
<label for="getBal_addr">Enter sender address : </label>
|
||||||
<input type="text" id="getBal_addr">
|
<input type="text" id="getBal_addr" class="firstColumn">
|
||||||
<button id="getBal_btn">Get Balance</button>
|
<button class="secondColumn" id="getBal_btn">Get Sender Balance</button>
|
||||||
<div id="dispBal"></div>
|
<div id="dispBal"></div>
|
||||||
Enter receiver Address : <input type="text" id="sendReceiver">
|
Enter receiver Address : <input type="text" id="sendReceiver" class="firstColumn">
|
||||||
<br/>Enter amount : <input type="number" id="sendAmt">
|
<br/>Enter amount : <input type="number" id="sendAmt" class="firstColumn">
|
||||||
<h3>Enter the FLO Data</h3>
|
<h3>Enter the FLO Data</h3>
|
||||||
<textarea rows="15" cols="70" id="flotextdata"></textarea><br/>
|
<textarea rows="15" cols="70" id="flotextdata"></textarea><br/>
|
||||||
<button id="sendBtn" onclick="sendTransaction()" disabled>Send</button>
|
<button id="sendBtn" onclick="sendTransaction()" disabled>Send</button>
|
||||||
@ -61,12 +143,41 @@ table, th, td {
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
addrGenMode(); //default start
|
getDataMode(); //default start
|
||||||
|
startup();
|
||||||
|
function startup(){
|
||||||
|
var idb = indexedDB.open("FLO_webWallet");
|
||||||
|
new Promise(function(resolve,reject){
|
||||||
|
idb.onerror = function(event) {
|
||||||
|
//console.log("Error in opening IndexedDB!");
|
||||||
|
reject(Error("Error in opening IndexedDB!"));
|
||||||
|
};
|
||||||
|
idb.onupgradeneeded = function(event) {
|
||||||
|
var objectStore = event.target.result.createObjectStore('Label');
|
||||||
|
};
|
||||||
|
idb.onsuccess = function(event) {
|
||||||
|
var db = event.target.result;
|
||||||
|
var obslabel = db.transaction('Label', "readwrite").objectStore('Label');
|
||||||
|
var val = obslabel.getAllKeys();
|
||||||
|
// console.log(val.result);
|
||||||
|
val.onsuccess = function(event){
|
||||||
|
resolve(event.target.result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
var input = document.getElementById("getAddr");
|
||||||
|
input.value = res.join(',');
|
||||||
|
monitorData();
|
||||||
|
input.value = "";
|
||||||
|
}).catch(error => {
|
||||||
|
console.log(error.message);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
function clearLocalData()
|
function clearLocalData()
|
||||||
{
|
{
|
||||||
document.getElementById("dispMsg").innerHTML = '<h3>Received FLO Data : </h3><br/>';
|
document.getElementById("dispMsg").innerHTML = '<h3>Received FLO Data : </h3><br/>';
|
||||||
var DBDeleteRequest = window.indexedDB.deleteDatabase("FLO_Walletless");
|
var DBDeleteRequest = window.indexedDB.deleteDatabase("FLO_webWallet");
|
||||||
DBDeleteRequest.onsuccess = function(event) {
|
DBDeleteRequest.onsuccess = function(event) {
|
||||||
console.log("Database deleted successfully");
|
console.log("Database deleted successfully");
|
||||||
alert("Successfully Cleared Local Data!");
|
alert("Successfully Cleared Local Data!");
|
||||||
@ -4934,7 +5045,7 @@ Bitcoin.Util = {
|
|||||||
document.getElementById("sendBtn").disabled = true;
|
document.getElementById("sendBtn").disabled = true;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
dispBal.innerHTML = `<table>${result}<tr><td colspan="2">Total Balance :</td><td>${totBal}</tr></table>`;
|
dispBal.innerHTML = `<table class="dispBalTable">${result}<tr><td colspan="2">Total Balance :</td><td>${totBal}</tr></table>`;
|
||||||
document.getElementById("sendBtn").disabled = false;
|
document.getElementById("sendBtn").disabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5033,8 +5144,13 @@ Bitcoin.Util = {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
//Converting old blocking waitForGlobal into non-blocking code
|
||||||
var waitForGlobal = function(param, callback) {
|
var waitForGlobal = function(param, callback) {
|
||||||
|
new Promise(callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* var waitForGlobal = function(param, callback) {
|
||||||
if (!window[param]) {
|
if (!window[param]) {
|
||||||
callback();
|
callback();
|
||||||
} else {
|
} else {
|
||||||
@ -5042,7 +5158,8 @@ Bitcoin.Util = {
|
|||||||
waitForGlobal(param, callback);
|
waitForGlobal(param, callback);
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
};
|
};*/
|
||||||
|
|
||||||
|
|
||||||
function monitorData(){
|
function monitorData(){
|
||||||
|
|
||||||
@ -5068,7 +5185,7 @@ Bitcoin.Util = {
|
|||||||
|
|
||||||
waitForGlobal("loadwait", function() {
|
waitForGlobal("loadwait", function() {
|
||||||
window["loadwait"] = true;
|
window["loadwait"] = true;
|
||||||
var idbtmp = indexedDB.open("FLO_Walletless");
|
var idbtmp = indexedDB.open("FLO_webWallet");
|
||||||
idbtmp.onerror = function(event) {
|
idbtmp.onerror = function(event) {
|
||||||
console.log("Error in opening IndexedDB!");
|
console.log("Error in opening IndexedDB!");
|
||||||
window["loadwait"] = false;
|
window["loadwait"] = false;
|
||||||
@ -5090,7 +5207,7 @@ Bitcoin.Util = {
|
|||||||
var version = db.version;
|
var version = db.version;
|
||||||
}
|
}
|
||||||
db.close();
|
db.close();
|
||||||
var idb = indexedDB.open("FLO_Walletless",version);
|
var idb = indexedDB.open("FLO_webWallet",version);
|
||||||
idb.onerror = function(event) {
|
idb.onerror = function(event) {
|
||||||
console.log("Error in opening IndexedDB!");
|
console.log("Error in opening IndexedDB!");
|
||||||
};
|
};
|
||||||
@ -5135,26 +5252,21 @@ Bitcoin.Util = {
|
|||||||
row.insertCell(3).innerHTML = 'floData';
|
row.insertCell(3).innerHTML = 'floData';
|
||||||
|
|
||||||
var obs = db.transaction(addr, "readwrite").objectStore(addr);
|
var obs = db.transaction(addr, "readwrite").objectStore(addr);
|
||||||
|
var objreq = obs.getAll();
|
||||||
var cursorRequest = obs.openCursor();
|
objreq.onsuccess = function(event){
|
||||||
cursorRequest.onsuccess = function(event) {
|
data = event.target.result;
|
||||||
var cursor = event.target.result;
|
// console.log(data);
|
||||||
if(cursor) {
|
data.forEach(tx => {
|
||||||
// cursor.value contains the current record being iterated through
|
var time = new Date(tx.time*1000);
|
||||||
// this is where you'd do something with the result
|
|
||||||
//console.log(cursor.value.sender+":"+cursor.value.receiver+":"+cursor.value.time+":"+cursor.value.txid+":"+cursor.value.floData);
|
|
||||||
var time = new Date(cursor.value.time*1000);
|
|
||||||
var row = table.insertRow(1) ;
|
var row = table.insertRow(1) ;
|
||||||
row.insertCell(0).innerHTML = cursor.value.sender;
|
row.insertCell(0).innerHTML = tx.sender;
|
||||||
row.insertCell(1).innerHTML = cursor.value.receiver;
|
row.insertCell(1).innerHTML = tx.receiver;
|
||||||
row.insertCell(2).innerHTML = time;
|
row.insertCell(2).innerHTML = time;
|
||||||
row.insertCell(3).innerHTML = cursor.value.floData;
|
row.insertCell(3).innerHTML = tx.floData;
|
||||||
//tmpResult = '<tr><td>'++'</td><td>'++'</td><td>'++'</td><td>'++'</td></tr>' + tmpResult;
|
})
|
||||||
cursor.continue();
|
|
||||||
} else {
|
|
||||||
refreshdata(dispMsgAddr);
|
refreshdata(dispMsgAddr);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
db.close();
|
db.close();
|
||||||
window["refreshwait"] -= 1;
|
window["refreshwait"] -= 1;
|
||||||
};
|
};
|
||||||
@ -5168,14 +5280,16 @@ Bitcoin.Util = {
|
|||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
function refreshdata(param){
|
function refreshdata(param){
|
||||||
|
|
||||||
var addr = param.id;
|
var addr = param.id;
|
||||||
var table = param.getElementsByTagName('table')[0];
|
var table = param.getElementsByTagName('table')[0];
|
||||||
var row = table.insertRow(1) ;
|
var row = table.insertRow(1) ;
|
||||||
var cell = row.insertCell(0);
|
var cell = row.insertCell(0);
|
||||||
cell.innerHTML = "<center>Refreshing...</center>";
|
cell.innerHTML = "<center>Refreshing...</center>";
|
||||||
cell.colSpan = 4;
|
cell.colSpan = 4;
|
||||||
|
|
||||||
waitForGlobal("refreshwait", function() {
|
waitForGlobal("refreshwait", function() {
|
||||||
var idb = indexedDB.open("FLO_Walletless");
|
var idb = indexedDB.open("FLO_webWallet");
|
||||||
idb.onerror = function(event) {
|
idb.onerror = function(event) {
|
||||||
console.log("Error in opening IndexedDB!");
|
console.log("Error in opening IndexedDB!");
|
||||||
};
|
};
|
||||||
@ -5240,7 +5354,7 @@ Bitcoin.Util = {
|
|||||||
label = label.value;
|
label = label.value;
|
||||||
param.getElementsByTagName('button')[0].style.display = "block";
|
param.getElementsByTagName('button')[0].style.display = "block";
|
||||||
param.getElementsByTagName('button')[1].style.display = "none";
|
param.getElementsByTagName('button')[1].style.display = "none";
|
||||||
var idb = indexedDB.open("FLO_Walletless");
|
var idb = indexedDB.open("FLO_webWallet");
|
||||||
idb.onerror = function(event) {
|
idb.onerror = function(event) {
|
||||||
console.log("Error in opening IndexedDB!");
|
console.log("Error in opening IndexedDB!");
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user