Merge pull request #14 from cmgustavo/feature/transaction-page

great job!
This commit is contained in:
Mario Colque 2014-01-09 22:01:49 -08:00
commit 9c7239e740
2 changed files with 119 additions and 42 deletions

View File

@ -45,26 +45,34 @@ $ npm install -g bower
http://localhost:3000
## Prerequisites
Get bitcore from github repository:
$ git clone https://github.com/bitpay/bitcore.git
$ cd bitcore
$ npm install
Run sync from mystery repository:
$ utils/sync.js
check utils/sync.js --help for options.
## API
A REST API is provided at /api. The entry points are:
### Prerequisites
Get bitcore from github repository:
$ git clone https://github.com/bitpay/bitcore.git
$ cd bitcore
$ npm install
Then create a symbolic link from this to your mystery repository. We need to
use bitcore from github, not with npm for now:
$ cd mystery/node_modules
$ rm -R bitcore
$ ln -s <path-to-your-clone-repositoy>/bitcore
Run sync from mystery repository (to save blocks in MongoDB):
$ utils/sync.js
Check utils/sync.js --help for options.
### Blocks
```
/api/block/[:hash]

View File

@ -1,32 +1,101 @@
<section data-ng-controller="transactionsController" data-ng-init="findOne()">
<div class="page-header">
<h1>Transaction <small>View information about a bitcoin transaction</small></h1>
<h1>
<span class="glyphicon glyphicon-transfer">&nbsp;</span>
<a href="/#!/tx/{{tx.txid}}" title="{{tx.txid}}">Transaction</a>
<small>View information about a bitcoin transaction</small>
</h1>
</div>
<ul>
<li>{{tx.txid}}</li>
<li>VIN
<ul data-ng-repeat="vin in tx.vin">
<li>coinbase: {{vin.coinbase}}</li>
<li>sequence: {{vin.sequence}}</li>
<li>txid: {{vin.txid}}</li>
<li>vout: {{vin.vout}}</li>
</ul>
</li>
<li>VOUT
<ul data-ng-repeat="vout in tx.vout">
<li>value: {{vout.value}}</li>
<li>n: {{vout.n}}</li>
<li>addresses: {{vin.scriptPubKey}}
<ul data-ng-repeat="addr in vout.scriptPubKey.addresses">
<li>address: {{addr}}</li>
<table class="table table-striped">
<thead>
<tr>
<th>Input</th>
<th>&nbsp;</th>
<th>Output</th>
</tr>
</thead>
<tbody>
<tr>
<td width="45%">
<ul class="list-unstyled" data-ng-repeat="vin in tx.vin" data-ng-show="!tx.isCoinBase">
<li><a href="/#!/address/{{vin.addr}}">{{vin.addr}}</a> <span class="pull-right badge">{{vin.value}} BTC</span></li>
</ul>
<div data-ng-show="tx.isCoinBase">
No Inputs (Newly Generated isCoinBasens)
</div>
</td>
<td width="10%" style="text-align: center;"><span class="glyphicon glyphicon-chevron-right">&nbsp;</span></td>
<td width="45%">
<div data-ng-repeat="vout in tx.vout">
<ul class="list-unstyled" data-ng-repeat="addr in vout.scriptPubKey.addresses">
<li><a href="/#!/address/{{addr}}">{{addr}}</a> <span class="pull-right badge">{{vout.value}} BTC</span></li>
</ul>
</li>
</ul>
</li>
<li>Blockhash: <a href="#!/block/{{tx.blockhash}}">{{tx.blockhash}}</a></li>
<li>Confirmations: {{tx.confirmations}}</li>
<li>Time {{tx.time}}</li>
<li>Bloctime {{tx.blocktime}}</li>
</ul>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3" style="text-align: right;">
<button type="button" class="btn btn-primary">{{tx.confirmations}} Confirmations</button>
<button type="button" class="btn btn-success">{{tx.valueOut}} BTC</button>
</td>
</tr>
</tfoot>
</table>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Summary</h3>
</div>
<div class="panel-body">
<table class="table table-striped">
<tbody>
<tr>
<td>Size</td>
<td>{{tx.size}} (bytes)</td>
</tr>
<tr>
<td>Received Time</td>
<td>{{tx.time * 1000|date:'medium'}}</td>
</tr>
<tr>
<td>Reward From Block</td>
<td><a href="/#!/block/{{tx.blockhash}}">Need height to show (it links to block page)</a></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default" data-ng-show="!tx.isCoinBase">
<div class="panel-heading">
<h3 class="panel-title">Inputs and Outputs</h3>
</div>
<div class="panel-body">
<table class="table table-striped">
<tbody>
<tr>
<td>Total Input</td>
<td>{{tx.valueIn}} BTC</td>
</tr>
<tr>
<td>Total Output</td>
<td>{{tx.valueOut}} BTC</td>
</tr>
<tr>
<td>Fees</td>
<td>{{tx.feeds}} BTC</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>