From 35370ba4853c9ae47c8b6bd3af6d5401f3fdc901 Mon Sep 17 00:00:00 2001 From: sowle Date: Mon, 1 Jun 2020 15:32:00 +0300 Subject: [PATCH] account_base::get_awo_blob() --- src/currency_core/account.cpp | 7 +++++++ src/currency_core/account.h | 1 + src/simplewallet/simplewallet.cpp | 9 ++------- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/currency_core/account.cpp b/src/currency_core/account.cpp index 601b8d5f..ac80a305 100644 --- a/src/currency_core/account.cpp +++ b/src/currency_core/account.cpp @@ -87,6 +87,13 @@ namespace currency return keys_seed_text + " " + timestamp_word + " " + auditable_flag_and_checksum_word; } //----------------------------------------------------------------- + std::string account_base::get_awo_blob() const + { + return get_public_address_str() + ":" + + epee::string_tools::pod_to_hex(m_keys.view_secret_key) + + (m_creation_timestamp ? ":" : "") + (m_creation_timestamp ? epee::string_tools::num_to_string_fast(m_creation_timestamp) : ""); + } + //----------------------------------------------------------------- bool account_base::restore_keys(const std::vector& keys_seed_binary) { CHECK_AND_ASSERT_MES(keys_seed_binary.size() == BRAINWALLET_DEFAULT_SEED_SIZE, false, "wrong restore data size: " << keys_seed_binary.size()); diff --git a/src/currency_core/account.h b/src/currency_core/account.h index 156d058e..52fec46a 100644 --- a/src/currency_core/account.h +++ b/src/currency_core/account.h @@ -54,6 +54,7 @@ namespace currency std::string get_public_address_str() const; std::string get_restore_braindata() const; + std::string get_awo_blob() const; bool restore_from_braindata(const std::string& seed_phrase); bool restore_from_awo_blob(const std::string& awo_blob); diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 27eca885..45c1799f 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -1510,13 +1510,8 @@ bool simple_wallet::awo_blob(const std::vector &args_) return true; } - const account_base& acc = m_wallet->get_account(); - - success_msg_writer() << "Auditable watch-only blob for this wallet is: "; - std::cout << acc.get_public_address_str() << ":" << epee::string_tools::pod_to_hex(acc.get_keys().view_secret_key); - if (acc.get_createtime()) - std::cout << ":" << acc.get_createtime(); - std::cout << ENDL; + success_msg_writer() << "Auditable watch-only blob for this wallet is:"; + std::cout << m_wallet->get_account().get_awo_blob() << ENDL; return true; } //----------------------------------------------------------------------------------------------------