PIVX Core  5.6.99
P2P Digital Currency
addresstablemodel.cpp
Go to the documentation of this file.
1 // Copyright (c) 2011-2014 The Bitcoin developers
2 // Copyright (c) 2014-2015 The Dash developers
3 // Copyright (c) 2015-2021 The PIVX Core developers
4 // Distributed under the MIT/X11 software license, see the accompanying
5 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 
7 #include "addresstablemodel.h"
8 #include "addressbook.h"
9 
10 #include "guiutil.h"
11 #include "walletmodel.h"
12 
13 #include "key_io.h"
14 #include "wallet/wallet.h"
15 #include "askpassphrasedialog.h"
16 
17 #include "sapling/key_io_sapling.h"
18 
19 #include <algorithm>
20 
21 #include <QDebug>
22 #include <QFont>
23 
24 const QString AddressTableModel::Send = "S";
25 const QString AddressTableModel::Receive = "R";
26 const QString AddressTableModel::Zerocoin = "X";
27 const QString AddressTableModel::Delegator = "D";
28 const QString AddressTableModel::Delegable = "E";
29 const QString AddressTableModel::ColdStaking = "C";
30 const QString AddressTableModel::ColdStakingSend = "T";
31 const QString AddressTableModel::ShieldedReceive = "U";
32 const QString AddressTableModel::ShieldedSend = "V";
33 
35  enum Type {
45  Hidden /* QSortFilterProxyModel will filter these out */
46  };
47 
49  QString label{};
50  QString address{};
51  QString pubcoin{};
52  uint creationTime{0};
53 
54  AddressTableEntry() = delete; // need to specify a type
55  AddressTableEntry(Type _type, const QString& _pubcoin): type(_type), pubcoin(_pubcoin) {}
56  AddressTableEntry(Type _type, const QString& _label, const QString& _address, const uint _creationTime) :
57  type(_type),
58  label(_label),
59  address(_address),
60  creationTime(_creationTime)
61  {}
62 };
63 
65  bool operator()(const AddressTableEntry& a, const AddressTableEntry& b) const
66  {
67  return a.address < b.address;
68  }
69  bool operator()(const AddressTableEntry& a, const QString& b) const
70  {
71  return a.address < b;
72  }
73  bool operator()(const QString& a, const AddressTableEntry& b) const
74  {
75  return a < b.address;
76  }
77 };
78 
79 /* Determine address type from address purpose */
80 static AddressTableEntry::Type translateTransactionType(const QString& strPurpose, bool isMine)
81 {
83  // "refund" addresses aren't shown, and change addresses aren't in mapAddressBook at all.
84  if (strPurpose == QString::fromStdString(AddressBook::AddressBookPurpose::SEND))
85  addressType = AddressTableEntry::Sending;
86  else if (strPurpose == QString::fromStdString(AddressBook::AddressBookPurpose::RECEIVE))
87  addressType = AddressTableEntry::Receiving;
88  else if (strPurpose == QString::fromStdString(AddressBook::AddressBookPurpose::DELEGATOR))
89  addressType = AddressTableEntry::Delegator;
90  else if (strPurpose == QString::fromStdString(AddressBook::AddressBookPurpose::DELEGABLE))
91  addressType = AddressTableEntry::Delegable;
92  else if (strPurpose == QString::fromStdString(AddressBook::AddressBookPurpose::COLD_STAKING))
93  addressType = AddressTableEntry::ColdStaking;
94  else if (strPurpose == QString::fromStdString(AddressBook::AddressBookPurpose::COLD_STAKING_SEND))
96  else if (strPurpose == QString::fromStdString(AddressBook::AddressBookPurpose::SHIELDED_RECEIVE))
98  else if (strPurpose == QString::fromStdString(AddressBook::AddressBookPurpose::SHIELDED_SEND))
99  addressType = AddressTableEntry::ShieldedSend;
100  else if (strPurpose == "unknown" || strPurpose == "") // if purpose not set, guess
101  addressType = (isMine ? AddressTableEntry::Receiving : AddressTableEntry::Sending);
102  return addressType;
103 }
104 
105 static QString translateTypeToString(AddressTableEntry::Type type)
106 {
107  switch (type) {
109  return QObject::tr("Contact");
111  return QObject::tr("Receiving");
113  return QObject::tr("Delegator");
115  return QObject::tr("Delegable");
117  return QObject::tr("Cold Staking");
119  return QObject::tr("Cold Staking Contact");
121  return QObject::tr("Receiving Shielded");
123  return QObject::tr("Contact Shielded");
125  return QObject::tr("Hidden");
126  default:
127  return QObject::tr("Unknown");
128  }
129 }
130 
131 // Private implementation
133 {
134 public:
135  CWallet* wallet{nullptr};
136  QList<AddressTableEntry> cachedAddressTable;
137  int sendNum = 0;
138  int recvNum = 0;
139  int dellNum = 0;
140  int coldSendNum = 0;
143 
145 
147  {
148  cachedAddressTable.clear();
149  {
151  for (auto it = wallet->NewAddressBookIterator(); it.IsValid(); it.Next()) {
152  auto addrBookData = it.GetValue();
153  CChainParams::Base58Type addrType;
154  if (AddressBook::IsColdStakingPurpose(addrBookData.purpose)) {
156  } else if (AddressBook::IsExchangePurpose(addrBookData.purpose)) {
158  } else {
159  addrType = CChainParams::PUBKEY_ADDRESS;
160  }
161 
162  const CWDestination& dest = *it.GetDestKey();
163  bool fMine = IsMine(*wallet, dest);
164  QString addressStr = QString::fromStdString(Standard::EncodeDestination(dest, addrType));
165  uint creationTime = 0;
166  if (addrBookData.isReceivePurpose() || addrBookData.isShieldedReceivePurpose()) {
167  creationTime = static_cast<uint>(wallet->GetKeyCreationTime(dest));
168  }
169 
170  AddressTableEntry::Type addressType = translateTransactionType(
171  QString::fromStdString(addrBookData.purpose), fMine);
172  const std::string& strName = addrBookData.name;
173 
174  updatePurposeCachedCounted(addrBookData.purpose, true);
175  cachedAddressTable.append(
176  AddressTableEntry(addressType,
177  QString::fromStdString(strName),
178  addressStr,
179  creationTime
180  )
181  );
182  }
183  }
184  // std::lower_bound() and std::upper_bound() require our cachedAddressTable list to be sorted in asc order
185  // Even though the map is already sorted this re-sorting step is needed because the originating map
186  // is sorted by binary address, not by base58() address.
188  }
189 
190  // add shielded addresses num if needed..
191  void updatePurposeCachedCounted(std::string purpose, bool add)
192  {
193  int *var = nullptr;
195  var = &recvNum;
196  } else if (purpose == AddressBook::AddressBookPurpose::SEND) {
197  var = &sendNum;
199  var = &coldSendNum;
201  var = &dellNum;
202  } else if (purpose == AddressBook::AddressBookPurpose::SHIELDED_SEND) {
203  var = &shieldedSendNum;
204  } else {
205  return;
206  }
207  if (var != nullptr) {
208  if (add) (*var)++; else (*var)--;
209  }
210  }
211 
212  void updateEntry(const QString& address, const QString& label, bool isMine, const QString& purpose, int status)
213  {
214  // Find address / label in model
215  QList<AddressTableEntry>::iterator lower = std::lower_bound(
217  QList<AddressTableEntry>::iterator upper = std::upper_bound(
219  int lowerIndex = (lower - cachedAddressTable.begin());
220  int upperIndex = (upper - cachedAddressTable.begin());
221  bool inModel = (lower != upper);
222  AddressTableEntry::Type newEntryType = translateTransactionType(purpose, isMine);
223 
224  switch (status) {
225  case CT_NEW: {
226  if (inModel) {
227  qWarning() << "AddressTablePriv::updateEntry : Warning: Got CT_NEW, but entry is already in model";
228  break;
229  }
230  uint creationTime = 0;
231 
232  std::string stdPurpose = purpose.toStdString();
233  if (stdPurpose == AddressBook::AddressBookPurpose::RECEIVE ||
235  creationTime = static_cast<uint>(wallet->GetKeyCreationTime(Standard::DecodeDestination(address.toStdString())));
236  }
237 
238  updatePurposeCachedCounted(stdPurpose, true);
239 
240  parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex);
241  cachedAddressTable.insert(lowerIndex, AddressTableEntry(newEntryType, label, address, creationTime));
242  parent->endInsertRows();
243  break;
244  }
245  case CT_UPDATED: {
246  if (!inModel) {
247  qWarning() << "AddressTablePriv::updateEntry : Warning: Got CT_UPDATED, but entry is not in model";
248  break;
249  }
250  lower->type = newEntryType;
251  lower->label = label;
252  parent->emitDataChanged(lowerIndex);
253  break;
254  }
255  case CT_DELETED: {
256  if (!inModel) {
257  qWarning() << "AddressTablePriv::updateEntry : Warning: Got CT_DELETED, but entry is not in model";
258  break;
259  }
260  parent->beginRemoveRows(QModelIndex(), lowerIndex, upperIndex - 1);
261  cachedAddressTable.erase(lower, upper);
262  parent->endRemoveRows();
263  updatePurposeCachedCounted(purpose.toStdString(), false);
264  break;
265  }
266  }
267  }
268 
269  void updateEntry(const QString &pubCoin, const QString &isUsed, int status)
270  {
271  // Find address / label in model
272  QList<AddressTableEntry>::iterator lower = std::lower_bound(
274  QList<AddressTableEntry>::iterator upper = std::upper_bound(
276  int lowerIndex = (lower - cachedAddressTable.begin());
277  bool inModel = (lower != upper);
279 
280  switch(status)
281  {
282  case CT_NEW:
283  if (inModel) {
284  qWarning() << "AddressTablePriv_ZC::updateEntry : Warning: Got CT_NEW, but entry is already in model";
285  }
286  parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex);
287  cachedAddressTable.insert(lowerIndex, AddressTableEntry(newEntryType, isUsed, pubCoin, 0));
288  parent->endInsertRows();
289  break;
290  case CT_UPDATED:
291  if (!inModel) {
292  qWarning() << "AddressTablePriv_ZC::updateEntry : Warning: Got CT_UPDATED, but entry is not in model";
293  break;
294  }
295  lower->type = newEntryType;
296  lower->label = isUsed;
297  parent->emitDataChanged(lowerIndex);
298  break;
299  }
300  }
301 
302  int size() { return cachedAddressTable.size(); }
303  int sizeSend() { return sendNum; }
304  int sizeRecv() { return recvNum; }
305  int sizeDell() { return dellNum; }
306  int sizeColdSend() { return coldSendNum; }
308  int sizeSendAll() { return sizeSend() + sizeColdSend() + sizeShieldedSend(); }
309 
311  {
312  if (idx >= 0 && idx < cachedAddressTable.size()) {
313  return &cachedAddressTable[idx];
314  } else {
315  return 0;
316  }
317  }
318 };
319 
320 AddressTableModel::AddressTableModel(CWallet* wallet, WalletModel* parent) : QAbstractTableModel(parent), walletModel(parent), wallet(wallet), priv(0)
321 {
322  columns << tr("Label") << tr("Address") << tr("Date") << tr("Type");
323  priv = new AddressTablePriv(wallet, this);
325 }
326 
328 {
329  delete priv;
330 }
331 
332 int AddressTableModel::rowCount(const QModelIndex& parent) const
333 {
334  Q_UNUSED(parent);
335  return priv->size();
336 }
337 
338 int AddressTableModel::columnCount(const QModelIndex& parent) const
339 {
340  Q_UNUSED(parent);
341  return columns.length();
342 }
343 
344 int AddressTableModel::sizeSend() const { return priv->sizeSend(); }
345 int AddressTableModel::sizeRecv() const { return priv->sizeRecv(); }
346 int AddressTableModel::sizeDell() const { return priv->sizeDell(); }
350 
351 QVariant AddressTableModel::data(const QModelIndex& index, int role) const
352 {
353  if (!index.isValid())
354  return QVariant();
355 
356  AddressTableEntry* rec = static_cast<AddressTableEntry*>(index.internalPointer());
357 
358  if (role == Qt::DisplayRole || role == Qt::EditRole) {
359  switch (index.column()) {
360  case Label:
361  if (rec->label.isEmpty() && role == Qt::DisplayRole) {
362  return tr("(no label)");
363  } else {
364  return rec->label;
365  }
366  case Address:
367  return rec->address;
368  case Date:
369  return rec->creationTime;
370  case Type:
371  return translateTypeToString(rec->type);
372  }
373  } else if (role == Qt::FontRole) {
374  QFont font;
375  if (index.column() == Address) {
377  }
378  return font;
379  } else if (role == TypeRole) {
380  switch (rec->type) {
382  return Send;
384  return Receive;
386  return Delegator;
388  return Delegable;
390  return ColdStaking;
392  return ColdStakingSend;
394  return ShieldedReceive;
396  return ShieldedSend;
397  default:
398  break;
399  }
400  }
401  return QVariant();
402 }
403 
404 bool AddressTableModel::setData(const QModelIndex& index, const QVariant& value, int role)
405 {
406  if (!index.isValid())
407  return false;
408  AddressTableEntry* rec = static_cast<AddressTableEntry*>(index.internalPointer());
409  std::string strPurpose = (rec->type == AddressTableEntry::Sending ?
412  editStatus = OK;
413 
414  if (role == Qt::EditRole) {
415  LOCK(wallet->cs_wallet); /* For SetAddressBook / DelAddressBook */
416  CTxDestination curAddress = DecodeDestination(rec->address.toStdString());
417  if (index.column() == Label) {
418  // Do nothing, if old label == new label
419  if (rec->label == value.toString()) {
421  return false;
422  }
423  wallet->SetAddressBook(curAddress, value.toString().toStdString(), strPurpose);
424  } else if (index.column() == Address) {
425  CTxDestination newAddress = DecodeDestination(value.toString().toStdString());
426  // Refuse to set invalid address, set error status and return false
427  if (!IsValidDestination(newAddress)) {
429  return false;
430  }
431  // Do nothing, if old address == new address
432  else if (newAddress == curAddress) {
434  return false;
435  }
436  // Check for duplicate addresses to prevent accidental deletion of addresses, if you try
437  // to paste an existing address over another address (with a different label)
438  else if (wallet->HasAddressBook(newAddress)) {
440  return false;
441  }
442  // Double-check that we're not overwriting a receiving address
443  else if (rec->type == AddressTableEntry::Sending) {
444  // Remove old entry
445  wallet->DelAddressBook(curAddress);
446  // Add new entry with new address
447  wallet->SetAddressBook(newAddress, rec->label.toStdString(), strPurpose);
448  }
449  }
450  return true;
451  }
452  return false;
453 }
454 
455 QVariant AddressTableModel::headerData(int section, Qt::Orientation orientation, int role) const
456 {
457  if (orientation == Qt::Horizontal) {
458  if (role == Qt::DisplayRole && section < columns.size()) {
459  return columns[section];
460  }
461  }
462  return QVariant();
463 }
464 
465 Qt::ItemFlags AddressTableModel::flags(const QModelIndex& index) const
466 {
467  if (!index.isValid())
468  return Qt::NoItemFlags;
469  AddressTableEntry* rec = static_cast<AddressTableEntry*>(index.internalPointer());
470 
471  Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
472  // Can edit address and label for sending addresses,
473  // and only label for receiving addresses.
474  if (rec->type == AddressTableEntry::Sending ||
475  (rec->type == AddressTableEntry::Receiving && index.column() == Label)) {
476  retval |= Qt::ItemIsEditable;
477  }
478  return retval;
479 }
480 
481 QModelIndex AddressTableModel::index(int row, int column, const QModelIndex& parent) const
482 {
483  Q_UNUSED(parent);
484  AddressTableEntry* data = priv->index(row);
485  if (data) {
486  return createIndex(row, column, priv->index(row));
487  } else {
488  return QModelIndex();
489  }
490 }
491 
492 void AddressTableModel::updateEntry(const QString& address,
493  const QString& label,
494  bool isMine,
495  const QString& purpose,
496  int status)
497 {
498  // Update address book model from Pivx core
499  priv->updateEntry(address, label, isMine, purpose, status);
500 }
501 
502 
503 void AddressTableModel::updateEntry(const QString &pubCoin, const QString &isUsed, int status)
504 {
505  // Update stealth address book model from Bitcoin core
506  priv->updateEntry(pubCoin, isUsed, status);
507 }
508 
509 
510 
511 QString AddressTableModel::addRow(const QString& type, const QString& label, const QString& address)
512 {
513  std::string strLabel = label.toStdString();
514  std::string strAddress = address.toStdString();
515 
516  editStatus = OK;
517 
518  if (type == Send) {
519  if (!walletModel->validateAddress(address)) {
521  return QString();
522  }
523  // Check for duplicate addresses
524  {
526  if (wallet->HasAddressBook(DecodeDestination(strAddress))) {
528  return QString();
529  }
530  }
531  } else if (type == Receive) {
532  // Generate a new address to associate with given label
533  CPubKey newKey;
534  if (!wallet->GetKeyFromPool(newKey)) {
536  if (!ctx.isValid()) {
537  // Unlock wallet failed or was cancelled
539  return QString();
540  }
541  if (!wallet->GetKeyFromPool(newKey)) {
543  return QString();
544  }
545  }
546  strAddress = EncodeDestination(newKey.GetID());
547  } else {
548  return QString();
549  }
550 
551  // Add entry
552  {
554  wallet->SetAddressBook(DecodeDestination(strAddress), strLabel,
556  }
557  return QString::fromStdString(strAddress);
558 }
559 
560 bool AddressTableModel::removeRows(int row, int count, const QModelIndex& parent)
561 {
562  Q_UNUSED(parent);
563  AddressTableEntry* rec = priv->index(row);
564  if (count != 1 || !rec || rec->type == AddressTableEntry::Receiving || rec->type == AddressTableEntry::ColdStaking) {
565  // Can only remove one row at a time, and cannot remove rows not in model.
566  // Also refuse to remove receiving addresses.
567  return false;
568  }
570  {
572  return wallet->DelAddressBook(Standard::DecodeDestination(rec->address.toStdString()), addrType);
573  }
574 }
575 
576 /* Look up label for address in address book, if not found return empty string.
577  */
578 QString AddressTableModel::labelForAddress(const QString& address) const
579 {
580  // TODO: Check why do we have empty addresses..
581  if (!address.isEmpty()) {
582  CWDestination dest = Standard::DecodeDestination(address.toStdString());
583  return QString::fromStdString(wallet->GetNameForAddressBookEntry(dest));
584  }
585  return QString();
586 }
587 
588 /* Look up purpose for address in address book
589  */
590 std::string AddressTableModel::purposeForAddress(const std::string& address) const
591 {
593 }
594 
595 int AddressTableModel::lookupAddress(const QString& address) const
596 {
597  QModelIndexList lst = match(index(0, Address, QModelIndex()),
598  Qt::EditRole, address, 1, Qt::MatchExactly);
599  if (lst.isEmpty()) {
600  return -1;
601  } else {
602  return lst.at(0).row();
603  }
604 }
605 
606 bool AddressTableModel::isWhitelisted(const std::string& address) const
607 {
609 }
610 
615 QString AddressTableModel::getAddressToShow(bool isShielded) const
616 {
618 
619  for (auto it = wallet->NewAddressBookIterator(); it.IsValid(); it.Next()) {
620  const auto addrData = it.GetValue();
621  CWDestination x = *it.GetDestKey();
622  if (!isShielded) {
623  if (addrData.purpose == AddressBook::AddressBookPurpose::RECEIVE) {
624  const auto &address = *it.GetCTxDestKey();
625  if (IsValidDestination(address) && IsMine(*wallet, address) && !wallet->IsUsed(address)) {
626  return QString::fromStdString(EncodeDestination(address));
627  }
628  }
629  } else {
630  if (addrData.purpose == AddressBook::AddressBookPurpose::SHIELDED_RECEIVE) {
631  const auto &address = *it.GetShieldedDestKey();
632  if (IsValidPaymentAddress(address) && IsMine(*wallet, address) && !wallet->IsUsed(address)) {
633  return QString::fromStdString(KeyIO::EncodePaymentAddress(address));
634  }
635  }
636  }
637  }
638 
639  // For some reason we don't have any address in our address book, let's create one
640  CallResult<Destination> res = !isShielded ? walletModel->getNewAddress("Default") :
641  walletModel->getNewShieldedAddress("default shielded");
642  return (res) ? QString::fromStdString(res.getObjResult()->ToString()) : "";;
643 }
644 
646 {
647  Q_EMIT dataChanged(index(idx, 0, QModelIndex()), index(idx, columns.length() - 1, QModelIndex()));
648 }
649 
650 void AddressTableModel::notifyChange(const QModelIndex &_index)
651 {
652  int idx = _index.row();
653  emitDataChanged(idx);
654 }
bool IsValidPaymentAddress(const libzcash::PaymentAddress &zaddr)
Check whether a PaymentAddress is not an InvalidEncoding.
Definition: address.cpp:92
Qt model of the address book in the core.
@ TypeRole
Type of address (Send, Receive, ColdStaking, ColdStakingSend, Delegator, Delegable)
int lookupAddress(const QString &address) const
AddressTablePriv * priv
int columnCount(const QModelIndex &parent) const
static const QString Delegator
Specifies cold staking addresses which delegated tokens to this wallet and ARE being staked.
AddressTableModel(CWallet *wallet, WalletModel *parent=0)
QVariant headerData(int section, Qt::Orientation orientation, int role) const
static const QString ColdStakingSend
Specifies send cold staking addresses (simil 'contacts')
static const QString ShieldedSend
Specifies shielded receive address.
WalletModel * walletModel
@ WALLET_UNLOCK_FAILURE
Wallet could not be unlocked to create new receiving address.
@ NO_CHANGES
No changes were made during edit operation.
@ INVALID_ADDRESS
Unparsable address.
@ KEY_GENERATION_FAILURE
Generating a new public key for a receiving address failed.
@ OK
Everything ok.
@ DUPLICATE_ADDRESS
Address already in address book.
void emitDataChanged(int index)
Notify listeners that data changed.
@ Address
Bitcoin address.
@ Label
User specified label.
@ Date
Address creation date.
@ Type
Address Type.
std::string purposeForAddress(const std::string &address) const
static const QString ShieldedReceive
Specifies shielded send address.
Qt::ItemFlags flags(const QModelIndex &index) const
bool setData(const QModelIndex &index, const QVariant &value, int role)
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
QModelIndex index(int row, int column, const QModelIndex &parent) const
int sizeShieldedSend() const
QVariant data(const QModelIndex &index, int role) const
static const QString Send
Specifies send address.
bool isWhitelisted(const std::string &address) const
Checks if the address is whitelisted.
static const QString Zerocoin
Specifies stealth address.
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
friend class AddressTablePriv
QString getAddressToShow(bool shielded=false) const
Return last unused address.
QString addRow(const QString &type, const QString &label, const QString &address)
static const QString Delegable
Specifies cold staking addresses which delegated tokens to this wallet.
void notifyChange(const QModelIndex &index)
static const QString Receive
Specifies receive address.
int rowCount(const QModelIndex &parent) const
static const QString ColdStaking
Specifies cold staking own addresses.
QString labelForAddress(const QString &address) const
void updateEntry(const QString &pubCoin, const QString &isUsed, int status)
QList< AddressTableEntry > cachedAddressTable
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
AddressTableModel * parent
AddressTablePriv(CWallet *wallet, AddressTableModel *parent)
AddressTableEntry * index(int idx)
void updatePurposeCachedCounted(std::string purpose, bool add)
An encapsulated public key.
Definition: pubkey.h:44
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
Definition: pubkey.h:167
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
Definition: wallet.h:577
RecursiveMutex cs_wallet
Definition: wallet.h:720
CAddressBookIterator NewAddressBookIterator()
Definition: wallet.h:1178
const Optional< T > & getObjResult() const
Interface to PIVX wallet from Qt view code.
Definition: walletmodel.h:109
bool validateAddress(const QString &address)
CallResult< Destination > getNewAddress(const std::string &label="") const
CallResult< Destination > getNewShieldedAddress(std::string strLabel="")
Return a new shielded address.
UnlockContext requestUnlock()
boost::variant< CTxDestination, libzcash::SaplingPaymentAddress > CWDestination
bool DelAddressBook(const CWDestination &address, const CChainParams::Base58Type addrType=CChainParams::PUBKEY_ADDRESS)
Definition: wallet.cpp:3659
std::string GetPurposeForAddressBookEntry(const CWDestination &address) const
Definition: wallet.cpp:3679
bool GetKeyFromPool(CPubKey &key, const uint8_t &type=HDChain::ChangeType::EXTERNAL)
Definition: wallet.cpp:3752
std::string GetNameForAddressBookEntry(const CWDestination &address) const
Definition: wallet.cpp:3686
bool HasAddressBook(const CWDestination &address) const
Definition: wallet.cpp:3710
bool SetAddressBook(const CWDestination &address, const std::string &strName, const std::string &purpose)
Definition: wallet.cpp:3642
int64_t GetKeyCreationTime(const CWDestination &dest)
Definition: wallet.cpp:221
bool IsUsed(const CTxDestination address) const
Definition: wallet.cpp:1462
@ CT_UPDATED
Definition: guiinterface.h:26
@ CT_DELETED
Definition: guiinterface.h:27
@ CT_NEW
Definition: guiinterface.h:25
isminetype IsMine(const CKeyStore &keystore, const CTxDestination &dest)
Definition: ismine.cpp:29
@ LOCK
Definition: lockunlock.h:16
const std::string COLD_STAKING_SEND
Definition: addressbook.cpp:16
const std::string SHIELDED_RECEIVE
Definition: addressbook.cpp:17
const std::string SHIELDED_SEND
Definition: addressbook.cpp:18
const std::string COLD_STAKING
Definition: addressbook.cpp:15
bool IsExchangePurpose(const std::string &purpose)
Definition: addressbook.cpp:32
bool IsColdStakingPurpose(const std::string &purpose)
Definition: addressbook.cpp:22
QFont bitcoinAddressFont()
Definition: guiutil.cpp:84
std::string EncodePaymentAddress(const libzcash::PaymentAddress &zaddr)
bool IsValidDestination(const CWDestination &address)
std::string EncodeDestination(const CWDestination &address, const CChainParams::Base58Type addrType)
CWDestination DecodeDestination(const std::string &strAddress)
boost::variant< CNoDestination, CKeyID, CScriptID, CExchangeKeyID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:72
Type type
AddressTableEntry(Type _type, const QString &_pubcoin)
AddressTableEntry(Type _type, const QString &_label, const QString &_address, const uint _creationTime)
QString pubcoin
QString label
uint creationTime
QString address
AddressTableEntry()=delete
Type
@ Zerocoin
@ Hidden
@ ShieldedSend
@ Delegable
@ ShieldedReceive
@ Delegator
@ Sending
@ Receiving
@ ColdStaking
@ ColdStakingSend
bool operator()(const AddressTableEntry &a, const AddressTableEntry &b) const
bool operator()(const QString &a, const AddressTableEntry &b) const
bool operator()(const AddressTableEntry &a, const QString &b) const