Fix Transaction decimal
This commit is contained in:
6
lib/Cargo.lock
generated
6
lib/Cargo.lock
generated
@@ -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)" = "<none>"
|
||||
"checksum silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=3a74fda1da22f35da8dc5973eb782338899810cb)" = "<none>"
|
||||
"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"
|
||||
|
||||
@@ -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" }
|
||||
|
||||
BIN
silentdragonlite
BIN
silentdragonlite
Binary file not shown.
@@ -267,7 +267,7 @@ bool Controller::processUnspent(const json& reply, QMap<QString, double>* balanc
|
||||
|
||||
newUtxos->push_back(UnspentOutput{ qsAddr, txid, amount, block, true });
|
||||
|
||||
(*balancesMap)[qsAddr] = ((*balancesMap)[qsAddr] + it["value"].get<json::number_float_t>()) /10000000;
|
||||
(*balancesMap)[qsAddr] = ((*balancesMap)[qsAddr] + (it["value"].get<json::number_float_t>()) /10000000);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -337,7 +337,7 @@ void Controller::refreshTransactions() {
|
||||
|
||||
for (auto o: it["outgoing_metadata"].get<json::array_t>()) {
|
||||
QString address = QString::fromStdString(o["address"]);
|
||||
double amount = it["value"].get<json::number_float_t>(); // Sent items are -ve
|
||||
double amount = -1 * o ["value"].get<json::number_float_t>() /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<json::number_float_t>(),
|
||||
""
|
||||
it["amount"].get<json::number_float_t>() /10000000,
|
||||
"."
|
||||
});
|
||||
|
||||
TransactionItem tx{
|
||||
|
||||
@@ -20,6 +20,7 @@ struct WatchedTx {
|
||||
std::function<void(QString, QString)> error;
|
||||
};
|
||||
|
||||
|
||||
struct MigrationStatus {
|
||||
bool available; // Whether the underlying hushd supports migration?
|
||||
bool enabled;
|
||||
|
||||
@@ -905,7 +905,7 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_5">
|
||||
<attribute name="title">
|
||||
<string>hushd</string>
|
||||
<string>Hush Daemon</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
|
||||
@@ -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<int> 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) {
|
||||
|
||||
@@ -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<QLineEdit*>(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<QLineEdit*>(QString("Amount") % QString::number(i+1))->text().trimmed().toDouble();
|
||||
totalAmt += amt;
|
||||
QString memo = ui->sendToWidgets->findChild<QLabel*>(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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -769,6 +769,8 @@ void AppDataServer::processGetInfo(QJsonObject jobj, MainWindow* mainWindow, std
|
||||
void AppDataServer::processGetTransactions(MainWindow* mainWindow, std::shared_ptr<ClientWebSocket> pClient) {
|
||||
QJsonArray txns;
|
||||
auto model = mainWindow->getRPC()->getTransactionsModel();
|
||||
qDebug() << "processGetTransactions";
|
||||
|
||||
|
||||
// Add transactions
|
||||
for (int i = 0; i < model->rowCount(QModelIndex()) && i < Settings::getMaxMobileAppTxns(); i++) {
|
||||
|
||||
Reference in New Issue
Block a user