156 bool fSubtractFeeFromAmount =
false;
158 std::vector<CRecipient>
vecSend;
160 if(recipients.empty())
171 if (
rcp.fSubtractFeeFromAmount)
172 fSubtractFeeFromAmount =
true;
182 setAddress.insert(
rcp.address);
216 if (fSubtractFeeFromAmount &&
newTx) {
217 transaction.reassignAmounts(
static_cast<int>(
res->change_pos.value_or(-1)));
226 }
catch (
const std::runtime_error& err) {
241 std::vector<std::string> messages;
244 if (!
rcp.message.isEmpty()) {
245 messages.emplace_back(
rcp.message.toStdString());
269 dest, &
name,
nullptr))
311 if (
m_wallet->privateKeysDisabled()) {
340 qDebug() <<
"NotifyUnload";
341 bool invoked = QMetaObject::invokeMethod(walletModel,
"unload");
347 qDebug() <<
"NotifyKeyStoreStatusChanged";
348 bool invoked = QMetaObject::invokeMethod(
walletmodel,
"updateStatus", Qt::QueuedConnection);
359 qDebug() <<
"NotifyAddressBookChanged: " +
strAddress +
" " +
strLabel +
" isMine=" + QString::number(
isMine) +
" purpose=" + QString::number(
static_cast<uint8_t>(purpose)) +
" status=" + QString::number(status);
373 bool invoked = QMetaObject::invokeMethod(
walletmodel,
"updateTransaction", Qt::QueuedConnection);
380 bool invoked = QMetaObject::invokeMethod(
walletmodel,
"showProgress", Qt::QueuedConnection,
421 if (
m_wallet->privateKeysDisabled()) {
454 std::vector<bilingual_str>
errors;
459 QMessageBox::critical(
nullptr,
tr(
"Fee bump error"),
tr(
"Increasing transaction fee failed") +
"<br />(" +
460 (
errors.size() ? QString::fromStdString(
errors[0].translated) :
"") +
")");
486 questionString.append(
tr(
"Warning: This may pay the additional fee by reducing change outputs or adding inputs, when necessary. It may add a new change output if one does not already exist. These changes may potentially leak privacy."));
494 const auto retval =
static_cast<QMessageBox::StandardButton
>(
confirmationDialog->exec());
497 if (retval != QMessageBox::Yes && retval != QMessageBox::Save) {
502 if (retval == QMessageBox::Save) {
505 bool complete =
false;
506 const auto err{
wallet().
fillPSBT({.sign =
false, .bip32_derivs =
true},
nullptr,
psbtx, complete)};
507 if (err || complete) {
508 QMessageBox::critical(
nullptr,
tr(
"Fee bump error"),
tr(
"Can't draft transaction."));
528 QMessageBox::critical(
nullptr,
tr(
"Fee bump error"),
tr(
"Can't sign transaction."));
533 QMessageBox::critical(
nullptr,
tr(
"Fee bump error"),
tr(
"Could not commit transaction") +
"<br />(" +
534 QString::fromStdString(
errors[0].translated)+
")");
546 QMessageBox::warning(
nullptr,
tr(
"Signer error"), QString::fromStdString(
util::ErrorString(result).translated));
548 }
catch (
const std::runtime_error&
e) {
549 QMessageBox::critical(
nullptr,
tr(
"Can't display address"),
e.what());
560 return QString::fromStdString(
m_wallet->getWalletName());
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, PayToAnchor, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
int64_t CAmount
Amount in satoshis (Can be negative)
Qt model of the address book in the core.
void updateEntry(const QString &address, const QString &label, bool isMine, wallet::AddressPurpose purpose, int status)
bool GetBoolArg(const std::string &strArg, bool fDefault) const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
Return boolean argument or default value.
static QString formatHtmlWithUnit(Unit unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD)
Format as HTML string (with unit)
@ MSG_INFORMATION
Predefined combinations for certain default usage cases.
@ MODAL
Force blocking, modal message box dialog (not just OS notification)
Model for Bitcoin network client.
uint256 getBestBlockHash() EXCLUSIVE_LOCKS_REQUIRED(!m_cached_tip_mutex)
Double ended buffer combining vector and stream-like interfaces.
Interface from Qt to configuration data structure for Bitcoin client.
bool getEnablePSBTControls() const
A version of CTransaction with the PSBT format.
Model for list of recently generated payment requests / bitcoin: URIs.
UI model for the transaction table of a wallet.
void updateConfirmations()
UnlockContext(WalletModel *wallet, bool valid, bool relock)
Interface to Bitcoin wallet from Qt view code.
OptionsModel * optionsModel
AddressTableModel * addressTableModel
RecentRequestsTableModel * getRecentRequestsTableModel() const
EncryptionStatus cachedEncryptionStatus
void refresh(bool pk_hash_only=false)
uint256 m_cached_last_update_tip
ClientModel * m_client_model
bool bumpFee(Txid hash, Txid &new_hash)
interfaces::Node & m_node
std::unique_ptr< interfaces::Handler > m_handler_transaction_changed
void pollBalanceChanged()
AddressTableModel * getAddressTableModel() const
util::Expected< void, wallet::WalletError > changePassphrase(const SecureString &oldPass, const SecureString &newPass)
RecentRequestsTableModel * recentRequestsTableModel
SendCoinsReturn prepareTransaction(WalletModelTransaction &transaction, const wallet::CCoinControl &coinControl)
TransactionTableModel * transactionTableModel
bool setWalletEncrypted(const SecureString &passphrase)
void updateAddressBook(const QString &address, const QString &label, bool isMine, wallet::AddressPurpose purpose, int status)
void message(const QString &title, const QString &message, unsigned int style)
bool validateAddress(const QString &address) const
void sendCoins(WalletModelTransaction &transaction)
void setClientModel(ClientModel *client_model)
CAmount getAvailableBalance(const wallet::CCoinControl *control)
bool isMultiwallet() const
std::unique_ptr< interfaces::Handler > m_handler_can_get_addrs_changed
std::unique_ptr< interfaces::Handler > m_handler_unload
void displayAddress(std::string sAddress) const
EncryptionStatus getEncryptionStatus() const
TransactionTableModel * getTransactionTableModel() const
interfaces::Wallet & wallet() const
std::unique_ptr< interfaces::Handler > m_handler_status_changed
interfaces::WalletBalances m_cached_balances
bool fForceCheckBalanceChanged
void coinsSent(WalletModel *wallet, SendCoinsRecipient recipient, QByteArray transaction)
QString getDisplayName() const
OptionsModel * getOptionsModel() const
void checkBalanceChanged(const interfaces::WalletBalances &new_balances)
void unsubscribeFromCoreSignals()
uint256 getLastBlockProcessed() const
WalletModel(std::unique_ptr< interfaces::Wallet > wallet, ClientModel &client_model, const PlatformStyle *platformStyle, QObject *parent=nullptr)
std::unique_ptr< interfaces::Handler > m_handler_address_book_changed
void encryptionStatusChanged()
std::unique_ptr< interfaces::Wallet > m_wallet
UnlockContext requestUnlock()
void balanceChanged(const interfaces::WalletBalances &balances)
static bool isWalletEnabled()
interfaces::WalletBalances getCachedBalance() const
QString getWalletName() const
std::unique_ptr< interfaces::Handler > m_handler_show_progress
@ TransactionCreationFailed
void subscribeToCoreSignals()
Data model for a walletmodel transaction.
virtual WalletLoader & walletLoader()=0
Get wallet loader.
virtual void commitTransaction(CTransactionRef tx, const std::vector< std::string > &messages)=0
Commit transaction.
virtual CAmount getAvailableBalance(const wallet::CCoinControl &coin_control)=0
Get available balance.
virtual bool hasExternalSigner()=0
virtual std::optional< common::PSBTError > fillPSBT(const common::PSBTFillOptions &options, size_t *n_signed, PartiallySignedTransaction &psbtx, bool &complete)=0
Fill PSBT.
virtual bool privateKeysDisabled()=0
virtual std::vector< std::unique_ptr< Wallet > > getWallets()=0
Return interfaces for accessing wallets (if any).
The util::Expected class provides a standard way for low-level functions to return either error value...
constexpr auto MODEL_UPDATE_DELAY
bool IsValidDestinationString(const std::string &str, const CChainParams ¶ms)
CTxDestination DecodeDestination(const std::string &str, std::string &error_msg, std::vector< int > *error_locations)
std::string EncodeDestination(const CTxDestination &dest)
QString WalletDisplayName(const QString &name)
auto ExceptionSafeConnect(Sender sender, Signal signal, Receiver receiver, Slot method, Qt::ConnectionType type=Qt::AutoConnection)
A drop-in replacement of QObject::connect function (see: https://doc.qt.io/qt-5/qobject....
void setClipboard(const QString &str)
bilingual_str ErrorString(const Result< T > &result)
constexpr bool DEFAULT_DISABLE_WALLET
AddressPurpose
Address purpose field that has been been stored with wallet sending and receiving addresses since BIP...
is a home for public enum and struct type definitions that are used internally by node code,...
constexpr TransactionSerParams TX_WITH_WITNESS
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
#define SEND_CONFIRM_DELAY
static void ShowProgress(SplashScreen *splash, const std::string &title, int nProgress, bool resume_possible)
A mutable version of CTransaction.
Collection of wallet balances.
bool fSubtractFeeFromAmount
ChangeType
General change type (added, updated, removed).
std::string EncodeBase64(std::span< const unsigned char > input)
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
std::shared_ptr< CWallet > m_wallet
is a home for public enum and struct type definitions that are used by internally by wallet code,...
static void NotifyTransactionChanged(WalletModel *walletmodel, const Txid &hash, ChangeType status)
static void NotifyUnload(WalletModel *walletModel)
static void NotifyAddressBookChanged(WalletModel *walletmodel, const CTxDestination &address, const std::string &label, bool isMine, wallet::AddressPurpose purpose, ChangeType status)
static void NotifyCanGetAddressesChanged(WalletModel *walletmodel)
static void ShowProgress(WalletModel *walletmodel, const std::string &title, int nProgress)
static void NotifyKeyStoreStatusChanged(WalletModel *walletmodel)