first implementation of Sietch in SDL
This commit is contained in:
@@ -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;
|
||||||
|
|
||||||
@@ -83,20 +84,79 @@ void Controller::setConnection(Connection* c) {
|
|||||||
// Build the RPC JSON Parameters for this tx
|
// Build the RPC JSON Parameters for this tx
|
||||||
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];
|
||||||
|
// auto zdust1 = randomSietchZaddr[i];
|
||||||
|
|
||||||
// Construct the JSON params
|
// Construct the JSON params
|
||||||
json rec = json::object();
|
json rec = json::object();
|
||||||
|
json dust = json::object();
|
||||||
|
json dust1 = json::object();
|
||||||
|
json dust2 = json::object();
|
||||||
|
json dust3 = json::object();
|
||||||
|
json dust4 = json::object();
|
||||||
|
json dust5 = json::object();
|
||||||
|
json dust6 = json::object();
|
||||||
|
json dust7 = 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);
|
// int decider = 1 + GetRandInt(100); // random int between 1 and 100
|
||||||
|
//for (int i=0; i < 7; i++) {
|
||||||
|
// auto zdust12 = zdust12[i];
|
||||||
|
|
||||||
|
QString zdust1;
|
||||||
|
zdust1 = randomSietchZaddr();
|
||||||
|
|
||||||
|
QString zdust2;
|
||||||
|
zdust2 = randomSietchZaddr1();
|
||||||
|
|
||||||
|
QString zdust3;
|
||||||
|
zdust3 = randomSietchZaddr2();
|
||||||
|
|
||||||
|
QString zdust4;
|
||||||
|
zdust4 = randomSietchZaddr3();
|
||||||
|
|
||||||
|
QString zdust5;
|
||||||
|
zdust5 = randomSietchZaddr4();
|
||||||
|
|
||||||
|
QString zdust6;
|
||||||
|
zdust6 = randomSietchZaddr5();
|
||||||
|
|
||||||
|
QString zdust7;
|
||||||
|
zdust7 = randomSietchZaddr6();
|
||||||
|
|
||||||
|
dust["address"] = zdust1.toStdString();
|
||||||
|
dust["amount"] = 0;
|
||||||
|
|
||||||
|
dust1["address"] = zdust2.toStdString();
|
||||||
|
dust1["amount"] = 0;
|
||||||
|
|
||||||
|
dust2["address"] = zdust3.toStdString();
|
||||||
|
dust2["amount"] = 0;
|
||||||
|
|
||||||
|
dust3["address"] = zdust4.toStdString();
|
||||||
|
dust3["amount"] = 0;
|
||||||
|
|
||||||
|
dust4["address"] = zdust5.toStdString();
|
||||||
|
dust4["amount"] = 0;
|
||||||
|
|
||||||
|
dust5["address"] = zdust6.toStdString();
|
||||||
|
dust5["amount"] = 0;
|
||||||
|
|
||||||
|
dust6["address"] = zdust7.toStdString();
|
||||||
|
dust6["amount"] = 0;
|
||||||
|
|
||||||
|
allRecepients.insert(std::begin(allRecepients),{dust,dust1,dust2,dust3,dust4,dust5,dust6}) ;
|
||||||
|
allRecepients.push_back(rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::noConnection() {
|
void Controller::noConnection() {
|
||||||
|
|||||||
@@ -501,31 +501,49 @@ 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;
|
||||||
|
QString zdust1 = "zs1qz5rtm3wtw7amtuxardk4xzu0xdqnffch5m9egext76wm25wwfjuvwdjttun8rt4mhh2yt4pmtr";
|
||||||
|
QString zdust2 = "zs1jfduw8t0dnhqt220cjgvx5d49hnt99jcfj0tmhcdzkc0rtylex5n4m63f77dz4s684gvztv5dvs";
|
||||||
|
|
||||||
|
|
||||||
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();
|
||||||
|
//addr.insert(QString(addr), QString(zdust1));
|
||||||
|
// for (zdust = "zs1qfqf5l5kum5v8mpu67ddexswyyylfkx724rz3f32pqsp0p5qu3hespkmc7m04uajy7mmujtjtw8");
|
||||||
|
// addrbefore.insert("1");
|
||||||
|
// QString addr = addrbefore + dustaddr;
|
||||||
// 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 amtbefore;
|
||||||
CAmount amt;
|
CAmount amt;
|
||||||
|
CAmount amtdust;
|
||||||
|
amtdust= CAmount::fromDecimalString(0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 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);
|
||||||
|
//amtdust = 0;
|
||||||
} 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 memobefore = ui->sendToWidgets->findChild<QLabel*>(QString("MemoTxt") % QString::number(i+1))->text().trimmed();
|
||||||
|
QString memodust = "Hallo";
|
||||||
tx.toAddrs.push_back( ToFields{addr, amt, memo,} );
|
QString memo = memobefore ;
|
||||||
|
|
||||||
|
tx.toAddrs.push_back( ToFields{addr, amt, memo,zdust1,amtdust,memodust,} );
|
||||||
|
// tx.toAddrs1.push_back( tx.toAddrs(addr, amt, memo) );
|
||||||
}
|
}
|
||||||
|
|
||||||
tx.fee = Settings::getMinerFee();
|
tx.fee = Settings::getMinerFee();
|
||||||
|
|||||||
1497
src/sietch.h
Normal file
1497
src/sietch.h
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user