+ tooltips

+ sort transactions by date correctly
+ confirmed transactions indicator
This commit is contained in:
Taegus
2018-12-20 18:29:23 +01:00
parent f80c9123f1
commit 62f8be866e
15 changed files with 228 additions and 13 deletions

54
modules/accounts.js Normal file
View File

@@ -0,0 +1,54 @@
const {app, dialog, ipcMain} = require('electron');
const admZip = require('adm-zip');
const path = require('path');
const fs = require('fs');
class Accounts {
constructor() {
}
exportAccounts() {
var savePath = dialog.showSaveDialog({
defaultPath: path.join(app.getPath('documents'), 'accounts.zip')
});
if (savePath) {
const accPath = path.join(path.join(process.env.APPDATA, 'Ether1'), 'keystore');
fs.readdir(accPath, function(err, files) {
var zip = new admZip();
for(let filePath of files) {
zip.addFile(filePath, fs.readFileSync(path.join(accPath, filePath)));
}
// store zip to path
zip.writeZip(savePath);
});
}
}
importAccounts() {
const accPath = path.join(path.join(process.env.APPDATA, 'Ether1'), 'keystore');
var openPath = dialog.showOpenDialog({
defaultPath: app.getPath('documents')
});
if (openPath) {
var zip = new admZip(openPath[0]);
zip.extractAllTo(accPath, true);
}
}
}
ipcMain.on('exportAccounts', (event, arg) => {
EthoAccounts.exportAccounts();
});
ipcMain.on('importAccounts', (event, arg) => {
EthoAccounts.importAccounts();
event.returnValue = true;
});
EthoAccounts = new Accounts();

View File

@@ -29,7 +29,8 @@ ipcMain.on('getTransactions', (event, arg) => {
docs[i].timestamp,
docs[i].fromaddr,
docs[i].toaddr,
docs[i].value
docs[i].value,
docs[i].confirmed || 1
]);
}

View File

@@ -1,5 +1,5 @@
const {app, dialog, BrowserWindow} = require('electron')
const child_process = require('child_process');
const {app, dialog} = require('electron');
const path = require('path');
class Geth {
@@ -14,6 +14,7 @@ class Geth {
this.gethProcess = child_process.spawn(gethPath, ['--ws', '--wsorigins', '*', '--wsaddr', '127.0.0.1', '--wsport', '8546', '--wsapi', 'admin,db,eth,net,miner,personal,web3']);
this.gethProcess.on('error', function(err) {
dialog.showErrorBox("Error starting application", "Geth failed to start!");
app.quit();
});
this.gethProcess.stderr.on('data', function(data) {
console.log(data.toString());