Skip to content

Commit

Permalink
Gui: getrawtransaction Implementation
Browse files Browse the repository at this point in the history
Add getrawtransaction RPC to GUI on Help > Verify external txid
  • Loading branch information
BrandonOdiwuor committed Nov 14, 2023
1 parent 10b3cd1 commit 9485fb4
Show file tree
Hide file tree
Showing 5 changed files with 264 additions and 49 deletions.
12 changes: 12 additions & 0 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,17 @@ void BitcoinGUI::createActions()
m_mask_values_action->setStatusTip(tr("Mask the values in the Overview tab"));
m_mask_values_action->setCheckable(true);

getRawTransactionAction = new QAction(tr("Verify external txid"), this);
getRawTransactionAction->setMenuRole(QAction::NoRole);
getRawTransactionAction->setStatusTip(tr("getrawtransaction RPC"));

connect(quitAction, &QAction::triggered, this, &BitcoinGUI::quitRequested);
connect(aboutAction, &QAction::triggered, this, &BitcoinGUI::aboutClicked);
connect(aboutQtAction, &QAction::triggered, qApp, QApplication::aboutQt);
connect(optionsAction, &QAction::triggered, this, &BitcoinGUI::optionsClicked);
connect(showHelpMessageAction, &QAction::triggered, this, &BitcoinGUI::showHelpMessageClicked);
connect(openRPCConsoleAction, &QAction::triggered, this, &BitcoinGUI::showDebugWindow);
connect(getRawTransactionAction, &QAction::triggered, this, &BitcoinGUI::getRawTransactionClicked);
// prevents an open debug window from becoming stuck/unusable on client shutdown
connect(quitAction, &QAction::triggered, rpcConsole, &QWidget::hide);

Expand Down Expand Up @@ -560,6 +565,7 @@ void BitcoinGUI::createMenuBar()
help->addSeparator();
help->addAction(aboutAction);
help->addAction(aboutQtAction);
help->addAction(getRawTransactionAction);
}

void BitcoinGUI::createToolBars()
Expand Down Expand Up @@ -932,6 +938,12 @@ void BitcoinGUI::showHelpMessageClicked()
GUIUtil::bringToFront(helpMessageDialog);
}

void BitcoinGUI::getRawTransactionClicked()
{
auto dlg = new HelpMessageDialog(this, HelpMessageDialog::GetRawTransactionMode, &m_node);
GUIUtil::ShowModalDialogAsynchronously(dlg);
}

#ifdef ENABLE_WALLET
void BitcoinGUI::openClicked()
{
Expand Down
3 changes: 3 additions & 0 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class BitcoinGUI : public QMainWindow
QAction* m_load_psbt_action = nullptr;
QAction* m_load_psbt_clipboard_action = nullptr;
QAction* aboutAction = nullptr;
QAction* getRawTransactionAction = nullptr;
QAction* receiveCoinsAction = nullptr;
QAction* optionsAction = nullptr;
QAction* encryptWalletAction = nullptr;
Expand Down Expand Up @@ -308,6 +309,8 @@ public Q_SLOTS:
void showDebugWindowActivateConsole();
/** Show help message dialog */
void showHelpMessageClicked();
/** show getrawtransaction dialog*/
void getRawTransactionClicked();

/** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
void showNormalIfMinimized() { showNormalIfMinimized(false); }
Expand Down
103 changes: 103 additions & 0 deletions src/qt/forms/helpmessagedialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,60 @@
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="bottomMargin">
<number>12</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelTxId">
<property name="text">
<string>transaction id: </string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QValidatedLineEdit" name="txidEdit">
<property name="toolTip">
<string>The transaction id</string>
</property>
<property name="placeholderText">
<string notr="true">Enter a transaction id...</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="verboseCheckbox">
<property name="toolTip">
<string>verbose</string>
</property>
<property name="text">
<string>verbose</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelBlockHash">
<property name="text">
<string>blockhash (optional): </string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QValidatedLineEdit" name="blockHashEdit">
<property name="toolTip">
<string>The block in which to look for the transaction</string>
</property>
<property name="placeholderText">
<string notr="true">Enter Blockhash...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTextEdit" name="helpMessage">
<property name="readOnly">
Expand Down Expand Up @@ -135,6 +189,16 @@
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="submitButton">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="okButton">
<property name="orientation">
Expand All @@ -152,6 +216,13 @@
<resources>
<include location="../bitcoin.qrc"/>
</resources>
<customwidgets>
<customwidget>
<class>QValidatedLineEdit</class>
<extends>QLineEdit</extends>
<header>qt/qvalidatedlineedit.h</header>
</customwidget>
</customwidgets>
<connections>
<connection>
<sender>okButton</sender>
Expand Down Expand Up @@ -185,5 +256,37 @@
</hint>
</hints>
</connection>
<connection>
<sender>submitButton</sender>
<signal>accepted()</signal>
<receiver>HelpMessageDialog</receiver>
<slot>onSubmitForm()</slot>
<hints>
<hint type="sourcelabel">
<x>395</x>
<y>343</y>
</hint>
<hint type="destinationlabel">
<x>389</x>
<y>199</y>
</hint>
</hints>
</connection>
<connection>
<sender>submitButton</sender>
<signal>rejected()</signal>
<receiver>HelpMessageDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>395</x>
<y>343</y>
</hint>
<hint type="destinationlabel">
<x>389</x>
<y>199</y>
</hint>
</hints>
</connection>
</connections>
</ui>
Loading

0 comments on commit 9485fb4

Please sign in to comment.