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. * UI Bootstrap - Defined as bower module in the [bower.json](bower.json) file.
## Quick Install ## Quick Install
The quickest way to get started with MEAN is to clone the project and utilize it like this: To install Mystery on local, you have to fork the main repository to your
computer:
Grunt Command Line Interface: 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 $ sudo npm -g install grunt-cli
@ -37,15 +46,30 @@ $ npm install -g bower
$ grunt $ 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 $ node server
Then open a browser and go to: Then open a browser and go to (with default port):
http://localhost:3000 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: Get bitcore from github repository:
$ git clone https://github.com/bitpay/bitcore.git $ git clone https://github.com/bitpay/bitcore.git
@ -63,6 +87,10 @@ $ npm install -g bower
$ ln -s <path-to-your-clone-repositoy>/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): Run sync from mystery repository (to save blocks in MongoDB):
$ utils/sync.js $ 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') script(type='text/javascript', src='/js/filters.js')
//Application Services //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/transactions.js')
script(type='text/javascript', src='/js/services/blocks.js') script(type='text/javascript', src='/js/services/blocks.js')
script(type='text/javascript', src='/js/services/global.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', { when('/blocks-date/:blockDate', {
templateUrl: 'views/blocks/list.html' templateUrl: 'views/blocks/list.html'
}). }).
when('/address/:address', { when('/address/:addrStr', {
templateUrl: 'views/address.html' templateUrl: 'views/address.html'
}). }).
otherwise({ otherwise({

View File

@ -1,8 +1,7 @@
'use strict'; 'use strict';
angular.module('mystery.address').controller('AddressController', ['$scope', function ($scope) { angular.module('mystery.address').controller('AddressController', ['$scope', '$routeParams', '$location', 'Global', 'Address', function ($scope, $routeParams, $location, Global, Address) {
/*
//example data
$scope.address = '1JmTTDcksW7A6GN7JnxuXkMAXsVN9zmgm1'; $scope.address = '1JmTTDcksW7A6GN7JnxuXkMAXsVN9zmgm1';
$scope.hash160 = '77ad7d08aaa9cf489ea4e468eaeb892b85f71e27'; $scope.hash160 = '77ad7d08aaa9cf489ea4e468eaeb892b85f71e27';
$scope.transactions = [ $scope.transactions = [
@ -17,4 +16,15 @@ angular.module('mystery.address').controller('AddressController', ['$scope', fun
amount: 0.1 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"> <div class="page-header">
<h1> <h1>
Address Address
<small>{{address}}</small> <small>Addresses are identifiers which you use to send bitcoins to another person.</small>
</h1> </h1>
</div> </div>
<div class="col-lg-9"> <div class="col-lg-9">
@ -10,29 +10,30 @@
<tbody> <tbody>
<tr> <tr>
<td>Address</td> <td>Address</td>
<td><a href="#!/address/{{address}}">{{address}}</a></td> <td><a href="/#!/address/{{address}}">{{address.addrStr}}</a></td>
</tr> </tr>
<tr> <tr>
<td>Hash160</td> <td>Total Received</td>
<td><a href="#!/address/{{hash160}}">{{hash160}}</a></td> <td>{{address.totalReceivedSat / 100000000}} BTC</td>
</tr> </tr>
<tr> <tr>
<td>Total Output</td> <td>Total Sent</td>
<td>1 BTC</td> <td>{{address.totalSentSat / 100000000}} BTC</td>
</tr> </tr>
<tr> <tr>
<td>Total Input</td> <td>Final Balance</td>
<td>0.2 BTC</td> <td>{{address.balanceSat / 100000000}} BTC</td>
</tr> </tr>
<tr> <tr>
<td>Current balance</td> <td>No. Transactions</td>
<td>10.2 BTC</td> <td>{{address.txApperances}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="col-lg-3"> <div class="col-lg-3">
<qrcode size="200" data="{{address}}"></qrcode> <qrcode size="200" data="{{address.addrStr}}"></qrcode>
</div> </div>
<div class="col-lg-12"> <div class="col-lg-12">
<h3> <h3>
@ -49,10 +50,10 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr data-ng-repeat="transaction in transactions"> <tr data-ng-repeat="transaction in address.transactions">
<td><a href="#!/tx/{{transaction.hash}}">{{transaction.hash}}</a></td> <td><a href="/#!/tx/{{transaction}}">{{transaction}}</a></td>
<td>{{transaction.time | date:'medium'}}</td> <td>--</td>
<td>{{transaction.amount}} BTC</td> <td>--</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

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