aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacob Brydolf <jacob@brydolf.net>2016-11-06 19:04:59 +0100
committerJacob Brydolf <jacob@brydolf.net>2016-11-08 21:48:26 +0100
commit35da3cb07463f2dafd7224603c2471064c2cdf1a (patch)
treeadda70e144a3f1991c98e7414b02cfa52d410fdf /src
parentMerge pull request #1298 (diff)
downloadmonero-35da3cb07463f2dafd7224603c2471064c2cdf1a.tar.xz
Wallet API: added getTxKey()
Diffstat (limited to 'src')
-rw-r--r--src/wallet/api/wallet.cpp20
-rw-r--r--src/wallet/api/wallet.h1
-rw-r--r--src/wallet/wallet2_api.h1
3 files changed, 22 insertions, 0 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index 7227b6b4d..3c472b410 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -728,6 +728,26 @@ std::string WalletImpl::getUserNote(const std::string &txid) const
return m_wallet->get_tx_note(htxid);
}
+std::string WalletImpl::getTxKey(const std::string &txid) const
+{
+ cryptonote::blobdata txid_data;
+ if(!epee::string_tools::parse_hexstr_to_binbuff(txid, txid_data))
+ {
+ return "";
+ }
+ const crypto::hash htxid = *reinterpret_cast<const crypto::hash*>(txid_data.data());
+
+ crypto::secret_key tx_key;
+ if (m_wallet->get_tx_key(htxid, tx_key))
+ {
+ return epee::string_tools::pod_to_hex(tx_key);
+ }
+ else
+ {
+ return "";
+ }
+}
+
bool WalletImpl::connectToDaemon()
{
bool result = m_wallet->check_connection();
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
index 69c27b035..7973349ca 100644
--- a/src/wallet/api/wallet.h
+++ b/src/wallet/api/wallet.h
@@ -99,6 +99,7 @@ public:
virtual void setDefaultMixin(uint32_t arg);
virtual bool setUserNote(const std::string &txid, const std::string &note);
virtual std::string getUserNote(const std::string &txid) const;
+ virtual std::string getTxKey(const std::string &txid) const;
private:
void clearStatus();
diff --git a/src/wallet/wallet2_api.h b/src/wallet/wallet2_api.h
index bdea8b22c..afa4aa5fe 100644
--- a/src/wallet/wallet2_api.h
+++ b/src/wallet/wallet2_api.h
@@ -355,6 +355,7 @@ struct Wallet
* \return the attached note, or empty string if there is none
*/
virtual std::string getUserNote(const std::string &txid) const = 0;
+ virtual std::string getTxKey(const std::string &txid) const = 0;
};
/**