summaryrefslogtreecommitdiff
path: root/patches/monero/0010-Add-hex-encoding-and-tx-key-getter-for-PendingTransc.patch
blob: 6917daa28e8acc10b201ff95562cf316c2a884f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From 42aca87b69ecdc9fb24d14dd947f8bbffc7f3500 Mon Sep 17 00:00:00 2001
From: M <m@cakewallet.com>
Date: Fri, 21 Apr 2023 15:43:47 -0400
Subject: [PATCH 10/14] Add hex encoding and tx key getter for
 PendingTransction in wallet api.

---
 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 9c3c26e..1f714d2 100644
--- a/src/wallet/api/pending_transaction.cpp
+++ b/src/wallet/api/pending_transaction.cpp
@@ -80,6 +80,22 @@ std::vector<std::string> PendingTransactionImpl::txid() const
     return txid;
 }
 
+std::vector<std::string> PendingTransactionImpl::hex() const
+{
+    std::vector<std::string> 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<std::string> PendingTransactionImpl::txKey() const
+{
+    std::vector<std::string> 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 403bfe2..0cc6c58 100644
--- a/src/wallet/api/pending_transaction.h
+++ b/src/wallet/api/pending_transaction.h
@@ -59,6 +59,8 @@ public:
     std::string multisigSignData() override;
     void signMultisigTx() override;
     std::vector<std::string> signersKeys() const override;
+    std::vector<std::string> hex() const override;
+    std::vector<std::string> txKey() const override;
 
 private:
     friend class WalletImpl;
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
index 013b5bc..f421fdc 100644
--- a/src/wallet/api/wallet2_api.h
+++ b/src/wallet/api/wallet2_api.h
@@ -127,6 +127,8 @@ struct PendingTransaction
      * @return vector of base58-encoded signers' public keys
      */
     virtual std::vector<std::string> signersKeys() const = 0;
+    virtual std::vector<std::string> hex() const = 0;
+    virtual std::vector<std::string> txKey() const = 0;
 };
 
 /**
-- 
2.39.5 (Apple Git-154)