Merge pull request #55 from MyHush/denio
change default server to lite.myhush.org, Prevent negative z balances,Hide 0-balance addresses from the balance, update cli lib
This commit is contained in:
6
lib/Cargo.lock
generated
6
lib/Cargo.lock
generated
@@ -1051,7 +1051,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"silentdragonlitelib 0.1.0 (git+https://github.com/MyHush/silentdragonlite-cli?rev=ded8a41fa886a3bfb6e0cefd69c3aedac2abd2a4)",
|
"silentdragonlitelib 0.1.0 (git+https://github.com/MyHush/silentdragonlite-cli?rev=473d476274077d88104392dc6ad384a06b5d2554)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1467,7 +1467,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "silentdragonlitelib"
|
name = "silentdragonlitelib"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/MyHush/silentdragonlite-cli?rev=ded8a41fa886a3bfb6e0cefd69c3aedac2abd2a4#ded8a41fa886a3bfb6e0cefd69c3aedac2abd2a4"
|
source = "git+https://github.com/MyHush/silentdragonlite-cli?rev=473d476274077d88104392dc6ad384a06b5d2554#473d476274077d88104392dc6ad384a06b5d2554"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bellman 0.1.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
"bellman 0.1.0 (git+https://github.com/DenioD/librustzcash.git?rev=caaee693c47c2ee9ecd1e1546b8fe3c714f342bc)",
|
||||||
@@ -2481,7 +2481,7 @@ dependencies = [
|
|||||||
"checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2"
|
"checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2"
|
||||||
"checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35"
|
"checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35"
|
||||||
"checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d"
|
"checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d"
|
||||||
"checksum silentdragonlitelib 0.1.0 (git+https://github.com/MyHush/silentdragonlite-cli?rev=ded8a41fa886a3bfb6e0cefd69c3aedac2abd2a4)" = "<none>"
|
"checksum silentdragonlitelib 0.1.0 (git+https://github.com/MyHush/silentdragonlite-cli?rev=473d476274077d88104392dc6ad384a06b5d2554)" = "<none>"
|
||||||
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||||
"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"
|
"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"
|
||||||
"checksum sodiumoxide 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585232e78a4fc18133eef9946d3080befdf68b906c51b621531c37e91787fa2b"
|
"checksum sodiumoxide 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585232e78a4fc18133eef9946d3080befdf68b906c51b621531c37e91787fa2b"
|
||||||
|
|||||||
@@ -11,4 +11,4 @@ crate-type = ["staticlib"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.58"
|
libc = "0.2.58"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
silentdragonlitelib = { git = "https://github.com/MyHush/silentdragonlite-cli", rev = "ded8a41fa886a3bfb6e0cefd69c3aedac2abd2a4" }
|
silentdragonlitelib = { git = "https://github.com/MyHush/silentdragonlite-cli", rev = "473d476274077d88104392dc6ad384a06b5d2554" }
|
||||||
|
|||||||
@@ -20,24 +20,29 @@ void BalancesTableModel::setNewData(const QList<QString> zaddrs, const QList<QSt
|
|||||||
// This is a QList deep copy.
|
// This is a QList deep copy.
|
||||||
*unspentOutputs = outputs;
|
*unspentOutputs = outputs;
|
||||||
|
|
||||||
|
// Are there any z or t addresses with balance in the balances table?
|
||||||
|
bool anyz = false;
|
||||||
|
bool anyt = false;
|
||||||
|
|
||||||
// Process the address balances into a list
|
// Process the address balances into a list
|
||||||
delete modeldata;
|
delete modeldata;
|
||||||
modeldata = new QList<std::tuple<QString, CAmount>>();
|
modeldata = new QList<std::tuple<QString, CAmount>>();
|
||||||
std::for_each(balances.keyBegin(), balances.keyEnd(), [=] (auto keyIt) {
|
std::for_each(balances.keyBegin(), balances.keyEnd(), [=, &anyz, &anyt] (auto keyIt) {
|
||||||
modeldata->push_back(std::make_tuple(keyIt, balances.value(keyIt)));
|
modeldata->push_back(std::make_tuple(keyIt, balances.value(keyIt)));
|
||||||
|
if (Settings::isZAddress(keyIt)) {
|
||||||
|
anyz = true;
|
||||||
|
} else if (Settings::isTAddress(keyIt)) {
|
||||||
|
anyt = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add all addresses that have no balances as well
|
// Add all addresses that have no balances, if there are no existing addresses
|
||||||
for (auto zaddr: zaddrs) {
|
if (!anyz && zaddrs.length() > 0) {
|
||||||
if (!balances.contains(zaddr)) {
|
modeldata->push_back(std::make_tuple(zaddrs[0], CAmount::fromqint64(0)));
|
||||||
modeldata->push_back(std::make_tuple(zaddr, CAmount::fromqint64(0)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto taddr: taddrs) {
|
if (!anyt && taddrs.length() > 0) {
|
||||||
if (!balances.contains(taddr)) {
|
modeldata->push_back(std::make_tuple(taddrs[0], CAmount::fromqint64(0)));
|
||||||
modeldata->push_back(std::make_tuple(taddr, CAmount::fromqint64(0)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// And then update the data
|
// And then update the data
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ public:
|
|||||||
bool operator> (const CAmount& other) const {
|
bool operator> (const CAmount& other) const {
|
||||||
return this->amount > other.amount;
|
return this->amount > other.amount;
|
||||||
}
|
}
|
||||||
|
bool operator== (const qint64 other) const {
|
||||||
|
return this->amount == other;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CAMOUNT_H
|
#endif // CAMOUNT_H
|
||||||
|
|||||||
@@ -353,6 +353,9 @@ void Controller::updateUIBalances() {
|
|||||||
|
|
||||||
CAmount balTotal = balT + balZ;
|
CAmount balTotal = balT + balZ;
|
||||||
CAmount balAvailable = balT + balVerified;
|
CAmount balAvailable = balT + balVerified;
|
||||||
|
if (balZ < 0) {
|
||||||
|
balZ = CAmount::fromqint64(0);
|
||||||
|
}
|
||||||
|
|
||||||
// Balances table
|
// Balances table
|
||||||
ui->balSheilded ->setText(balZ.toDecimalhushString());
|
ui->balSheilded ->setText(balZ.toDecimalhushString());
|
||||||
|
|||||||
@@ -457,8 +457,8 @@ void MainWindow::setupSettingsModal() {
|
|||||||
settings.chkFetchPrices->setChecked(Settings::getInstance()->getAllowFetchPrices());
|
settings.chkFetchPrices->setChecked(Settings::getInstance()->getAllowFetchPrices());
|
||||||
|
|
||||||
// List of default servers
|
// List of default servers
|
||||||
|
settings.cmbServer->addItem("https://lite.myhush.org");
|
||||||
settings.cmbServer->addItem("https://hush-lightwallet.de:443");
|
settings.cmbServer->addItem("https://hush-lightwallet.de:443");
|
||||||
settings.cmbServer->addItem("https://lite.myhush.org:443");
|
|
||||||
|
|
||||||
// Load current values into the dialog
|
// Load current values into the dialog
|
||||||
auto conf = Settings::getInstance()->getSettings();
|
auto conf = Settings::getInstance()->getSettings();
|
||||||
@@ -1048,8 +1048,7 @@ void MainWindow::setupReceiveTab() {
|
|||||||
updateTAddrCombo(checked);
|
updateTAddrCombo(checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle the "View all addresses" button as well
|
|
||||||
ui->btnViewAllAddresses->setVisible(checked);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// View all addresses goes to "View all private keys"
|
// View all addresses goes to "View all private keys"
|
||||||
@@ -1065,7 +1064,14 @@ void MainWindow::setupReceiveTab() {
|
|||||||
Settings::saveRestoreTableHeader(viewaddrs.tblAddresses, &d, "viewalladdressestable");
|
Settings::saveRestoreTableHeader(viewaddrs.tblAddresses, &d, "viewalladdressestable");
|
||||||
viewaddrs.tblAddresses->horizontalHeader()->setStretchLastSection(true);
|
viewaddrs.tblAddresses->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
|
||||||
ViewAllAddressesModel model(viewaddrs.tblAddresses, getRPC()->getModel()->getAllTAddresses(), getRPC());
|
QList<QString> allAddresses;
|
||||||
|
if (ui->rdioTAddr->isChecked()) {
|
||||||
|
allAddresses = getRPC()->getModel()->getAllTAddresses();
|
||||||
|
} else {
|
||||||
|
allAddresses = getRPC()->getModel()->getAllZAddresses();
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewAllAddressesModel model(viewaddrs.tblAddresses, allAddresses, getRPC());
|
||||||
viewaddrs.tblAddresses->setModel(&model);
|
viewaddrs.tblAddresses->setModel(&model);
|
||||||
|
|
||||||
QObject::connect(viewaddrs.btnExportAll, &QPushButton::clicked, this, &MainWindow::exportAllKeys);
|
QObject::connect(viewaddrs.btnExportAll, &QPushButton::clicked, this, &MainWindow::exportAllKeys);
|
||||||
@@ -1100,6 +1106,20 @@ void MainWindow::setupReceiveTab() {
|
|||||||
QObject::connect(ui->btnReceiveNewAddr, &QPushButton::clicked, [=] () {
|
QObject::connect(ui->btnReceiveNewAddr, &QPushButton::clicked, [=] () {
|
||||||
if (!rpc->getConnection())
|
if (!rpc->getConnection())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Go over the dropdown and just select the next address that has:
|
||||||
|
// 0 balance and has no labels
|
||||||
|
for (int i=ui->listReceiveAddresses->currentIndex()+1; i < ui->listReceiveAddresses->count(); i++) {
|
||||||
|
QString item = ui->listReceiveAddresses->itemText(i);
|
||||||
|
CAmount bal = getRPC()->getModel()->getAllBalances().value(item, CAmount());
|
||||||
|
if (bal == 0 && AddressBook::getInstance()->getLabelForAddress(item).isEmpty()) {
|
||||||
|
// Pick this one, since it has no balance and no label
|
||||||
|
ui->listReceiveAddresses->setCurrentIndex(i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If none of the existing items were eligible, create a new one.
|
||||||
|
|
||||||
if (ui->rdioZSAddr->isChecked()) {
|
if (ui->rdioZSAddr->isChecked()) {
|
||||||
addNewZaddr(true);
|
addNewZaddr(true);
|
||||||
@@ -1113,7 +1133,7 @@ void MainWindow::setupReceiveTab() {
|
|||||||
if (tab == 2) {
|
if (tab == 2) {
|
||||||
// Switched to receive tab, select the z-addr radio button
|
// Switched to receive tab, select the z-addr radio button
|
||||||
ui->rdioZSAddr->setChecked(true);
|
ui->rdioZSAddr->setChecked(true);
|
||||||
ui->btnViewAllAddresses->setVisible(false);
|
|
||||||
|
|
||||||
// And then select the first one
|
// And then select the first one
|
||||||
ui->listReceiveAddresses->setCurrentIndex(0);
|
ui->listReceiveAddresses->setCurrentIndex(0);
|
||||||
|
|||||||
@@ -770,7 +770,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="btnReceiveNewAddr">
|
<widget class="QPushButton" name="btnReceiveNewAddr">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>New Address</string>
|
<string>Next Address</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ void Settings::saveRestoreTableHeader(QTableView* table, QDialog* d, QString tab
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString Settings::getDefaultServer() {
|
QString Settings::getDefaultServer() {
|
||||||
return "https://hush-lightwallet.de:443";
|
return "https://lite.myhush.org";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::openAddressInExplorer(QString address) {
|
void Settings::openAddressInExplorer(QString address) {
|
||||||
|
|||||||
Reference in New Issue
Block a user