Skip to content

Commit e233da2

Browse files
Gui: getrawtransaction Implementation
Add getrawtransaction RPC to GUI on Help > Verify external txid
1 parent 10b3cd1 commit e233da2

File tree

5 files changed

+264
-49
lines changed

5 files changed

+264
-49
lines changed

src/qt/bitcoingui.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,12 +368,17 @@ void BitcoinGUI::createActions()
368368
m_mask_values_action->setStatusTip(tr("Mask the values in the Overview tab"));
369369
m_mask_values_action->setCheckable(true);
370370

371+
getRawTransactionAction = new QAction(tr("Verify external txid"), this);
372+
getRawTransactionAction->setMenuRole(QAction::NoRole);
373+
getRawTransactionAction->setStatusTip(tr("getrawtransaction RPC"));
374+
371375
connect(quitAction, &QAction::triggered, this, &BitcoinGUI::quitRequested);
372376
connect(aboutAction, &QAction::triggered, this, &BitcoinGUI::aboutClicked);
373377
connect(aboutQtAction, &QAction::triggered, qApp, QApplication::aboutQt);
374378
connect(optionsAction, &QAction::triggered, this, &BitcoinGUI::optionsClicked);
375379
connect(showHelpMessageAction, &QAction::triggered, this, &BitcoinGUI::showHelpMessageClicked);
376380
connect(openRPCConsoleAction, &QAction::triggered, this, &BitcoinGUI::showDebugWindow);
381+
connect(getRawTransactionAction, &QAction::triggered, this, &BitcoinGUI::getRawTransactionClicked);
377382
// prevents an open debug window from becoming stuck/unusable on client shutdown
378383
connect(quitAction, &QAction::triggered, rpcConsole, &QWidget::hide);
379384

@@ -560,6 +565,7 @@ void BitcoinGUI::createMenuBar()
560565
help->addSeparator();
561566
help->addAction(aboutAction);
562567
help->addAction(aboutQtAction);
568+
help->addAction(getRawTransactionAction);
563569
}
564570

565571
void BitcoinGUI::createToolBars()
@@ -932,6 +938,12 @@ void BitcoinGUI::showHelpMessageClicked()
932938
GUIUtil::bringToFront(helpMessageDialog);
933939
}
934940

941+
void BitcoinGUI::getRawTransactionClicked()
942+
{
943+
auto dlg = new HelpMessageDialog(this, HelpMessageDialog::GetRawTransactionMode, &m_node);
944+
GUIUtil::ShowModalDialogAsynchronously(dlg);
945+
}
946+
935947
#ifdef ENABLE_WALLET
936948
void BitcoinGUI::openClicked()
937949
{

src/qt/bitcoingui.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ class BitcoinGUI : public QMainWindow
145145
QAction* m_load_psbt_action = nullptr;
146146
QAction* m_load_psbt_clipboard_action = nullptr;
147147
QAction* aboutAction = nullptr;
148+
QAction* getRawTransactionAction = nullptr;
148149
QAction* receiveCoinsAction = nullptr;
149150
QAction* optionsAction = nullptr;
150151
QAction* encryptWalletAction = nullptr;
@@ -308,6 +309,8 @@ public Q_SLOTS:
308309
void showDebugWindowActivateConsole();
309310
/** Show help message dialog */
310311
void showHelpMessageClicked();
312+
/** show getrawtransaction dialog*/
313+
void getRawTransactionClicked();
311314

312315
/** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
313316
void showNormalIfMinimized() { showNormalIfMinimized(false); }

src/qt/forms/helpmessagedialog.ui

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,60 @@
7676
</item>
7777
<item>
7878
<layout class="QVBoxLayout" name="verticalLayout">
79+
<item>
80+
<layout class="QFormLayout" name="formLayout">
81+
<property name="bottomMargin">
82+
<number>12</number>
83+
</property>
84+
<item row="0" column="0">
85+
<widget class="QLabel" name="labelTxId">
86+
<property name="text">
87+
<string>transaction id: </string>
88+
</property>
89+
</widget>
90+
</item>
91+
<item row="0" column="1">
92+
<widget class="QValidatedLineEdit" name="txidEdit">
93+
<property name="toolTip">
94+
<string>The transaction id</string>
95+
</property>
96+
<property name="placeholderText">
97+
<string notr="true">Enter a transaction id...</string>
98+
</property>
99+
</widget>
100+
</item>
101+
<item row="1" column="0">
102+
<widget class="QCheckBox" name="verboseCheckbox">
103+
<property name="toolTip">
104+
<string>verbose</string>
105+
</property>
106+
<property name="text">
107+
<string>verbose</string>
108+
</property>
109+
<property name="checked">
110+
<bool>false</bool>
111+
</property>
112+
</widget>
113+
</item>
114+
<item row="2" column="0">
115+
<widget class="QLabel" name="labelBlockHash">
116+
<property name="text">
117+
<string>blockhash (optional): </string>
118+
</property>
119+
</widget>
120+
</item>
121+
<item row="2" column="1">
122+
<widget class="QValidatedLineEdit" name="blockHashEdit">
123+
<property name="toolTip">
124+
<string>The block in which to look for the transaction</string>
125+
</property>
126+
<property name="placeholderText">
127+
<string notr="true">Enter Blockhash...</string>
128+
</property>
129+
</widget>
130+
</item>
131+
</layout>
132+
</item>
79133
<item>
80134
<widget class="QTextEdit" name="helpMessage">
81135
<property name="readOnly">
@@ -135,6 +189,16 @@
135189
</property>
136190
</spacer>
137191
</item>
192+
<item>
193+
<widget class="QDialogButtonBox" name="submitButton">
194+
<property name="orientation">
195+
<enum>Qt::Horizontal</enum>
196+
</property>
197+
<property name="standardButtons">
198+
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
199+
</property>
200+
</widget>
201+
</item>
138202
<item>
139203
<widget class="QDialogButtonBox" name="okButton">
140204
<property name="orientation">
@@ -152,6 +216,13 @@
152216
<resources>
153217
<include location="../bitcoin.qrc"/>
154218
</resources>
219+
<customwidgets>
220+
<customwidget>
221+
<class>QValidatedLineEdit</class>
222+
<extends>QLineEdit</extends>
223+
<header>qt/qvalidatedlineedit.h</header>
224+
</customwidget>
225+
</customwidgets>
155226
<connections>
156227
<connection>
157228
<sender>okButton</sender>
@@ -185,5 +256,37 @@
185256
</hint>
186257
</hints>
187258
</connection>
259+
<connection>
260+
<sender>submitButton</sender>
261+
<signal>accepted()</signal>
262+
<receiver>HelpMessageDialog</receiver>
263+
<slot>onSubmitForm()</slot>
264+
<hints>
265+
<hint type="sourcelabel">
266+
<x>395</x>
267+
<y>343</y>
268+
</hint>
269+
<hint type="destinationlabel">
270+
<x>389</x>
271+
<y>199</y>
272+
</hint>
273+
</hints>
274+
</connection>
275+
<connection>
276+
<sender>submitButton</sender>
277+
<signal>rejected()</signal>
278+
<receiver>HelpMessageDialog</receiver>
279+
<slot>reject()</slot>
280+
<hints>
281+
<hint type="sourcelabel">
282+
<x>395</x>
283+
<y>343</y>
284+
</hint>
285+
<hint type="destinationlabel">
286+
<x>389</x>
287+
<y>199</y>
288+
</hint>
289+
</hints>
290+
</connection>
188291
</connections>
189292
</ui>

0 commit comments

Comments
 (0)