Merge pull request #33 from cmgustavo/feature/more-block-info

Feature/more block info
This commit is contained in:
Matias Alejo Garcia 2014-01-13 15:40:53 -08:00
commit a7283e3945
7 changed files with 76 additions and 32 deletions

View File

@ -23,9 +23,18 @@ $ npm install -g bower
* UI Bootstrap - Defined as bower module in the [bower.json](bower.json) file.
## Quick Install
The quickest way to get started with MEAN is to clone the project and utilize it like this:
Grunt Command Line Interface:
To install Mystery on local, you have to fork the main repository to your
computer:
https://github.com/bitpay/mystery
Then clone it wherever you want:
$ git clone git@github.com:<your_username>/mystery.git
$ cd myster
Install Grunt Command Line Interface:
$ sudo npm -g install grunt-cli
@ -37,15 +46,30 @@ $ npm install -g bower
$ grunt
When not using grunt you can use (for example in production):
When not using grunt you can use (for example in production or test
environment):
$ node server
Then open a browser and go to:
Then open a browser and go to (with default port):
http://localhost:3000
### Prerequisites
If you get an error, please check the next section "Post-install"
### Post-install (post-dependecies)
Get bufferput package from Github repository:
$ git clone git@github.com:gasteve/node-bufferput.git
Create symbolic link of node-bufferput in your mystery folder:
$ cd <your_path_to>/mystery/node_modules
$ ln -s <path_to>/node-bufferput bufferput
Get bitcore from github repository:
Get bitcore from github repository:
$ git clone https://github.com/bitpay/bitcore.git
@ -62,7 +86,11 @@ $ npm install -g bower
$ rm -R bitcore
$ ln -s <path-to-your-clone-repositoy>/bitcore
## API
A REST API is provided at /api.
Run sync from mystery repository (to save blocks in MongoDB):
$ utils/sync.js

View File

@ -25,6 +25,7 @@ script(type='text/javascript', src='/js/directives.js')
script(type='text/javascript', src='/js/filters.js')
//Application Services
script(type='text/javascript', src='/js/services/address.js')
script(type='text/javascript', src='/js/services/transactions.js')
script(type='text/javascript', src='/js/services/blocks.js')
script(type='text/javascript', src='/js/services/global.js')

View File

@ -19,7 +19,7 @@ angular.module('mystery').config(['$routeProvider',
when('/blocks-date/:blockDate', {
templateUrl: 'views/blocks/list.html'
}).
when('/address/:address', {
when('/address/:addrStr', {
templateUrl: 'views/address.html'
}).
otherwise({

View File

@ -1,8 +1,7 @@
'use strict';
angular.module('mystery.address').controller('AddressController', ['$scope', function ($scope) {
//example data
angular.module('mystery.address').controller('AddressController', ['$scope', '$routeParams', '$location', 'Global', 'Address', function ($scope, $routeParams, $location, Global, Address) {
/*
$scope.address = '1JmTTDcksW7A6GN7JnxuXkMAXsVN9zmgm1';
$scope.hash160 = '77ad7d08aaa9cf489ea4e468eaeb892b85f71e27';
$scope.transactions = [
@ -17,4 +16,15 @@ angular.module('mystery.address').controller('AddressController', ['$scope', fun
amount: 0.1
}
];
*/
$scope.global = Global;
$scope.findOne = function() {
Address.get({
addrStr: $routeParams.addrStr
}, function(address) {
$scope.address = address;
});
};
}]);

View File

@ -0,0 +1,8 @@
'use strict';
angular.module('mystery.address').factory('Address', ['$resource', function($resource) {
return $resource('/api/addr/:addrStr', {
addrStr: '@addStr'
});
}]);

View File

@ -1,8 +1,8 @@
<section data-ng-controller="AddressController">
<section data-ng-controller="AddressController" data-ng-init="findOne()">
<div class="page-header">
<h1>
Address
<small>{{address}}</small>
<small>Addresses are identifiers which you use to send bitcoins to another person.</small>
</h1>
</div>
<div class="col-lg-9">
@ -10,29 +10,30 @@
<tbody>
<tr>
<td>Address</td>
<td><a href="#!/address/{{address}}">{{address}}</a></td>
<td><a href="/#!/address/{{address}}">{{address.addrStr}}</a></td>
</tr>
<tr>
<td>Hash160</td>
<td><a href="#!/address/{{hash160}}">{{hash160}}</a></td>
<td>Total Received</td>
<td>{{address.totalReceivedSat / 100000000}} BTC</td>
</tr>
<tr>
<td>Total Output</td>
<td>1 BTC</td>
<td>Total Sent</td>
<td>{{address.totalSentSat / 100000000}} BTC</td>
</tr>
<tr>
<td>Total Input</td>
<td>0.2 BTC</td>
<td>Final Balance</td>
<td>{{address.balanceSat / 100000000}} BTC</td>
</tr>
<tr>
<td>Current balance</td>
<td>10.2 BTC</td>
<td>No. Transactions</td>
<td>{{address.txApperances}}</td>
</tr>
</tbody>
</table>
</div>
<div class="col-lg-3">
<qrcode size="200" data="{{address}}"></qrcode>
<qrcode size="200" data="{{address.addrStr}}"></qrcode>
</div>
<div class="col-lg-12">
<h3>
@ -49,10 +50,10 @@
</tr>
</thead>
<tbody>
<tr data-ng-repeat="transaction in transactions">
<td><a href="#!/tx/{{transaction.hash}}">{{transaction.hash}}</a></td>
<td>{{transaction.time | date:'medium'}}</td>
<td>{{transaction.amount}} BTC</td>
<tr data-ng-repeat="transaction in address.transactions">
<td><a href="/#!/tx/{{transaction}}">{{transaction}}</a></td>
<td>--</td>
<td>--</td>
</tr>
</tbody>
</table>

View File

@ -14,7 +14,7 @@
<tbody>
<tr>
<td>Number Of Transactions</td>
<td>--</td>
<td>{{block.tx.length}}<td>
</tr>
<tr>
<td>Output Total</td>
@ -36,10 +36,6 @@
<td>Timestamp</td>
<td>{{block.time * 1000 | date:'medium'}}</td>
</tr>
<tr>
<td>Received Time</td>
<td>--<td>
</tr>
<tr>
<td>Relayed By</td>
<td>--</td>