diff --git a/lib/Cargo.lock b/lib/Cargo.lock index b74002a..08604e5 100644 --- a/lib/Cargo.lock +++ b/lib/Cargo.lock @@ -172,7 +172,7 @@ checksum = "cdcf67bb7ba7797a081cd19009948ab533af7c355d5caf1d08c777582d351e9c" [[package]] name = "bellman" version = "0.1.0" -source = "git+https://git.hush.is/hush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37#1a0204113d487cdaaf183c2967010e5214ff9e37" +source = "git+https://git.hush.is/hush/librustzcash.git?rev=acff1444ec373e9c3e37b47ca95bfd358e45255b#acff1444ec373e9c3e37b47ca95bfd358e45255b" dependencies = [ "bit-vec", "blake2s_simd", @@ -497,7 +497,7 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "ff" version = "0.4.0" -source = "git+https://git.hush.is/hush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37#1a0204113d487cdaaf183c2967010e5214ff9e37" +source = "git+https://git.hush.is/hush/librustzcash.git?rev=acff1444ec373e9c3e37b47ca95bfd358e45255b#acff1444ec373e9c3e37b47ca95bfd358e45255b" dependencies = [ "byteorder", "ff_derive", @@ -507,7 +507,7 @@ dependencies = [ [[package]] name = "ff_derive" version = "0.3.0" -source = "git+https://git.hush.is/hush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37#1a0204113d487cdaaf183c2967010e5214ff9e37" +source = "git+https://git.hush.is/hush/librustzcash.git?rev=acff1444ec373e9c3e37b47ca95bfd358e45255b#acff1444ec373e9c3e37b47ca95bfd358e45255b" dependencies = [ "num-bigint", "num-integer", @@ -665,7 +665,7 @@ dependencies = [ [[package]] name = "group" version = "0.1.0" -source = "git+https://git.hush.is/hush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37#1a0204113d487cdaaf183c2967010e5214ff9e37" +source = "git+https://git.hush.is/hush/librustzcash.git?rev=acff1444ec373e9c3e37b47ca95bfd358e45255b#acff1444ec373e9c3e37b47ca95bfd358e45255b" dependencies = [ "ff", "rand 0.7.3", @@ -1132,7 +1132,7 @@ dependencies = [ [[package]] name = "pairing" version = "0.14.2" -source = "git+https://git.hush.is/hush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37#1a0204113d487cdaaf183c2967010e5214ff9e37" +source = "git+https://git.hush.is/hush/librustzcash.git?rev=acff1444ec373e9c3e37b47ca95bfd358e45255b#acff1444ec373e9c3e37b47ca95bfd358e45255b" dependencies = [ "byteorder", "ff", @@ -1849,7 +1849,7 @@ dependencies = [ [[package]] name = "silentdragonlitelib" version = "0.1.0" -source = "git+https://git.hush.is/hush/silentdragonlite-cli?rev=1334c89e0f4ddd23725020e16753d0ea95c09bf5#1334c89e0f4ddd23725020e16753d0ea95c09bf5" +source = "git+https://git.hush.is/hush/silentdragonlite-cli?rev=8fc0dc539a3b29655f0538c671b42feee5205641#8fc0dc539a3b29655f0538c671b42feee5205641" dependencies = [ "base58", "bellman", @@ -2695,7 +2695,7 @@ dependencies = [ [[package]] name = "zcash_client_backend" version = "0.0.0" -source = "git+https://git.hush.is/hush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37#1a0204113d487cdaaf183c2967010e5214ff9e37" +source = "git+https://git.hush.is/hush/librustzcash.git?rev=acff1444ec373e9c3e37b47ca95bfd358e45255b#acff1444ec373e9c3e37b47ca95bfd358e45255b" dependencies = [ "bech32", "bs58", @@ -2711,7 +2711,7 @@ dependencies = [ [[package]] name = "zcash_primitives" version = "0.0.0" -source = "git+https://git.hush.is/hush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37#1a0204113d487cdaaf183c2967010e5214ff9e37" +source = "git+https://git.hush.is/hush/librustzcash.git?rev=acff1444ec373e9c3e37b47ca95bfd358e45255b#acff1444ec373e9c3e37b47ca95bfd358e45255b" dependencies = [ "aes", "blake2b_simd", @@ -2734,7 +2734,7 @@ dependencies = [ [[package]] name = "zcash_proofs" version = "0.0.0" -source = "git+https://git.hush.is/hush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37#1a0204113d487cdaaf183c2967010e5214ff9e37" +source = "git+https://git.hush.is/hush/librustzcash.git?rev=acff1444ec373e9c3e37b47ca95bfd358e45255b#acff1444ec373e9c3e37b47ca95bfd358e45255b" dependencies = [ "bellman", "blake2b_simd", diff --git a/lib/Cargo.toml b/lib/Cargo.toml index c25ef8d..c2e044a 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -12,4 +12,4 @@ crate-type = ["staticlib"] libc = "0.2.58" lazy_static = "1.4.0" blake3 = "0.3.4" -silentdragonlitelib = { git = "https://git.hush.is/hush/silentdragonlite-cli", rev = "1334c89e0f4ddd23725020e16753d0ea95c09bf5" } +silentdragonlitelib = { git = "https://git.hush.is/hush/silentdragonlite-cli", rev = "8fc0dc539a3b29655f0538c671b42feee5205641" } diff --git a/src/controller.cpp b/src/controller.cpp index f419485..543a67c 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -221,6 +221,7 @@ void Controller::fillTxJsonParams(json& allRecepients, Tx tx, bool isChatMessage json rec = json::object(); rec["address"] = toAddr.addr.toStdString(); rec["amount"] = toAddr.amount.toqint64(); + rec["fee"] = tx.fee.toqint64(); if (Settings::isZAddress(toAddr.addr) && !toAddr.memo.trimmed().isEmpty()) rec["memo"] = toAddr.memo.toStdString(); diff --git a/src/mainwindow.h b/src/mainwindow.h index 31ab6e1..9ed7558 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -161,6 +161,7 @@ private: void addAddressSection(); void maxAmountChecked(int checked); + void toggleMinerFeeEditable(int state); void editSchedule(); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index db12534..4a204dc 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -59,7 +59,7 @@ - 5 + 2 @@ -93,6 +93,7 @@ + 75 true @@ -737,6 +738,7 @@ + 75 true @@ -749,6 +751,7 @@ + 75 true @@ -877,8 +880,8 @@ Send - - + + false @@ -907,6 +910,7 @@ + 75 true @@ -945,7 +949,7 @@ - + Send To @@ -979,8 +983,8 @@ 0 0 - 1301 - 493 + 1331 + 527 @@ -1163,24 +1167,27 @@ - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + Use custom Fee + + - + + + + Qt::Horizontal + + + + 1198 + 20 + + + + + @@ -1972,7 +1979,7 @@ 0 0 1379 - 24 + 22 diff --git a/src/sendtab.cpp b/src/sendtab.cpp index 2bd4fab..96153d8 100644 --- a/src/sendtab.cpp +++ b/src/sendtab.cpp @@ -31,6 +31,9 @@ void MainWindow::setupSendTab() { // Max available Checkbox QObject::connect(ui->Max1, &QCheckBox::stateChanged, this, &MainWindow::maxAmountChecked); + //Custom Fee Checkbox + QObject::connect(ui->customFee, &QCheckBox::stateChanged, this, &MainWindow::toggleMinerFeeEditable); + // The first Address button QObject::connect(ui->Address1, &QLineEdit::textChanged, [=] (auto text) { this->addressChanged(1, text); @@ -57,8 +60,8 @@ void MainWindow::setupSendTab() { this->amountChanged(1, text); }); - // Fee amount changed ui->minerFeeAmt->setReadOnly(true); + // Fee amount changed QObject::connect(ui->minerFeeAmt, &QLineEdit::textChanged, [=](auto txt) { CAmount fee = CAmount::fromDecimalString(txt); @@ -520,7 +523,6 @@ Tx MainWindow::createTxFromSendPage() { CAmount amt; - // Make sure it parses amtStr.toDouble(&ok); if (!ok) { @@ -534,16 +536,21 @@ Tx MainWindow::createTxFromSendPage() { QString memo = ui->sendToWidgets->findChild(QString("MemoTxt") % QString::number(i+1))->text().trimmed(); - - tx.toAddrs.push_back( ToFields{addr, amt, memo} ); } + // Allow Custom Fee in SendTab + bool customFee = ui->customFee->isChecked(); - - tx.fee = Settings::getMinerFee(); + CAmount fee ; + if (customFee) { + QString feeStr = ui->minerFeeAmt->text(); + tx.fee = CAmount::fromDecimalString(feeStr); + }else{ + tx.fee = Settings::getMinerFee(); + } return tx; } @@ -797,11 +804,20 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) { confirm.lblRecurringDesc->setText(rpi->getScheduleDescription()); } + CAmount defaultFee = Settings::getMinerFee(); + if (tx.fee.toDecimalString() != defaultFee.toDecimalString() ) { + auto customFeeWarning = new QLabel(confirm.sendToAddrs); + customFeeWarning->setObjectName(QStringLiteral("Custom Fee")); + customFeeWarning->setText(tr("You are using a custom Fee")); + customFeeWarning->setStyleSheet("color: red;"); + confirm.gridLayout->addWidget(customFeeWarning); + confirm.gridLayout->rowStretch(1); + row++; +} + // Syncing warning confirm.syncingWarning->setVisible(Settings::getInstance()->isSyncing()); - - // Show the dialog and submit it if the user confirms return d.exec() == QDialog::Accepted; } @@ -956,9 +972,24 @@ QString MainWindow::doSendTxValidations(Tx tx) { .arg(available.toDecimalhushString(), total.toDecimalhushString()); } + if (total == 0) { + return tr("Value or fee must be > 0\n\nValue and fee cannot both be 0."); + + } + return ""; } void MainWindow::cancelButton() { clearSendForm(); } + +//Check for custom fee checkbox +void MainWindow::toggleMinerFeeEditable(int state) { + if (state == Qt::Checked) { + ui->minerFeeAmt->setReadOnly(false); + } else { + ui->minerFeeAmt->setReadOnly(true); + ui->minerFeeAmt->setText(Settings::getMinerFee().toDecimalString()); + } +} \ No newline at end of file