From 6d0a4a4d7b97b8bc26f4ef26d00948dbbc9e6ed3 Mon Sep 17 00:00:00 2001 From: auruya Date: Wed, 8 Oct 2025 22:28:50 +0300 Subject: [PATCH] add carrotkeys fn to wallet api (#68) --- src/wallet/api/wallet.cpp | 12 ++++++++++++ src/wallet/api/wallet.h | 1 + src/wallet/api/wallet2_api.h | 12 ++++++++++++ 3 files changed, 25 insertions(+) diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index 41f4b53f0..6c7e54bbf 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -920,6 +920,18 @@ std::string WalletImpl::publicSpendKey() const return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_account_address.m_spend_public_key); } +std::vector WalletImpl::carrotKeys() const +{ + return { + epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_carrot_account_address.s_master), + epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_carrot_account_address.k_prove_spend), + epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_carrot_account_address.s_view_balance), + epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_carrot_account_address.k_view_incoming), + epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_carrot_account_address.k_generate_image), + epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_carrot_account_address.s_generate_address) + }; +} + std::string WalletImpl::publicMultisigSignerKey() const { try { diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h index ef1dca257..39e737675 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h @@ -99,6 +99,7 @@ public: std::string publicViewKey() const override; std::string secretSpendKey() const override; std::string publicSpendKey() const override; + std::vector carrotKeys() const override; std::string publicMultisigSignerKey() const override; std::string secretViewBalance() const override; std::string secretProveSpend() const override; diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h index c21cc5779..c0c6792c1 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h @@ -559,6 +559,18 @@ struct Wallet */ virtual std::string publicSpendKey() const = 0; + /*! + * \brief allCarrotKeys - returns all Carrot keys + * [0] - s_master + * [1] - k_prove_spend + * [2] - s_view_balance + * [3] - k_view_incoming + * [4] - k_generate_image + * [5] - s_generate_address + * \return - vector of all Carrot keys + */ + virtual std::vector carrotKeys() const = 0; + /*! * \brief publicMultisigSignerKey - returns public signer key * \return - public multisignature signer key or empty string if wallet is not multisig