+ transaction details with explorer redirection

+ sorting and floating header for wallets and address book
+ detect geth crash and notify the user
This commit is contained in:
Taegus
2019-03-05 18:54:29 +01:00
parent 0552dcdcba
commit 35c1eb5472
10 changed files with 366 additions and 251 deletions

View File

@@ -134,6 +134,15 @@ body.pg-loaded > .inner {
height: 300px; height: 300px;
} }
#dlgTransactionInfo {
width: 700px;
max-width: 700px !important;
}
#dlgTransactionInfo .modalBody {
height: 300px;
}
#dlgAddAddressToBook .modalBody, #dlgAddAddressToBook .modalBody,
#dlgChangeWalletName .modalBody, #dlgChangeWalletName .modalBody,
#dlgChangeAddressName .modalBody, #dlgChangeAddressName .modalBody,
@@ -231,6 +240,7 @@ div.sidebar svg {
.dataTables_scrollBody .transactionsBlockNum { .dataTables_scrollBody .transactionsBlockNum {
color: #f92472; color: #f92472;
cursor: pointer;
} }
.sendWrapper, .sendWrapper,
@@ -268,7 +278,18 @@ div.sidebar svg {
.sendTXInfo label { .sendTXInfo label {
line-height: 30px; line-height: 30px;
font-size: 1.2em; font-size: 1.1em;
}
.txInfo label {
line-height: 30px;
margin-left: 5px;
font-size: 1em;
}
.txInfo label + label {
color: #7A1336;
margin-left: 0px;
} }
.sendTXdivider { .sendTXdivider {

View File

@@ -8,7 +8,7 @@ th[role=columnheader]:not(.no-sort):after {
margin-top: 7px; margin-top: 7px;
border-width: 0 8px 8px; border-width: 0 8px 8px;
border-style: solid; border-style: solid;
border-color: #7A1336 transparent; border-color: #ccc transparent;
visibility: hidden; visibility: hidden;
opacity: 0; opacity: 0;
-ms-user-select: none; -ms-user-select: none;

View File

@@ -1,67 +1,74 @@
<div id="walletsToolbar"> <div id="walletsToolbar">
<button type="button" class="btn btn-etho" id="btnNewAddress"><i class="fas fa-plus"></i></button> <button type="button" class="btn btn-etho" id="btnNewAddress">
<i class="fas fa-plus"></i>
</button>
</div> </div>
<div id="addressList" class="{{#if addressData.length}}addressWrapper{{else}}noAddressWrapper{{/if}}"> <div id="addressList" class="{{#if addressData.length}}addressWrapper{{else}}noAddressWrapper{{/if}}">
{{#if addressData.length}} {{#if addressData.length}}
<table class="bordered" id="addressTable"> <table class="bordered" id="addressTable">
<thead> <thead>
<tr> <tr>
<th scope="col"></th> <th scope="col" data-sort-method='none'></th>
<th scope="col">Name</th> <th scope="col">Name</th>
<th scope="col">Address</th> <th scope="col">Address</th>
<th scope="col">Actions</th> <th scope="col" data-sort-method='none'>Actions</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{#addressData}} {{#addressData}}
<tr> <tr>
<th scope="row" class="colEdit"><button type="button" class="btn btn-etho btnChangAddressName" data-address="{{address}}" data-name="{{name}}">Edit</button></th> <th scope="row" class="colEdit">
<td>{{name}}</td> <button type="button" class="btn btn-etho btnChangAddressName" data-address="{{address}}" data-name="{{name}}">Edit</button>
<td><span class="textAddress">{{address}}</span></td> </th>
<td><button type="button" class="btn btn-etho btnDeleteAddress" data-address="{{address}}"><i class="far fa-trash-alt"></i></button></td> <td>{{name}}</td>
</tr> <td>
{{/addressData}} <span class="textAddress">{{address}}</span></td>
</tbody> <td>
</table> <button type="button" class="btn btn-etho btnDeleteAddress" data-address="{{address}}">
{{else}} <i class="far fa-trash-alt"></i>
<div id="noAddressPresent">You don't have any addresses, create a new one</div> </button>
{{/if}} </td>
</tr>
{{/addressData}}
</tbody>
</table>
{{else}}
<div id="noAddressPresent">You don't have any addresses, create a new one</div>
{{/if}}
</div> </div>
<div id="dlgCreateAddressAndName" class="modalDialog" data-iziModal-title="Create new address" data-iziModal-subtitle="Enter the name and the address" data-iziModal-icon="icon-home"> <div id="dlgCreateAddressAndName" class="modalDialog" data-izimodal-title="Create new address" data-izimodal-subtitle="Enter the name and the address" data-izimodal-icon="icon-home">
<div class="modalBody"> <div class="modalBody">
<div class="form-group"> <div class="form-group">
<label for="addressName">Address Name:</label> <label for="addressName">Address Name:</label>
<input type="text" class="form-control" id="addressName"> <input type="text" class="form-control" id="addressName">
</div>
<div class="form-group">
<label for="addressHash">Address Hash:</label>
<input type="text" class="form-control" id="addressHash">
</div>
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnCreateAddressConfirm">Confirm</button>
</div> </div>
<div class="form-group">
<label for="addressHash">Address Hash:</label>
<input type="text" class="form-control" id="addressHash">
</div>
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnCreateAddressConfirm">Confirm</button>
</div>
</div> </div>
<!-- The modal to change address name --> <!-- The modal to change address name -->
<div id="dlgChangeAddressName" class="modalDialog" data-iziModal-title="Address Name" data-iziModal-subtitle="Enter the name for this address" data-iziModal-icon="icon-home"> <div id="dlgChangeAddressName" class="modalDialog" data-izimodal-title="Address Name" data-izimodal-subtitle="Enter the name for this address" data-izimodal-icon="icon-home">
<div class="modalBody"> <div class="modalBody">
<div class="form-group"> <div class="form-group">
<label for="usr">Type Name:</label> <label for="usr">Type Name:</label>
<input type="text" class="form-control" id="inputAddressName"> <input type="text" class="form-control" id="inputAddressName">
</div>
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnChangeAddressNameConfirm">Confirm</button>
</div> </div>
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnChangeAddressNameConfirm">Confirm</button>
</div>
</div> </div>
<!-- The modal for delete confirmation --> <!-- The modal for delete confirmation -->
<div id="dlgDeleteAddressConfirm" class="modalDialog" data-iziModal-title="Application Error" data-iziModal-subtitle="Something went wrong, don't kill the fish..." data-iziModal-icon="icon-home"> <div id="dlgDeleteAddressConfirm" class="modalDialog" data-izimodal-title="Application Error" data-izimodal-subtitle="Something went wrong, don't kill the fish..." data-izimodal-icon="icon-home">
<div class="modalBody"> <div class="modalBody">
<div class="form-group"> <div class="form-group">
<span>Do you really want to delete the address?</span> <span>Do you really want to delete the address?</span>
</div>
<button type="button" class="btn btn-etho btn-dialog-cancel" id="btnDeleteAddressCancel">No</button>
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnDeleteAddressConfirm">Yes</button>
</div> </div>
<button type="button" class="btn btn-etho btn-dialog-cancel" id="btnDeleteAddressCancel">No</button>
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnDeleteAddressConfirm">Yes</button>
</div>
</div> </div>

View File

@@ -1,110 +1,120 @@
<div class="sendWrapper"> <div class="sendWrapper">
<div class="card-panel"> <div class="card-panel">
<form class="col s12"> <form class="col s12">
<div class="row"> <div class="row">
<div class="input-field col s6"> <div class="input-field col s6">
<select id="sendFromAddress"> <select id="sendFromAddress">
<option value="" disabled selected>Choose your address</option> <option value="" disabled="disabled" selected="selected">Choose your address</option>
{{#addressData}} {{#addressData}}
<option value="{{address}}">{{name}} - {{address}}</option> <option value="{{address}}">{{name}}
{{/addressData}} -
</select> {{address}}</option>
<label for="sendFromAddress">From address:</label> {{/addressData}}
<small id="sendFromAddressName" class="form-text text-muted"></small> </select>
</div> <label for="sendFromAddress">From address:</label>
<div class="input-field col s6"> <small id="sendFromAddressName" class="form-text text-muted"></small>
<label for="sendToAddress" class="active">To address:</label> </div>
<div class="addressInputWrapper"> <div class="input-field col s6">
<input id="sendToAddress" placeholder="recipient address" type="text"> <label for="sendToAddress" class="active">To address:</label>
<button type="button" class="btn btn-etho btnSendToolButton" id="btnAddToAddressBook"><i class="fas fa-plus"></i></button> <div class="addressInputWrapper">
<button type="button" class="btn btn-etho btnSendToolButton" id="btnLookForToAddress"><i class="fas fa-search"></i></button> <input id="sendToAddress" placeholder="recipient address" type="text">
</div> <button type="button" class="btn btn-etho btnSendToolButton" id="btnAddToAddressBook">
<small id="sendToAddressName" class="form-text text-muted"></small> <i class="fas fa-plus"></i>
</div> </button>
</div> <button type="button" class="btn btn-etho btnSendToolButton" id="btnLookForToAddress">
<div class="row"> <i class="fas fa-search"></i>
<div class="input-field col s6"> </button>
<input id="sendAmmount" placeholder="0" type="number" value="0"> </div>
<label for="sendAmmount" class="active">Amount:</label> <small id="sendToAddressName" class="form-text text-muted"></small>
</div> </div>
<div class="input-field col s6"> </div>
<div class="input-field col s12"> <div class="row">
<span id="sendMaxAmmount">0</span><span>ETHO</span> <div class="input-field col s6">
<button type="button" class="btn btn-etho" id="btnSendAll">ALL</button> <input id="sendAmmount" placeholder="0" type="number" value="0">
</div> <label for="sendAmmount" class="active">Amount:</label>
</div> </div>
</div> <div class="input-field col s6">
<div class="row"> <div class="input-field col s12">
<div class="input-field col s12"> <span id="sendMaxAmmount">0</span><span>ETHO</span>
<button type="button" class="btn btn-etho" id="btnSendTransaction">Send</button> <button type="button" class="btn btn-etho" id="btnSendAll">ALL</button>
</div> </div>
</div> </div>
</form> </div>
</div> <div class="row">
<div id="cardTransactionsForAddress" class="card-panel" style="display: none;"> <div class="input-field col s12">
<table id="tableTransactionsForAddress" class="display" style="width:100%"> <button type="button" class="btn btn-etho" id="btnSendTransaction">Send</button>
<thead> </div>
<tr> </div>
<th>Block</th> </form>
<th>Timestamp</th> </div>
<th>To</th> <div id="cardTransactionsForAddress" class="card-panel" style="display: none;">
<th>Value</th> <table id="tableTransactionsForAddress" class="display" style="width:100%">
</tr> <thead>
</thead> <tr>
<tfoot> <th>Block</th>
<tr> <th>Timestamp</th>
<th>Block</th> <th>To</th>
<th>Timestamp</th> <th>Value</th>
<th>To</th> </tr>
<th>Value</th> </thead>
</tr> <tfoot>
</tfoot> <tr>
</table> <th>Block</th>
</div> <th>Timestamp</th>
<th>To</th>
<th>Value</th>
</tr>
</tfoot>
</table>
</div>
</div> </div>
<!-- The modal for wallet password --> <!-- send details dialog -->
<div id="dlgSendWalletPassword" class="modalDialog" data-iziModal-title="Wallet Password" data-iziModal-subtitle="To send from this wallet, please enter the wallet password" data-iziModal-icon="icon-home"> <div id="dlgSendWalletPassword" class="modalDialog" data-izimodal-title="Wallet Password" data-izimodal-subtitle="To send from this wallet, please enter the wallet password" data-izimodal-icon="icon-home">
<div class="modalBody"> <div class="modalBody">
<div class="form-group sendTXInfo"> <div class="form-group sendTXInfo">
<i class="fas fa-wallet"></i> <i class="fas fa-wallet"></i>
<label>From address:</label><label id="fromAddressInfo"></label> <label>From address:</label>
</div> <label id="fromAddressInfo"></label>
<div class="form-group sendTXInfo">
<i class="fas fa-wallet"></i>
<label>To address:</label><label id="toAddressInfo"></label>
</div>
<div class="form-group sendTXInfo">
<i class="fas fa-dollar-sign"></i>
<label>Value to send:</label><label id="valueToSendInfo"></label><label class="currencyTicker">ETHO</label>
</div>
<div class="form-group sendTXInfo">
<i class="fas fa-dollar-sign"></i>
<label>Fee to pay:</label><label id="feeToPayInfo"></label><label class="currencyTicker">ETHO</label>
</div>
<hr class="sendTXdivider">
<div class="form-group sendTXPass">
<label for="usr">Type Password:</label>
<input type="password" class="form-control" id="walletPassword">
</div>
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnSendWalletPasswordConfirm">Confirm</button>
</div> </div>
<div class="form-group sendTXInfo">
<i class="fas fa-wallet"></i>
<label>To address:</label>
<label id="toAddressInfo"></label>
</div>
<div class="form-group sendTXInfo">
<i class="fas fa-dollar-sign"></i>
<label>Value to send:</label>
<label id="valueToSendInfo"></label>
<label class="currencyTicker">ETHO</label>
</div>
<div class="form-group sendTXInfo">
<i class="fas fa-dollar-sign"></i>
<label>Fee to pay:</label>
<label id="feeToPayInfo"></label>
<label class="currencyTicker">ETHO</label>
</div>
<hr class="sendTXdivider">
<div class="form-group sendTXPass">
<label for="usr">Type Password:</label>
<input type="password" class="form-control" id="walletPassword">
</div>
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnSendWalletPasswordConfirm">Confirm</button>
</div>
</div> </div>
<!-- The modal for address list --> <!-- The modal for address list -->
<div id="dlgAddressList" class="modalDialog" data-iziModal-title="AddressList" data-iziModal-subtitle="Please select an address from the list" data-iziModal-icon="icon-home"> <div id="dlgAddressList" class="modalDialog" data-izimodal-title="AddressList" data-izimodal-subtitle="Please select an address from the list" data-izimodal-icon="icon-home">
<div class="modalBody" id="dlgAddressListBody"> <div class="modalBody" id="dlgAddressListBody"></div>
</div>
</div> </div>
<!-- The modal to add address to address book --> <!-- The modal to add address to address book -->
<div id="dlgAddAddressToBook" class="modalDialog" data-iziModal-title="Address Name" data-iziModal-subtitle="Enter the name for this address" data-iziModal-icon="icon-home"> <div id="dlgAddAddressToBook" class="modalDialog" data-izimodal-title="Address Name" data-izimodal-subtitle="Enter the name for this address" data-izimodal-icon="icon-home">
<div class="modalBody"> <div class="modalBody">
<div class="form-group"> <div class="form-group">
<label for="usr">Address Name:</label> <label for="usr">Address Name:</label>
<input type="text" class="form-control" id="inputAddressName"> <input type="text" class="form-control" id="inputAddressName">
</div>
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnAddAddressToBookConfirm">Confirm</button>
</div> </div>
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnAddAddressToBookConfirm">Confirm</button>
</div>
</div> </div>

View File

@@ -1,38 +1,77 @@
<div id="transactionsWrapper"> <div id="transactionsWrapper">
<!----<button type="button" class="btn btn-etho" id="btnRefreshTransactions">Refresh</button>--> <!----<button type="button" class="btn btn-etho" id="btnRefreshTransactions">Refresh</button>-->
<table id="tableTransactionsForAll" class="display tableTransactions" style="width:100%"> <table id="tableTransactionsForAll" class="display tableTransactions" style="width:100%">
<thead> <thead>
<tr> <tr>
<th></th> <th></th>
<th>Block</th> <th>Block</th>
<th>Timestamp</th> <th>Timestamp</th>
<th>From</th> <th>TxHash</th>
<th>To</th> <th>From</th>
<th>Value</th> <th>To</th>
<th></th> <th>Value</th>
</tr> <th></th>
</thead> </tr>
<tfoot> </thead>
<tr> <tfoot>
<th></th> <tr>
<th>Block</th> <th></th>
<th>Timestamp</th> <th>Block</th>
<th>From</th> <th>Timestamp</th>
<th>To</th> <th>From</th>
<th>Value</th> <th>TxHash</th>
<th></th> <th>To</th>
</tr> <th>Value</th>
</tfoot> <th></th>
</table> </tr>
</tfoot>
</table>
</div>
<!-- transaction details dialog -->
<div id="dlgTransactionInfo" class="modalDialog" data-izimodal-title="Transaction Info" data-izimodal-subtitle="Detailed info about the selected transaction" data-izimodal-icon="icon-home">
<div class="modalBody">
<div class="form-group txInfo">
<i class="fas fa-wallet"></i>
<label>Block height:</label>
<label id="txBlockHeight"></label>
</div>
<div class="form-group txInfo">
<i class="fas fa-wallet"></i>
<label>TX Timestamp:</label>
<label id="txTimestamp"></label>
</div>
<div class="form-group txInfo">
<i class="fas fa-wallet"></i>
<label>TX hash:</label>
<a id="txHash"></a>
</div>
<div class="form-group txInfo">
<i class="fas fa-wallet"></i>
<label>From address:</label>
<a id="txFromAddress"></a>
</div>
<div class="form-group txInfo">
<i class="fas fa-wallet"></i>
<label>To address:</label>
<a id="txToAddress"></a>
</div>
<div class="form-group txInfo">
<i class="fas fa-dollar-sign"></i>
<label>Value:</label>
<label id="txValue"></label>
<label class="currencyTicker">ETHO</label>
</div>
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnTxInfoClose">Close</button>
</div>
</div> </div>
<div class="loadingOverlay" id="loadingTransactionsOverlay"> <div class="loadingOverlay" id="loadingTransactionsOverlay">
<div class="loadingWrapper"> <div class="loadingWrapper">
<div class="loadingTextTransactions">Transaction are loading, please wait...</div> <div class="loadingTextTransactions">Transaction are loading, please wait...</div>
<div class='spinner'> <div class='spinner'>
<div class='bounce bounce1'></div> <div class='bounce bounce1'></div>
<div class='bounce bounce2'></div> <div class='bounce bounce2'></div>
<div class='bounce bounce3'></div> <div class='bounce bounce3'></div>
</div> </div>
<div> <div></div>
</div>

View File

@@ -58,6 +58,7 @@ ipcMain.on("getTransactions", (event, arg) => {
ResultData.push([ ResultData.push([
docs[i].block, docs[i].block,
docs[i].timestamp, docs[i].timestamp,
docs[i].txhash,
docs[i].fromaddr, docs[i].fromaddr,
docs[i].toaddr, docs[i].toaddr,
docs[i].value docs[i].value

View File

@@ -7,8 +7,9 @@ const os = require("os");
class Geth { class Geth {
constructor() { constructor() {
this.isRunning = false;
this.gethProcess = null; this.gethProcess = null;
this.logGethEvents = false; this.logGethEvents = true;
// create the user data dir (needed for MacOS) // create the user data dir (needed for MacOS)
if (!fs.existsSync(app.getPath("userData"))) { if (!fs.existsSync(app.getPath("userData"))) {
fs.mkdirSync(app.getPath("userData")); fs.mkdirSync(app.getPath("userData"));
@@ -48,6 +49,7 @@ class Geth {
startGeth() { startGeth() {
// get the path of get and execute the child process // get the path of get and execute the child process
try { try {
this.isRunning = true;
const gethPath = path.join(this.binaries, "geth"); const gethPath = path.join(this.binaries, "geth");
this.gethProcess = child_process.spawn(gethPath, [ this.gethProcess = child_process.spawn(gethPath, [
"--ws", "--ws",
@@ -69,6 +71,12 @@ class Geth {
dialog.showErrorBox("Error starting application", "Geth failed to start!"); dialog.showErrorBox("Error starting application", "Geth failed to start!");
app.quit(); app.quit();
}); });
this.gethProcess.on("close", function (err) {
if (this.isRunning) {
dialog.showErrorBox("Error running the node", "The node stoped working. Wallet will close!");
app.quit();
}
});
this.gethProcess.stderr.on("data", function (data) { this.gethProcess.stderr.on("data", function (data) {
EthoGeth._writeLog(data.toString() + "\n"); EthoGeth._writeLog(data.toString() + "\n");
}); });
@@ -83,6 +91,8 @@ class Geth {
} }
stopGeth() { stopGeth() {
this.isRunning = false;
if (os.type() == "Windows_NT") { if (os.type() == "Windows_NT") {
const gethWrapePath = path.join(this.binaries, "WrapGeth.exe"); const gethWrapePath = path.join(this.binaries, "WrapGeth.exe");
child_process.spawnSync(gethWrapePath, [this.gethProcess.pid]); child_process.spawnSync(gethWrapePath, [this.gethProcess.pid]);

View File

@@ -162,7 +162,7 @@ if (process.platform === "darwin") {
} }
ipcMain.on("openURL", (event, arg) => { ipcMain.on("openURL", (event, arg) => {
shell.openExternal("https://github.com/taeguscromis/Ether1DesktopWallet/issues"); shell.openExternal(arg);
}); });
const menu = Menu.buildFromTemplate(template); const menu = Menu.buildFromTemplate(template);

View File

@@ -1,8 +1,7 @@
const {ipcRenderer} = require('electron'); const {ipcRenderer} = require("electron");
class AddressBook { class AddressBook {
constructor() { constructor() {}
}
setAddressName(address, name) { setAddressName(address, name) {
var addressBook = EthoDatatabse.getAddresses(); var addressBook = EthoDatatabse.getAddresses();
@@ -29,12 +28,13 @@ class AddressBook {
EthoDatatabse.setAddresses(addressBook); EthoDatatabse.setAddresses(addressBook);
} }
enableButtonTooltips() { enableButtonTooltips() {}
}
renderAddressBook() { renderAddressBook() {
var addressObject = EthoAddressBook.getAddressList(); var addressObject = EthoAddressBook.getAddressList();
var renderData = { addressData: [] }; var renderData = {
addressData: []
};
for (var key in addressObject) { for (var key in addressObject) {
if (addressObject.hasOwnProperty(key)) { if (addressObject.hasOwnProperty(key)) {
@@ -53,15 +53,18 @@ class AddressBook {
} }
// the event to tell us that the wallets are rendered // the event to tell us that the wallets are rendered
$(document).on("render_addressBook", function() { $(document).on("render_addressBook", function () {
$("#btnNewAddress").off('click').on('click', function() { new Tablesort(document.getElementById("addressTable"));
$("#addressTable").floatThead();
$("#btnNewAddress").off("click").on("click", function () {
$("#dlgCreateAddressAndName").iziModal(); $("#dlgCreateAddressAndName").iziModal();
$("#addressName").val(""); $("#addressName").val("");
$("#addressHash").val(""); $("#addressHash").val("");
$('#dlgCreateAddressAndName').iziModal('open'); $("#dlgCreateAddressAndName").iziModal("open");
function doCreateNewWallet() { function doCreateNewWallet() {
$('#dlgCreateAddressAndName').iziModal('close'); $("#dlgCreateAddressAndName").iziModal("close");
if (!EthoBlockchain.isAddress($("#addressHash").val())) { if (!EthoBlockchain.isAddress($("#addressHash").val())) {
EthoMainGUI.showGeneralError("Address must be a valid address!"); EthoMainGUI.showGeneralError("Address must be a valid address!");
@@ -69,78 +72,67 @@ $(document).on("render_addressBook", function() {
EthoAddressBook.setAddressName($("#addressHash").val(), $("#addressName").val()); EthoAddressBook.setAddressName($("#addressHash").val(), $("#addressName").val());
EthoAddressBook.renderAddressBook(); EthoAddressBook.renderAddressBook();
iziToast.success({ iziToast.success({title: "Created", message: "New address was successfully created", position: "topRight", timeout: 5000});
title: 'Created',
message: 'New address was successfully created',
position: 'topRight',
timeout: 5000
});
} }
} }
$("#btnCreateAddressConfirm").off('click').on('click', function() { $("#btnCreateAddressConfirm").off("click").on("click", function () {
doCreateNewWallet(); doCreateNewWallet();
}); });
$("#dlgCreateAddressAndName").off('keypress').on('keypress', function(e) { $("#dlgCreateAddressAndName").off("keypress").on("keypress", function (e) {
if(e.which == 13) { if (e.which == 13) {
doCreateNewWallet(); doCreateNewWallet();
} }
}); });
}); });
$(".btnChangAddressName").off('click').on('click', function() { $(".btnChangAddressName").off("click").on("click", function () {
var walletAddress = $(this).attr('data-address'); var walletAddress = $(this).attr("data-address");
var walletName = $(this).attr('data-name'); var walletName = $(this).attr("data-name");
$("#dlgChangeAddressName").iziModal(); $("#dlgChangeAddressName").iziModal();
$("#inputAddressName").val(walletName); $("#inputAddressName").val(walletName);
$('#dlgChangeAddressName').iziModal('open'); $("#dlgChangeAddressName").iziModal("open");
function doChangeAddressName() { function doChangeAddressName() {
EthoAddressBook.setAddressName(walletAddress, $("#inputAddressName").val()); EthoAddressBook.setAddressName(walletAddress, $("#inputAddressName").val());
$('#dlgChangeAddressName').iziModal('close'); $("#dlgChangeAddressName").iziModal("close");
EthoAddressBook.renderAddressBook(); EthoAddressBook.renderAddressBook();
} }
$("#btnChangeAddressNameConfirm").off('click').on('click', function() { $("#btnChangeAddressNameConfirm").off("click").on("click", function () {
doChangeAddressName(); doChangeAddressName();
}); });
$("#dlgChangeAddressName").off('keypress').on('keypress', function(e) { $("#dlgChangeAddressName").off("keypress").on("keypress", function (e) {
if(e.which == 13) { if (e.which == 13) {
doChangeAddressName(); doChangeAddressName();
} }
}); });
}); });
$(".btnDeleteAddress").off('click').on('click', function() { $(".btnDeleteAddress").off("click").on("click", function () {
var deleteAddress = $(this).attr('data-address'); var deleteAddress = $(this).attr("data-address");
$("#dlgDeleteAddressConfirm").iziModal(); $("#dlgDeleteAddressConfirm").iziModal();
$('#dlgDeleteAddressConfirm').iziModal('open'); $("#dlgDeleteAddressConfirm").iziModal("open");
$("#btnDeleteAddressCancel").off('click').on('click', function() { $("#btnDeleteAddressCancel").off("click").on("click", function () {
$('#dlgDeleteAddressConfirm').iziModal('close'); $("#dlgDeleteAddressConfirm").iziModal("close");
}); });
$("#btnDeleteAddressConfirm").off('click').on('click', function() { $("#btnDeleteAddressConfirm").off("click").on("click", function () {
$('#dlgDeleteAddressConfirm').iziModal('close'); $("#dlgDeleteAddressConfirm").iziModal("close");
EthoAddressBook.deleteAddress(deleteAddress); EthoAddressBook.deleteAddress(deleteAddress);
EthoAddressBook.renderAddressBook(); EthoAddressBook.renderAddressBook();
}); });
}); });
$(".textAddress").off('click').on('click', function() { $(".textAddress").off("click").on("click", function () {
EthoMainGUI.copyToClipboard($(this).html()); EthoMainGUI.copyToClipboard($(this).html());
iziToast.success({ iziToast.success({title: "Copied", message: "Address was copied to clipboard", position: "topRight", timeout: 2000});
title: 'Copied',
message: 'Address was copied to clipboard',
position: 'topRight',
timeout: 2000
});
}); });
}); });

View File

@@ -1,3 +1,5 @@
const {ipcRenderer} = require("electron");
class tableTransactions { class tableTransactions {
constructor() { constructor() {
this.appState = "account"; this.appState = "account";
@@ -57,12 +59,15 @@ class tableTransactions {
return moment(data, "YYYY-MM-DD HH:mm:ss").format("MMM Do YYYY HH:mm:ss"); return moment(data, "YYYY-MM-DD HH:mm:ss").format("MMM Do YYYY HH:mm:ss");
} }
}, { }, {
targets: 5, targets: 3,
visible: false
}, {
targets: 6,
render: function (data, type, row) { render: function (data, type, row) {
return parseFloat(web3Local.utils.fromWei(EthoUtils.toFixed(parseFloat(data)).toString(), "ether")).toFixed(2); return parseFloat(web3Local.utils.fromWei(EthoUtils.toFixed(parseFloat(data)).toString(), "ether")).toFixed(2);
} }
}, { }, {
targets: 6, targets: 7,
defaultContent: "", defaultContent: "",
render: function (data, type, row) { render: function (data, type, row) {
if (row[1]) { if (row[1]) {
@@ -77,6 +82,36 @@ class tableTransactions {
$("#loadingTransactionsOverlay").css("display", "none"); $("#loadingTransactionsOverlay").css("display", "none");
} }
}); });
$(id + " tbody").off("click").on("click", "td", function () {
if ($(id).DataTable().cell(this).index().column == 1) {
var rowIdx = $(id).DataTable().cell(this).index().row;
var rowData = $(id).DataTable().rows(rowIdx).data()[0];
console.log(rowData[6]);
$("#dlgTransactionInfo").iziModal();
$("#txBlockHeight").html(rowData[1]);
$("#txTimestamp").html(rowData[2]);
$("#txHash").html(rowData[3]);
$("#txHash").attr("href", vsprintf("https://explorer.ether1.org/tx/%s", [rowData[3]]));
$("#txFromAddress").html(rowData[4]);
$("#txFromAddress").attr("href", vsprintf("https://explorer.ether1.org/addr/%s", [rowData[4]]));
$("#txToAddress").html(rowData[5]);
$("#txToAddress").attr("href", vsprintf("https://explorer.ether1.org/addr/%s", [rowData[5]]));
$("#txValue").html(web3Local.utils.fromWei(EthoUtils.toFixed(parseFloat(rowData[6])).toString(), "ether"));
$("#dlgTransactionInfo a").off("click").on("click", function (even) {
event.preventDefault();
ipcRenderer.send("openURL", $(this).attr("href"));
});
$("#btnTxInfoClose").off("click").on("click", function () {
$("#dlgTransactionInfo").iziModal("close");
});
$("#dlgTransactionInfo").iziModal("open");
}
});
} }
} }