+ initial import

This commit is contained in:
Taegus
2018-12-16 13:33:09 +01:00
commit 554f96387b
47 changed files with 14962 additions and 0 deletions

35
modules/geth.js Normal file
View File

@@ -0,0 +1,35 @@
const {app, dialog, BrowserWindow} = require('electron')
const child_process = require('child_process');
const path = require('path');
class Geth {
constructor() {
this.gethProcess = null;
}
startGeth() {
// get the path of get and execute the child process
try {
const gethPath = path.join(app.getPath('userData'), '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!");
});
this.gethProcess.stderr.on('data', function(data) {
console.log(data.toString());
});
this.gethProcess.stdout.on('data', function(data) {
console.log(data.toString());
});
} catch (e) {
dialog.showErrorBox("Error starting application", e);
app.quit();
}
}
stopGeth() {
this.gethProcess.kill('SIGINT');
}
}
EthoGeth = new Geth();