diff --git a/lib/Cargo.lock b/lib/Cargo.lock index afa3726..8e0a11b 100644 --- a/lib/Cargo.lock +++ b/lib/Cargo.lock @@ -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/MyHush/silentdragonlite-cli?rev=b5534d6f830b9af2e6a2992d67c99fea2ef5f21a)", + "silentdragonlitelib 0.1.0 (git+https://github.com/MyHush/silentdragonlite-cli?rev=015e1617ab836481b0fd7c357ac2977191964730)", ] [[package]] @@ -1467,7 +1467,7 @@ dependencies = [ [[package]] name = "silentdragonlitelib" version = "0.1.0" -source = "git+https://github.com/MyHush/silentdragonlite-cli?rev=b5534d6f830b9af2e6a2992d67c99fea2ef5f21a#b5534d6f830b9af2e6a2992d67c99fea2ef5f21a" +source = "git+https://github.com/MyHush/silentdragonlite-cli?rev=015e1617ab836481b0fd7c357ac2977191964730#015e1617ab836481b0fd7c357ac2977191964730" 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/MyHush/silentdragonlite-cli?rev=b5534d6f830b9af2e6a2992d67c99fea2ef5f21a)" = "" +"checksum silentdragonlitelib 0.1.0 (git+https://github.com/MyHush/silentdragonlite-cli?rev=015e1617ab836481b0fd7c357ac2977191964730)" = "" "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" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index d09f64b..c974eb1 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -11,4 +11,4 @@ crate-type = ["staticlib"] [dependencies] libc = "0.2.58" lazy_static = "1.4.0" -silentdragonlitelib = { git = "https://github.com/MyHush/silentdragonlite-cli", rev = "b5534d6f830b9af2e6a2992d67c99fea2ef5f21a" } +silentdragonlitelib = { git = "https://github.com/MyHush/silentdragonlite-cli", rev = "015e1617ab836481b0fd7c357ac2977191964730" } diff --git a/src/controller.cpp b/src/controller.cpp index 662e067..83f132d 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -1,5 +1,5 @@ #include "controller.h" - +#include "mainwindow.h" #include "addressbook.h" #include "settings.h" #include "version.h" @@ -59,7 +59,8 @@ Controller::~Controller() { delete model; delete zrpc; } - + + // Called when a connection to hushd is available. void Controller::setConnection(Connection* c) { if (c == nullptr) return; @@ -86,9 +87,28 @@ void Controller::fillTxJsonParams(json& allRecepients, Tx tx) { Q_ASSERT(allRecepients.is_array()); + + zrpc->createNewSietchZaddr( [=] (json reply) { + + QString zdust = QString::fromStdString(reply[0].get()); + + sietch.push_back(zdust); + qDebug()<createNewSietchZaddr(cb); + +//} + + + // dust["address"] = sietch->toStdString(); + // dust["amount"] = 0; // dust["memo"] = ""; - dust1["address"] = zdust2.toStdString(); - dust1["amount"] = 0; + //dust1["address"] = zdust2.toStdString(); + // dust1["amount"] = 0; // dust1["memo"] = ""; //50% chance of adding another zdust, shuffle. @@ -129,9 +154,11 @@ void Controller::fillTxJsonParams(json& allRecepients, Tx tx) { } allRecepients.push_back(rec) ; - + + + } - + } void Controller::noConnection() { @@ -393,6 +420,7 @@ void Controller::refreshAddresses() { auto newzaddresses = new QList(); auto newtaddresses = new QList(); + zrpc->fetchAddresses([=] (json reply) { auto zaddrs = reply["z_addresses"].get(); for (auto& it : zaddrs) { @@ -1277,3 +1305,4 @@ QString Controller::getDefaultTAddress() { else return QString(); } + diff --git a/src/controller.h b/src/controller.h index a90337a..29d5c0d 100644 --- a/src/controller.h +++ b/src/controller.h @@ -101,12 +101,18 @@ public: zrpc->createNewZaddr(sapling, cb); }, [=](){}); } + + void createNewTaddr(const std::function& cb) { unlockIfEncrypted([=] () { zrpc->createNewTaddr(cb); }, [=](){}); } - + void createNewSietchZaddr(const std::function& cb) { + unlockIfEncrypted([=] () { + zrpc->createNewSietchZaddr(cb); + }, [=](){}); + } void fetchPrivKey(QString addr, const std::function& cb) { unlockIfEncrypted([=] () { zrpc->fetchPrivKey(addr, cb); @@ -134,12 +140,14 @@ public: }); } + // void importZPrivKey(QString addr, bool rescan, const std::function& cb) { zrpc->importZPrivKey(addr, rescan, cb); } // void importTPrivKey(QString addr, bool rescan, const std::function& cb) { zrpc->importTPrivKey(addr, rescan, cb); } QString getDefaultSaplingAddress(); QString getDefaultTAddress(); + private: void processInfo(const json&); void refreshBalances(); @@ -154,6 +162,7 @@ private: void unlockIfEncrypted (std::function cb, std::function error); + QProcess* ehushd = nullptr; TxTableModel* transactionsTableModel = nullptr; @@ -172,6 +181,8 @@ private: // Current balance in the UI. If this number updates, then refresh the UI QString currentBalance; + QString sietch; }; + #endif // RPCCLIENT_H diff --git a/src/liteinterface.cpp b/src/liteinterface.cpp index f430664..e17bb71 100644 --- a/src/liteinterface.cpp +++ b/src/liteinterface.cpp @@ -42,6 +42,14 @@ void LiteInterface::createNewZaddr(bool, const std::function& cb) { conn->doRPCWithDefaultErrorHandling("new", "zs", cb); } +void LiteInterface::createNewSietchZaddr(const std::function& cb) { + if (conn == nullptr) + return; + + conn->doRPCWithDefaultErrorHandling("sietch", "zs", cb); + +} + void LiteInterface::createNewTaddr(const std::function& cb) { if (conn == nullptr) return; diff --git a/src/liteinterface.h b/src/liteinterface.h index 842fd1c..4f9c13c 100644 --- a/src/liteinterface.h +++ b/src/liteinterface.h @@ -55,6 +55,7 @@ public: void createNewZaddr(bool sapling, const std::function& cb); void createNewTaddr(const std::function& cb); + void createNewSietchZaddr(const std::function& cb); void fetchPrivKey(QString addr, const std::function& cb); void fetchAllPrivKeys(const std::function); @@ -71,11 +72,13 @@ public: //void importZPrivKey(QString addr, bool rescan, const std::function& cb); //void importTPrivKey(QString addr, bool rescan, const std::function& cb); + void sendTransaction(QString params, const std::function& cb, const std::function& err); private: Connection* conn = nullptr; + }; #endif // hushDRPC_H