GUI: WalletModel: Wrap checkAddressForUsage and findAddressUsage

This commit is contained in:
Luke Dashjr 2019-05-07 13:15:59 +00:00
parent cd213eca16
commit 178605b413
2 changed files with 20 additions and 0 deletions

View File

@ -155,6 +155,22 @@ bool WalletModel::validateAddress(const QString& address) const
return IsValidDestinationString(address.toStdString());
}
bool WalletModel::checkAddressForUsage(const std::vector<std::string>& addresses) const
{
return m_wallet->checkAddressForUsage(addresses);
}
bool WalletModel::findAddressUsage(const QStringList& addresses, std::function<void(const QString&, const interfaces::WalletTx&, uint32_t)> callback) const
{
std::vector<std::string> std_addresses;
for (const auto& address : addresses) {
std_addresses.push_back(address.toStdString());
}
return m_wallet->findAddressUsage(std_addresses, [&callback](const std::string& address, const interfaces::WalletTx& wtx, uint32_t output_index){
callback(QString::fromStdString(address), wtx, output_index);
});
}
WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransaction &transaction, const CCoinControl& coinControl)
{
CAmount total = 0;

View File

@ -10,12 +10,14 @@
#endif
#include <key.h>
#include <primitives/transaction.h>
#include <qt/walletmodeltransaction.h>
#include <interfaces/wallet.h>
#include <support/allocators/secure.h>
#include <string>
#include <vector>
#include <QObject>
@ -85,6 +87,8 @@ public:
// Check address for validity
bool validateAddress(const QString& address) const;
bool checkAddressForUsage(const std::vector<std::string>& addresses) const;
bool findAddressUsage(const QStringList& addresses, std::function<void(const QString&, const interfaces::WalletTx&, uint32_t)> callback) const;
// Return status record for SendCoins, contains error id + information
struct SendCoinsReturn