Fetch addresses
This commit is contained in:
@@ -254,31 +254,31 @@ void Controller::refreshAddresses() {
|
|||||||
return noConnection();
|
return noConnection();
|
||||||
|
|
||||||
auto newzaddresses = new QList<QString>();
|
auto newzaddresses = new QList<QString>();
|
||||||
|
auto newtaddresses = new QList<QString>();
|
||||||
|
|
||||||
zrpc->fetchZAddresses([=] (json reply) {
|
zrpc->fetchAddresses([=] (json reply) {
|
||||||
for (auto& it : reply.get<json::array_t>()) {
|
auto zaddrs = reply["z_addresses"].get<json::array_t>();
|
||||||
|
for (auto& it : zaddrs) {
|
||||||
auto addr = QString::fromStdString(it.get<json::string_t>());
|
auto addr = QString::fromStdString(it.get<json::string_t>());
|
||||||
newzaddresses->push_back(addr);
|
newzaddresses->push_back(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
model->replaceZaddresses(newzaddresses);
|
model->replaceZaddresses(newzaddresses);
|
||||||
|
|
||||||
// Refresh the sent and received txs from all these z-addresses
|
auto taddrs = reply["t_addresses"].get<json::array_t>();
|
||||||
refreshSentZTrans();
|
for (auto& it : taddrs) {
|
||||||
refreshReceivedZTrans(model->getAllZAddresses());
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
auto newtaddresses = new QList<QString>();
|
|
||||||
zrpc->fetchTAddresses([=] (json reply) {
|
|
||||||
for (auto& it : reply.get<json::array_t>()) {
|
|
||||||
auto addr = QString::fromStdString(it.get<json::string_t>());
|
auto addr = QString::fromStdString(it.get<json::string_t>());
|
||||||
if (Settings::isTAddress(addr))
|
if (Settings::isTAddress(addr))
|
||||||
newtaddresses->push_back(addr);
|
newtaddresses->push_back(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
model->replaceTaddresses(newtaddresses);
|
model->replaceTaddresses(newtaddresses);
|
||||||
|
|
||||||
|
// Refresh the sent and received txs from all these z-addresses
|
||||||
|
refreshSentZTrans();
|
||||||
|
refreshReceivedZTrans(model->getAllZAddresses());
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to create the data model and update the views, used below.
|
// Function to create the data model and update the views, used below.
|
||||||
|
|||||||
@@ -20,32 +20,13 @@ bool LiteInterface::haveConnection() {
|
|||||||
return conn != nullptr;
|
return conn != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiteInterface::fetchTAddresses(const std::function<void(json)>& cb) {
|
void LiteInterface::fetchAddresses(const std::function<void(json)>& cb) {
|
||||||
if (conn == nullptr)
|
if (conn == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// json payload = {
|
conn->doRPCWithDefaultErrorHandling("addresses", "", cb);
|
||||||
// {"jsonrpc", "1.0"},
|
|
||||||
// {"id", "someid"},
|
|
||||||
// {"method", "getaddressesbyaccount"},
|
|
||||||
// {"params", {""}}
|
|
||||||
// };
|
|
||||||
|
|
||||||
// conn->doRPCWithDefaultErrorHandling(payload, cb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiteInterface::fetchZAddresses(const std::function<void(json)>& cb) {
|
|
||||||
if (conn == nullptr)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// json payload = {
|
|
||||||
// {"jsonrpc", "1.0"},
|
|
||||||
// {"id", "someid"},
|
|
||||||
// {"method", "z_listaddresses"},
|
|
||||||
// };
|
|
||||||
|
|
||||||
// conn->doRPCWithDefaultErrorHandling(payload, cb);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LiteInterface::fetchUnspent(const std::function<void(json)>& cb) {
|
void LiteInterface::fetchUnspent(const std::function<void(json)>& cb) {
|
||||||
if (conn == nullptr)
|
if (conn == nullptr)
|
||||||
|
|||||||
@@ -30,8 +30,7 @@ public:
|
|||||||
|
|
||||||
void fetchUnspent (const std::function<void(json)>& cb);
|
void fetchUnspent (const std::function<void(json)>& cb);
|
||||||
void fetchTransactions (const std::function<void(json)>& cb);
|
void fetchTransactions (const std::function<void(json)>& cb);
|
||||||
void fetchZAddresses (const std::function<void(json)>& cb);
|
void fetchAddresses (const std::function<void(json)>& cb);
|
||||||
void fetchTAddresses (const std::function<void(json)>& cb);
|
|
||||||
|
|
||||||
void fetchReceivedZTrans(QList<QString> zaddrs, const std::function<void(QString)> usedAddrFn,
|
void fetchReceivedZTrans(QList<QString> zaddrs, const std::function<void(QString)> usedAddrFn,
|
||||||
const std::function<void(QList<TransactionItem>)> txdataFn);
|
const std::function<void(QList<TransactionItem>)> txdataFn);
|
||||||
|
|||||||
Reference in New Issue
Block a user