@@ -5,6 +5,7 @@
|
||||
#include "version.h"
|
||||
#include "camount.h"
|
||||
#include "websockets.h"
|
||||
#include "sietch.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
@@ -84,19 +85,39 @@ void Controller::setConnection(Connection* c) {
|
||||
void Controller::fillTxJsonParams(json& allRecepients, Tx tx) {
|
||||
Q_ASSERT(allRecepients.is_array());
|
||||
|
||||
|
||||
// For each addr/amt/memo, construct the JSON and also build the confirm dialog box
|
||||
for (int i=0; i < tx.toAddrs.size(); i++) {
|
||||
auto toAddr = tx.toAddrs[i];
|
||||
|
||||
// Construct the JSON params
|
||||
json rec = json::object();
|
||||
json dust = json::object();
|
||||
|
||||
rec["address"] = toAddr.addr.toStdString();
|
||||
rec["amount"] = toAddr.amount.toqint64();
|
||||
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() {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "controller.h"
|
||||
#include "recurring.h"
|
||||
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
void MainWindow::setupSendTab() {
|
||||
@@ -501,32 +502,44 @@ Tx MainWindow::createTxFromSendPage() {
|
||||
// For each addr/amt in the sendTo tab
|
||||
int totalItems = ui->sendToWidgets->children().size() - 2; // The last one is a spacer, so ignore that
|
||||
CAmount totalAmt;
|
||||
|
||||
for (int i=0; i < totalItems; i++) {
|
||||
QString addr = ui->sendToWidgets->findChild<QLineEdit*>(QString("Address") % QString::number(i+1))->text().trimmed();
|
||||
|
||||
// Remove label if it exists
|
||||
addr = AddressBook::addressFromAddressLabel(addr);
|
||||
|
||||
// QString dustamt = "0";
|
||||
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
|
||||
}
|
||||
|
||||
bool ok;
|
||||
|
||||
CAmount amt;
|
||||
|
||||
|
||||
// Make sure it parses
|
||||
amtStr.toDouble(&ok);
|
||||
if (!ok) {
|
||||
amt = CAmount::fromqint64(-1);
|
||||
|
||||
} else {
|
||||
amt = CAmount::fromDecimalString(amtStr);
|
||||
totalAmt = 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} );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
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