diff options
Diffstat (limited to '')
-rw-r--r-- | src/wallet/api/transaction_history.cpp | 1 | ||||
-rw-r--r-- | src/wallet/api/transaction_info.cpp | 19 | ||||
-rw-r--r-- | src/wallet/api/transaction_info.h | 1 | ||||
-rw-r--r-- | src/wallet/wallet2_api.h | 1 | ||||
-rw-r--r-- | tests/libwallet_api_tests/main.cpp | 8 |
5 files changed, 19 insertions, 11 deletions
diff --git a/src/wallet/api/transaction_history.cpp b/src/wallet/api/transaction_history.cpp index 185cd164f..c7e7472e9 100644 --- a/src/wallet/api/transaction_history.cpp +++ b/src/wallet/api/transaction_history.cpp @@ -103,6 +103,7 @@ void TransactionHistoryImpl::refresh() ti->m_amount = pd.m_amount; ti->m_direction = TransactionInfo::Direction_In; ti->m_hash = string_tools::pod_to_hex(pd.m_tx_hash); + ti->m_blockheight = pd.m_block_height; // TODO: // ti->m_timestamp = pd.m_timestamp; m_history.push_back(ti); diff --git a/src/wallet/api/transaction_info.cpp b/src/wallet/api/transaction_info.cpp index c28c52355..578b84832 100644 --- a/src/wallet/api/transaction_info.cpp +++ b/src/wallet/api/transaction_info.cpp @@ -62,37 +62,42 @@ int TransactionInfoImpl::direction() const bool TransactionInfoImpl::isHold() const { - return false; + return m_hold; } bool TransactionInfoImpl::isFailed() const { - return false; + return m_failed; } uint64_t TransactionInfoImpl::amount() const { - return 0; + return m_amount; } uint64_t TransactionInfoImpl::fee() const { - return 0; + return m_fee; +} + +uint64_t TransactionInfoImpl::blockHeight() const +{ + return m_blockheight; } string TransactionInfoImpl::hash() const { - return ""; + return m_hash; } std::time_t TransactionInfoImpl::timestamp() const { - return std::time_t(0); + return m_timestamp; } string TransactionInfoImpl::paymentId() const { - return ""; + return m_paymentid; } } // namespace diff --git a/src/wallet/api/transaction_info.h b/src/wallet/api/transaction_info.h index 945b0d9ed..a06bc367e 100644 --- a/src/wallet/api/transaction_info.h +++ b/src/wallet/api/transaction_info.h @@ -49,6 +49,7 @@ public: virtual uint64_t amount() const; //! always 0 for incoming txes virtual uint64_t fee() const; + virtual uint64_t blockHeight() const; virtual std::string hash() const; virtual std::time_t timestamp() const; diff --git a/src/wallet/wallet2_api.h b/src/wallet/wallet2_api.h index c4843d33f..4954db0d2 100644 --- a/src/wallet/wallet2_api.h +++ b/src/wallet/wallet2_api.h @@ -71,6 +71,7 @@ struct TransactionInfo virtual bool isFailed() const = 0; virtual uint64_t amount() const = 0; virtual uint64_t fee() const = 0; + virtual uint64_t blockHeight() const = 0; virtual std::string hash() const = 0; virtual std::time_t timestamp() const = 0; virtual std::string paymentId() const = 0; diff --git a/tests/libwallet_api_tests/main.cpp b/tests/libwallet_api_tests/main.cpp index 6921e6c3a..51c0a3ca3 100644 --- a/tests/libwallet_api_tests/main.cpp +++ b/tests/libwallet_api_tests/main.cpp @@ -31,7 +31,6 @@ #include "gtest/gtest.h" #include "wallet/wallet2_api.h" -#include "cryptonote_core/cryptonote_format_utils.h" #include <boost/filesystem.hpp> #include <boost/algorithm/string.hpp> @@ -299,8 +298,11 @@ TEST_F(WalletManagerTest, WalletHistory) auto transaction_print = [=] (Bitmonero::TransactionInfo * t) { std::cout << "d: " << (t->direction() == Bitmonero::TransactionInfo::Direction_In ? "in" : "out") - << ", a: " << t->amount() + << ", bh: " << t->blockHeight() + << ", a: " << Bitmonero::Wallet::displayAmount(t->amount()) + << ", f: " << Bitmonero::Wallet::displayAmount(t->fee()) << ", h: " << t->hash() + << ", pid: " << t->paymentId() << std::endl; }; @@ -308,8 +310,6 @@ TEST_F(WalletManagerTest, WalletHistory) ASSERT_TRUE(t != nullptr); transaction_print(t); } - - } |