5 #if defined(HAVE_CONFIG_H)    30 #include <QMessageBox>    36     QObject(parent), 
m_wallet(
std::move(wallet)), m_node(node), optionsModel(_optionsModel), addressTableModel(0),
    37     transactionTableModel(0),
    38     recentRequestsTableModel(0),
    39     cachedEncryptionStatus(Unencrypted),
    79     if (!
m_wallet->tryGetBalances(new_balances, numBlocks)) {
   111         bool isMine, 
const QString &purpose, 
int status)
   131     bool fSubtractFeeFromAmount = 
false;
   132     QList<SendCoinsRecipient> recipients = transaction.
getRecipients();
   133     std::vector<CRecipient> vecSend;
   135     if(recipients.empty())
   140     QSet<QString> setAddress; 
   146         if (rcp.fSubtractFeeFromAmount)
   147             fSubtractFeeFromAmount = 
true;
   150         if (rcp.paymentRequest.IsInitialized())
   153             const payments::PaymentDetails& details = rcp.paymentRequest.getDetails();
   154             for (
int i = 0; i < details.outputs_size(); i++)
   156                 const payments::Output& out = details.outputs(i);
   157                 if (out.amount() <= 0) 
continue;
   158                 subtotal += out.amount();
   159                 const unsigned char* scriptStr = (
const unsigned char*)out.script().data();
   160                 CScript scriptPubKey(scriptStr, scriptStr+out.script().size());
   161                 CAmount nAmount = out.amount();
   163                 vecSend.push_back(recipient);
   182             setAddress.insert(rcp.address);
   186             CRecipient recipient = {scriptPubKey, rcp.amount, rcp.fSubtractFeeFromAmount};
   192     if(setAddress.size() != nAddresses)
   206         int nChangePosRet = -1;
   207         std::string strFailReason;
   209         auto& newTx = transaction.
getWtx();
   210         newTx = 
m_wallet->createTransaction(vecSend, coinControl, 
true , nChangePosRet, nFeeRequired, strFailReason);
   212         if (fSubtractFeeFromAmount && newTx)
   217             if(!fSubtractFeeFromAmount && (total + nFeeRequired) > nBalance)
   221             Q_EMIT 
message(tr(
"Send Coins"), QString::fromStdString(strFailReason),
   238     QByteArray transaction_array; 
   241         std::vector<std::pair<std::string, std::string>> vOrderForm;
   245             if (rcp.paymentRequest.IsInitialized())
   248                 if (PaymentServer::verifyExpired(rcp.paymentRequest.getDetails())) {
   254                 rcp.paymentRequest.SerializeToString(&value);
   255                 vOrderForm.emplace_back(
"PaymentRequest", std::move(value));
   259             if (!rcp.message.isEmpty()) 
   260                 vOrderForm.emplace_back(
"Message", rcp.message.toStdString());
   263         auto& newTx = transaction.
getWtx();
   264         std::string rejectReason;
   265         if (!newTx->commit({} , std::move(vOrderForm), rejectReason))
   269         ssTx << newTx->get();
   270         transaction_array.append(&(ssTx[0]), ssTx.
size());
   279         if (!rcp.paymentRequest.IsInitialized())
   282             std::string strAddress = rcp.address.toStdString();
   284             std::string strLabel = rcp.label.toStdString();
   289                      dest, &
name,  
nullptr,  
nullptr))
   291                     m_wallet->setAddressBook(dest, strLabel, 
"send");
   293                 else if (
name != strLabel)
   295                     m_wallet->setAddressBook(dest, strLabel, 
""); 
   299         Q_EMIT 
coinsSent(
this, rcp, transaction_array);
   348         return m_wallet->encryptWallet(passphrase);
   367         return m_wallet->unlock(passPhrase);
   374     return m_wallet->changeWalletPassphrase(oldPass, newPass);
   380     qDebug() << 
"NotifyUnload";
   381     QMetaObject::invokeMethod(walletModel, 
"unload", Qt::QueuedConnection);
   384 static void NotifyKeyStoreStatusChanged(
WalletModel *walletmodel)
   386     qDebug() << 
"NotifyKeyStoreStatusChanged";
   387     QMetaObject::invokeMethod(walletmodel, 
"updateStatus", Qt::QueuedConnection);
   390 static void NotifyAddressBookChanged(
WalletModel *walletmodel,
   391         const CTxDestination &address, 
const std::string &label, 
bool isMine,
   392         const std::string &purpose, 
ChangeType status)
   395     QString strLabel = QString::fromStdString(label);
   396     QString strPurpose = QString::fromStdString(purpose);
   398     qDebug() << 
"NotifyAddressBookChanged: " + strAddress + 
" " + strLabel + 
" isMine=" + QString::number(isMine) + 
" purpose=" + strPurpose + 
" status=" + QString::number(status);
   399     QMetaObject::invokeMethod(walletmodel, 
"updateAddressBook", Qt::QueuedConnection,
   400                               Q_ARG(QString, strAddress),
   401                               Q_ARG(QString, strLabel),
   403                               Q_ARG(QString, strPurpose),
   411     QMetaObject::invokeMethod(walletmodel, 
"updateTransaction", Qt::QueuedConnection);
   414 static void ShowProgress(
WalletModel *walletmodel, 
const std::string &title, 
int nProgress)
   417     QMetaObject::invokeMethod(walletmodel, 
"showProgress", Qt::QueuedConnection,
   418                               Q_ARG(QString, QString::fromStdString(title)),
   419                               Q_ARG(
int, nProgress));
   422 static void NotifyWatchonlyChanged(
WalletModel *walletmodel, 
bool fHaveWatchonly)
   424     QMetaObject::invokeMethod(walletmodel, 
"updateWatchOnlyFlag", Qt::QueuedConnection,
   425                               Q_ARG(
bool, fHaveWatchonly));
   476         wallet->setWalletLocked(
true);
   489     vReceiveRequests = 
m_wallet->getDestValues(
"rr"); 
   496     std::stringstream ss;
   498     std::string key = 
"rr" + ss.str(); 
   500     if (sRequest.empty())
   501         return m_wallet->eraseDestData(dest, key);
   503         return m_wallet->addDestData(dest, key, sRequest);
   510     std::vector<std::string> errors;
   514     if (!
m_wallet->createBumpTransaction(hash, coin_control, 0 , errors, old_fee, new_fee, mtx)) {
   515         QMessageBox::critical(0, tr(
"Fee bump error"), tr(
"Increasing transaction fee failed") + 
"<br />(" +
   516             (errors.size() ? QString::fromStdString(errors[0]) : 
"") +
")");
   521     QString questionString = tr(
"Do you want to increase the fee?");
   522     questionString.append(
"<br />");
   523     questionString.append(
"<table style=\"text-align: left;\">");
   524     questionString.append(
"<tr><td>");
   525     questionString.append(tr(
"Current fee:"));
   526     questionString.append(
"</td><td>");
   528     questionString.append(
"</td></tr><tr><td>");
   529     questionString.append(tr(
"Increase:"));
   530     questionString.append(
"</td><td>");
   532     questionString.append(
"</td></tr><tr><td>");
   533     questionString.append(tr(
"New fee:"));
   534     questionString.append(
"</td><td>");
   536     questionString.append(
"</td></tr></table>");
   538     confirmationDialog.
exec();
   539     QMessageBox::StandardButton retval = 
static_cast<QMessageBox::StandardButton
>(confirmationDialog.result());
   542     if (retval != QMessageBox::Yes) {
   553     if (!
m_wallet->signBumpTransaction(mtx)) {
   554         QMessageBox::critical(0, tr(
"Fee bump error"), tr(
"Can't sign transaction."));
   558     if(!
m_wallet->commitBumpTransaction(hash, std::move(mtx), errors, new_hash)) {
   559         QMessageBox::critical(0, tr(
"Fee bump error"), tr(
"Could not commit transaction") + 
"<br />(" +
   560             QString::fromStdString(errors[0])+
")");
   578     return QString::fromStdString(
m_wallet->getWalletName());
 
void loadReceiveRequests(std::vector< std::string > &vReceiveRequests)
 
Model for list of recently generated payment requests / bitcoin: URIs. 
 
TransactionTableModel * transactionTableModel
 
std::unique_ptr< interfaces::PendingWalletTx > & getWtx()
 
interfaces::Wallet & wallet() const
 
void coinsSent(WalletModel *wallet, SendCoinsRecipient recipient, QByteArray transaction)
 
RecentRequestsTableModel * recentRequestsTableModel
 
std::unique_ptr< interfaces::Handler > m_handler_address_book_changed
 
static bool isWalletEnabled()
 
bool IsValidDestinationString(const std::string &str, const CChainParams ¶ms)
 
WalletModel(std::unique_ptr< interfaces::Wallet > wallet, interfaces::Node &node, const PlatformStyle *platformStyle, OptionsModel *optionsModel, QObject *parent=0)
 
UnlockContext requestUnlock()
 
std::unique_ptr< interfaces::Handler > m_handler_unload
 
void unsubscribeFromCoreSignals()
 
static QString formatHtmlWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as HTML string (with unit) 
 
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
 
SendCoinsReturn sendCoins(WalletModelTransaction &transaction)
 
QList< SendCoinsRecipient > getRecipients() const
 
std::unique_ptr< interfaces::Handler > m_handler_status_changed
 
bool fSubtractFeeFromAmount
 
Double ended buffer combining vector and stream-like interfaces. 
 
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value. 
 
virtual std::vector< std::unique_ptr< Wallet > > getWallets()=0
Return interfaces for accessing wallets (if any). 
 
AddressTableModel * getAddressTableModel()
 
EncryptionStatus getEncryptionStatus() const
 
void setTransactionFee(const CAmount &newFee)
 
bool bumpFee(uint256 hash, uint256 &new_hash)
 
UnlockContext(WalletModel *wallet, bool valid, bool relock)
 
int64_t CAmount
Amount in satoshis (Can be negative) 
 
void push_back(const T &value)
 
ChangeType
General change type (added, updated, removed). 
 
Collection of wallet balances. 
 
boost::variant< CNoDestination, CKeyID, CScriptID, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown > CTxDestination
A txout script template with a specific destination. 
 
bool changePassphrase(const SecureString &oldPass, const SecureString &newPass)
 
void reassignAmounts(int nChangePosRet)
 
bool privateKeysDisabled() const
 
std::unique_ptr< interfaces::Wallet > m_wallet
 
virtual CAmount getMaxTxFee()=0
Get max tx fee. 
 
SendCoinsReturn prepareTransaction(WalletModelTransaction &transaction, const CCoinControl &coinControl)
 
void encryptionStatusChanged()
 
OptionsModel * optionsModel
 
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination. 
 
QString getWalletName() const
 
TransactionTableModel * getTransactionTableModel()
 
EncryptionStatus cachedEncryptionStatus
 
void CopyFrom(const UnlockContext &rhs)
 
UI model for the transaction table of a wallet. 
 
boost::optional< bool > m_signal_bip125_rbf
Override the wallet's m_signal_rbf if set. 
 
Qt model of the address book in the core. 
 
bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString())
 
std::unique_ptr< interfaces::Handler > m_handler_show_progress
 
bool validateAddress(const QString &address)
 
void updateWatchOnlyFlag(bool fHaveWatchonly)
 
CTxDestination DecodeDestination(const std::string &str)
 
bool fForceCheckBalanceChanged
 
RecentRequestsTableModel * getRecentRequestsTableModel()
 
Interface from Qt to configuration data structure for Bitcoin client. 
 
Serialized script, used inside transaction inputs and outputs. 
 
Interface to Bitcoin wallet from Qt view code. 
 
interfaces::WalletBalances m_cached_balances
 
bool setWalletEncrypted(bool encrypted, const SecureString &passphrase)
 
interfaces::Node & m_node
 
void message(const QString &title, const QString &message, unsigned int style)
 
void notifyWatchonlyChanged(bool fHaveWatchonly)
 
Data model for a walletmodel transaction. 
 
std::string EncodeDestination(const CTxDestination &dest)
 
A mutable version of CTransaction. 
 
AddressTableModel * addressTableModel
 
virtual int getNumBlocks()=0
Get num blocks. 
 
std::unique_ptr< interfaces::Handler > m_handler_transaction_changed
 
void checkBalanceChanged(const interfaces::WalletBalances &new_balances)
 
void updateConfirmations()
 
bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest)
 
bool balanceChanged(const WalletBalances &prev) const
 
void updateAddressBook(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
 
Top-level interface for a bitcoin node (bsha3d process). 
 
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
 
void balanceChanged(const interfaces::WalletBalances &balances)
 
std::unique_ptr< interfaces::Handler > m_handler_watch_only_changed
 
void pollBalanceChanged()
 
OptionsModel * getOptionsModel()
 
void subscribeToCoreSignals()