mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2025-01-09 11:17:25 -03:00
enotes changes
This commit is contained in:
parent
11c92a48ff
commit
64b54a40b9
8 changed files with 80 additions and 473 deletions
|
@ -40,9 +40,7 @@ set(wallet_api_sources
|
||||||
address_book.cpp
|
address_book.cpp
|
||||||
subaddress.cpp
|
subaddress.cpp
|
||||||
subaddress_account.cpp
|
subaddress_account.cpp
|
||||||
unsigned_transaction.cpp
|
unsigned_transaction.cpp)
|
||||||
coins.cpp
|
|
||||||
coins_info.cpp)
|
|
||||||
|
|
||||||
set(wallet_api_headers
|
set(wallet_api_headers
|
||||||
wallet2_api.h)
|
wallet2_api.h)
|
||||||
|
@ -57,9 +55,7 @@ set(wallet_api_private_headers
|
||||||
address_book.h
|
address_book.h
|
||||||
subaddress.h
|
subaddress.h
|
||||||
subaddress_account.h
|
subaddress_account.h
|
||||||
unsigned_transaction.h
|
unsigned_transaction.h)
|
||||||
coins.h
|
|
||||||
coins_info.h)
|
|
||||||
|
|
||||||
monero_private_headers(wallet_api
|
monero_private_headers(wallet_api
|
||||||
${wallet_api_private_headers})
|
${wallet_api_private_headers})
|
||||||
|
|
|
@ -1,185 +0,0 @@
|
||||||
#include "coins.h"
|
|
||||||
#include "coins_info.h"
|
|
||||||
#include "wallet.h"
|
|
||||||
#include "crypto/hash.h"
|
|
||||||
#include "wallet/wallet2.h"
|
|
||||||
#include "common_defines.h"
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
using namespace epee;
|
|
||||||
|
|
||||||
namespace Monero {
|
|
||||||
|
|
||||||
Coins::~Coins() = default;
|
|
||||||
|
|
||||||
CoinsImpl::CoinsImpl(WalletImpl *wallet)
|
|
||||||
: m_wallet(wallet) {}
|
|
||||||
|
|
||||||
CoinsImpl::~CoinsImpl()
|
|
||||||
{
|
|
||||||
for (auto t : m_rows)
|
|
||||||
delete t;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CoinsImpl::count() const
|
|
||||||
{
|
|
||||||
boost::shared_lock<boost::shared_mutex> lock(m_rowsMutex);
|
|
||||||
int result = m_rows.size();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
CoinsInfo *CoinsImpl::coin(int index) const
|
|
||||||
{
|
|
||||||
boost::shared_lock<boost::shared_mutex> lock(m_rowsMutex);
|
|
||||||
// sanity check
|
|
||||||
if (index < 0)
|
|
||||||
return nullptr;
|
|
||||||
auto index_ = static_cast<unsigned>(index);
|
|
||||||
return index_ < m_rows.size() ? m_rows[index_] : nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<CoinsInfo *> CoinsImpl::getAll() const
|
|
||||||
{
|
|
||||||
boost::shared_lock<boost::shared_mutex> lock(m_rowsMutex);
|
|
||||||
return m_rows;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CoinsImpl::refresh()
|
|
||||||
{
|
|
||||||
LOG_PRINT_L2("Refreshing coins");
|
|
||||||
|
|
||||||
boost::unique_lock<boost::shared_mutex> lock(m_rowsMutex);
|
|
||||||
boost::shared_lock<boost::shared_mutex> transfers_lock(m_wallet->m_wallet->m_transfers_mutex);
|
|
||||||
|
|
||||||
// delete old outputs;
|
|
||||||
for (auto t : m_rows)
|
|
||||||
delete t;
|
|
||||||
m_rows.clear();
|
|
||||||
|
|
||||||
for (size_t i = 0; i < m_wallet->m_wallet->get_num_transfer_details(); ++i)
|
|
||||||
{
|
|
||||||
const tools::wallet2::transfer_details &td = m_wallet->m_wallet->get_transfer_details(i);
|
|
||||||
|
|
||||||
auto ci = new CoinsInfoImpl();
|
|
||||||
ci->m_blockHeight = td.m_block_height;
|
|
||||||
ci->m_hash = string_tools::pod_to_hex(td.m_txid);
|
|
||||||
ci->m_internalOutputIndex = td.m_internal_output_index;
|
|
||||||
ci->m_globalOutputIndex = td.m_global_output_index;
|
|
||||||
ci->m_spent = td.m_spent;
|
|
||||||
ci->m_frozen = td.m_frozen;
|
|
||||||
ci->m_spentHeight = td.m_spent_height;
|
|
||||||
ci->m_amount = td.m_amount;
|
|
||||||
ci->m_rct = td.m_rct;
|
|
||||||
ci->m_keyImageKnown = td.m_key_image_known;
|
|
||||||
ci->m_pkIndex = td.m_pk_index;
|
|
||||||
ci->m_subaddrIndex = td.m_subaddr_index.minor;
|
|
||||||
ci->m_subaddrAccount = td.m_subaddr_index.major;
|
|
||||||
ci->m_address = m_wallet->m_wallet->get_subaddress_as_str(td.m_subaddr_index); // todo: this is expensive, cache maybe?
|
|
||||||
ci->m_addressLabel = m_wallet->m_wallet->get_subaddress_label(td.m_subaddr_index);
|
|
||||||
ci->m_keyImage = string_tools::pod_to_hex(td.m_key_image);
|
|
||||||
ci->m_unlockTime = td.m_tx.unlock_time;
|
|
||||||
ci->m_unlocked = m_wallet->m_wallet->is_transfer_unlocked(td);
|
|
||||||
ci->m_pubKey = string_tools::pod_to_hex(td.get_public_key());
|
|
||||||
ci->m_coinbase = td.m_tx.vin.size() == 1 && td.m_tx.vin[0].type() == typeid(cryptonote::txin_gen);
|
|
||||||
ci->m_description = m_wallet->m_wallet->get_tx_note(td.m_txid);
|
|
||||||
|
|
||||||
m_rows.push_back(ci);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CoinsImpl::setFrozen(std::string public_key)
|
|
||||||
{
|
|
||||||
crypto::public_key pk;
|
|
||||||
if (!epee::string_tools::hex_to_pod(public_key, pk))
|
|
||||||
{
|
|
||||||
LOG_ERROR("Invalid public key: " << public_key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
m_wallet->m_wallet->freeze(pk);
|
|
||||||
refresh();
|
|
||||||
}
|
|
||||||
catch (const std::exception& e)
|
|
||||||
{
|
|
||||||
LOG_ERROR("setFrozen: " << e.what());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CoinsImpl::setFrozen(int index)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
m_wallet->m_wallet->freeze(index);
|
|
||||||
refresh();
|
|
||||||
}
|
|
||||||
catch (const std::exception& e)
|
|
||||||
{
|
|
||||||
LOG_ERROR("setLabel: " << e.what());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CoinsImpl::thaw(std::string public_key)
|
|
||||||
{
|
|
||||||
crypto::public_key pk;
|
|
||||||
if (!epee::string_tools::hex_to_pod(public_key, pk))
|
|
||||||
{
|
|
||||||
LOG_ERROR("Invalid public key: " << public_key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
m_wallet->m_wallet->thaw(pk);
|
|
||||||
refresh();
|
|
||||||
}
|
|
||||||
catch (const std::exception& e)
|
|
||||||
{
|
|
||||||
LOG_ERROR("thaw: " << e.what());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CoinsImpl::thaw(int index)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
m_wallet->m_wallet->thaw(index);
|
|
||||||
refresh();
|
|
||||||
}
|
|
||||||
catch (const std::exception& e)
|
|
||||||
{
|
|
||||||
LOG_ERROR("thaw: " << e.what());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CoinsImpl::isTransferUnlocked(uint64_t unlockTime, uint64_t blockHeight) {
|
|
||||||
return m_wallet->m_wallet->is_transfer_unlocked(unlockTime, blockHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CoinsImpl::setDescription(const std::string &public_key, const std::string &description)
|
|
||||||
{
|
|
||||||
crypto::public_key pk;
|
|
||||||
if (!epee::string_tools::hex_to_pod(public_key, pk))
|
|
||||||
{
|
|
||||||
LOG_ERROR("Invalid public key: " << public_key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
const size_t index = m_wallet->m_wallet->get_transfer_details(pk);
|
|
||||||
const tools::wallet2::transfer_details &td = m_wallet->m_wallet->get_transfer_details(index);
|
|
||||||
m_wallet->m_wallet->set_tx_note(td.m_txid, description);
|
|
||||||
refresh();
|
|
||||||
}
|
|
||||||
catch (const std::exception& e)
|
|
||||||
{
|
|
||||||
LOG_ERROR("setDescription: " << e.what());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
|
@ -1,40 +0,0 @@
|
||||||
#ifndef FEATHER_COINS_H
|
|
||||||
#define FEATHER_COINS_H
|
|
||||||
|
|
||||||
#include "wallet/api/wallet2_api.h"
|
|
||||||
#include "wallet/wallet2.h"
|
|
||||||
|
|
||||||
namespace Monero {
|
|
||||||
|
|
||||||
class WalletImpl;
|
|
||||||
|
|
||||||
class CoinsImpl : public Coins
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit CoinsImpl(WalletImpl * wallet);
|
|
||||||
~CoinsImpl() override;
|
|
||||||
int count() const override;
|
|
||||||
CoinsInfo * coin(int index) const override;
|
|
||||||
std::vector<CoinsInfo*> getAll() const override;
|
|
||||||
void refresh() override;
|
|
||||||
|
|
||||||
void setFrozen(std::string public_key) override;
|
|
||||||
void setFrozen(int index) override;
|
|
||||||
void thaw(std::string public_key) override;
|
|
||||||
void thaw(int index) override;
|
|
||||||
|
|
||||||
bool isTransferUnlocked(uint64_t unlockTime, uint64_t blockHeight) override;
|
|
||||||
|
|
||||||
void setDescription(const std::string &public_key, const std::string &description) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
WalletImpl *m_wallet;
|
|
||||||
std::vector<CoinsInfo*> m_rows;
|
|
||||||
mutable boost::shared_mutex m_rowsMutex;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Bitmonero = Monero;
|
|
||||||
|
|
||||||
#endif //FEATHER_COINS_H
|
|
|
@ -1,122 +0,0 @@
|
||||||
#include "coins_info.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
namespace Monero {
|
|
||||||
|
|
||||||
CoinsInfo::~CoinsInfo() = default;
|
|
||||||
|
|
||||||
CoinsInfoImpl::CoinsInfoImpl()
|
|
||||||
: m_blockHeight(0)
|
|
||||||
, m_internalOutputIndex(0)
|
|
||||||
, m_globalOutputIndex(0)
|
|
||||||
, m_spent(false)
|
|
||||||
, m_frozen(false)
|
|
||||||
, m_spentHeight(0)
|
|
||||||
, m_amount(0)
|
|
||||||
, m_rct(false)
|
|
||||||
, m_keyImageKnown(false)
|
|
||||||
, m_pkIndex(0)
|
|
||||||
, m_subaddrAccount(0)
|
|
||||||
, m_subaddrIndex(0)
|
|
||||||
, m_unlockTime(0)
|
|
||||||
, m_unlocked(false)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
CoinsInfoImpl::~CoinsInfoImpl() = default;
|
|
||||||
|
|
||||||
uint64_t CoinsInfoImpl::blockHeight() const
|
|
||||||
{
|
|
||||||
return m_blockHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
string CoinsInfoImpl::hash() const
|
|
||||||
{
|
|
||||||
return m_hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t CoinsInfoImpl::internalOutputIndex() const {
|
|
||||||
return m_internalOutputIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t CoinsInfoImpl::globalOutputIndex() const
|
|
||||||
{
|
|
||||||
return m_globalOutputIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CoinsInfoImpl::spent() const
|
|
||||||
{
|
|
||||||
return m_spent;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CoinsInfoImpl::frozen() const
|
|
||||||
{
|
|
||||||
return m_frozen;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t CoinsInfoImpl::spentHeight() const
|
|
||||||
{
|
|
||||||
return m_spentHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t CoinsInfoImpl::amount() const
|
|
||||||
{
|
|
||||||
return m_amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CoinsInfoImpl::rct() const {
|
|
||||||
return m_rct;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CoinsInfoImpl::keyImageKnown() const {
|
|
||||||
return m_keyImageKnown;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t CoinsInfoImpl::pkIndex() const {
|
|
||||||
return m_pkIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t CoinsInfoImpl::subaddrIndex() const {
|
|
||||||
return m_subaddrIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t CoinsInfoImpl::subaddrAccount() const {
|
|
||||||
return m_subaddrAccount;
|
|
||||||
}
|
|
||||||
|
|
||||||
string CoinsInfoImpl::address() const {
|
|
||||||
return m_address;
|
|
||||||
}
|
|
||||||
|
|
||||||
string CoinsInfoImpl::addressLabel() const {
|
|
||||||
return m_addressLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
string CoinsInfoImpl::keyImage() const {
|
|
||||||
return m_keyImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t CoinsInfoImpl::unlockTime() const {
|
|
||||||
return m_unlockTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CoinsInfoImpl::unlocked() const {
|
|
||||||
return m_unlocked;
|
|
||||||
}
|
|
||||||
|
|
||||||
string CoinsInfoImpl::pubKey() const {
|
|
||||||
return m_pubKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CoinsInfoImpl::coinbase() const {
|
|
||||||
return m_coinbase;
|
|
||||||
}
|
|
||||||
|
|
||||||
string CoinsInfoImpl::description() const {
|
|
||||||
return m_description;
|
|
||||||
}
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
namespace Bitmonero = Monero;
|
|
|
@ -1,71 +0,0 @@
|
||||||
#ifndef FEATHER_COINS_INFO_H
|
|
||||||
#define FEATHER_COINS_INFO_H
|
|
||||||
|
|
||||||
#include "wallet/api/wallet2_api.h"
|
|
||||||
#include <string>
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
namespace Monero {
|
|
||||||
|
|
||||||
class CoinsImpl;
|
|
||||||
|
|
||||||
class CoinsInfoImpl : public CoinsInfo
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CoinsInfoImpl();
|
|
||||||
~CoinsInfoImpl();
|
|
||||||
|
|
||||||
virtual uint64_t blockHeight() const override;
|
|
||||||
virtual std::string hash() const override;
|
|
||||||
virtual size_t internalOutputIndex() const override;
|
|
||||||
virtual uint64_t globalOutputIndex() const override;
|
|
||||||
virtual bool spent() const override;
|
|
||||||
virtual bool frozen() const override;
|
|
||||||
virtual uint64_t spentHeight() const override;
|
|
||||||
virtual uint64_t amount() const override;
|
|
||||||
virtual bool rct() const override;
|
|
||||||
virtual bool keyImageKnown() const override;
|
|
||||||
virtual size_t pkIndex() const override;
|
|
||||||
virtual uint32_t subaddrIndex() const override;
|
|
||||||
virtual uint32_t subaddrAccount() const override;
|
|
||||||
virtual std::string address() const override;
|
|
||||||
virtual std::string addressLabel() const override;
|
|
||||||
virtual std::string keyImage() const override;
|
|
||||||
virtual uint64_t unlockTime() const override;
|
|
||||||
virtual bool unlocked() const override;
|
|
||||||
virtual std::string pubKey() const override;
|
|
||||||
virtual bool coinbase() const override;
|
|
||||||
virtual std::string description() const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
uint64_t m_blockHeight;
|
|
||||||
std::string m_hash;
|
|
||||||
size_t m_internalOutputIndex;
|
|
||||||
uint64_t m_globalOutputIndex;
|
|
||||||
bool m_spent;
|
|
||||||
bool m_frozen;
|
|
||||||
uint64_t m_spentHeight;
|
|
||||||
uint64_t m_amount;
|
|
||||||
bool m_rct;
|
|
||||||
bool m_keyImageKnown;
|
|
||||||
size_t m_pkIndex;
|
|
||||||
uint32_t m_subaddrIndex;
|
|
||||||
uint32_t m_subaddrAccount;
|
|
||||||
std::string m_address;
|
|
||||||
std::string m_addressLabel;
|
|
||||||
std::string m_keyImage;
|
|
||||||
uint64_t m_unlockTime;
|
|
||||||
bool m_unlocked;
|
|
||||||
std::string m_pubKey;
|
|
||||||
bool m_coinbase;
|
|
||||||
std::string m_description;
|
|
||||||
|
|
||||||
friend class CoinsImpl;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
namespace Bitmonero = Monero;
|
|
||||||
|
|
||||||
#endif //FEATHER_COINS_INFO_H
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include "transaction_history.h"
|
#include "transaction_history.h"
|
||||||
#include "address_book.h"
|
#include "address_book.h"
|
||||||
#include "subaddress.h"
|
#include "subaddress.h"
|
||||||
#include "coins.h"
|
|
||||||
#include "subaddress_account.h"
|
#include "subaddress_account.h"
|
||||||
#include "common_defines.h"
|
#include "common_defines.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
@ -48,6 +47,7 @@
|
||||||
|
|
||||||
#include <boost/locale.hpp>
|
#include <boost/locale.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cryptonote;
|
using namespace cryptonote;
|
||||||
|
@ -436,7 +436,6 @@ WalletImpl::WalletImpl(NetworkType nettype, uint64_t kdf_rounds)
|
||||||
m_refreshEnabled = false;
|
m_refreshEnabled = false;
|
||||||
m_addressBook.reset(new AddressBookImpl(this));
|
m_addressBook.reset(new AddressBookImpl(this));
|
||||||
m_subaddress.reset(new SubaddressImpl(this));
|
m_subaddress.reset(new SubaddressImpl(this));
|
||||||
m_coins.reset(new CoinsImpl(this));
|
|
||||||
m_subaddressAccount.reset(new SubaddressAccountImpl(this));
|
m_subaddressAccount.reset(new SubaddressAccountImpl(this));
|
||||||
|
|
||||||
|
|
||||||
|
@ -1886,9 +1885,54 @@ AddressBook *WalletImpl::addressBook()
|
||||||
return m_addressBook.get();
|
return m_addressBook.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Coins *WalletImpl::coins()
|
std::vector<Enote> WalletImpl::enotes()
|
||||||
{
|
{
|
||||||
return m_coins.get();
|
LOG_PRINT_L2("Refreshing coins");
|
||||||
|
|
||||||
|
boost::shared_lock<boost::shared_mutex> transfers_lock(m_wallet->m_transfers_mutex);
|
||||||
|
|
||||||
|
std::vector<Enote> enotes;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < m_wallet->get_num_transfer_details(); ++i)
|
||||||
|
{
|
||||||
|
const tools::wallet2::transfer_details &td = m_wallet->get_transfer_details(i);
|
||||||
|
|
||||||
|
Enote enote;
|
||||||
|
enote.idx = i;
|
||||||
|
enote.blockHeight = td.m_block_height;
|
||||||
|
enote.hash = epee::string_tools::pod_to_hex(td.m_txid);
|
||||||
|
enote.internalOutputIndex = td.m_internal_output_index;
|
||||||
|
enote.globalOutputIndex = td.m_global_output_index;
|
||||||
|
enote.spent = td.m_spent;
|
||||||
|
enote.frozen = td.m_frozen;
|
||||||
|
enote.spentHeight = td.m_spent_height;
|
||||||
|
enote.amount = td.m_amount;
|
||||||
|
enote.rct = td.m_rct;
|
||||||
|
enote.keyImageKnown = td.m_key_image_known;
|
||||||
|
enote.pkIndex = td.m_pk_index;
|
||||||
|
enote.subaddrIndex = td.m_subaddr_index.minor;
|
||||||
|
enote.subaddrAccount = td.m_subaddr_index.major;
|
||||||
|
enote.address = m_wallet->get_subaddress_as_str(td.m_subaddr_index); // todo: this is expensive, cache maybe?
|
||||||
|
enote.addressLabel = m_wallet->get_subaddress_label(td.m_subaddr_index);
|
||||||
|
enote.keyImage = epee::string_tools::pod_to_hex(td.m_key_image);
|
||||||
|
enote.unlockTime = td.m_tx.unlock_time;
|
||||||
|
enote.unlocked = m_wallet->is_transfer_unlocked(td);
|
||||||
|
enote.pubKey = epee::string_tools::pod_to_hex(td.get_public_key());
|
||||||
|
enote.coinbase = td.m_tx.vin.size() == 1 && td.m_tx.vin[0].type() == typeid(cryptonote::txin_gen);
|
||||||
|
enote.description = m_wallet->get_tx_note(td.m_txid);
|
||||||
|
|
||||||
|
enotes.push_back(enote);
|
||||||
|
}
|
||||||
|
|
||||||
|
return enotes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WalletImpl::freeze(size_t idx) {
|
||||||
|
m_wallet->freeze(idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WalletImpl::thaw(size_t idx) {
|
||||||
|
m_wallet->thaw(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
Subaddress *WalletImpl::subaddress()
|
Subaddress *WalletImpl::subaddress()
|
||||||
|
|
|
@ -46,7 +46,6 @@ class PendingTransactionImpl;
|
||||||
class UnsignedTransactionImpl;
|
class UnsignedTransactionImpl;
|
||||||
class AddressBookImpl;
|
class AddressBookImpl;
|
||||||
class SubaddressImpl;
|
class SubaddressImpl;
|
||||||
class CoinsImpl;
|
|
||||||
class SubaddressAccountImpl;
|
class SubaddressAccountImpl;
|
||||||
struct Wallet2CallbackImpl;
|
struct Wallet2CallbackImpl;
|
||||||
|
|
||||||
|
@ -189,7 +188,9 @@ public:
|
||||||
PendingTransaction::Priority priority) const override;
|
PendingTransaction::Priority priority) const override;
|
||||||
virtual TransactionHistory * history() override;
|
virtual TransactionHistory * history() override;
|
||||||
virtual AddressBook * addressBook() override;
|
virtual AddressBook * addressBook() override;
|
||||||
virtual Coins * coins() override;
|
virtual std::vector<Enote> enotes() override;
|
||||||
|
virtual void freeze(size_t idx) override;
|
||||||
|
virtual void thaw(size_t idx) override;
|
||||||
virtual Subaddress * subaddress() override;
|
virtual Subaddress * subaddress() override;
|
||||||
virtual SubaddressAccount * subaddressAccount() override;
|
virtual SubaddressAccount * subaddressAccount() override;
|
||||||
virtual void setListener(WalletListener * l) override;
|
virtual void setListener(WalletListener * l) override;
|
||||||
|
@ -260,7 +261,6 @@ private:
|
||||||
friend class TransactionHistoryImpl;
|
friend class TransactionHistoryImpl;
|
||||||
friend struct Wallet2CallbackImpl;
|
friend struct Wallet2CallbackImpl;
|
||||||
friend class AddressBookImpl;
|
friend class AddressBookImpl;
|
||||||
friend class CoinsImpl;
|
|
||||||
friend class SubaddressImpl;
|
friend class SubaddressImpl;
|
||||||
friend class SubaddressAccountImpl;
|
friend class SubaddressAccountImpl;
|
||||||
|
|
||||||
|
@ -273,7 +273,6 @@ private:
|
||||||
std::unique_ptr<Wallet2CallbackImpl> m_wallet2Callback;
|
std::unique_ptr<Wallet2CallbackImpl> m_wallet2Callback;
|
||||||
std::unique_ptr<AddressBookImpl> m_addressBook;
|
std::unique_ptr<AddressBookImpl> m_addressBook;
|
||||||
std::unique_ptr<SubaddressImpl> m_subaddress;
|
std::unique_ptr<SubaddressImpl> m_subaddress;
|
||||||
std::unique_ptr<CoinsImpl> m_coins;
|
|
||||||
std::unique_ptr<SubaddressAccountImpl> m_subaddressAccount;
|
std::unique_ptr<SubaddressAccountImpl> m_subaddressAccount;
|
||||||
|
|
||||||
// multi-threaded refresh stuff
|
// multi-threaded refresh stuff
|
||||||
|
|
|
@ -262,48 +262,32 @@ struct AddressBook
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The CoinsInfo - interface for displaying coins information
|
* @brief Enote - enote (utxo) information
|
||||||
*/
|
*/
|
||||||
struct CoinsInfo
|
struct Enote
|
||||||
{
|
{
|
||||||
virtual ~CoinsInfo() = 0;
|
size_t idx;
|
||||||
|
uint64_t blockHeight;
|
||||||
virtual uint64_t blockHeight() const = 0;
|
std::string hash;
|
||||||
virtual std::string hash() const = 0;
|
size_t internalOutputIndex;
|
||||||
virtual size_t internalOutputIndex() const = 0;
|
uint64_t globalOutputIndex;
|
||||||
virtual uint64_t globalOutputIndex() const = 0;
|
bool spent;
|
||||||
virtual bool spent() const = 0;
|
bool frozen;
|
||||||
virtual bool frozen() const = 0;
|
uint64_t spentHeight;
|
||||||
virtual uint64_t spentHeight() const = 0;
|
uint64_t amount;
|
||||||
virtual uint64_t amount() const = 0;
|
bool rct;
|
||||||
virtual bool rct() const = 0;
|
bool keyImageKnown;
|
||||||
virtual bool keyImageKnown() const = 0;
|
size_t pkIndex;
|
||||||
virtual size_t pkIndex() const = 0;
|
uint32_t subaddrIndex;
|
||||||
virtual uint32_t subaddrIndex() const = 0;
|
uint32_t subaddrAccount;
|
||||||
virtual uint32_t subaddrAccount() const = 0;
|
std::string address;
|
||||||
virtual std::string address() const = 0;
|
std::string addressLabel;
|
||||||
virtual std::string addressLabel() const = 0;
|
std::string keyImage;
|
||||||
virtual std::string keyImage() const = 0;
|
uint64_t unlockTime;
|
||||||
virtual uint64_t unlockTime() const = 0;
|
bool unlocked;
|
||||||
virtual bool unlocked() const = 0;
|
std::string pubKey;
|
||||||
virtual std::string pubKey() const = 0;
|
bool coinbase;
|
||||||
virtual bool coinbase() const = 0;
|
std::string description;
|
||||||
virtual std::string description() const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Coins
|
|
||||||
{
|
|
||||||
virtual ~Coins() = 0;
|
|
||||||
virtual int count() const = 0;
|
|
||||||
virtual CoinsInfo * coin(int index) const = 0;
|
|
||||||
virtual std::vector<CoinsInfo*> getAll() const = 0;
|
|
||||||
virtual void refresh() = 0;
|
|
||||||
virtual void setFrozen(std::string public_key) = 0;
|
|
||||||
virtual void setFrozen(int index) = 0;
|
|
||||||
virtual void thaw(std::string public_key) = 0;
|
|
||||||
virtual void thaw(int index) = 0;
|
|
||||||
virtual bool isTransferUnlocked(uint64_t unlockTime, uint64_t blockHeight) = 0;
|
|
||||||
virtual void setDescription(const std::string &public_key, const std::string &description) = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SubaddressRow {
|
struct SubaddressRow {
|
||||||
|
@ -989,7 +973,9 @@ struct Wallet
|
||||||
|
|
||||||
virtual TransactionHistory * history() = 0;
|
virtual TransactionHistory * history() = 0;
|
||||||
virtual AddressBook * addressBook() = 0;
|
virtual AddressBook * addressBook() = 0;
|
||||||
virtual Coins * coins() = 0;
|
virtual std::vector<Enote> enotes() = 0;
|
||||||
|
virtual void freeze(size_t idx) = 0;
|
||||||
|
virtual void thaw(size_t idx) = 0;
|
||||||
virtual Subaddress * subaddress() = 0;
|
virtual Subaddress * subaddress() = 0;
|
||||||
virtual SubaddressAccount * subaddressAccount() = 0;
|
virtual SubaddressAccount * subaddressAccount() = 0;
|
||||||
virtual void setListener(WalletListener *) = 0;
|
virtual void setListener(WalletListener *) = 0;
|
||||||
|
|
Loading…
Reference in a new issue