mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-21 00:58:40 +02:00
Import transaction
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -13,7 +13,8 @@ class DaemonRpc : public QObject {
|
||||
|
||||
public:
|
||||
enum Endpoint {
|
||||
SEND_RAW_TRANSACTION = 0
|
||||
SEND_RAW_TRANSACTION = 0,
|
||||
GET_TRANSACTIONS
|
||||
};
|
||||
|
||||
struct DaemonResponse {
|
||||
@@ -29,6 +30,7 @@ public:
|
||||
explicit DaemonRpc(QObject *parent, UtilsNetworking *network, QString daemonAddress);
|
||||
|
||||
void sendRawTransaction(const QString &tx_as_hex, bool do_not_relay = false, bool do_sanity_checks = true);
|
||||
void getTransactions(const QStringList &txs_hashes, bool decode_as_json = false, bool prune = false);
|
||||
|
||||
void setDaemonAddress(const QString &daemonAddress);
|
||||
void setNetwork(UtilsNetworking *network);
|
||||
|
||||
Reference in New Issue
Block a user