diff --git a/assets/styles/style.css b/assets/styles/style.css index fe93e68..08fca68 100644 --- a/assets/styles/style.css +++ b/assets/styles/style.css @@ -134,6 +134,15 @@ body.pg-loaded > .inner { height: 300px; } +#dlgTransactionInfo { + width: 700px; + max-width: 700px !important; +} + +#dlgTransactionInfo .modalBody { + height: 300px; +} + #dlgAddAddressToBook .modalBody, #dlgChangeWalletName .modalBody, #dlgChangeAddressName .modalBody, @@ -231,6 +240,7 @@ div.sidebar svg { .dataTables_scrollBody .transactionsBlockNum { color: #f92472; + cursor: pointer; } .sendWrapper, @@ -268,7 +278,18 @@ div.sidebar svg { .sendTXInfo label { 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 { @@ -403,4 +424,4 @@ div.noAddressWrapper { #chartMarketPrice { height: calc(100vh - 260px); -} +} \ No newline at end of file diff --git a/assets/styles/tablesort.css b/assets/styles/tablesort.css index 3c14856..5108762 100644 --- a/assets/styles/tablesort.css +++ b/assets/styles/tablesort.css @@ -8,7 +8,7 @@ th[role=columnheader]:not(.no-sort):after { margin-top: 7px; border-width: 0 8px 8px; border-style: solid; - border-color: #7A1336 transparent; + border-color: #ccc transparent; visibility: hidden; opacity: 0; -ms-user-select: none; diff --git a/assets/templates/addressBook.html b/assets/templates/addressBook.html index 50157b8..b67f9d7 100644 --- a/assets/templates/addressBook.html +++ b/assets/templates/addressBook.html @@ -1,67 +1,74 @@
- +
- {{#if addressData.length}} - - - - - - - - - - - {{#addressData}} - - - - - - - {{/addressData}} - -
NameAddressActions
{{name}}{{address}}
- {{else}} -
You don't have any addresses, create a new one
- {{/if}} + {{#if addressData.length}} + + + + + + + + + + + {{#addressData}} + + + + + + + {{/addressData}} + +
NameAddressActions
+ + {{name}} + {{address}} + +
+ {{else}} +
You don't have any addresses, create a new one
+ {{/if}}
- -
-
-
- - -
-
- - -
- + +
+
+
+ +
+
+ + +
+ +
-
-
-
- - -
- +
+
+
+ +
+ +
-
-
-
- Do you really want to delete the address? -
- - +
+
+
+ Do you really want to delete the address?
+ + +
- - \ No newline at end of file diff --git a/assets/templates/send.html b/assets/templates/send.html index 644bb75..c8d1ce7 100644 --- a/assets/templates/send.html +++ b/assets/templates/send.html @@ -1,110 +1,120 @@
-
-
-
-
- - - -
-
- -
- - - -
- -
-
-
-
- - -
-
-
- 0ETHO - -
-
-
-
-
- -
-
-
-
- +
+
+
+
+ + + +
+
+ +
+ + + +
+ +
+
+
+
+ + +
+
+
+ 0ETHO + +
+
+
+
+
+ +
+
+
+
+
- -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
-
- - -
- + +
+
+
+ + +
+
+ + + +
+
+ + + + +
+
+ + + + +
+
+
+ + +
+ +
-
-
-
+
+
-
-
-
- - -
- +
+
+
+ +
+ +
- \ No newline at end of file diff --git a/assets/templates/transactions.html b/assets/templates/transactions.html index 62244dc..bde1e0a 100644 --- a/assets/templates/transactions.html +++ b/assets/templates/transactions.html @@ -1,38 +1,77 @@
- - - - - - - - - - - - - - - - - - - - - - - - -
BlockTimestampFromToValue
BlockTimestampFromToValue
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
BlockTimestampTxHashFromToValue
BlockTimestampFromTxHashToValue
+
+ + +
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + + +
+ +
-
-
Transaction are loading, please wait...
-
-
-
-
-
-
-
+
+
Transaction are loading, please wait...
+
+
+
+
+
+
diff --git a/modules/database.js b/modules/database.js index 86edbf7..aa7e9a3 100644 --- a/modules/database.js +++ b/modules/database.js @@ -58,6 +58,7 @@ ipcMain.on("getTransactions", (event, arg) => { ResultData.push([ docs[i].block, docs[i].timestamp, + docs[i].txhash, docs[i].fromaddr, docs[i].toaddr, docs[i].value diff --git a/modules/geth.js b/modules/geth.js index 96c1a75..5618e62 100644 --- a/modules/geth.js +++ b/modules/geth.js @@ -7,8 +7,9 @@ const os = require("os"); class Geth { constructor() { + this.isRunning = false; this.gethProcess = null; - this.logGethEvents = false; + this.logGethEvents = true; // create the user data dir (needed for MacOS) if (!fs.existsSync(app.getPath("userData"))) { fs.mkdirSync(app.getPath("userData")); @@ -48,6 +49,7 @@ class Geth { startGeth() { // get the path of get and execute the child process try { + this.isRunning = true; const gethPath = path.join(this.binaries, "geth"); this.gethProcess = child_process.spawn(gethPath, [ "--ws", @@ -69,6 +71,12 @@ class Geth { dialog.showErrorBox("Error starting application", "Geth failed to start!"); 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) { EthoGeth._writeLog(data.toString() + "\n"); }); @@ -83,6 +91,8 @@ class Geth { } stopGeth() { + this.isRunning = false; + if (os.type() == "Windows_NT") { const gethWrapePath = path.join(this.binaries, "WrapGeth.exe"); child_process.spawnSync(gethWrapePath, [this.gethProcess.pid]); diff --git a/modules/menu.js b/modules/menu.js index 25092ca..892754e 100644 --- a/modules/menu.js +++ b/modules/menu.js @@ -162,7 +162,7 @@ if (process.platform === "darwin") { } ipcMain.on("openURL", (event, arg) => { - shell.openExternal("https://github.com/taeguscromis/Ether1DesktopWallet/issues"); + shell.openExternal(arg); }); const menu = Menu.buildFromTemplate(template); diff --git a/renderer/addressBook.js b/renderer/addressBook.js index 3f164de..9c19b4b 100644 --- a/renderer/addressBook.js +++ b/renderer/addressBook.js @@ -1,9 +1,8 @@ -const {ipcRenderer} = require('electron'); +const {ipcRenderer} = require("electron"); class AddressBook { - constructor() { - } - + constructor() {} + setAddressName(address, name) { var addressBook = EthoDatatabse.getAddresses(); @@ -29,12 +28,13 @@ class AddressBook { EthoDatatabse.setAddresses(addressBook); } - enableButtonTooltips() { - } - + enableButtonTooltips() {} + renderAddressBook() { var addressObject = EthoAddressBook.getAddressList(); - var renderData = { addressData: [] }; + var renderData = { + addressData: [] + }; for (var key in addressObject) { if (addressObject.hasOwnProperty(key)) { @@ -46,102 +46,94 @@ class AddressBook { } // render the wallets current state - EthoMainGUI.renderTemplate("addressBook.html", renderData); + EthoMainGUI.renderTemplate("addressBook.html", renderData); $(document).trigger("render_addressBook"); EthoAddressBook.enableButtonTooltips(); } } // the event to tell us that the wallets are rendered -$(document).on("render_addressBook", function() { - $("#btnNewAddress").off('click').on('click', function() { +$(document).on("render_addressBook", function () { + new Tablesort(document.getElementById("addressTable")); + $("#addressTable").floatThead(); + + $("#btnNewAddress").off("click").on("click", function () { $("#dlgCreateAddressAndName").iziModal(); $("#addressName").val(""); $("#addressHash").val(""); - $('#dlgCreateAddressAndName').iziModal('open'); + $("#dlgCreateAddressAndName").iziModal("open"); function doCreateNewWallet() { - $('#dlgCreateAddressAndName').iziModal('close'); + $("#dlgCreateAddressAndName").iziModal("close"); if (!EthoBlockchain.isAddress($("#addressHash").val())) { - EthoMainGUI.showGeneralError("Address must be a valid address!"); + EthoMainGUI.showGeneralError("Address must be a valid address!"); } else { EthoAddressBook.setAddressName($("#addressHash").val(), $("#addressName").val()); EthoAddressBook.renderAddressBook(); - - iziToast.success({ - title: 'Created', - message: 'New address was successfully created', - position: 'topRight', - timeout: 5000 - }); - - } - } - $("#btnCreateAddressConfirm").off('click').on('click', function() { + iziToast.success({title: "Created", message: "New address was successfully created", position: "topRight", timeout: 5000}); + } + } + + $("#btnCreateAddressConfirm").off("click").on("click", function () { doCreateNewWallet(); }); - $("#dlgCreateAddressAndName").off('keypress').on('keypress', function(e) { - if(e.which == 13) { + $("#dlgCreateAddressAndName").off("keypress").on("keypress", function (e) { + if (e.which == 13) { doCreateNewWallet(); } - }); - }); - - $(".btnChangAddressName").off('click').on('click', function() { - var walletAddress = $(this).attr('data-address'); - var walletName = $(this).attr('data-name'); + }); + }); + + $(".btnChangAddressName").off("click").on("click", function () { + var walletAddress = $(this).attr("data-address"); + var walletName = $(this).attr("data-name"); $("#dlgChangeAddressName").iziModal(); $("#inputAddressName").val(walletName); - $('#dlgChangeAddressName').iziModal('open'); + $("#dlgChangeAddressName").iziModal("open"); function doChangeAddressName() { EthoAddressBook.setAddressName(walletAddress, $("#inputAddressName").val()); - $('#dlgChangeAddressName').iziModal('close'); + $("#dlgChangeAddressName").iziModal("close"); EthoAddressBook.renderAddressBook(); } - $("#btnChangeAddressNameConfirm").off('click').on('click', function() { + $("#btnChangeAddressNameConfirm").off("click").on("click", function () { doChangeAddressName(); }); - $("#dlgChangeAddressName").off('keypress').on('keypress', function(e) { - if(e.which == 13) { + $("#dlgChangeAddressName").off("keypress").on("keypress", function (e) { + if (e.which == 13) { doChangeAddressName(); } - }); - }); - - $(".btnDeleteAddress").off('click').on('click', function() { - var deleteAddress = $(this).attr('data-address'); + }); + }); + + $(".btnDeleteAddress").off("click").on("click", function () { + var deleteAddress = $(this).attr("data-address"); $("#dlgDeleteAddressConfirm").iziModal(); - $('#dlgDeleteAddressConfirm').iziModal('open'); - - $("#btnDeleteAddressCancel").off('click').on('click', function() { - $('#dlgDeleteAddressConfirm').iziModal('close'); + $("#dlgDeleteAddressConfirm").iziModal("open"); + + $("#btnDeleteAddressCancel").off("click").on("click", function () { + $("#dlgDeleteAddressConfirm").iziModal("close"); }); - $("#btnDeleteAddressConfirm").off('click').on('click', function() { - $('#dlgDeleteAddressConfirm').iziModal('close'); + $("#btnDeleteAddressConfirm").off("click").on("click", function () { + $("#dlgDeleteAddressConfirm").iziModal("close"); EthoAddressBook.deleteAddress(deleteAddress); EthoAddressBook.renderAddressBook(); }); - }); + }); - $(".textAddress").off('click').on('click', function() { + $(".textAddress").off("click").on("click", function () { EthoMainGUI.copyToClipboard($(this).html()); - iziToast.success({ - title: 'Copied', - message: 'Address was copied to clipboard', - position: 'topRight', - timeout: 2000 - }); + iziToast.success({title: "Copied", message: "Address was copied to clipboard", position: "topRight", timeout: 2000}); }); -}); - +}); + EthoAddressBook = new AddressBook(); \ No newline at end of file diff --git a/renderer/tableTransactions.js b/renderer/tableTransactions.js index e48f755..0278ec9 100644 --- a/renderer/tableTransactions.js +++ b/renderer/tableTransactions.js @@ -1,3 +1,5 @@ +const {ipcRenderer} = require("electron"); + class tableTransactions { constructor() { 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"); } }, { - targets: 5, + targets: 3, + visible: false + }, { + targets: 6, render: function (data, type, row) { return parseFloat(web3Local.utils.fromWei(EthoUtils.toFixed(parseFloat(data)).toString(), "ether")).toFixed(2); } }, { - targets: 6, + targets: 7, defaultContent: "", render: function (data, type, row) { if (row[1]) { @@ -77,6 +82,36 @@ class tableTransactions { $("#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"); + } + }); } }