Skip to content

Commit

Permalink
Wallet API: added getTxKey()
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaqueeee committed Nov 8, 2016
1 parent af2ceb2 commit 35da3cb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/wallet/api/wallet.cpp
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/wallet/api/wallet.h
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/wallet/wallet2_api.h
Expand Up @@ -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;
};

/**
Expand Down

0 comments on commit 35da3cb

Please sign in to comment.