Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display inputs on /tx #1433

Merged
merged 1 commit into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1725,6 +1725,10 @@ mod tests {
StatusCode::OK,
format!(
".*<title>Transaction {txid}</title>.*<h1>Transaction <span class=monospace>{txid}</span></h1>
<h2>1 Input</h2>
<ul>
<li><a class=monospace href=/output/0000000000000000000000000000000000000000000000000000000000000000:4294967295>0000000000000000000000000000000000000000000000000000000000000000:4294967295</a></li>
</ul>
<h2>1 Output</h2>
<ul class=monospace>
<li>
Expand Down
11 changes: 10 additions & 1 deletion src/templates/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ mod tests {
let transaction = Transaction {
version: 0,
lock_time: PackedLockTime(0),
input: Vec::new(),
input: vec![TxIn {
sequence: Default::default(),
previous_output: Default::default(),
script_sig: Default::default(),
witness: Default::default(),
}],
output: vec![
TxOut {
value: 50 * COIN_VALUE,
Expand All @@ -64,6 +69,10 @@ mod tests {
format!(
"
<h1>Transaction <span class=monospace>{txid}</span></h1>
<h2>1 Input</h2>
<ul>
<li><a class=monospace href=/output/0000000000000000000000000000000000000000000000000000000000000000:4294967295>0000000000000000000000000000000000000000000000000000000000000000:4294967295</a></li>
</ul>
<h2>2 Outputs</h2>
<ul class=monospace>
<li>
Expand Down
6 changes: 6 additions & 0 deletions templates/transaction.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ <h2>Inscription Geneses</h2>
<dd><a href=/block/{{ blockhash }} class=monospace>{{ blockhash }}</a></dd>
</dl>
%% }
<h2>{{"Input".tally(self.transaction.input.len())}}</h2>
<ul>
%% for input in &self.transaction.input {
<li><a class=monospace href=/output/{{input.previous_output}}>{{input.previous_output}}</a></li>
%% }
</ul>
<h2>{{"Output".tally(self.transaction.output.len())}}</h2>
<ul class=monospace>
%% for (vout, output) in self.transaction.output.iter().enumerate() {
Expand Down