30#include <QActionGroup>
33#include <QProgressDialog>
45 : QStackedWidget(parent), clientModel(nullptr), walletModel(_walletModel),
46 platformStyle(_platformStyle) {
51 QVBoxLayout *vbox =
new QVBoxLayout();
52 QHBoxLayout *hbox_buttons =
new QHBoxLayout();
55 QPushButton *exportButton =
new QPushButton(tr(
"&Export"),
this);
56 exportButton->setToolTip(
57 tr(
"Export the data in the current tab to a file"));
61 hbox_buttons->addStretch();
62 hbox_buttons->addWidget(exportButton);
63 vbox->addLayout(hbox_buttons);
156 &TransactionTableModel::rowsInserted,
this,
191 QModelIndex index = ttm->
index(start, 0, parent);
199 int64_t(amount) *
SATOSHI, type, address, label,
218 if (!addr.isEmpty()) {
227 signVerifyMessageDialog->setAttribute(Qt::WA_DeleteOnClose);
231 if (!addr.isEmpty()) {
240 signVerifyMessageDialog->setAttribute(Qt::WA_DeleteOnClose);
244 if (!addr.isEmpty()) {
251 this, tr(
"Load Transaction Data"), QString(),
252 tr(
"Partially Signed Transaction (*.psbt)"),
nullptr);
253 if (filename.isEmpty()) {
259 tr(
"PSBT file must be smaller than 100 MiB"),
263 std::ifstream in{filename.toLocal8Bit().data(), std::ios::binary};
264 std::vector<uint8_t> data;
265 data.assign(std::istream_iterator<uint8_t>{in}, {});
271 tr(
"Unable to decode PSBT file") +
"\n" +
272 QString::fromStdString(
error),
278 bool complete =
false;
281 msgBox.setText(
"PSBT");
282 switch (analysis.
next) {
285 msgBox.setInformativeText(
286 "PSBT is incomplete. Copy to clipboard for manual inspection?");
289 msgBox.setInformativeText(
290 "Transaction needs more signatures. Copy to clipboard?");
296 msgBox.setInformativeText(
297 tr(
"Would you like to send this transaction?"));
301 msgBox.setInformativeText(
302 tr(
"There was an unexpected problem processing the PSBT. "
303 "Copy to clipboard for manual inspection?"));
307 msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
308 switch (msgBox.exec()) {
309 case QMessageBox::Yes: {
311 std::string err_string;
320 tr(
"Broadcasted transaction successfully."),
325 QString::fromStdString(err_string),
333 Q_EMIT
message(tr(
"PSBT copied"),
"Copied to clipboard",
338 case QMessageBox::Cancel:
371 tr(
"Wallet Data (*.dat)"),
nullptr);
373 if (filename.isEmpty()) {
380 tr(
"There was an error trying to save the wallet data to %1.")
385 tr(
"Backup Successful"),
386 tr(
"The wallet data was successfully saved to %1.").arg(filename),
427 if (nProgress == 0) {
428 progressDialog =
new QProgressDialog(title, tr(
"Cancel"), 0, 100);
434 }
else if (nProgress == 100) {
static constexpr Amount SATOSHI
Widget that shows a list of sending or receiving addresses.
@ ForEditing
Open address book for editing.
void setModel(AddressTableModel *model)
Multifunctional dialog to ask for passphrases.
void setModel(WalletModel *model)
@ Unlock
Ask passphrase and unlock.
@ Encrypt
Ask passphrase twice and encrypt.
@ ChangePass
Ask old passphrase + new passphrase twice.
@ MSG_INFORMATION
Predefined combinations for certain default usage cases.
@ MODAL
Force blocking, modal message box dialog (not just OS notification)
Double ended buffer combining vector and stream-like interfaces.
Amount GetFeePerK() const
Return the fee in satoshis for a size of 1000 bytes.
A mutable version of CTransaction.
Model for Bitcoin network client.
interfaces::Node & node() const
int getDisplayUnit() const
Overview ("home") page widget.
void setWalletModel(WalletModel *walletModel)
void setClientModel(ClientModel *clientModel)
void transactionClicked(const QModelIndex &index)
void outOfSyncWarningClicked()
void showOutOfSyncWarning(bool fShow)
void setPrivacy(bool privacy)
Dialog for requesting payment of bitcoins.
void setModel(WalletModel *model)
Dialog for sending bitcoins.
void setClientModel(ClientModel *clientModel)
void setModel(WalletModel *model)
bool handlePaymentRequest(const SendCoinsRecipient &recipient)
void setAddress(const QString &address)
void message(const QString &title, const QString &message, unsigned int style)
void coinsSent(const uint256 &txid)
void showTab_SM(bool fShow)
void setAddress_SM(const QString &address)
void showTab_VM(bool fShow)
void setModel(WalletModel *model)
void setAddress_VM(const QString &address)
UI model for the transaction table of a wallet.
@ LabelRole
Label of address related to transaction.
@ AddressRole
Address of transaction.
QVariant data(const QModelIndex &index, int role) const override
bool processingQueuedTransactions() const
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Widget showing the transaction list for a wallet, including a filter row.
void setModel(WalletModel *model)
void message(const QString &title, const QString &message, unsigned int style)
Fired when a message should be reported to the user.
void focusTransaction(const QModelIndex &)
Interface to Bitcoin wallet from Qt view code.
void showProgress(const QString &title, int nProgress)
void message(const QString &title, const QString &message, unsigned int style)
void setClientModel(ClientModel *client_model)
AddressTableModel * getAddressTableModel()
OptionsModel * getOptionsModel()
EncryptionStatus getEncryptionStatus() const
interfaces::Wallet & wallet() const
void encryptionStatusChanged()
QString getWalletName() const
TransactionTableModel * getTransactionTableModel()
const PlatformStyle * platformStyle
void gotoHistoryPage()
Switch to history (transactions) page.
void gotoVerifyMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to verify message tab.
void setWalletModel(WalletModel *walletModel)
Set the wallet model.
bool handlePaymentRequest(const SendCoinsRecipient &recipient)
void gotoSendCoinsPage(QString addr="")
Switch to send coins page.
void incomingTransaction(const QString &date, int unit, const Amount amount, const QString &type, const QString &address, const QString &label, const QString &walletName)
Notify that a new transaction appeared.
void changePassphrase()
Change encrypted wallet passphrase.
QProgressDialog * progressDialog
SendCoinsDialog * sendCoinsPage
OverviewPage * overviewPage
void setClientModel(ClientModel *clientModel)
Set the client model.
void outOfSyncWarningClicked()
Notify that the out of sync warning icon has been pressed.
void gotoReceiveCoinsPage()
Switch to receive coins page.
void gotoSignMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to sign message tab.
QWidget * transactionsPage
void usedSendingAddresses()
Show used sending addresses.
ReceiveCoinsDialog * receiveCoinsPage
void encryptWallet()
Encrypt the wallet.
TransactionView * transactionView
WalletView(const PlatformStyle *platformStyle, WalletModel *walletModel, QWidget *parent)
void showProgress(const QString &title, int nProgress)
Show progress dialog e.g.
void message(const QString &title, const QString &message, unsigned int style)
Fired when a message should be reported to the user.
AddressBookPage * usedReceivingAddressesPage
void backupWallet()
Backup the wallet.
ClientModel * clientModel
void gotoLoadPSBT()
Load Partially Signed Bitcoin Transaction.
void requestedSyncWarningInfo()
User has requested more information about the out of sync state.
AddressBookPage * usedSendingAddressesPage
void unlockWallet()
Ask for passphrase to unlock wallet temporarily.
WalletModel * walletModel
void gotoOverviewPage()
Switch to overview (home) page.
void usedReceivingAddresses()
Show used receiving addresses.
void transactionClicked()
WalletModel * getWalletModel()
void updateEncryptionStatus()
Re-emit encryption status signal.
void hdEnabledStatusChanged()
HD-Enabled status of wallet changed (only possible during startup)
void setPrivacy(bool privacy)
void processNewTransaction(const QModelIndex &parent, int start, int end)
Show incoming transaction notification for new transactions.
void showOutOfSyncWarning(bool fShow)
void encryptionStatusChanged()
Encryption status of wallet changed.
virtual node::NodeContext * context()
Get and set internal node context.
virtual bool isInitialBlockDownload()=0
Is initial block download.
virtual void abortRescan()=0
Abort a rescan.
virtual bool backupWallet(const std::string &filename)=0
Back up wallet.
std::streampos GetFileSize(const char *path, std::streamsize max)
Get the size of a file by scanning it.
bool error(const char *fmt, const Args &...args)
QString HtmlEscape(const QString &str, bool fMultiLine)
void PolishProgressDialog(QProgressDialog *dialog)
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
Get open filename, convenience wrapper for QFileDialog::getOpenFileName.
QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix when ...
void bringToFront(QWidget *w)
void setClipboard(const QString &str)
PSBTAnalysis AnalyzePSBT(PartiallySignedTransaction psbtx)
Provides helpful miscellaneous information about where a PSBT is in the signing workflow.
TransactionError BroadcastTransaction(const NodeContext &node, const CTransactionRef tx, std::string &err_string, const Amount max_tx_fee, bool relay, bool wait_callback)
Submit a transaction to the mempool and (optionally) relay it to all P2P peers.
static const CFeeRate DEFAULT_MAX_RAW_TX_FEE_RATE
Maximum fee rate for sendrawtransaction and testmempoolaccept RPC calls.
static CTransactionRef MakeTransactionRef()
std::shared_ptr< const CTransaction > CTransactionRef
bool FinalizeAndExtractPSBT(PartiallySignedTransaction &psbtx, CMutableTransaction &result)
Finalizes a PSBT if possible, and extracts it to a CMutableTransaction if it could be finalized.
bool DecodeRawPSBT(PartiallySignedTransaction &psbt, Span< const std::byte > tx_data, std::string &error)
Decode a raw (binary blob) PSBT into a PartiallySignedTransaction.
const std::streamsize MAX_FILE_SIZE_PSBT
Span< const std::byte > MakeByteSpan(V &&v) noexcept
A version of CTransaction with the PSBT format.
Holds the results of AnalyzePSBT (miscellaneous information about a PSBT)
PSBTRole next
Which of the BIP 174 roles needs to handle the transaction next.
std::string EncodeBase64(Span< const uint8_t > input)
static const int PROTOCOL_VERSION
network protocol versioning