#include <address_book.h>
Definition at line 39 of file address_book.h.
◆ AddressBookImpl()
| Electroneum::AddressBookImpl::AddressBookImpl |
( |
WalletImpl * | wallet | ) |
|
◆ ~AddressBookImpl()
| Electroneum::AddressBookImpl::~AddressBookImpl |
( |
| ) |
|
◆ addRow()
| bool Electroneum::AddressBookImpl::addRow |
( |
const std::string & | dst_addr, |
|
|
const std::string & | payment_id, |
|
|
const std::string & | description ) |
|
overridevirtual |
Implements Electroneum::AddressBook.
Definition at line 48 of file address_book.cpp.
49{
50 clearStatus();
51
52 cryptonote::address_parse_info
info;
54 m_errorString =
tr(
"Invalid destination address");
56 return false;
57 }
58
61
62
63 if(payment_id_str.length() == 16) {
64 m_errorString =
tr(
"Invalid payment ID. Short payment ID should only be used in an integrated address");
66 return false;
67 }
68
69
70 if(!payment_id_str.empty() && !has_long_pid) {
71 m_errorString =
tr(
"Invalid payment ID");
73 return false;
74 }
75
76
77 if(has_long_pid &&
info.has_payment_id) {
78 m_errorString =
tr(
"Integrated address and long payment ID can't be used at the same time");
80 return false;
81 }
82
83
84 if (
info.has_payment_id)
85 {
86 memcpy(payment_id.data,
info.payment_id.data, 8);
87 }
88
89 bool r = m_wallet->m_wallet->add_address_book_row(
info.address,payment_id,description,
info.is_subaddress);
90 if (r)
92 else
94 return r;
95}
void * memcpy(void *a, const void *b, size_t c)
bool get_account_address_from_str(address_parse_info &info, network_type nettype, std::string const &str)
◆ deleteRow()
| bool Electroneum::AddressBookImpl::deleteRow |
( |
std::size_t | rowId | ) |
|
|
overridevirtual |
◆ errorCode()
| int Electroneum::AddressBookImpl::errorCode |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ errorString()
| std::string Electroneum::AddressBookImpl::errorString |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ getAll()
| std::vector< AddressBookRow * > Electroneum::AddressBookImpl::getAll |
( |
| ) |
const |
|
overridevirtual |
◆ lookupPaymentID()
| int Electroneum::AddressBookImpl::lookupPaymentID |
( |
const std::string & | payment_id | ) |
const |
|
overridevirtual |
Implements Electroneum::AddressBook.
Definition at line 135 of file address_book.cpp.
136{
137
138 const std::string long_payment_id = payment_id + std::string(64 - payment_id.size(), '0');
139
140 int idx = -1;
141 for (const auto &row: m_rows) {
142 ++idx;
143
144 if (payment_id == row->getPaymentId())
145 return idx;
146
147 if (long_payment_id == row->getPaymentId())
148 return idx;
149
150 const std::string long_row_payment_id = row->getPaymentId() + std::string(64 - row->getPaymentId().size(), '0');
151 if (payment_id == long_row_payment_id)
152 return idx;
153 }
154 return -1;
155}
◆ refresh()
| void Electroneum::AddressBookImpl::refresh |
( |
| ) |
|
|
overridevirtual |
Implements Electroneum::AddressBook.
Definition at line 97 of file address_book.cpp.
98{
100
101 clearRows();
102
103
104 std::vector<tools::wallet2::address_book_row>
rows = m_wallet->m_wallet->get_address_book();
105 for (
size_t i = 0; i <
rows.size(); ++i) {
106 tools::wallet2::address_book_row * row = &
rows.at(i);
107
108 std::string payment_id = (row->
m_payment_id == crypto::null_hash)?
"" : epee::string_tools::
pod_to_hex(row->m_payment_id);
110
111 if (!row->
m_is_subaddress && payment_id.length() > 16 && payment_id.substr(16).find_first_not_of(
'0') == std::string::npos) {
112 payment_id = payment_id.substr(0,16);
116
117 payment_id = "";
118 }
119 }
121 m_rows.push_back(abr);
122 }
123
124}
std::string get_account_address_as_str(network_type nettype, bool subaddress, account_public_address const &adr)
std::string get_account_integrated_address_as_str(network_type nettype, account_public_address const &adr, crypto::hash8 const &payment_id)
std::string pod_to_hex(const t_pod_type &s)
The documentation for this class was generated from the following files:
- /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/wallet/api/address_book.h
- /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/wallet/api/address_book.cpp