github.com/dawnbass68/maddcash@v0.0.0-20201001105353-c91c12cb36e5/static/templates/tx.html (about)

     1  {{define "specific"}}{{$cs := .CoinShortcut}}{{$tx := .Tx}}
     2  <h1>Transaction</h1>
     3  <div class="alert alert-data ellipsis">
     4      <span class="data">{{$tx.Txid}}</span>
     5  </div>
     6  <h3>Summary</h3>
     7  <div class="data-div">
     8      <table class="table data-table">
     9          <tbody>
    10              {{- if $tx.Confirmations -}}
    11              <tr>
    12                  <td style="width: 25%;">Mined Time</td>
    13                  <td class="data">{{formatUnixTime $tx.Blocktime}}</td>
    14              </tr>{{end -}}
    15              <tr>
    16                  <td style="width: 25%;">In Block</td>
    17                  <td class="ellipsis data">{{if $tx.Confirmations}}{{$tx.Blockhash}}{{else}}Unconfirmed{{end}}</td>
    18              </tr>
    19              {{- if $tx.Confirmations -}}
    20              <tr>
    21                  <td>In Block Height</td>
    22                  <td class="data"><a href="/block/{{$tx.Blockheight}}">{{$tx.Blockheight}}</a></td>
    23              </tr>{{end}}
    24              {{- if $tx.EthereumSpecific -}}
    25              <tr>
    26                  <td>Status</td>
    27                  {{- if $tx.EthereumSpecific.Status -}}
    28                  {{- if eq $tx.EthereumSpecific.Status 1 -}}
    29                  <td class="data text-success">Success</td>
    30                  {{- else -}}
    31                  {{- if eq $tx.EthereumSpecific.Status -1 -}}
    32                  <td class="data">Pending</td>
    33                  {{- else -}}
    34                  <td class="data">Unknown</td>
    35                  {{- end -}}
    36                  {{- end -}}
    37                  {{- else -}}
    38                  <td class="data text-danger">Fail</td>
    39                  {{- end -}}
    40              </tr>
    41              <tr>
    42                  <td>Value</td>
    43                  <td class="data">{{formatAmount $tx.ValueOutSat}} {{$cs}}</td>
    44              </tr>
    45              <tr>
    46                  <td>Gas Used / Limit</td>
    47                  <td class="data">{{if $tx.EthereumSpecific.GasUsed}}{{$tx.EthereumSpecific.GasUsed}}{{else}}pending{{end}} / {{$tx.EthereumSpecific.GasLimit}}</td>
    48              </tr>
    49              <tr>
    50                  <td>Gas Price</td>
    51                  <td class="data">{{formatAmount $tx.EthereumSpecific.GasPrice}} {{$cs}}</td>
    52              </tr>
    53              {{- else -}}
    54              <tr>
    55                  <td>Total Input</td>
    56                  <td class="data">{{formatAmount $tx.ValueInSat}} {{$cs}}</td>
    57              </tr>
    58              <tr>
    59                  <td>Total Output</td>
    60                  <td class="data">{{formatAmount $tx.ValueOutSat}} {{$cs}}</td>
    61              </tr>
    62              {{- end -}}
    63              {{- if $tx.FeesSat -}}
    64              <tr>
    65                  <td>Fees</td>
    66                  <td class="data">{{formatAmount $tx.FeesSat}} {{$cs}}</td>
    67              </tr>{{end -}}
    68          </tbody>
    69      </table>
    70  </div>
    71  <h3>Details</h3>
    72  <div class="data-div">
    73      {{template "txdetail" .}}
    74  </div>
    75  <div class="data-div">
    76      <h5>Raw Transaction</h5>
    77      <div class="alert alert-data" style="word-wrap: break-word; font-size: smaller;">
    78          <pre id="txSpecific"></pre>
    79      </div>
    80      <script type="text/javascript">
    81          txSpecific = {{$tx.CoinSpecificJSON}};
    82          function syntaxHighlight(json) {
    83              json = JSON.stringify(json, undefined, 2);
    84              json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
    85              return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
    86                  var cls = 'number';
    87                  if (/^"/.test(match)) {
    88                      if (/:$/.test(match)) {
    89                          cls = 'key';
    90                      } else {
    91                          cls = 'string';
    92                      }
    93                  } else if (/true|false/.test(match)) {
    94                      cls = 'boolean';
    95                  } else if (/null/.test(match)) {
    96                      cls = 'null';
    97                  }
    98                  return '<span class="' + cls + '">' + match + '</span>';
    99              });
   100          }
   101          document.getElementById('txSpecific').innerHTML = syntaxHighlight(txSpecific);
   102      </script>
   103  </div>
   104  {{end}}