15#include <qt/forms/ui_psbtoperationsdialog.h>
44 connect(
m_ui->closeButton, &QPushButton::clicked,
this, &PSBTOperationsDialog::close);
46 m_ui->signTransactionButton->setEnabled(
false);
47 m_ui->broadcastTransactionButton->setEnabled(
false);
65 .
arg(QString::fromStdString(PSBTErrorString(*err).translated)),
71 m_ui->signTransactionButton->setEnabled(
false);
74 m_ui->broadcastTransactionButton->setEnabled(complete);
96 if (!complete && !ctx.
isValid()) {
98 }
else if (!complete &&
n_signed < 1) {
100 }
else if (!complete) {
104 showStatus(
tr(
"Signed transaction successfully. Transaction is ready to broadcast."),
106 m_ui->broadcastTransactionButton->setEnabled(
true);
122 TransactionError error =
125 if (error == TransactionError::OK) {
126 showStatus(
tr(
"Transaction broadcast successfully! Transaction ID: %1")
164 if (filename.isEmpty()) {
167 std::ofstream out{filename.toLocal8Bit().data(), std::ofstream::out | std::ofstream::binary};
199 tx_description.append(
tr(
"Unable to calculate transaction fee or total transaction amount."));
215 tx_description.append(
QString(
"<br /><span style='font-size:10pt; font-weight:normal;'>(=%1)</span>")
229 m_ui->statusBar->setText(msg);
232 m_ui->statusBar->setStyleSheet(
"QLabel { background-color : lightgreen }");
236 m_ui->statusBar->setStyleSheet(
"QLabel { background-color : orange }");
240 m_ui->statusBar->setStyleSheet(
"QLabel { background-color : red }");
244 m_ui->statusBar->show();
278 need_sig_text +=
" " +
tr(
"(But this wallet cannot sign transactions.)");
281 need_sig_text +=
" " +
tr(
"(But this wallet does not have the right keys.)");
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a scriptPubKey for the destination.
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)
static QString format(Unit unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD, bool justify=false)
Format as string.
static QString formatHtmlWithUnit(Unit unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD)
Format as HTML string (with unit)
static QList< Unit > availableUnits()
Get list of units, for drop-down box.
static QString formatWithUnit(Unit unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD)
Format as string (with unit)
An output of a transaction.
Model for Bitcoin network client.
OptionsModel * getOptionsModel()
interfaces::Node & node() const
Double ended buffer combining vector and stream-like interfaces.
BitcoinUnit getDisplayUnit() const
Dialog showing transaction details.
PartiallySignedTransaction m_transaction_data
PSBTOperationsDialog(QWidget *parent, WalletModel *walletModel, ClientModel *clientModel)
void broadcastTransaction()
void updateTransactionDisplay()
WalletModel * m_wallet_model
Ui::PSBTOperationsDialog * m_ui
void openWithPSBT(PartiallySignedTransaction psbtx)
size_t couldSignInputs(const PartiallySignedTransaction &psbtx)
void showTransactionStatus(const PartiallySignedTransaction &psbtx)
void showStatus(const QString &msg, StatusLevel level)
ClientModel * m_client_model
QString renderTransaction(const PartiallySignedTransaction &psbtx)
Interface to Bitcoin wallet from Qt view code.
interfaces::Wallet & wallet() const
UnlockContext requestUnlock()
virtual node::TransactionError broadcastTransaction(CTransactionRef tx, CAmount max_tx_fee, std::string &err_string)=0
Broadcast transaction.
virtual std::optional< common::PSBTError > fillPSBT(std::optional< int > sighash_type, bool sign, bool bip32derivs, size_t *n_signed, PartiallySignedTransaction &psbtx, bool &complete)=0
Fill PSBT.
virtual bool txoutIsMine(const CTxOut &txout)=0
Return whether transaction output belongs to wallet.
virtual bool privateKeysDisabled()=0
std::string EncodeDestination(const CTxDestination &dest)
is a home for simple string functions returning descriptive messages that are used in RPC and GUI int...
Utility functions used by the Bitcoin Qt UI.
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 setClipboard(const QString &str)
bilingual_str TransactionErrorString(const TransactionError err)
PSBTAnalysis AnalyzePSBT(PartiallySignedTransaction psbtx)
Provides helpful miscellaneous information about where a PSBT is in the signing workflow.
static const CFeeRate DEFAULT_MAX_RAW_TX_FEE_RATE
Maximum fee rate for sendrawtransaction and testmempoolaccept RPC calls.
is a home for public enum and struct type definitions that are used internally by node code,...
static CTransactionRef MakeTransactionRef(Tx &&txIn)
std::shared_ptr< const CTransaction > CTransactionRef
size_t CountPSBTUnsignedInputs(const PartiallySignedTransaction &psbt)
Counts the unsigned inputs of a PSBT.
bool FinalizeAndExtractPSBT(PartiallySignedTransaction &psbtx, CMutableTransaction &result)
Finalizes a PSBT if possible, and extracts it to a CMutableTransaction if it could be finalized.
bool FinalizePSBT(PartiallySignedTransaction &psbtx)
Finalizes a PSBT if possible, combining partial signatures.
A mutable version of CTransaction.
A version of CTransaction with the PSBT format.
std::optional< CMutableTransaction > tx
Holds the results of AnalyzePSBT (miscellaneous information about a PSBT)
std::string EncodeBase64(std::span< const unsigned char > input)
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.