diff --git a/assets/styles/style.css b/assets/styles/style.css
index ce2a70d..ad55b3b 100644
--- a/assets/styles/style.css
+++ b/assets/styles/style.css
@@ -110,11 +110,11 @@ body.pg-loaded > .inner {
}
#dlgGeneralError .modalBody {
- height: 100px;
+ height: 100px;
}
#dlgGeneralConfirm .modalBody {
- height: 100px;
+ height: 100px;
}
#dlgDeleteAddressConfirm .modalBody {
height: 100px;
@@ -129,6 +129,7 @@ body.pg-loaded > .inner {
height: 300px;
}
+#dlgAddAddressToBook .modalBody,
#dlgChangeWalletName .modalBody,
#dlgChangeAddressName .modalBody {
height: 150px;
@@ -364,4 +365,13 @@ div.noAddressWrapper {
#addressListFilter {
color: #aaa;
+}
+
+.btnSendToolButton {
+ width: 40px;
+ padding: 0px;
+}
+
+#btnAddToAddressBook {
+ margin-right: 3px;
}
\ No newline at end of file
diff --git a/assets/templates/send.html b/assets/templates/send.html
index 1d02017..e6b314a 100644
--- a/assets/templates/send.html
+++ b/assets/templates/send.html
@@ -14,7 +14,8 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/database.js b/modules/database.js
index 7f11078..95fa001 100644
--- a/modules/database.js
+++ b/modules/database.js
@@ -1,8 +1,9 @@
-const {app, ipcMain} = require('electron');
+const {app, dialog, ipcMain} = require('electron');
const storage = require('electron-storage');
const datastore = require('nedb');
const moment = require('moment');
const path = require('path');
+const fs = require('fs');
const dbPath = path.join(app.getPath('userData'), 'storage.db');
const db = new datastore({ filename: dbPath });
@@ -76,4 +77,15 @@ ipcMain.on('setJSONFile', (event, arg) => {
event.returnValue = { success: true, error: null };
}
});
+});
+
+ipcMain.on('deleteTransactions', (event, arg) => {
+ fs.unlink(dbPath, (err) => {
+ if (err) {
+ event.returnValue = { success: false, error: err };
+ dialog.showErrorBox("Error deleting the file", err.message);
+ } else {
+ event.returnValue = { success: true, error: null };
+ }
+ });
});
\ No newline at end of file
diff --git a/renderer/maingui.js b/renderer/maingui.js
index 765d9b5..26b667c 100644
--- a/renderer/maingui.js
+++ b/renderer/maingui.js
@@ -55,6 +55,7 @@ class MainGUI {
$("#btnGeneralConfirmYes").click(function() {
$('#dlgGeneralConfirm').iziModal('close');
+ console.log(true);
callback(true);
});
diff --git a/renderer/send.js b/renderer/send.js
index 324ae82..bb16c5d 100644
--- a/renderer/send.js
+++ b/renderer/send.js
@@ -109,6 +109,39 @@ $(document).on("render_send", function() {
}
);
});
+
+ $("#btnAddToAddressBook").off('click').on('click', function() {
+ if (EthoBlockchain.isAddress($("#sendToAddress").val())) {
+ $("#dlgAddAddressToBook").iziModal();
+ $("#inputAddressName").val("");
+ $('#dlgAddAddressToBook').iziModal('open');
+
+ function doAddAddressToAddressBook() {
+ EthoAddressBook.setAddressName($("#sendToAddress").val(), $("#inputAddressName").val());
+ $('#dlgAddAddressToBook').iziModal('close');
+
+ iziToast.success({
+ title: 'Success',
+ message: 'Address was added to address book',
+ position: 'topRight',
+ timeout: 2000
+ });
+ }
+ } else {
+ EthoMainGUI.showGeneralError("Recipient address is not valid!");
+ }
+
+ $("#btnAddAddressToBookConfirm").off('click').on('click', function() {
+ doAddAddressToAddressBook();
+ });
+
+ $("#dlgAddAddressToBook").off('keypress').on('keypress', function(e) {
+ if(e.which == 13) {
+ doAddAddressToAddressBook();
+ }
+ });
+ });
+
$("#btnSendTransaction").off('click').on('click', function() {
if (EthoSend.validateSendForm()) {
diff --git a/renderer/settings.js b/renderer/settings.js
index e94c2ff..78c2e68 100644
--- a/renderer/settings.js
+++ b/renderer/settings.js
@@ -17,7 +17,29 @@ $(document).on("render_settings", function() {
if (EthoTransactions.getIsSyncing()) {
EthoMainGUI.showGeneralError("Transactions sync is currently in progress");
} else {
+ // first disable keepInSync
EthoTransactions.disableKeepInSync();
+ // then delete the transactions data
+ var counters = EthoDatatabse.getCounters();
+ counters.transactions = 0;
+ EthoDatatabse.setCounters(counters);
+ ipcRenderer.sendSync('deleteTransactions', null);
+ // sync all the transactions to the current block
+ web3Local.eth.getBlock("latest", function(error, localBlock) {
+ if (error) {
+ EthoMainGUI.showGeneralError(error);
+ } else {
+ EthoTransactions.enableKeepInSync();
+ EthoTransactions.syncTransactionsForAllAddresses(localBlock.number);
+
+ iziToast.success({
+ title: 'Success',
+ message: 'Transactions are being resynced',
+ position: 'topRight',
+ timeout: 5000
+ });
+ }
+ });
}
}
});
diff --git a/renderer/transactions.js b/renderer/transactions.js
index d5b4721..14eddc4 100644
--- a/renderer/transactions.js
+++ b/renderer/transactions.js
@@ -102,42 +102,6 @@ class Transactions {
}
enableKeepInSync() {
- function processTransaction(data) {
-
- if ((EthoWallets.getAddressExists(data.from)) || (EthoWallets.getAddressExists(data.to))) {
- if (data.blockNumber) {
- console.log(data.blockNumber);
- }
-
- var Transaction = {
- block: null,
- txhash: data.hash.toLowerCase(),
- fromaddr: data.from.toLowerCase(),
- timestamp: moment.unix(data.timestamp).format('YYYY-MM-DD HH:mm:ss'),
- toaddr: data.to.toLowerCase(),
- value: Number(data.value).toExponential(5).toString().replace('+','')
- }
-
- // store transaction and notify about new transactions
- ipcRenderer.send('storeTransaction', Transaction);
- $(document).trigger("onNewAccountTransaction");
-
- iziToast.info({
- title: 'New Transaction',
- message: vsprintf('Transaction from address %s to address %s was just processed', [Transaction.fromaddr, Transaction.toaddr]),
- position: 'topRight',
- timeout: 10000
- });
-
- // render transactions again to show latest
- if (EthoMainGUI.getAppState() == "transactions") {
- setTimeout(function() {
- EthoTransactions.renderTransactions();
- }, 500);
- }
- }
- }
-
EthoBlockchain.subsribeNewBlockHeaders(
function(error) {
EthoMainGUI.showGeneralError(error);