! fixed import from zip file

+ import from private key
This commit is contained in:
Taegus
2019-01-05 18:09:08 +01:00
parent 7fb212f7fc
commit b9d5fdadc2
5 changed files with 85 additions and 44 deletions

View File

@@ -215,6 +215,10 @@ class Blockchain {
});
}
importFromPrivateKey(privateKey) {
return web3Local.eth.accounts.privateKeyToAccount(privateKey);
}
subsribePendingTransactions(clbError, clbSuccess, clbData) {
this.txSubscribe = web3Local.eth.subscribe('pendingTransactions', function(error, result){
if (error) {

View File

@@ -44,6 +44,7 @@ class Wallets {
EthoUtils.createToolTip("#btnNewAddress", "Create New Address");
EthoUtils.createToolTip("#btnExportAccounts", "Export Accounts");
EthoUtils.createToolTip("#btnImportAccounts", "Import Accounts");
EthoUtils.createToolTip("#btnImportFromPrivateKey", "Import From Private Key");
}
validateNewAccountForm() {
@@ -178,7 +179,41 @@ $(document).on("render_wallets", function() {
});
$("#btnImportAccounts").off('click').on('click', function() {
ipcRenderer.sendSync('importAccounts', {});
var ImportResult = ipcRenderer.sendSync('importAccounts', {});
if (ImportResult.success) {
iziToast.success({
title: 'Imported',
message: ImportResult.text,
position: 'topRight',
timeout: 2000
});
} else {
EthoMainGUI.showGeneralError(ImportResult.text);
}
});
$("#btnImportFromPrivateKey").off('click').on('click', function() {
$("#dlgImportFromPrivateKey").iziModal();
$("#inputPrivateKey").val("");
$('#dlgImportFromPrivateKey').iziModal('open');
function doImportFromPrivateKeys() {
EthoBlockchain.importFromPrivateKey($("#inputPrivateKey").val());
$('#dlgChangeWalletName').iziModal('close');
EthoWallets.renderWalletsState();
}
$("#btnImportFromPrivateKeyConfirm").off('click').on('click', function() {
doImportFromPrivateKeys();
});
$("#dlgImportFromPrivateKey").off('keypress').on('keypress', function(e) {
if(e.which == 13) {
doImportFromPrivateKeys();
}
});
});
$(".textAddress").off('click').on('click', function() {