switch back to json lohman - qtjson in new branch for more testing

This commit is contained in:
DenioD
2020-07-05 20:06:35 +02:00
parent 362e93f0b3
commit 460974f594
28 changed files with 19342 additions and 466 deletions

View File

@@ -20,6 +20,8 @@
#include "Model/ContactItem.h"
#include "contactmodel.h"
using json = nlohmann::json;
struct WatchedTx {
QString opid;
Tx tx;
@@ -90,7 +92,7 @@ public:
const std::function<void(QString txid)> submitted,
const std::function<void(QString txid, QString errStr)> error);
void fillTxJsonParams(QJsonArray &params, Tx tx);
void fillTxJsonParams(json& params, Tx tx);
const TxTableModel* getTransactionsModel() { return transactionsTableModel; }
@@ -98,58 +100,58 @@ public:
void noConnection();
bool isEmbedded() { return ehushd != nullptr; }
void encryptWallet(QString password, const std::function<void(QJsonValue)>& cb) {
void encryptWallet(QString password, const std::function<void(json)>& cb) {
zrpc->encryptWallet(password, cb);
}
void removeWalletEncryption(QString password, const std::function<void(QJsonValue)>& cb) {
void removeWalletEncryption(QString password, const std::function<void(json)>& cb) {
zrpc->removeWalletEncryption(password, cb); }
void saveWallet(const std::function<void(QJsonValue)>& cb) { zrpc->saveWallet(cb); }
void saveWallet(const std::function<void(json)>& cb) { zrpc->saveWallet(cb); }
void clearWallet(const std::function<void(QJsonValue)>& cb) { zrpc->clearWallet(cb); }
void clearWallet(const std::function<void(json)>& cb) { zrpc->clearWallet(cb); }
void createNewZaddr(bool sapling, const std::function<void(QJsonValue)>& cb) {
void createNewZaddr(bool sapling, const std::function<void(json)>& cb) {
unlockIfEncrypted([=] () {
zrpc->createNewZaddr(sapling, cb);
}, [=](){});
}
void createNewTaddr(const std::function<void(QJsonValue)>& cb) {
void createNewTaddr(const std::function<void(json)>& cb) {
unlockIfEncrypted([=] () {
zrpc->createNewTaddr(cb);
}, [=](){});
}
void createNewSietchZaddr(const std::function<void(QJsonValue)>& cb) {
void createNewSietchZaddr(const std::function<void(json)>& cb) {
unlockIfEncrypted([=] () {
zrpc->createNewSietchZaddr(cb);
}, [=](){});
}
void fetchPrivKey(QString addr, const std::function<void(QJsonValue)>& cb) {
void fetchPrivKey(QString addr, const std::function<void(json)>& cb) {
unlockIfEncrypted([=] () {
zrpc->fetchPrivKey(addr, cb);
},
[=]() {
cb(QJsonObject({ {"error", "Failed to unlock wallet"} }) );
cb({ {"error", "Failed to unlock wallet"} });
});
}
void fetchAllPrivKeys(const std::function<void(QJsonValue)> cb) {
void fetchAllPrivKeys(const std::function<void(json)> cb) {
unlockIfEncrypted([=] () {
zrpc->fetchAllPrivKeys(cb);
},
[=]() {
cb(QJsonObject({ {"error", "Failed to unlock wallet"} }));
cb({ {"error", "Failed to unlock wallet"} });
});
}
void fetchSeed(const std::function<void(QJsonValue)> cb) {
void fetchSeed(const std::function<void(json)> cb) {
unlockIfEncrypted([=] () {
zrpc->fetchSeed(cb);
},
[=]() {
cb(QJsonObject({ {"error", "Failed to unlock wallet"} }));
cb({ {"error", "Failed to unlock wallet"} });
});
}
@@ -162,12 +164,12 @@ public:
private:
void processInfo(const QJsonValue&);
void processInfo(const json&);
void refreshBalances();
void refreshTransactions();
void processUnspent (const QJsonValue& reply, QMap<QString, CAmount>* newBalances, QList<UnspentOutput>* newUnspentOutputs);
void processUnspent (const json& reply, QMap<QString, CAmount>* newBalances, QList<UnspentOutput>* newUnspentOutputs);
void updateUI (bool anyUnconfirmed);
void updateUIBalances ();