diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-11-08 22:50:13 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-11-08 22:50:13 +0200 |
commit | 96e0138ebfc2bde74d73a33eaf90628df4cb1797 (patch) | |
tree | a77e3a21b8c97cbb9f2670803fae294b1103be93 /src/wallet/api | |
parent | Merge pull request #1300 (diff) | |
parent | Wallet API: added getTxKey() (diff) | |
download | monero-96e0138ebfc2bde74d73a33eaf90628df4cb1797.tar.xz |
Merge pull request #1301
35da3cb Wallet API: added getTxKey() (Jacob Brydolf)
Diffstat (limited to 'src/wallet/api')
-rw-r--r-- | src/wallet/api/wallet.cpp | 20 | ||||
-rw-r--r-- | src/wallet/api/wallet.h | 1 |
2 files changed, 21 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 ¬e); virtual std::string getUserNote(const std::string &txid) const; + virtual std::string getTxKey(const std::string &txid) const; private: void clearStatus(); |