Skip to content

Commit

Permalink
ui: add tx & script version to tx details
Browse files Browse the repository at this point in the history
  • Loading branch information
thi4go authored and chappjc committed Sep 17, 2021
1 parent 551a7eb commit df93ebc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
30 changes: 16 additions & 14 deletions cmd/dcrdata/views/tx.tmpl
Expand Up @@ -228,26 +228,24 @@
{{end}}
{{end}}
<tr>
<td class="text-right medium-sans text-nowrap pr-2 py-2"
>Raw Tx:
</td>
<td class="text-left py-1 text-secondary"><a
href="/api/tx/decoded/{{.TxID}}?indent=true" data-turbolinks="false">decoded</a> &middot; <a
href="/api/tx/hex/{{.TxID}}" data-turbolinks="false">hex</a>
</td>
<td class="text-right medium-sans text-nowrap pr-2 py-2"
>Time:
<td class="text-right medium-sans text-nowrap pr-2 py-2">Tx Raw: </td>
<td class="text-left py-1 text-secondary">
<a href="/api/tx/decoded/{{.TxID}}?indent=true" data-turbolinks="false">decoded</a> &middot;
<a href="/api/tx/hex/{{.TxID}}" data-turbolinks="false">hex</a>
</td>
<td class="text-right medium-sans text-nowrap pr-2 py-2">Time: </td>
<td class="text-left py-1 text-secondary" data-target="tx.formattedAge">{{.Time.String}}</td>
</tr>
<tr>
<td class="text-right medium-sans text-nowrap pr-2 py-2"
>Size:
</td>
<td class="text-left py-1 text-secondary">{{.FormattedSize}}</td>
<td class="text-right medium-sans text-nowrap pr-2 py-2">Rate:</td>
<td class="text-right medium-sans text-nowrap pr-2 py-2">Tx Version: </td>
<td class="text-left py-1 text-secondary">{{.TxVersion}}</td>
<td class="text-right medium-sans text-nowrap pr-2 py-2">Rate: </td>
<td class="text-left py-1 text-secondary">{{.FeeRate}}/kB</td>
</tr>
<tr>
<td class="text-right medium-sans text-nowrap pr-2 py-2">Size: </td>
<td class="text-left py-1 text-secondary">{{.FormattedSize}}</td>
</tr>
{{if $.SwapsFound}}
<tr>
<td class="text-right medium-sans text-nowrap pr-2 py-2"
Expand Down Expand Up @@ -362,6 +360,7 @@
<th class="shrink-to-fit">#</th>
<th class="addr-hash-column"><div class="pl-1">Address</div></th>
<th class="text-left shrink-to-fit">Type</th>
<th class="text-left shrink-to-fit">Version</th>
<th class="text-left shrink-to-fit">Spent</th>
<th class="text-right shrink-to-fit">DCR</th>
</tr>
Expand Down Expand Up @@ -396,6 +395,9 @@
<td class="fs13 break-word shrink-to-fit">
{{.Type}}
</td>
<td class="fs13 break-word shrink-to-fit">
{{$v.Version}}
</td>
<td class="text-left fs13 shrink-to-fit">{{with $spending := (index $.Data.SpendingTxns $i) }}
{{if $spending.Hash}}
<a href="/tx/{{$spending.Hash}}/in/{{$spending.Index}}">{{$v.Spent}}</a>
Expand Down
2 changes: 2 additions & 0 deletions db/dcrpg/pgblockchain.go
Expand Up @@ -5712,6 +5712,7 @@ func (pgb *ChainDB) GetExplorerTx(txid string) *exptypes.TxInfo {
txBasic, txType := makeExplorerTxBasic(txraw, ticketPrice, msgTx, pgb.chainParams)
tx := &exptypes.TxInfo{
TxBasic: txBasic,
TxVersion: txraw.Version,
BlockHeight: txraw.BlockHeight,
BlockIndex: txraw.BlockIndex,
BlockHash: txraw.BlockHash,
Expand Down Expand Up @@ -5845,6 +5846,7 @@ func (pgb *ChainDB) GetExplorerTx(txid string) *exptypes.TxInfo {
Type: vout.ScriptPubKey.Type,
Spent: txout == nil,
Index: vout.N,
Version: vout.Version,
})
}
tx.Vout = outputs
Expand Down
2 changes: 2 additions & 0 deletions explorer/types/explorertypes.go
Expand Up @@ -173,6 +173,7 @@ type TrimmedTxInfo struct {
// TxInfo models data needed for display on the tx page
type TxInfo struct {
*TxBasic
TxVersion int32
SpendingTxns []TxInID
Vin []Vin
Vout []Vout
Expand Down Expand Up @@ -427,6 +428,7 @@ type Vout struct {
OP_RETURN string
OP_TADD bool
Index uint32
Version uint16
}

// TrimmedBlockInfo models data needed to display block info on the new home page
Expand Down

0 comments on commit df93ebc

Please sign in to comment.