! fixed bug in importing single account to the wallet

! fixed bug when smart contract transactions were causing problems
This commit is contained in:
Taegus
2019-01-20 20:28:24 +01:00
parent 6f78865edc
commit ffaa1a3230
3 changed files with 46 additions and 40 deletions

View File

@@ -44,14 +44,16 @@ class Transactions {
$.getJSON("https://richlist.ether1.org/transactions_list.php" + params, function( result ) {
result.data.forEach(element => {
ipcRenderer.send('storeTransaction', {
block: element.block.toString(),
txhash: element.txhash.toLowerCase(),
fromaddr: element.fromaddr.toLowerCase(),
timestamp: element.timestamp,
toaddr: element.toaddr.toLowerCase(),
value: element.value
});
if (element.fromaddr && element.toaddr) {
ipcRenderer.send('storeTransaction', {
block: element.block.toString(),
txhash: element.txhash.toLowerCase(),
fromaddr: element.fromaddr.toLowerCase(),
timestamp: element.timestamp,
toaddr: element.toaddr.toLowerCase(),
value: element.value
});
}
});
// call the transaction sync for the next address
@@ -128,32 +130,34 @@ class Transactions {
function(data) {
if (data.transactions) {
data.transactions.forEach(element => {
if ((EthoWallets.getAddressExists(element.from)) || (EthoWallets.getAddressExists(element.to))) {
var Transaction = {
block: element.blockNumber.toString(),
txhash: element.hash.toLowerCase(),
fromaddr: element.from.toLowerCase(),
timestamp: moment.unix(data.timestamp).format('YYYY-MM-DD HH:mm:ss'),
toaddr: element.to.toLowerCase(),
value: Number(element.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
});
if (EthoMainGUI.getAppState() == "transactions") {
setTimeout(function() {
EthoTransactions.renderTransactions();
}, 500);
}
if (element.from && element.to) {
if ((EthoWallets.getAddressExists(element.from)) || (EthoWallets.getAddressExists(element.to))) {
var Transaction = {
block: element.blockNumber.toString(),
txhash: element.hash.toLowerCase(),
fromaddr: element.from.toLowerCase(),
timestamp: moment.unix(data.timestamp).format('YYYY-MM-DD HH:mm:ss'),
toaddr: element.to.toLowerCase(),
value: Number(element.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
});
if (EthoMainGUI.getAppState() == "transactions") {
setTimeout(function() {
EthoTransactions.renderTransactions();
}, 500);
}
}
}
});
}