wallet API additions for better Carrot support

This commit is contained in:
Some Random Crypto Guy
2025-10-07 13:32:15 +01:00
parent c5be51053a
commit e5bfc2f6ad
3 changed files with 61 additions and 1 deletions
+33 -1
View File
@@ -893,21 +893,33 @@ std::string WalletImpl::integratedAddress(const std::string &payment_id, bool ca
std::string WalletImpl::secretViewKey() const
{
uint32_t hf_version = m_wallet->estimate_current_hard_fork();
if (hf_version >= HF_VERSION_CARROT)
return epee::string_tools::pod_to_hex(unwrap(unwrap(m_wallet->get_account().get_keys().k_view_incoming)));
else
return epee::string_tools::pod_to_hex(unwrap(unwrap(m_wallet->get_account().get_keys().m_view_secret_key)));
}
std::string WalletImpl::publicViewKey() const
{
uint32_t hf_version = m_wallet->estimate_current_hard_fork();
if (hf_version >= HF_VERSION_CARROT)
return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_carrot_account_address.m_view_public_key);
else
return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_account_address.m_view_public_key);
}
std::string WalletImpl::secretSpendKey() const
{
return epee::string_tools::pod_to_hex(unwrap(unwrap(m_wallet->get_account().get_keys().m_spend_secret_key)));
return epee::string_tools::pod_to_hex(unwrap(unwrap(m_wallet->get_account().get_keys().m_spend_secret_key)));
}
std::string WalletImpl::publicSpendKey() const
{
uint32_t hf_version = m_wallet->estimate_current_hard_fork();
if (hf_version >= HF_VERSION_CARROT)
return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_carrot_account_address.m_spend_public_key);
else
return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_account_address.m_spend_public_key);
}
@@ -921,6 +933,26 @@ std::string WalletImpl::publicMultisigSignerKey() const
}
}
std::string WalletImpl::secretViewBalance() const
{
return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().s_view_balance;
}
std::string WalletImpl::secretProveSpend() const
{
return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().k_prove_spend;
}
std::string WalletImpl::secretGenerateAddress() const
{
return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().s_generate_address;
}
std::string WalletImpl::secretGenerateImage() const
{
return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().k_generate_image;
}
std::string WalletImpl::path() const
{
return m_wallet->path();
+4
View File
@@ -100,6 +100,10 @@ public:
std::string secretSpendKey() const override;
std::string publicSpendKey() const override;
std::string publicMultisigSignerKey() const override;
std::string secretViewBalance() const override;
std::string secretProveSpend() const override;
std::string secretGenerateAddress() const override;
std::string secretGenerateImage() const override;
std::string path() const override;
void stop() override;
bool store(const std::string &path) override;
+24
View File
@@ -565,6 +565,30 @@ struct Wallet
*/
virtual std::string publicMultisigSignerKey() const = 0;
/*!
* \brief secretViewBalance - returns Carrot "view balance" secret
* \return - Carrot s_vb
*/
virtual std::string secretViewBalance() const = 0;
/*!
* \brief secretProveSpend - returns Carrot "prove spend" secret
* \return - Carrot secret k_ps
*/
virtual std::string secretProveSpend() const = 0;
/*!
* \brief secretGenerateAddress - returns Carrot "generate address" secret
* \return - Carrot secret s_ga
*/
virtual std::string secretGenerateAddress() const = 0;
/*!
* \brief secretGenerateImage - returns Carrot "generate key image" secret
* \return - Carrot secret k_gi
*/
virtual std::string secretGenerateImage() const = 0;
/*!
* \brief stop - interrupts wallet refresh() loop once (doesn't stop background refresh thread)
*/