Skip to content
Permalink
Browse files

Merge pull request #1301

35da3cb Wallet API: added getTxKey() (Jacob Brydolf)
  • Loading branch information...
fluffypony committed Nov 8, 2016
2 parents c57ce06 + 35da3cb commit 96e0138ebfc2bde74d73a33eaf90628df4cb1797
Showing with 22 additions and 0 deletions.
  1. +20 −0 src/wallet/api/wallet.cpp
  2. +1 −0 src/wallet/api/wallet.h
  3. +1 −0 src/wallet/wallet2_api.h
@@ -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();
@@ -99,6 +99,7 @@ class WalletImpl : public Wallet
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();
@@ -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;
};

/**

0 comments on commit 96e0138

Please sign in to comment.
You can’t perform that action at this time.