! fixed bug in importing single account to the wallet
! fixed bug when smart contract transactions were causing problems
This commit is contained in:
@@ -42,11 +42,11 @@ class Accounts {
|
|||||||
var extName = path.extname(accountsFile).toUpperCase();
|
var extName = path.extname(accountsFile).toUpperCase();
|
||||||
const accPath = this.getKeyStoreLocation();
|
const accPath = this.getKeyStoreLocation();
|
||||||
|
|
||||||
if (extName = '.ZIP') {
|
if (extName == '.ZIP') {
|
||||||
var zip = new admZip(accountsFile);
|
var zip = new admZip(accountsFile);
|
||||||
zip.extractAllTo(accPath, true);
|
zip.extractAllTo(accPath, true);
|
||||||
return { success: true, text: "Accounts ware successfully imported."};
|
return { success: true, text: "Accounts ware successfully imported."};
|
||||||
} else if (extName = '.JSON') {
|
} else {
|
||||||
fs.copyFile(accountsFile, path.join(accPath, path.basename(accountsFile)), (err) => {
|
fs.copyFile(accountsFile, path.join(accPath, path.basename(accountsFile)), (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return { success: false, text: err};
|
return { success: false, text: err};
|
||||||
@@ -54,8 +54,6 @@ class Accounts {
|
|||||||
return { success: true, text: "Account was successfully imported."};
|
return { success: true, text: "Account was successfully imported."};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
return { success: false, text: "This is not a valid account file or arhive!"};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,6 +80,10 @@ ipcMain.on('importAccounts', (event, arg) => {
|
|||||||
{
|
{
|
||||||
"name": "json",
|
"name": "json",
|
||||||
"extensions": ["json"]
|
"extensions": ["json"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "All",
|
||||||
|
"extensions": ["*.*"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -89,7 +91,7 @@ ipcMain.on('importAccounts', (event, arg) => {
|
|||||||
if (openPath) {
|
if (openPath) {
|
||||||
event.returnValue = EthoAccounts.importAccounts(openPath[0]);
|
event.returnValue = EthoAccounts.importAccounts(openPath[0]);
|
||||||
} else {
|
} else {
|
||||||
event.returnValue = false;
|
event.returnValue = {};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -44,14 +44,16 @@ class Transactions {
|
|||||||
|
|
||||||
$.getJSON("https://richlist.ether1.org/transactions_list.php" + params, function( result ) {
|
$.getJSON("https://richlist.ether1.org/transactions_list.php" + params, function( result ) {
|
||||||
result.data.forEach(element => {
|
result.data.forEach(element => {
|
||||||
ipcRenderer.send('storeTransaction', {
|
if (element.fromaddr && element.toaddr) {
|
||||||
block: element.block.toString(),
|
ipcRenderer.send('storeTransaction', {
|
||||||
txhash: element.txhash.toLowerCase(),
|
block: element.block.toString(),
|
||||||
fromaddr: element.fromaddr.toLowerCase(),
|
txhash: element.txhash.toLowerCase(),
|
||||||
timestamp: element.timestamp,
|
fromaddr: element.fromaddr.toLowerCase(),
|
||||||
toaddr: element.toaddr.toLowerCase(),
|
timestamp: element.timestamp,
|
||||||
value: element.value
|
toaddr: element.toaddr.toLowerCase(),
|
||||||
});
|
value: element.value
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// call the transaction sync for the next address
|
// call the transaction sync for the next address
|
||||||
@@ -128,32 +130,34 @@ class Transactions {
|
|||||||
function(data) {
|
function(data) {
|
||||||
if (data.transactions) {
|
if (data.transactions) {
|
||||||
data.transactions.forEach(element => {
|
data.transactions.forEach(element => {
|
||||||
if ((EthoWallets.getAddressExists(element.from)) || (EthoWallets.getAddressExists(element.to))) {
|
if (element.from && element.to) {
|
||||||
var Transaction = {
|
if ((EthoWallets.getAddressExists(element.from)) || (EthoWallets.getAddressExists(element.to))) {
|
||||||
block: element.blockNumber.toString(),
|
var Transaction = {
|
||||||
txhash: element.hash.toLowerCase(),
|
block: element.blockNumber.toString(),
|
||||||
fromaddr: element.from.toLowerCase(),
|
txhash: element.hash.toLowerCase(),
|
||||||
timestamp: moment.unix(data.timestamp).format('YYYY-MM-DD HH:mm:ss'),
|
fromaddr: element.from.toLowerCase(),
|
||||||
toaddr: element.to.toLowerCase(),
|
timestamp: moment.unix(data.timestamp).format('YYYY-MM-DD HH:mm:ss'),
|
||||||
value: Number(element.value).toExponential(5).toString().replace('+','')
|
toaddr: element.to.toLowerCase(),
|
||||||
}
|
value: Number(element.value).toExponential(5).toString().replace('+','')
|
||||||
|
}
|
||||||
// store transaction and notify about new transactions
|
|
||||||
ipcRenderer.send('storeTransaction', Transaction);
|
// store transaction and notify about new transactions
|
||||||
$(document).trigger("onNewAccountTransaction");
|
ipcRenderer.send('storeTransaction', Transaction);
|
||||||
|
$(document).trigger("onNewAccountTransaction");
|
||||||
iziToast.info({
|
|
||||||
title: 'New Transaction',
|
iziToast.info({
|
||||||
message: vsprintf('Transaction from address %s to address %s was just processed', [Transaction.fromaddr, Transaction.toaddr]),
|
title: 'New Transaction',
|
||||||
position: 'topRight',
|
message: vsprintf('Transaction from address %s to address %s was just processed', [Transaction.fromaddr, Transaction.toaddr]),
|
||||||
timeout: 10000
|
position: 'topRight',
|
||||||
});
|
timeout: 10000
|
||||||
|
});
|
||||||
if (EthoMainGUI.getAppState() == "transactions") {
|
|
||||||
setTimeout(function() {
|
if (EthoMainGUI.getAppState() == "transactions") {
|
||||||
EthoTransactions.renderTransactions();
|
setTimeout(function() {
|
||||||
}, 500);
|
EthoTransactions.renderTransactions();
|
||||||
}
|
}, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ $(document).on("render_wallets", function() {
|
|||||||
position: 'topRight',
|
position: 'topRight',
|
||||||
timeout: 2000
|
timeout: 2000
|
||||||
});
|
});
|
||||||
} else {
|
} else if (ImportResult.success == false) {
|
||||||
EthoMainGUI.showGeneralError(ImportResult.text);
|
EthoMainGUI.showGeneralError(ImportResult.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user