blockbook/static/templates/tx.html

117 lines
4.5 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

{{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>
{{- end -}}
{{- if $tx.FeesSat -}}
<tr>
<td>Fees</td>
<td class="data">{{formatAmount $tx.FeesSat}} {{$cs}}</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>
<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}}