diff options
| author | Czarek Nakamoto <cyjan@mrcyjanek.net> | 2024-04-14 14:13:46 +0200 |
|---|---|---|
| committer | Czarek Nakamoto <cyjan@mrcyjanek.net> | 2024-04-14 14:13:46 +0200 |
| commit | 56c0c95e8a1a9a2c91a628d34f41b8453eb4dbce (patch) | |
| tree | 5ed6fac660423d7df870dd55b137fd99c99fb1aa | |
| parent | f5a6dbdd8ef45493a24c1a6130ad4168ca1dddaf (diff) | |
cake om nom nom nomcake_stuff
| -rw-r--r-- | monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp index 0160b8c..c75d08f 100644 --- a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp +++ b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp @@ -1695,6 +1695,77 @@ bool MONERO_DEBUG_isPointerNull(void* wallet_ptr) { return (wallet != NULL); } +// rather minimal implementation of the WalletListener +// borrowed from cake, I'm going to explore callbacks in future, but for now this is just enough. +struct MoneroWalletListener : Monero::WalletListener +{ + uint64_t m_height; + bool m_need_to_refresh; + bool m_new_transaction; + + MoneroWalletListener() + { + m_height = 0; + m_need_to_refresh = false; + m_new_transaction = false; + } + + void moneySpent(const std::string &txId, uint64_t amount) + { + m_new_transaction = true; + } + + void moneyReceived(const std::string &txId, uint64_t amount) + { + m_new_transaction = true; + } + + void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount) + { + m_new_transaction = true; + } + + void newBlock(uint64_t height) + { + m_height = height; + } + + void updated() + { + m_new_transaction = true; + } + + void refreshed() + { + m_need_to_refresh = true; + } + + void resetNeedToRefresh() + { + m_need_to_refresh = false; + } + + bool isNeedToRefresh() + { + return m_need_to_refresh; + } + + bool isNewTransactionExist() + { + return m_new_transaction; + } + + void resetIsNewTransactionExist() + { + m_new_transaction = false; + } + + uint64_t height() + { + return m_height; + } +}; + #ifdef __cplusplus } #endif |
