First implementation of color based on wallet value & Clean up
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
<th scope="col" class="no-sort"></th>
|
<th scope="col" class="no-sort"></th>
|
||||||
<th scope="col">Name</th>
|
<th scope="col">Name</th>
|
||||||
<th scope="col">Address</th>
|
<th scope="col">Address</th>
|
||||||
<th scope="col"class="no-sort"></th>
|
<th scope="col" class="no-sort"></th>
|
||||||
<th scope="col" data-sort-method='number'>Balance</th>
|
<th scope="col" data-sort-method='number'>Balance</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
<i class="fas fa-qrcode"></i>
|
<i class="fas fa-qrcode"></i>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td>{{balance}}</td>
|
<td id="colorbal" style="color: red;">{{balance}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/addressData}}
|
{{/addressData}}
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -76,32 +76,32 @@
|
|||||||
|
|
||||||
<!-- The modal to change wallet name -->
|
<!-- The modal to change wallet name -->
|
||||||
<div id="dlgChangeWalletName" class="modalDialog" data-izimodal-title="Wallet Name" data-izimodal-subtitle="Enter the name for this address" data-izimodal-icon="icon-home">
|
<div id="dlgChangeWalletName" class="modalDialog" data-izimodal-title="Wallet Name" data-izimodal-subtitle="Enter the name for this address" data-izimodal-icon="icon-home">
|
||||||
<div class="modalBody">
|
<div class="modalBody">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputWalletName">Type Name:</label>
|
<label for="inputWalletName">Type Name:</label>
|
||||||
<input type="text" class="form-control" id="inputWalletName">
|
<input type="text" class="form-control" id="inputWalletName">
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnChangeWalletNameConfirm">Confirm</button>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnChangeWalletNameConfirm">Confirm</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- The modal to import from private key -->
|
<!-- The modal to import from private key -->
|
||||||
<div id="dlgImportFromPrivateKey" class="modalDialog" data-izimodal-title="Import private key" data-izimodal-subtitle="Import account from private key" data-izimodal-icon="icon-home">
|
<div id="dlgImportFromPrivateKey" class="modalDialog" data-izimodal-title="Import private key" data-izimodal-subtitle="Import account from private key" data-izimodal-icon="icon-home">
|
||||||
<div class="modalBody">
|
<div class="modalBody">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputPrivateKey">Private Key:</label>
|
<label for="inputPrivateKey">Private Key:</label>
|
||||||
<input type="password" class="form-control" id="inputPrivateKey">
|
<input type="password" class="form-control" id="inputPrivateKey">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="walletPasswordSecond">Account Password:</label>
|
||||||
|
<input type="password" class="form-control" id="keyPasswordFirst">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="walletPasswordSecond">Confirm Password:</label>
|
||||||
|
<input type="password" class="form-control" id="keyPasswordSecond">
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnImportFromPrivateKeyConfirm">Import</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label for="walletPasswordSecond">Account Password:</label>
|
|
||||||
<input type="password" class="form-control" id="keyPasswordFirst">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="walletPasswordSecond">Confirm Password:</label>
|
|
||||||
<input type="password" class="form-control" id="keyPasswordSecond">
|
|
||||||
</div>
|
|
||||||
<button type="button" class="btn btn-etho btn-dialog-confirm" id="btnImportFromPrivateKeyConfirm">Import</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span id="nodestorage" style="display:none;">Loading</span>
|
<span id="nodestorage" style="display:none;">Loading</span>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
// In renderer process (web page).
|
// In renderer process (web page).
|
||||||
const {ipcRenderer} = require("electron");
|
const {
|
||||||
|
ipcRenderer
|
||||||
|
} = require("electron");
|
||||||
|
|
||||||
class Blockchain {
|
class Blockchain {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -8,7 +10,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getBlock(blockToGet, includeData, clbError, clbSuccess) {
|
getBlock(blockToGet, includeData, clbError, clbSuccess) {
|
||||||
web3Local.eth.getBlock(blockToGet, includeData, function (error, block) {
|
web3Local.eth.getBlock(blockToGet, includeData, function(error, block) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError(error);
|
clbError(error);
|
||||||
} else {
|
} else {
|
||||||
@@ -18,7 +20,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAccounts(clbError, clbSuccess) {
|
getAccounts(clbError, clbSuccess) {
|
||||||
web3Local.eth.getAccounts(function (err, res) {
|
web3Local.eth.getAccounts(function(err, res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
clbError(err);
|
clbError(err);
|
||||||
} else {
|
} else {
|
||||||
@@ -32,7 +34,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getTransaction(thxid, clbError, clbSuccess) {
|
getTransaction(thxid, clbError, clbSuccess) {
|
||||||
web3Local.eth.getTransaction(thxid, function (error, result) {
|
web3Local.eth.getTransaction(thxid, function(error, result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError(error);
|
clbError(error);
|
||||||
} else {
|
} else {
|
||||||
@@ -42,7 +44,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getTranasctionFee(fromAddress, toAddress, value, clbError, clbSuccess) {
|
getTranasctionFee(fromAddress, toAddress, value, clbError, clbSuccess) {
|
||||||
web3Local.eth.getTransactionCount(fromAddress, function (error, result) {
|
web3Local.eth.getTransactionCount(fromAddress, function(error, result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError(error);
|
clbError(error);
|
||||||
} else {
|
} else {
|
||||||
@@ -54,12 +56,12 @@ class Blockchain {
|
|||||||
nonce: result
|
nonce: result
|
||||||
};
|
};
|
||||||
|
|
||||||
web3Local.eth.estimateGas(RawTransaction, function (error, result) {
|
web3Local.eth.estimateGas(RawTransaction, function(error, result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError(error);
|
clbError(error);
|
||||||
} else {
|
} else {
|
||||||
var usedGas = result + 1;
|
var usedGas = result + 1;
|
||||||
web3Local.eth.getGasPrice(function (error, result) {
|
web3Local.eth.getGasPrice(function(error, result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError(error);
|
clbError(error);
|
||||||
} else {
|
} else {
|
||||||
@@ -73,11 +75,11 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prepareTransaction(password, fromAddress, toAddress, value, clbError, clbSuccess) {
|
prepareTransaction(password, fromAddress, toAddress, value, clbError, clbSuccess) {
|
||||||
web3Local.eth.personal.unlockAccount(fromAddress, password, function (error, result) {
|
web3Local.eth.personal.unlockAccount(fromAddress, password, function(error, result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError("Wrong password for the selected address!");
|
clbError("Wrong password for the selected address!");
|
||||||
} else {
|
} else {
|
||||||
web3Local.eth.getTransactionCount(fromAddress, "pending", function (error, result) {
|
web3Local.eth.getTransactionCount(fromAddress, "pending", function(error, result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError(error);
|
clbError(error);
|
||||||
} else {
|
} else {
|
||||||
@@ -89,17 +91,17 @@ class Blockchain {
|
|||||||
nonce: result
|
nonce: result
|
||||||
};
|
};
|
||||||
|
|
||||||
web3Local.eth.estimateGas(RawTransaction, function (error, result) {
|
web3Local.eth.estimateGas(RawTransaction, function(error, result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError(error);
|
clbError(error);
|
||||||
} else {
|
} else {
|
||||||
RawTransaction.gas = result + 1;
|
RawTransaction.gas = result + 1;
|
||||||
web3Local.eth.getGasPrice(function (error, result) {
|
web3Local.eth.getGasPrice(function(error, result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError(error);
|
clbError(error);
|
||||||
} else {
|
} else {
|
||||||
RawTransaction.gasPrice = result;
|
RawTransaction.gasPrice = result;
|
||||||
web3Local.eth.signTransaction(RawTransaction, fromAddress, function (error, result) {
|
web3Local.eth.signTransaction(RawTransaction, fromAddress, function(error, result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError(error);
|
clbError(error);
|
||||||
} else {
|
} else {
|
||||||
@@ -117,7 +119,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sendTransaction(rawTransaction, clbError, clbSuccess) {
|
sendTransaction(rawTransaction, clbError, clbSuccess) {
|
||||||
web3Local.eth.sendSignedTransaction(rawTransaction, function (error, result) {
|
web3Local.eth.sendSignedTransaction(rawTransaction, function(error, result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError(error);
|
clbError(error);
|
||||||
} else {
|
} else {
|
||||||
@@ -134,7 +136,7 @@ class Blockchain {
|
|||||||
var wallets = EthoDatatabse.getWallets();
|
var wallets = EthoDatatabse.getWallets();
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
|
|
||||||
web3Local.eth.getAccounts(function (err, res) {
|
web3Local.eth.getAccounts(function(err, res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
clbError(err);
|
clbError(err);
|
||||||
} else {
|
} else {
|
||||||
@@ -160,7 +162,7 @@ class Blockchain {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function updateBalance(index) {
|
function updateBalance(index) {
|
||||||
web3Local.eth.getBalance(rendererData.addressData[index].address, function (error, balance) {
|
web3Local.eth.getBalance(rendererData.addressData[index].address, function(error, balance) {
|
||||||
rendererData.addressData[index].balance = parseFloat(web3Local.utils.fromWei(balance, "ether")).toFixed(2);
|
rendererData.addressData[index].balance = parseFloat(web3Local.utils.fromWei(balance, "ether")).toFixed(2);
|
||||||
rendererData.sumBalance = rendererData.sumBalance + parseFloat(web3Local.utils.fromWei(balance, "ether"));
|
rendererData.sumBalance = rendererData.sumBalance + parseFloat(web3Local.utils.fromWei(balance, "ether"));
|
||||||
|
|
||||||
@@ -170,6 +172,7 @@ class Blockchain {
|
|||||||
} else {
|
} else {
|
||||||
rendererData.sumBalance = parseFloat(rendererData.sumBalance).toFixed(2);
|
rendererData.sumBalance = parseFloat(rendererData.sumBalance).toFixed(2);
|
||||||
clbSuccess(rendererData);
|
clbSuccess(rendererData);
|
||||||
|
document.getElementById('colorbal').style.color = "#49e449";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -182,7 +185,7 @@ class Blockchain {
|
|||||||
var wallets = EthoDatatabse.getWallets();
|
var wallets = EthoDatatabse.getWallets();
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
|
|
||||||
web3Local.eth.getAccounts(function (err, res) {
|
web3Local.eth.getAccounts(function(err, res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
clbError(err);
|
clbError(err);
|
||||||
} else {
|
} else {
|
||||||
@@ -204,7 +207,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createNewAccount(password, clbError, clbSuccess) {
|
createNewAccount(password, clbError, clbSuccess) {
|
||||||
web3Local.eth.personal.newAccount(password, function (error, account) {
|
web3Local.eth.personal.newAccount(password, function(error, account) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError(error);
|
clbError(error);
|
||||||
} else {
|
} else {
|
||||||
@@ -214,7 +217,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
importFromPrivateKey(privateKey, keyPassword, clbError, clbSuccess) {
|
importFromPrivateKey(privateKey, keyPassword, clbError, clbSuccess) {
|
||||||
web3Local.eth.personal.importRawKey(privateKey, keyPassword, function (error, account) {
|
web3Local.eth.personal.importRawKey(privateKey, keyPassword, function(error, account) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError(error);
|
clbError(error);
|
||||||
} else {
|
} else {
|
||||||
@@ -224,13 +227,13 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
subsribePendingTransactions(clbError, clbSuccess, clbData) {
|
subsribePendingTransactions(clbError, clbSuccess, clbData) {
|
||||||
this.txSubscribe = web3Local.eth.subscribe("pendingTransactions", function (error, result) {
|
this.txSubscribe = web3Local.eth.subscribe("pendingTransactions", function(error, result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError(error);
|
clbError(error);
|
||||||
} else {
|
} else {
|
||||||
clbSuccess(result);
|
clbSuccess(result);
|
||||||
}
|
}
|
||||||
}).on("data", function (transaction) {
|
}).on("data", function(transaction) {
|
||||||
if (clbData) {
|
if (clbData) {
|
||||||
clbData(transaction);
|
clbData(transaction);
|
||||||
}
|
}
|
||||||
@@ -239,7 +242,7 @@ class Blockchain {
|
|||||||
|
|
||||||
unsubsribePendingTransactions(clbError, clbSuccess) {
|
unsubsribePendingTransactions(clbError, clbSuccess) {
|
||||||
if (this.txSubscribe) {
|
if (this.txSubscribe) {
|
||||||
this.txSubscribe.unsubscribe(function (error, success) {
|
this.txSubscribe.unsubscribe(function(error, success) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError(error);
|
clbError(error);
|
||||||
} else {
|
} else {
|
||||||
@@ -250,13 +253,13 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
subsribeNewBlockHeaders(clbError, clbSuccess, clbData) {
|
subsribeNewBlockHeaders(clbError, clbSuccess, clbData) {
|
||||||
this.bhSubscribe = web3Local.eth.subscribe("newBlockHeaders", function (error, result) {
|
this.bhSubscribe = web3Local.eth.subscribe("newBlockHeaders", function(error, result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError(error);
|
clbError(error);
|
||||||
} else {
|
} else {
|
||||||
clbSuccess(result);
|
clbSuccess(result);
|
||||||
}
|
}
|
||||||
}).on("data", function (blockHeader) {
|
}).on("data", function(blockHeader) {
|
||||||
if (clbData) {
|
if (clbData) {
|
||||||
clbData(blockHeader);
|
clbData(blockHeader);
|
||||||
}
|
}
|
||||||
@@ -265,7 +268,7 @@ class Blockchain {
|
|||||||
|
|
||||||
unsubsribeNewBlockHeaders(clbError, clbSuccess) {
|
unsubsribeNewBlockHeaders(clbError, clbSuccess) {
|
||||||
if (this.bhSubscribe) {
|
if (this.bhSubscribe) {
|
||||||
this.bhSubscribe.unsubscribe(function (error, success) {
|
this.bhSubscribe.unsubscribe(function(error, success) {
|
||||||
if (error) {
|
if (error) {
|
||||||
clbError(error);
|
clbError(error);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user