diff --git a/lib/Cargo.lock b/lib/Cargo.lock index 26c09ac..9710859 100644 --- a/lib/Cargo.lock +++ b/lib/Cargo.lock @@ -1051,7 +1051,7 @@ version = "0.1.0" dependencies = [ "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)", - "silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=11d5d15e8b03c0a5b6eae1af00ac17fb7660a004)", + "silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=3a74fda1da22f35da8dc5973eb782338899810cb)", ] [[package]] @@ -1467,7 +1467,7 @@ dependencies = [ [[package]] name = "silentdragonlitelib" version = "0.1.0" -source = "git+https://github.com/DenioD/silentdragonlite-cli?rev=11d5d15e8b03c0a5b6eae1af00ac17fb7660a004#11d5d15e8b03c0a5b6eae1af00ac17fb7660a004" +source = "git+https://github.com/DenioD/silentdragonlite-cli?rev=3a74fda1da22f35da8dc5973eb782338899810cb#3a74fda1da22f35da8dc5973eb782338899810cb" dependencies = [ "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)", @@ -2481,7 +2481,7 @@ dependencies = [ "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 sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" -"checksum silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=11d5d15e8b03c0a5b6eae1af00ac17fb7660a004)" = "" +"checksum silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=3a74fda1da22f35da8dc5973eb782338899810cb)" = "" "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 sodiumoxide 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585232e78a4fc18133eef9946d3080befdf68b906c51b621531c37e91787fa2b" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 3ee29ec..8313af5 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -11,4 +11,4 @@ crate-type = ["staticlib"] [dependencies] libc = "0.2.58" lazy_static = "1.4.0" -silentdragonlitelib = { git = "https://github.com/DenioD/silentdragonlite-cli", rev = "11d5d15e8b03c0a5b6eae1af00ac17fb7660a004" } +silentdragonlitelib = { git = "https://github.com/DenioD/silentdragonlite-cli", rev = "3a74fda1da22f35da8dc5973eb782338899810cb" } diff --git a/silentdragonlite b/silentdragonlite deleted file mode 100755 index 53f6094..0000000 Binary files a/silentdragonlite and /dev/null differ diff --git a/src/controller.cpp b/src/controller.cpp index 62a2bee..562096b 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -267,7 +267,7 @@ bool Controller::processUnspent(const json& reply, QMap* balanc newUtxos->push_back(UnspentOutput{ qsAddr, txid, amount, block, true }); - (*balancesMap)[qsAddr] = ((*balancesMap)[qsAddr] + it["value"].get()) /10000000; + (*balancesMap)[qsAddr] = ((*balancesMap)[qsAddr] + (it["value"].get()) /10000000); } }; @@ -337,7 +337,7 @@ void Controller::refreshTransactions() { for (auto o: it["outgoing_metadata"].get()) { QString address = QString::fromStdString(o["address"]); - double amount = it["value"].get(); // Sent items are -ve + double amount = -1 * o ["value"].get() /10000000; // Sent items are -ve QString memo; if (!o["memo"].is_null()) { @@ -369,8 +369,8 @@ void Controller::refreshTransactions() { items.push_back(TransactionItemDetail{ address, - it["amount"].get(), - "" + it["amount"].get() /10000000, + "." }); TransactionItem tx{ diff --git a/src/controller.h b/src/controller.h index 852ee6b..6be3630 100644 --- a/src/controller.h +++ b/src/controller.h @@ -20,6 +20,7 @@ struct WatchedTx { std::function error; }; + struct MigrationStatus { bool available; // Whether the underlying hushd supports migration? bool enabled; diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 31e896e..d1af9c2 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -905,7 +905,7 @@ - hushd + Hush Daemon diff --git a/src/recurring.cpp b/src/recurring.cpp index a7d1a4b..403af79 100644 --- a/src/recurring.cpp +++ b/src/recurring.cpp @@ -201,8 +201,8 @@ void Recurring::updateInfoWithTx(RecurringPaymentInfo* r, Tx tx) { r->toAddr = tx.toAddrs[0].addr; r->memo = tx.toAddrs[0].memo; r->fromAddr = tx.fromAddr; - if (r->currency.isEmpty() || r->currency == "USD") { - r->currency = "USD"; + if (r->currency.isEmpty() || r->currency == "usd") { + r->currency = "usd"; r->amt = tx.toAddrs[0].amount * Settings::getInstance()->gethushPrice(); } else { @@ -461,7 +461,7 @@ void Recurring::processMultiplePending(RecurringPaymentInfo rpi, MainWindow* mai void Recurring::executeRecurringPayment(MainWindow* main, RecurringPaymentInfo rpi, QList paymentNumbers) { // Amount is in USD or hush? auto amt = rpi.amt; - if (rpi.currency == "USD") { + if (rpi.currency == "usd") { // If there is no price, then fail the payment if (Settings::getInstance()->gethushPrice() == 0) { for (auto paymentNumber: paymentNumbers) { diff --git a/src/sendtab.cpp b/src/sendtab.cpp index 578050c..ac0a9f4 100644 --- a/src/sendtab.cpp +++ b/src/sendtab.cpp @@ -511,22 +511,17 @@ Tx MainWindow::createTxFromSendPage() { // If address is sprout, then we can't send change to sapling, because of turnstile. sendChangeToSapling = sendChangeToSapling && !Settings::getInstance()->isSproutAddress(addr); - - QString amtStr = ui->sendToWidgets->findChild(QString("Amount") % QString::number(i+1))->text().trimmed(); - if (amtStr.isEmpty()) { - amtStr = "-1";; // The user didn't specify an amount - } - - double amt = amtStr.toDouble(); + double amt = ui->sendToWidgets->findChild(QString("Amount") % QString::number(i+1))->text().trimmed().toDouble(); totalAmt += amt; QString memo = ui->sendToWidgets->findChild(QString("MemoTxt") % QString::number(i+1))->text().trimmed(); - tx.toAddrs.push_back( ToFields{addr, amt, memo} ); + tx.toAddrs.push_back( ToFields{addr, amt, memo,} ); } if (Settings::getInstance()->getAllowCustomFees()) { tx.fee = ui->minerFeeAmt->text().toDouble(); - } else { + } + else { tx.fee = Settings::getMinerFee(); } diff --git a/src/settings.h b/src/settings.h index 6e0c28d..d1af60f 100644 --- a/src/settings.h +++ b/src/settings.h @@ -99,7 +99,7 @@ public: static bool isTAddress(QString addr); static QString getDecimalString(double amt); - static QString getUSDFormat(double usdAmt); + static QString getUSDFormat(double bal); static QString getUSDFromhushAmount(double bal); static QString gethushDisplayFormat(double bal); diff --git a/src/txtablemodel.cpp b/src/txtablemodel.cpp index dc1b19b..44384c5 100644 --- a/src/txtablemodel.cpp +++ b/src/txtablemodel.cpp @@ -105,7 +105,7 @@ bool TxTableModel::exportToCsv(QString fileName) const { case Column::Confirmations: return QString::number(dat.confirmations); case Column::Amount: { // Sum up all the amounts - qint64 total = 0; + double total = 0; for (int i=0; i < dat.items.length(); i++) { total += dat.items[i].amount; } @@ -141,7 +141,7 @@ bool TxTableModel::exportToCsv(QString fileName) const { case Column::Confirmations: return QString("%1 Network Confirmations").arg(QString::number(dat.confirmations)); case Column::Amount: { // Sum up all the amounts - qint64 total = 0; + double total = 0; for (int i=0; i < dat.items.length(); i++) { total += dat.items[i].amount; } @@ -237,7 +237,7 @@ QString TxTableModel::getType(int row) const { QString TxTableModel::getAmt(int row) const { auto dat = modeldata->at(row); - qint64 total = 0; + double total = 0; for (int i=0; i < dat.items.length(); i++) { total += dat.items[i].amount; } diff --git a/src/websockets.cpp b/src/websockets.cpp index bb5da93..27c6772 100644 --- a/src/websockets.cpp +++ b/src/websockets.cpp @@ -769,6 +769,8 @@ void AppDataServer::processGetInfo(QJsonObject jobj, MainWindow* mainWindow, std void AppDataServer::processGetTransactions(MainWindow* mainWindow, std::shared_ptr pClient) { QJsonArray txns; auto model = mainWindow->getRPC()->getTransactionsModel(); + qDebug() << "processGetTransactions"; + // Add transactions for (int i = 0; i < model->rowCount(QModelIndex()) && i < Settings::getMaxMobileAppTxns(); i++) {