diff --git a/src/currency_core/currency_format_utils_transactions.cpp b/src/currency_core/currency_format_utils_transactions.cpp index d4650dfa..7554aae5 100644 --- a/src/currency_core/currency_format_utils_transactions.cpp +++ b/src/currency_core/currency_format_utils_transactions.cpp @@ -408,4 +408,28 @@ namespace currency #endif } + //---------------------------------------------------------------------------------------------------- + std::string wallet2::transform_tx_to_str(const currency::transaction& tx) + { + return currency::obj_to_json_str(tx); + } + //---------------------------------------------------------------------------------------------------- + currency::transaction wallet2::transform_str_to_tx(const std::string& tx_str) + { + THROW_IF_TRUE_WALLET_INT_ERR_EX_NO_HANDLER(false, "transform_str_to_tx shoruld never be called"); + return currency::transaction(); + } + //---------------------------------------------------------------------------------------------------- + const transaction_wallet_info& wallet2::transform_ptr_to_value(const std::shared_ptr& a) + { + return *a; + } + //---------------------------------------------------------------------------------------------------- + std::shared_ptr wallet2::transform_value_to_ptr(const transaction_wallet_info& d) + { + THROW_IF_TRUE_WALLET_INT_ERR_EX_NO_HANDLER(false, "transform_value_to_ptr shoruld never be called"); + return std::shared_ptr(); + } + + } \ No newline at end of file diff --git a/src/currency_core/currency_format_utils_transactions.h b/src/currency_core/currency_format_utils_transactions.h index 087e19be..2944d755 100644 --- a/src/currency_core/currency_format_utils_transactions.h +++ b/src/currency_core/currency_format_utils_transactions.h @@ -329,5 +329,11 @@ namespace currency }; // struct tx_generation_context bool validate_tx_output_details_againt_tx_generation_context(const transaction& tx, const tx_generation_context& gen_context, const crypto::secret_key& onet_time_key); + std::string transform_tx_to_str(const transaction& tx); + transaction transform_str_to_tx(const std::string& tx_str); + const transaction_wallet_info& transform_ptr_to_value(const std::shared_ptr& a); + std::shared_ptr transform_value_to_ptr(const transaction_wallet_info& d); + + } // namespace currency diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index c67243e9..0d1c3e6c 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -133,17 +133,6 @@ std::string wallet2::transfer_flags_to_str(uint32_t flags) return result; } //---------------------------------------------------------------------------------------------------- -std::string wallet2::transform_tx_to_str(const currency::transaction& tx) -{ - return currency::obj_to_json_str(tx); -} -//---------------------------------------------------------------------------------------------------- -currency::transaction wallet2::transform_str_to_tx(const std::string& tx_str) -{ - THROW_IF_TRUE_WALLET_INT_ERR_EX_NO_HANDLER(false, "transform_str_to_tx shoruld never be called"); - return currency::transaction(); -} -//---------------------------------------------------------------------------------------------------- uint64_t transfer_details_base_to_amount(const transfer_details_base& tdb) { return tdb.amount(); @@ -153,17 +142,6 @@ std::string transfer_details_base_to_tx_hash(const transfer_details_base& tdb) { return epee::string_tools::pod_to_hex(currency::get_transaction_hash(tdb.m_ptx_wallet_info->m_tx)); } -//---------------------------------------------------------------------------------------------------- -const transaction_wallet_info& wallet2::transform_ptr_to_value(const std::shared_ptr& a) -{ - return *a; -} -//---------------------------------------------------------------------------------------------------- -std::shared_ptr wallet2::transform_value_to_ptr(const transaction_wallet_info& d) -{ - THROW_IF_TRUE_WALLET_INT_ERR_EX_NO_HANDLER(false, "transform_value_to_ptr shoruld never be called"); - return std::shared_ptr(); -} //---------------------------------------------------------------------------------------------------- void wallet2::init(const std::string& daemon_address) diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 3d75569d..8c2974f3 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -224,11 +224,7 @@ namespace tools wallet2(); static std::string transfer_flags_to_str(uint32_t flags); - static std::string transform_tx_to_str(const currency::transaction& tx); - static currency::transaction transform_str_to_tx(const std::string& tx_str); - static const transaction_wallet_info& transform_ptr_to_value(const std::shared_ptr& a); - static std::shared_ptr transform_value_to_ptr(const transaction_wallet_info& d); static uint64_t transfer_details_base_to_amount(const transfer_details_base& tdb); static std::string transfer_details_base_to_tx_hash(const transfer_details_base& tdb); diff --git a/src/wallet/wallet2_base.h b/src/wallet/wallet2_base.h index 26978519..5f3e052f 100644 --- a/src/wallet/wallet2_base.h +++ b/src/wallet/wallet2_base.h @@ -298,7 +298,7 @@ namespace tools BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(m_block_height) KV_SERIALIZE(m_block_timestamp) - KV_SERIALIZE_CUSTOM(m_tx, std::string, tools::wallet2::transform_tx_to_str, tools::wallet2::transform_str_to_tx) + KV_SERIALIZE_CUSTOM(m_tx, std::string, currency::wallet2::transform_tx_to_str, currency::transform_str_to_tx) END_KV_SERIALIZE_MAP() BEGIN_BOOST_SERIALIZATION() @@ -366,7 +366,7 @@ namespace tools } BEGIN_KV_SERIALIZE_MAP() - KV_SERIALIZE_CUSTOM(m_ptx_wallet_info, const transaction_wallet_info&, tools::wallet2::transform_ptr_to_value, tools::wallet2::transform_value_to_ptr) + KV_SERIALIZE_CUSTOM(m_ptx_wallet_info, const transaction_wallet_info&, currency::transform_ptr_to_value, currency::transform_value_to_ptr) KV_SERIALIZE(m_internal_output_index) KV_SERIALIZE(m_spent_height) KV_SERIALIZE(m_flags)