Import transaction

This commit is contained in:
tobtoht
2020-11-10 12:38:37 +01:00
parent 24133ac390
commit 046b2cfc4c
12 changed files with 308 additions and 3 deletions
+11
View File
@@ -23,6 +23,17 @@ void DaemonRpc::sendRawTransaction(const QString &tx_as_hex, bool do_not_relay,
connect(reply, &QNetworkReply::finished, std::bind(&DaemonRpc::onResponse, this, reply, Endpoint::SEND_RAW_TRANSACTION));
}
void DaemonRpc::getTransactions(const QStringList &txs_hashes, bool decode_as_json, bool prune) {
QJsonObject req;
req["txs_hashes"] = QJsonArray::fromStringList(txs_hashes);
req["decode_as_json"] = decode_as_json;
req["prune"] = prune;
QString url = QString("%1/get_transactions").arg(m_daemonAddress);
QNetworkReply *reply = m_network->postJson(url, req);
connect(reply, &QNetworkReply::finished, std::bind(&DaemonRpc::onResponse, this, reply, Endpoint::GET_TRANSACTIONS));
}
void DaemonRpc::onResponse(QNetworkReply *reply, Endpoint endpoint) {
const auto ok = reply->error() == QNetworkReply::NoError;
const auto err = reply->errorString();