|
| 1 | +// Copyright (c) 2014-2025, The Monero Project |
| 2 | +// |
| 3 | +// All rights reserved. |
| 4 | +// |
| 5 | +// Redistribution and use in source and binary forms, with or without modification, are |
| 6 | +// permitted provided that the following conditions are met: |
| 7 | +// |
| 8 | +// 1. Redistributions of source code must retain the above copyright notice, this list of |
| 9 | +// conditions and the following disclaimer. |
| 10 | +// |
| 11 | +// 2. Redistributions in binary form must reproduce the above copyright notice, this list |
| 12 | +// of conditions and the following disclaimer in the documentation and/or other |
| 13 | +// materials provided with the distribution. |
| 14 | +// |
| 15 | +// 3. Neither the name of the copyright holder nor the names of its contributors may be |
| 16 | +// used to endorse or promote products derived from this software without specific |
| 17 | +// prior written permission. |
| 18 | +// |
| 19 | +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY |
| 20 | +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 21 | +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
| 22 | +// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 | +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 24 | +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 25 | +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 26 | +// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF |
| 27 | +// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | + |
| 29 | +#include "wallet/api/wallet2_api.h" |
| 30 | + |
| 31 | + |
| 32 | +namespace Monero { |
| 33 | + |
| 34 | +class EnoteDetailsImpl : public EnoteDetails |
| 35 | +{ |
| 36 | +public: |
| 37 | + EnoteDetailsImpl(); |
| 38 | + ~EnoteDetailsImpl() override; |
| 39 | + std::string onetimeAddress() const override; |
| 40 | + std::string viewTag() const override; |
| 41 | + std::uint64_t blockHeight() const override; |
| 42 | + std::string txId() const override; |
| 43 | + std::uint64_t internalEnoteIndex() const override; |
| 44 | + std::uint64_t globalEnoteIndex() const override; |
| 45 | + bool isSpent() const override; |
| 46 | + bool isFrozen() const override; |
| 47 | + std::uint64_t spentHeight() const override; |
| 48 | + std::string keyImage() const override; |
| 49 | + std::string mask() const override; |
| 50 | + std::uint64_t amount() const override; |
| 51 | + TxProtocol protocolVersion() const override; |
| 52 | + bool isKeyImageKnown() const override; |
| 53 | + bool isKeyImageRequest() const override; |
| 54 | + std::uint64_t pkIndex() const override; |
| 55 | + std::vector<std::pair<std::uint64_t, std::string>> uses() const override; |
| 56 | + |
| 57 | + // Multisig |
| 58 | + bool isKeyImagePartial() const override; |
| 59 | + |
| 60 | +private: |
| 61 | + friend class WalletImpl; |
| 62 | + |
| 63 | + // Ko |
| 64 | + std::string m_onetime_address; |
| 65 | + // view_tag |
| 66 | + std::string m_view_tag; |
| 67 | + // this enote was received at block height |
| 68 | + std::uint64_t m_block_height; |
| 69 | + // tx id in which tx enote was received |
| 70 | + std::string m_tx_id; |
| 71 | + // relative index in tx |
| 72 | + std::uint64_t m_internal_enote_index; |
| 73 | + // absolute index from `cryptonote::COMMAND_RPC_GET_TRANSACTIONS::entry.output_indices` |
| 74 | + std::uint64_t m_global_enote_index; |
| 75 | + // is spent |
| 76 | + bool m_spent; |
| 77 | + // is frozen |
| 78 | + bool m_frozen; |
| 79 | + // blockchain height, set if spent |
| 80 | + std::uint64_t m_spent_height; |
| 81 | + // key image |
| 82 | + std::string m_key_image; |
| 83 | + // x, blinding factor in amount commitment C = x G + a H |
| 84 | + std::string m_mask; |
| 85 | + // a |
| 86 | + std::uint64_t m_amount; |
| 87 | + // protocol version : TxProtocol_CryptoNote / TxProtocol_RingCT |
| 88 | + TxProtocol m_protocol_version; |
| 89 | + // is key image known |
| 90 | + bool m_key_image_known; |
| 91 | + // view wallets: we want to request it; cold wallets: it was requested |
| 92 | + bool m_key_image_request; |
| 93 | + // public key index in tx_extra |
| 94 | + std::uint64_t m_pk_index; |
| 95 | + // track uses of this enote in the blockchain in the format [ [block_height, tx_id], ... ] if `wallet2::m_track_uses` is true (default is false) |
| 96 | + std::vector<std::pair<std::uint64_t, std::string>> m_uses; |
| 97 | + |
| 98 | + // Multisig |
| 99 | + bool m_key_image_partial; |
| 100 | + // NOTE : These multisig members are part of wallet2 transfer_details and may need to get added here. |
| 101 | +/* |
| 102 | + std::vector<rct::key> m_multisig_k; |
| 103 | + std::vector<multisig_info> m_multisig_info; // one per other participant |
| 104 | +*/ |
| 105 | +}; |
| 106 | + |
| 107 | +} // namespace |
0 commit comments