38 cachedEncryptionStatus(Unencrypted), timer(
new QTimer(
this)) {
118 const QString &purpose,
int status) {
137 bool fSubtractFeeFromAmount =
false;
139 std::vector<CRecipient>
vecSend;
141 if (recipients.empty()) {
151 if (
rcp.fSubtractFeeFromAmount) {
152 fSubtractFeeFromAmount =
true;
157 if (
rcp.paymentRequest.IsInitialized()) {
159 const payments::PaymentDetails &details =
160 rcp.paymentRequest.getDetails();
161 for (
int i = 0; i < details.outputs_size(); i++) {
162 const payments::Output &out = details.outputs(i);
163 if (out.amount() <= 0) {
172 CRecipient recipient = {scriptPubKey, nAmount,
173 rcp.fSubtractFeeFromAmount};
193 setAddress.insert(
rcp.address);
199 rcp.fSubtractFeeFromAmount};
224 if (fSubtractFeeFromAmount &&
newTx) {
233 QString::fromStdString(
error.translated),
253 std::vector<std::pair<std::string, std::string>> vOrderForm;
256 if (
rcp.paymentRequest.IsInitialized()) {
258 if (PaymentServer::verifyExpired(
rcp.paymentRequest.getDetails())) {
264 rcp.paymentRequest.SerializeToString(&value);
265 vOrderForm.emplace_back(
"PaymentRequest", std::move(value));
269 if (!
rcp.message.isEmpty()) {
272 vOrderForm.emplace_back(
"Message",
rcp.message.toStdString());
289 if (!
rcp.paymentRequest.IsInitialized())
365 qDebug() <<
"NotifyUnload";
366 bool invoked = QMetaObject::invokeMethod(walletModel,
"unload");
371 qDebug() <<
"NotifyKeyStoreStatusChanged";
373 Qt::QueuedConnection);
379 const std::string &label,
bool isMine,
380 const std::string &purpose,
388 " isMine=" + QString::number(
isMine) +
390 " status=" + QString::number(status);
391 bool invoked = QMetaObject::invokeMethod(
392 walletmodel,
"updateAddressBook", Qt::QueuedConnection,
403 Qt::QueuedConnection);
410 bool invoked = QMetaObject::invokeMethod(
419 Qt::QueuedConnection,
426 QMetaObject::invokeMethod(
walletmodel,
"canGetAddressesChanged");
437 std::placeholders::_2, std::placeholders::_3,
438 std::placeholders::_4, std::placeholders::_5));
441 std::placeholders::_2));
443 ShowProgress,
this, std::placeholders::_1, std::placeholders::_2));
480 if (valid && relock) {
481 wallet->setWalletLocked(
true);
502 std::stringstream
ss;
505 std::string key =
"rr" +
ss.str();
516 return QString::fromStdString(
m_wallet->getWalletName());
521 return name.isEmpty() ?
"[" +
tr(
"default wallet") +
"]" :
name;
static constexpr Amount SATOSHI
std::string EncodeCashAddr(const CTxDestination &dst, const CChainParams ¶ms)
const CChainParams & Params()
Return the currently selected parameters.
Qt model of the address book in the core.
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
Double ended buffer combining vector and stream-like interfaces.
Model for Bitcoin network client.
BlockHash getBestBlockHash() EXCLUSIVE_LOCKS_REQUIRED(!m_cached_tip_mutex)
Interface from Qt to configuration data structure for Bitcoin client.
Model for list of recently generated payment requests / bitcoincash: URIs.
UI model for the transaction table of a wallet.
void updateConfirmations()
UnlockContext(WalletModel *wallet, bool valid, bool relock)
void CopyFrom(UnlockContext &&rhs)
Interface to Bitcoin wallet from Qt view code.
OptionsModel * optionsModel
bool validateAddress(const QString &address)
AddressTableModel * addressTableModel
void loadReceiveRequests(std::vector< std::string > &vReceiveRequests)
EncryptionStatus cachedEncryptionStatus
ClientModel * m_client_model
std::unique_ptr< interfaces::Handler > m_handler_watch_only_changed
BlockHash m_cached_last_update_tip
interfaces::Node & m_node
std::unique_ptr< interfaces::Handler > m_handler_transaction_changed
void pollBalanceChanged()
Current, immature or unconfirmed balance might have changed - emit 'balanceChanged' if so.
SendCoinsReturn sendCoins(WalletModelTransaction &transaction)
RecentRequestsTableModel * recentRequestsTableModel
TransactionTableModel * transactionTableModel
bool setWalletEncrypted(const SecureString &passphrase)
void notifyWatchonlyChanged(bool fHaveWatchonly)
bool changePassphrase(const SecureString &oldPass, const SecureString &newPass)
BlockHash getLastBlockProcessed() const
bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString())
void message(const QString &title, const QString &message, unsigned int style)
void coinsSent(interfaces::Wallet &wallet, SendCoinsRecipient recipient, QByteArray transaction)
void setClientModel(ClientModel *client_model)
const CChainParams & getChainParams() const
bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest)
AddressTableModel * getAddressTableModel()
OptionsModel * getOptionsModel()
std::unique_ptr< interfaces::Handler > m_handler_can_get_addrs_changed
std::unique_ptr< interfaces::Handler > m_handler_unload
SendCoinsReturn prepareTransaction(WalletModelTransaction &transaction, const CCoinControl &coinControl)
EncryptionStatus getEncryptionStatus() const
interfaces::Wallet & wallet() const
RecentRequestsTableModel * getRecentRequestsTableModel()
std::unique_ptr< interfaces::Handler > m_handler_status_changed
interfaces::WalletBalances m_cached_balances
bool fForceCheckBalanceChanged
QString getDisplayName() const
void checkBalanceChanged(const interfaces::WalletBalances &new_balances)
void unsubscribeFromCoreSignals()
void updateTransaction()
New transaction, or transaction changed status.
void updateAddressBook(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
New, updated or removed address book entry.
WalletModel(std::unique_ptr< interfaces::Wallet > wallet, ClientModel &client_model, const PlatformStyle *platformStyle, QObject *parent=nullptr)
void updateWatchOnlyFlag(bool fHaveWatchonly)
Watch-only added.
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()
QString getWalletName() const
std::unique_ptr< interfaces::Handler > m_handler_show_progress
@ AmountWithFeeExceedsBalance
@ TransactionCreationFailed
void subscribeToCoreSignals()
TransactionTableModel * getTransactionTableModel()
Data model for a walletmodel transaction.
virtual WalletClient & walletClient()=0
Get wallet client.
virtual std::vector< std::unique_ptr< Wallet > > getWallets()=0
Return interfaces for accessing wallets (if any).
virtual void commitTransaction(CTransactionRef tx, WalletValueMap value_map, WalletOrderForm order_form)=0
Commit transaction.
static const int MODEL_UPDATE_DELAY
bool IsValidDestinationString(const std::string &str, const CChainParams ¶ms)
CTxDestination DecodeDestination(const std::string &addr, const CChainParams ¶ms)
bool error(const char *fmt, const Args &...args)
Implement std::hash so RCUPtr can be used as a key for maps or sets.
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
static void ShowProgress(SplashScreen *splash, const std::string &title, int nProgress, bool resume_possible)
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
std::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
static constexpr Amount zero() noexcept
A BlockHash is a unqiue identifier for a block.
A TxId is the identifier of a transaction.
Collection of wallet balances.
ChangeType
General change type (added, updated, removed).
static const int PROTOCOL_VERSION
network protocol versioning
std::shared_ptr< CWallet > m_wallet
static const bool DEFAULT_DISABLE_WALLET
static void NotifyUnload(WalletModel *walletModel)
static void NotifyWatchonlyChanged(WalletModel *walletmodel, bool fHaveWatchonly)
static void NotifyCanGetAddressesChanged(WalletModel *walletmodel)
static void NotifyAddressBookChanged(WalletModel *walletmodel, const CTxDestination &address, const std::string &label, bool isMine, const std::string &purpose, ChangeType status)
static void NotifyTransactionChanged(WalletModel *walletmodel, const TxId &hash, ChangeType status)
static void ShowProgress(WalletModel *walletmodel, const std::string &title, int nProgress)
static void NotifyKeyStoreStatusChanged(WalletModel *walletmodel)