@@ -5,6 +5,7 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "camount.h"
|
#include "camount.h"
|
||||||
#include "websockets.h"
|
#include "websockets.h"
|
||||||
|
#include "sietch.h"
|
||||||
|
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
|
||||||
@@ -84,19 +85,39 @@ void Controller::setConnection(Connection* c) {
|
|||||||
void Controller::fillTxJsonParams(json& allRecepients, Tx tx) {
|
void Controller::fillTxJsonParams(json& allRecepients, Tx tx) {
|
||||||
Q_ASSERT(allRecepients.is_array());
|
Q_ASSERT(allRecepients.is_array());
|
||||||
|
|
||||||
|
|
||||||
// For each addr/amt/memo, construct the JSON and also build the confirm dialog box
|
// For each addr/amt/memo, construct the JSON and also build the confirm dialog box
|
||||||
for (int i=0; i < tx.toAddrs.size(); i++) {
|
for (int i=0; i < tx.toAddrs.size(); i++) {
|
||||||
auto toAddr = tx.toAddrs[i];
|
auto toAddr = tx.toAddrs[i];
|
||||||
|
|
||||||
// Construct the JSON params
|
// Construct the JSON params
|
||||||
json rec = json::object();
|
json rec = json::object();
|
||||||
|
json dust = json::object();
|
||||||
|
|
||||||
rec["address"] = toAddr.addr.toStdString();
|
rec["address"] = toAddr.addr.toStdString();
|
||||||
rec["amount"] = toAddr.amount.toqint64();
|
rec["amount"] = toAddr.amount.toqint64();
|
||||||
if (Settings::isZAddress(toAddr.addr) && !toAddr.memo.trimmed().isEmpty())
|
if (Settings::isZAddress(toAddr.addr) && !toAddr.memo.trimmed().isEmpty())
|
||||||
rec["memo"] = toAddr.memo.toStdString();
|
rec["memo"] = toAddr.memo.toStdString();
|
||||||
|
|
||||||
allRecepients.push_back(rec);
|
unsigned int MIN_ZOUTS=8;
|
||||||
|
while (allRecepients.size() < MIN_ZOUTS) {
|
||||||
|
QString zdust1;
|
||||||
|
zdust1 = randomSietchZaddr();
|
||||||
|
|
||||||
|
|
||||||
|
dust["address"] = zdust1.toStdString();
|
||||||
|
dust["amount"] = 0;
|
||||||
|
dust["memo"] = "";
|
||||||
|
|
||||||
|
|
||||||
|
allRecepients.insert(std::begin(allRecepients),{dust}) ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
allRecepients.push_back(rec) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::noConnection() {
|
void Controller::noConnection() {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
#include "recurring.h"
|
#include "recurring.h"
|
||||||
|
|
||||||
|
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
|
||||||
void MainWindow::setupSendTab() {
|
void MainWindow::setupSendTab() {
|
||||||
@@ -501,32 +502,44 @@ Tx MainWindow::createTxFromSendPage() {
|
|||||||
// For each addr/amt in the sendTo tab
|
// For each addr/amt in the sendTo tab
|
||||||
int totalItems = ui->sendToWidgets->children().size() - 2; // The last one is a spacer, so ignore that
|
int totalItems = ui->sendToWidgets->children().size() - 2; // The last one is a spacer, so ignore that
|
||||||
CAmount totalAmt;
|
CAmount totalAmt;
|
||||||
|
|
||||||
for (int i=0; i < totalItems; i++) {
|
for (int i=0; i < totalItems; i++) {
|
||||||
QString addr = ui->sendToWidgets->findChild<QLineEdit*>(QString("Address") % QString::number(i+1))->text().trimmed();
|
QString addr = ui->sendToWidgets->findChild<QLineEdit*>(QString("Address") % QString::number(i+1))->text().trimmed();
|
||||||
|
|
||||||
// Remove label if it exists
|
// Remove label if it exists
|
||||||
addr = AddressBook::addressFromAddressLabel(addr);
|
addr = AddressBook::addressFromAddressLabel(addr);
|
||||||
|
// QString dustamt = "0";
|
||||||
QString amtStr = ui->sendToWidgets->findChild<QLineEdit*>(QString("Amount") % QString::number(i+1))->text().trimmed();
|
QString amtStr = ui->sendToWidgets->findChild<QLineEdit*>(QString("Amount") % QString::number(i+1))->text().trimmed();
|
||||||
if (amtStr.isEmpty()) {
|
if (amtStr.isEmpty()) {
|
||||||
amtStr = "-1";; // The user didn't specify an amount
|
amtStr = "-1";; // The user didn't specify an amount
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
CAmount amt;
|
CAmount amt;
|
||||||
|
|
||||||
|
|
||||||
// Make sure it parses
|
// Make sure it parses
|
||||||
amtStr.toDouble(&ok);
|
amtStr.toDouble(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
amt = CAmount::fromqint64(-1);
|
amt = CAmount::fromqint64(-1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
amt = CAmount::fromDecimalString(amtStr);
|
amt = CAmount::fromDecimalString(amtStr);
|
||||||
totalAmt = totalAmt + amt;
|
totalAmt = totalAmt + amt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString memo = ui->sendToWidgets->findChild<QLabel*>(QString("MemoTxt") % QString::number(i+1))->text().trimmed();
|
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} );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tx.fee = Settings::getMinerFee();
|
tx.fee = Settings::getMinerFee();
|
||||||
|
|
||||||
|
|||||||
5689
src/sietch.h
Normal file
5689
src/sietch.h
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user