+ tooltips
+ sort transactions by date correctly + confirmed transactions indicator
This commit is contained in:
@@ -28,6 +28,16 @@ class Blockchain {
|
||||
return web3Local.utils.isAddress(address);
|
||||
}
|
||||
|
||||
getTransaction(thxid, clbError, clbSuccess) {
|
||||
web3Local.eth.getTransaction(thxid, function( error, result ) {
|
||||
if (error) {
|
||||
clbError(error);
|
||||
} else {
|
||||
clbSuccess(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getTranasctionFee(fromAddress, toAddress, value, clbError, clbSuccess) {
|
||||
web3Local.eth.getTransactionCount(fromAddress, function( error, result ) {
|
||||
if (error) {
|
||||
@@ -65,7 +75,7 @@ class Blockchain {
|
||||
clbError("Wrong password for the selected address!");
|
||||
} else
|
||||
{
|
||||
web3Local.eth.getTransactionCount(fromAddress, function( error, result ) {
|
||||
web3Local.eth.getTransactionCount(fromAddress, 'pending', function( error, result ) {
|
||||
if (error) {
|
||||
clbError(error);
|
||||
} else {
|
||||
|
||||
@@ -139,6 +139,24 @@ $(document).on("render_send", function() {
|
||||
position: 'topRight',
|
||||
timeout: 5000
|
||||
});
|
||||
|
||||
EthoBlockchain.getTransaction(data,
|
||||
function(error) {
|
||||
EthoMainGUI.showGeneralError(error);
|
||||
},
|
||||
function(transaction) {
|
||||
/*
|
||||
ipcRenderer.send('storeTransaction', {
|
||||
block: element.block,
|
||||
fromaddr: element.fromaddr,
|
||||
timestamp: element.timestamp,
|
||||
toaddr: element.toaddr,
|
||||
value: element.value,
|
||||
confirmed: "1",
|
||||
});
|
||||
*/
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// In renderer process (web page).
|
||||
const {ipcRenderer} = require('electron');
|
||||
|
||||
class Transactions {
|
||||
@@ -23,14 +22,15 @@ class Transactions {
|
||||
|
||||
$.getJSON("https://richlist.ether1.org/transactions_list.php" + params, function( result ) {
|
||||
result.data.forEach(element => {
|
||||
var Transaction = {
|
||||
ipcRenderer.send('storeTransaction', {
|
||||
block: element.block,
|
||||
txhash: element.hash,
|
||||
fromaddr: element.fromaddr,
|
||||
timestamp: element.timestamp,
|
||||
toaddr: element.toaddr,
|
||||
value: element.value
|
||||
}
|
||||
ipcRenderer.send('storeTransaction', Transaction);
|
||||
value: element.value,
|
||||
confirmed: "1"
|
||||
});
|
||||
});
|
||||
|
||||
// call the transaction sync for the next address
|
||||
@@ -93,6 +93,9 @@ class Transactions {
|
||||
}
|
||||
});
|
||||
|
||||
// register the sort datetime format
|
||||
$.fn.dataTable.moment('MMM Do YYYY');
|
||||
|
||||
// render the transactions
|
||||
$('#tableTransactionsForAll').DataTable({
|
||||
"paging": false,
|
||||
@@ -129,6 +132,16 @@ class Transactions {
|
||||
"render": function ( data, type, row ) {
|
||||
return parseFloat(web3Local.utils.fromWei(EthoUtils.toFixed(parseFloat(data)).toString(), 'ether')).toFixed(2);
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": 6,
|
||||
"render": function ( data, type, row ) {
|
||||
if (data == 0) {
|
||||
return '<i class="fas fa-question"></i>';
|
||||
} else if (data == 1) {
|
||||
return '<i class="fas fa-check"></i>';
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"drawCallback": function( settings ) {
|
||||
@@ -172,7 +185,8 @@ $(document).on("onSyncInterval", function() {
|
||||
fromaddr: element.from.toLowerCase(),
|
||||
timestamp: moment().format('YYYY-MM-DD HH:mm:ss'),
|
||||
toaddr: element.to.toLowerCase(),
|
||||
value: Number(element.value).toExponential(5).toString().replace('+','')
|
||||
value: Number(element.value).toExponential(5).toString().replace('+',''),
|
||||
confirmed: "0",
|
||||
}
|
||||
|
||||
// store transaction and notify about new transactions
|
||||
|
||||
@@ -39,6 +39,19 @@ class Utils {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
createToolTip(element, text) {
|
||||
tippy(element, {
|
||||
content: text,
|
||||
delay: 500,
|
||||
arrow: true,
|
||||
arrowType: 'round',
|
||||
size: 'large',
|
||||
duration: 500,
|
||||
animation: 'scale'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
EthoUtils = new Utils();
|
||||
@@ -1,4 +1,3 @@
|
||||
// In renderer process (web page).
|
||||
const {ipcRenderer} = require('electron');
|
||||
|
||||
class Wallets {
|
||||
@@ -22,6 +21,12 @@ class Wallets {
|
||||
this.addressList.push(address.toLowerCase());
|
||||
}
|
||||
|
||||
enableButtonTooltips() {
|
||||
EthoUtils.createToolTip("#btnNewAddress", "Create New Address");
|
||||
EthoUtils.createToolTip("#btnExportAccounts", "Export Accounts");
|
||||
EthoUtils.createToolTip("#btnImportAccounts", "Import Accounts");
|
||||
}
|
||||
|
||||
validateNewAccountForm() {
|
||||
if (EthoMainGUI.getAppState() == "account") {
|
||||
if (!$("#walletPasswordFirst").val()) {
|
||||
@@ -61,6 +66,7 @@ renderWalletsState() {
|
||||
// render the wallets current state
|
||||
EthoMainGUI.renderTemplate("wallets.html", data);
|
||||
$(document).trigger("render_wallets");
|
||||
EthoWallets.enableButtonTooltips();
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -148,6 +154,14 @@ $(document).on("render_wallets", function() {
|
||||
});
|
||||
});
|
||||
|
||||
$("#btnExportAccounts").off('click').on('click', function() {
|
||||
ipcRenderer.send('exportAccounts', {});
|
||||
});
|
||||
|
||||
$("#btnImportAccounts").off('click').on('click', function() {
|
||||
ipcRenderer.sendSync('importAccounts', {});
|
||||
});
|
||||
|
||||
$(".textAddress").off('click').on('click', function() {
|
||||
EthoMainGUI.copyToClipboard($(this).html());
|
||||
|
||||
@@ -168,7 +182,7 @@ $(document).on("onGethReady", function() {
|
||||
|
||||
$(document).on("onNewAccountTransaction", function() {
|
||||
if (EthoMainGUI.getAppState() == "account") {
|
||||
EthoWallets.renderWalletsState();
|
||||
EthoWallets.renderWalletsState();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user