blockbook/static/templates/tx.html

170 lines
6.3 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{define "specific"}}{{$cs := .CoinShortcut}}{{$tx := .Tx}}
<h1>Transaction</h1>
<div class="alert alert-data ellipsis">
<span class="data">{{$tx.Txid}}</span>
</div>
<h3>Summary</h3>
<div class="data-div">
<table class="table data-table">
<tbody>
{{- if $tx.Confirmations -}}
<tr>
<td style="width: 25%;">Mined Time</td>
<td class="data">{{formatUnixTime $tx.Blocktime}}</td>
</tr>{{end -}}
<tr>
<td style="width: 25%;">In Block</td>
<td class="ellipsis data">{{if $tx.Confirmations}}{{$tx.Blockhash}}{{else}}Unconfirmed{{end}}</td>
</tr>
{{- if $tx.Confirmations -}}
<tr>
<td>In Block Height</td>
<td class="data"><a href="/block/{{$tx.Blockheight}}">{{$tx.Blockheight}}</a></td>
</tr>{{end}}
{{- if $tx.EthereumSpecific -}}
<tr>
<td>Status</td>
{{- if $tx.EthereumSpecific.Status -}}
{{- if eq $tx.EthereumSpecific.Status 1 -}}
<td class="data text-success">Success</td>
{{- else -}}
{{- if eq $tx.EthereumSpecific.Status -1 -}}
<td class="data">Pending</td>
{{- else -}}
<td class="data">Unknown</td>
{{- end -}}
{{- end -}}
{{- else -}}
<td class="data text-danger">Fail</td>
{{- end -}}
</tr>
<tr>
<td>Value</td>
<td class="data">{{formatAmount $tx.ValueOutSat}} {{$cs}}</td>
</tr>
<tr>
<td>Gas Used / Limit</td>
<td class="data">{{if $tx.EthereumSpecific.GasUsed}}{{$tx.EthereumSpecific.GasUsed}}{{else}}pending{{end}} / {{$tx.EthereumSpecific.GasLimit}}</td>
</tr>
<tr>
<td>Gas Price</td>
<td class="data">{{formatAmount $tx.EthereumSpecific.GasPrice}} {{$cs}}</td>
</tr>
{{- else -}}
<tr>
<td>Total Input</td>
<td class="data">{{formatAmount $tx.ValueInSat}} {{$cs}}</td>
</tr>
<tr>
<td>Total Output</td>
<td class="data">{{formatAmount $tx.ValueOutSat}} {{$cs}}</td>
</tr>
{{- if $tx.VSize -}}
<tr>
<td>Size / vSize</td>
<td class="data">{{$tx.Size}} / {{$tx.VSize}}</td>
</tr>
{{- else -}}
{{- if $tx.Size -}}
<tr>
<td>Size</td>
<td class="data">{{$tx.Size}}</td>
</tr>
{{- end -}}
{{- end -}}
{{- end -}}
{{- if $tx.FeesSat -}}
<tr>
<td>Fees</td>
<td class="data">{{formatAmount $tx.FeesSat}} {{$cs}}{{if $tx.Size}} ({{feePerByte $tx}}){{end}}</td>
</tr>{{end -}}
{{- if not $tx.Confirmations}}
<tr>
<td><span title="Replace by fee">RBF</span></td>
<td class="data">
{{- if $tx.Rbf}}
<span title="Replace by fee transaction, could be replaced.">ON</span>
{{- else -}}
<span title="Final transaction that can not be replaced unless it is dropped from the mempool.">OFF</span>
{{end -}}
</td>
</tr>
{{end -}}
</tbody>
</table>
</div>
<h3>Details</h3>
<div class="data-div">
{{template "txdetail" .}}
</div>
{{if eq .ChainType 1}}
{{if $tx.EthereumSpecific.ParsedData}}
{{if $tx.EthereumSpecific.ParsedData.Function }}
<div class="data-div">
<h5>Input Data</h5>
<div class="row">
{{if $tx.EthereumSpecific.ParsedData.Name}}<div class="col-6">{{$tx.EthereumSpecific.ParsedData.Name}}</div>{{end}}{{if $tx.EthereumSpecific.ParsedData.MethodId}}<div class="col-6">Method ID: {{$tx.EthereumSpecific.ParsedData.MethodId}}</div>{{end}}
{{if $tx.EthereumSpecific.ParsedData.Function}}<div class="col-12">Function: {{$tx.EthereumSpecific.ParsedData.Function}}</div>{{end}}
{{if $tx.EthereumSpecific.ParsedData.Params}}
<div class="col-12">
<table class="table data-table">
<thead>
<tr>
<th style="width: 5%;">#</th>
<th>Type</th>
<th>Data</th>
</tr>
</thead>
<tbody>
{{range $i,$p := $tx.EthereumSpecific.ParsedData.Params}}
<tr>
<td>{{$i}}</td>
<td>{{$p.Type}}</td>
<td>
{{range $j,$v := $p.Values}}
{{if $j}}<br>{{end}}
{{if hasPrefix $p.Type "address"}}<a href="/address/{{$v}}">{{$v}}</a>{{else}}{{$v}}{{end}}
{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{end}}
</div>
</div>
{{end}}
{{end}}
{{end}}
<div class="data-div">
<h5>Raw Transaction</h5>
<div class="alert alert-data" style="word-wrap: break-word; font-size: smaller;">
<pre id="txSpecific"></pre>
</div>
<script type="text/javascript">
txSpecific = {{$tx.CoinSpecificData}};
function syntaxHighlight(json) {
json = JSON.stringify(json, undefined, 2);
json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
var cls = 'number';
if (/^"/.test(match)) {
if (/:$/.test(match)) {
cls = 'key';
} else {
cls = 'string';
}
} else if (/true|false/.test(match)) {
cls = 'boolean';
} else if (/null/.test(match)) {
cls = 'null';
}
return '<span class="' + cls + '">' + match + '</span>';
});
}
document.getElementById('txSpecific').innerHTML = syntaxHighlight(txSpecific);
</script>
</div>
{{end}}