diff --git a/README.md b/README.md index 9843a23..49f2ca6 100644 --- a/README.md +++ b/README.md @@ -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:/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 /mystery/node_modules + $ ln -s /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 /bitcore - + +## API + + A REST API is provided at /api. + Run sync from mystery repository (to save blocks in MongoDB): $ utils/sync.js diff --git a/app/views/includes/foot.jade b/app/views/includes/foot.jade index 2b10e08..ab3e493 100755 --- a/app/views/includes/foot.jade +++ b/app/views/includes/foot.jade @@ -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') diff --git a/public/js/config.js b/public/js/config.js index c176160..1281385 100755 --- a/public/js/config.js +++ b/public/js/config.js @@ -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({ diff --git a/public/js/controllers/address.js b/public/js/controllers/address.js index e921d98..7c859db 100644 --- a/public/js/controllers/address.js +++ b/public/js/controllers/address.js @@ -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; + }); + }; + }]); diff --git a/public/js/services/address.js b/public/js/services/address.js new file mode 100644 index 0000000..820f537 --- /dev/null +++ b/public/js/services/address.js @@ -0,0 +1,8 @@ +'use strict'; + +angular.module('mystery.address').factory('Address', ['$resource', function($resource) { + return $resource('/api/addr/:addrStr', { + addrStr: '@addStr' + }); +}]); + diff --git a/public/views/address.html b/public/views/address.html index 45a0149..4237598 100644 --- a/public/views/address.html +++ b/public/views/address.html @@ -1,8 +1,8 @@ -
+
@@ -10,29 +10,30 @@ Address - {{address}} + {{address.addrStr}} - Hash160 - {{hash160}} + Total Received + {{address.totalReceivedSat / 100000000}} BTC - Total Output - 1 BTC + Total Sent + {{address.totalSentSat / 100000000}} BTC - Total Input - 0.2 BTC + Final Balance + {{address.balanceSat / 100000000}} BTC - Current balance - 10.2 BTC + No. Transactions + {{address.txApperances}} +
- +

@@ -49,10 +50,10 @@ - - {{transaction.hash}} - {{transaction.time | date:'medium'}} - {{transaction.amount}} BTC + + {{transaction}} + -- + -- diff --git a/public/views/block.html b/public/views/block.html index 98d76ac..aced34b 100644 --- a/public/views/block.html +++ b/public/views/block.html @@ -14,7 +14,7 @@ Number Of Transactions - -- + {{block.tx.length}} Output Total @@ -36,10 +36,6 @@ Timestamp {{block.time * 1000 | date:'medium'}} - - Received Time - -- - Relayed By --