updated address book functionality to support Carrot addresses
This commit is contained in:
@@ -11076,7 +11076,7 @@ bool simple_wallet::address_book(const std::vector<std::string> &args/* = std::v
|
||||
description += " ";
|
||||
description += args[i];
|
||||
}
|
||||
m_wallet->add_address_book_row(info.address, info.has_payment_id ? &info.payment_id : NULL, description, info.is_subaddress);
|
||||
m_wallet->add_address_book_row(info.address, info.has_payment_id ? &info.payment_id : NULL, description, info.is_subaddress, info.is_carrot);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -11100,9 +11100,9 @@ bool simple_wallet::address_book(const std::vector<std::string> &args/* = std::v
|
||||
success_msg_writer() << tr("Index: ") << i;
|
||||
std::string address;
|
||||
if (row.m_has_payment_id)
|
||||
address = cryptonote::get_account_integrated_address_as_str(m_wallet->nettype(), row.m_address, row.m_payment_id);
|
||||
address = cryptonote::get_account_integrated_address_as_str(m_wallet->nettype(), row.m_address, row.m_payment_id, row.m_is_carrot);
|
||||
else
|
||||
address = get_account_address_as_str(m_wallet->nettype(), row.m_is_subaddress, row.m_address);
|
||||
address = get_account_address_as_str(m_wallet->nettype(), row.m_is_subaddress, row.m_address, row.m_is_carrot);
|
||||
success_msg_writer() << tr("Address: ") << address;
|
||||
success_msg_writer() << tr("Description: ") << row.m_description << "\n";
|
||||
}
|
||||
|
||||
@@ -4021,7 +4021,7 @@ void wallet2::fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height,
|
||||
}
|
||||
|
||||
|
||||
bool wallet2::add_address_book_row(const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress)
|
||||
bool wallet2::add_address_book_row(const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress, bool is_carrot)
|
||||
{
|
||||
wallet2::address_book_row a;
|
||||
a.m_address = address;
|
||||
@@ -4029,6 +4029,7 @@ bool wallet2::add_address_book_row(const cryptonote::account_public_address &add
|
||||
a.m_payment_id = payment_id ? *payment_id : crypto::null_hash8;
|
||||
a.m_description = description;
|
||||
a.m_is_subaddress = is_subaddress;
|
||||
a.m_is_carrot = is_carrot;
|
||||
|
||||
auto old_size = m_address_book.size();
|
||||
m_address_book.push_back(a);
|
||||
@@ -4037,7 +4038,7 @@ bool wallet2::add_address_book_row(const cryptonote::account_public_address &add
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wallet2::set_address_book_row(size_t row_id, const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress)
|
||||
bool wallet2::set_address_book_row(size_t row_id, const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress, bool is_carrot)
|
||||
{
|
||||
wallet2::address_book_row a;
|
||||
a.m_address = address;
|
||||
@@ -4045,6 +4046,7 @@ bool wallet2::set_address_book_row(size_t row_id, const cryptonote::account_publ
|
||||
a.m_payment_id = payment_id ? *payment_id : crypto::null_hash8;
|
||||
a.m_description = description;
|
||||
a.m_is_subaddress = is_subaddress;
|
||||
a.m_is_carrot = is_carrot;
|
||||
|
||||
const auto size = m_address_book.size();
|
||||
if (row_id >= size)
|
||||
|
||||
@@ -859,6 +859,7 @@ private:
|
||||
std::string m_description;
|
||||
bool m_is_subaddress;
|
||||
bool m_has_payment_id;
|
||||
bool m_is_carrot;
|
||||
|
||||
BEGIN_SERIALIZE_OBJECT()
|
||||
VERSION_FIELD(0)
|
||||
@@ -867,6 +868,7 @@ private:
|
||||
FIELD(m_description)
|
||||
FIELD(m_is_subaddress)
|
||||
FIELD(m_has_payment_id)
|
||||
FIELD(m_is_carrot)
|
||||
END_SERIALIZE()
|
||||
};
|
||||
|
||||
@@ -1646,8 +1648,8 @@ private:
|
||||
* \brief GUI Address book get/store
|
||||
*/
|
||||
std::vector<address_book_row> get_address_book() const { return m_address_book; }
|
||||
bool add_address_book_row(const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress);
|
||||
bool set_address_book_row(size_t row_id, const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress);
|
||||
bool add_address_book_row(const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress, bool is_carrot);
|
||||
bool set_address_book_row(size_t row_id, const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress, bool is_carrot);
|
||||
bool delete_address_book_row(std::size_t row_id);
|
||||
|
||||
uint64_t get_num_rct_outputs();
|
||||
@@ -2290,7 +2292,7 @@ BOOST_CLASS_VERSION(tools::wallet2::payment_details, 5)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::pool_payment_details, 1)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::unconfirmed_transfer_details, 8)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::confirmed_transfer_details, 6)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::address_book_row, 18)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::address_book_row, 19)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::reserve_proof_entry, 0)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::unsigned_tx_set, 1)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::signed_tx_set, 1)
|
||||
@@ -2668,6 +2670,9 @@ namespace boost
|
||||
a & x.m_has_payment_id;
|
||||
if (x.m_has_payment_id)
|
||||
a & x.m_payment_id;
|
||||
if (ver < 19)
|
||||
return;
|
||||
a & x.m_is_carrot;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
|
||||
@@ -3313,9 +3313,9 @@ namespace tools
|
||||
const auto &entry = ab[idx];
|
||||
std::string address;
|
||||
if (entry.m_has_payment_id)
|
||||
address = cryptonote::get_account_integrated_address_as_str(m_wallet->nettype(), entry.m_address, entry.m_payment_id);
|
||||
address = cryptonote::get_account_integrated_address_as_str(m_wallet->nettype(), entry.m_address, entry.m_payment_id, entry.m_is_carrot);
|
||||
else
|
||||
address = get_account_address_as_str(m_wallet->nettype(), entry.m_is_subaddress, entry.m_address);
|
||||
address = get_account_address_as_str(m_wallet->nettype(), entry.m_is_subaddress, entry.m_address, entry.m_is_carrot);
|
||||
res.entries.push_back(wallet_rpc::COMMAND_RPC_GET_ADDRESS_BOOK_ENTRY::entry{idx, address, entry.m_description});
|
||||
}
|
||||
}
|
||||
@@ -3355,7 +3355,7 @@ namespace tools
|
||||
er.message = std::string("WALLET_RPC_ERROR_CODE_WRONG_ADDRESS: ") + req.address;
|
||||
return false;
|
||||
}
|
||||
if (!m_wallet->add_address_book_row(info.address, info.has_payment_id ? &info.payment_id : NULL, req.description, info.is_subaddress))
|
||||
if (!m_wallet->add_address_book_row(info.address, info.has_payment_id ? &info.payment_id : NULL, req.description, info.is_subaddress, info.is_carrot))
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
|
||||
er.message = "Failed to add address book entry";
|
||||
@@ -3414,12 +3414,13 @@ namespace tools
|
||||
entry.m_is_subaddress = info.is_subaddress;
|
||||
if (info.has_payment_id)
|
||||
entry.m_payment_id = info.payment_id;
|
||||
entry.m_is_carrot = info.is_carrot;
|
||||
}
|
||||
|
||||
if (req.set_description)
|
||||
entry.m_description = req.description;
|
||||
|
||||
if (!m_wallet->set_address_book_row(req.index, entry.m_address, req.set_address && entry.m_has_payment_id ? &entry.m_payment_id : NULL, entry.m_description, entry.m_is_subaddress))
|
||||
if (!m_wallet->set_address_book_row(req.index, entry.m_address, req.set_address && entry.m_has_payment_id ? &entry.m_payment_id : NULL, entry.m_description, entry.m_is_subaddress, entry.m_is_carrot))
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
|
||||
er.message = "Failed to edit address book entry";
|
||||
|
||||
Reference in New Issue
Block a user