From dd1c07a58b27dcf3650793e309ffad2bb0e18cc9 Mon Sep 17 00:00:00 2001 From: dsc Date: Sat, 30 Dec 2023 16:12:24 +0200 Subject: [PATCH] add hex() and txKey() to PendingTransaction --- src/wallet/api/pending_transaction.cpp | 16 ++++++++++++++++ src/wallet/api/pending_transaction.h | 2 ++ src/wallet/api/wallet2_api.h | 2 ++ 3 files changed, 20 insertions(+) diff --git a/src/wallet/api/pending_transaction.cpp b/src/wallet/api/pending_transaction.cpp index 25e544667..ee17df162 100644 --- a/src/wallet/api/pending_transaction.cpp +++ b/src/wallet/api/pending_transaction.cpp @@ -79,6 +79,22 @@ std::vector PendingTransactionImpl::txid() const return txid; } +std::vector PendingTransactionImpl::hex() const +{ + std::vector hexs; + for (const auto &pt: m_pending_tx) + hexs.push_back(epee::string_tools::buff_to_hex_nodelimer(cryptonote::tx_to_blob(pt.tx))); + return hexs; +} + +std::vector PendingTransactionImpl::txKey() const +{ + std::vector keys; + for (const auto& pt: m_pending_tx) + keys.push_back(epee::string_tools::pod_to_hex(pt.tx_key)); + return keys; +} + bool PendingTransactionImpl::commit(const std::string &filename, bool overwrite) { diff --git a/src/wallet/api/pending_transaction.h b/src/wallet/api/pending_transaction.h index fa2cf6599..d3bfa5c02 100644 --- a/src/wallet/api/pending_transaction.h +++ b/src/wallet/api/pending_transaction.h @@ -66,6 +66,8 @@ public: std::string multisigSignData() override; void signMultisigTx() override; std::vector signersKeys() const override; + std::vector hex() const override; + std::vector txKey() const override; private: friend class WalletImpl; diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h index cbd9b3a67..03988f393 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h @@ -174,6 +174,8 @@ struct PendingTransaction * @return vector of base58-encoded signers' public keys */ virtual std::vector signersKeys() const = 0; + virtual std::vector hex() const = 0; + virtual std::vector txKey() const = 0; }; /**