Permalink
Browse files

1.4 fixes

  • Loading branch information...
Luke Williams
Luke Williams committed Jan 13, 2015
1 parent 8d4fa47 commit 4252286ada56f294d50e5750642d3b5554900808
Showing with 58 additions and 43 deletions.
  1. +4 −4 bin/instance
  2. +12 −5 lib/database.js
  3. +2 −0 lib/explorer.js
  4. +1 −1 lib/locale.js
  5. +2 −2 settings.json.template
  6. +18 −18 spec/explorerSpec.js
  7. +1 −1 views/address.jade
  8. +2 −1 views/block.jade
  9. +4 −2 views/index.jade
  10. +5 −2 views/layout.jade
  11. +7 −7 views/markets.jade
View
@@ -24,11 +24,11 @@ db.connect(dbString, function() {
}
});
db.check_market('mintpal', function(exists) {
db.check_market('poloniex', function(exists) {
if(exists == false) {
console.log('no mintpal entry found, creating now..');
db.create_market(settings.markets.coin, settings.markets.exchange, 'mintpal', function(){
//console.log('mintpal entry created successfully.');
console.log('no poloniex entry found, creating now..');
db.create_market(settings.markets.coin, settings.markets.exchange, 'poloniex', function(){
});
}
});
View
@@ -35,11 +35,13 @@ function update_address(hash, txid, amount, type, cb) {
//console.log(address);
if ( hash == 'coinbase' ) {
if (address) {
var sent = address.sent + amount;
Address.update({a_id:hash}, {
sent: sent,
}, function() {
return cb();
lib.convert_to_satoshi(amount, function(amount_sat) {
var sent = address.sent + amount_sat;
Address.update({a_id:hash}, {
sent: sent,
}, function() {
return cb();
});
});
} else {
var newAddress = new Address({
@@ -703,6 +705,11 @@ module.exports = {
var complete = false;
lib.syncLoop((end - start) + 1, function (loop) {
var x = loop.iteration();
if (x % 5000 === 0) {
Stats.update({coin: coin}, {
last: start + x - 1,
}, function() {});
}
lib.get_blockhash(start + x, function(blockhash){
if (blockhash) {
//var s_timer = new Date().getTime();
View
@@ -199,10 +199,12 @@ module.exports = {
});
} else if (settings.supply == 'BALANCES') {
module.exports.balance_supply(function(supply) {
console.log('BALANCES');
return cb(supply/100000000);
});
} else {
coinbase_supply(function(supply) {
console.log('COINBASE');
return cb(supply/100000000);
});
}
View
@@ -127,7 +127,7 @@ exports.reloadLocale = function reloadLocale(locale) {
var localeFilename = locale;
//console.log(localeFilename);
localeFilename = "./" + localeFilename;
console.log('Loading locale: ' + localeFilename);
//console.log('Loading locale: ' + localeFilename);
var localeStr;
try{
//read the settings sync
View
@@ -72,9 +72,9 @@
"markets": {
"coin": "RZR",
"exchange": "BTC",
"mintpal": true,
"poloniex": true,
"bittrex": true,
"default": "mintpal"
"default": "bittrex"
},
// twitter
View
@@ -1,32 +1,32 @@
describe("explorer", function() {
describe('explorer', function() {
var lib = require('../lib/explorer');
var data = require('../test/data.js');
describe("convert_to_satoshi", function() {
describe('convert_to_satoshi', function() {
it("should be able to convert round numbers", function() {
it('should be able to convert round numbers', function() {
lib.convert_to_satoshi(500, function(amount_sat){
expect(amount_sat).toEqual(50000000000);
});
});
it("should be able to convert decimals above 1", function() {
it('should be able to convert decimals above 1', function() {
lib.convert_to_satoshi(500.12564, function(amount_sat){
expect(amount_sat).toEqual(50012564000);
});
});
it("should be able to convert decimals below 1", function() {
it('should be able to convert decimals below 1', function() {
lib.convert_to_satoshi(0.0005, function(amount_sat){
expect(amount_sat).toEqual(50000);
});
});
});
describe("is_unique", function() {
describe('is_unique', function() {
var arrayStrMap = [
{'addresses' : 'XsF8k8s5CoS3XATqW2FkuTsznbJJzFAC2U'},
@@ -42,31 +42,31 @@ describe("explorer", function() {
{'addresses' : ['XfuW2K9QiGMSsq5eXgtimEQvTvz9dzBCzb']}
];
it("should return index of matching string object", function() {
it('should return index of matching string object', function() {
lib.is_unique(arrayStrMap, arrayStrMap[2].addresses, function(unique, index){
expect(index).toEqual(2);
expect(unique).toEqual(false);
});
});
it("should return index of matching array object", function() {
it('should return index of matching array object', function() {
lib.is_unique(arrayArrMap, arrayArrMap[2].addresses, function(unique, index){
expect(index).toEqual(2);
expect(unique).toEqual(false);
});
});
it("should return true if no matching string object", function() {
it('should return true if no matching string object', function() {
lib.is_unique(arrayStrMap, 'unique', function(unique, index){
expect(index).toEqual(null);
expect(unique).toEqual(true);
});
});
it("should return true if no matching array object", function() {
it('should return true if no matching array object', function() {
lib.is_unique(arrayArrMap, ['unique'], function(unique, index){
expect(index).toEqual(null);
expect(unique).toEqual(true);
@@ -75,7 +75,7 @@ describe("explorer", function() {
});
});
describe("prepare_vout", function() {
describe('prepare_vout', function() {
var originalTimeout;
@@ -84,14 +84,14 @@ describe("explorer", function() {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
});
it("should ignore nonstandard outputs", function(done) {
it('should ignore nonstandard outputs', function(done) {
lib.prepare_vout(data.txA().vout, data.txA().txid, function(prepared) {
expect(prepared.length).toEqual(152);
done();
});
});
it("should maintain order", function(done) {
it('should maintain order', function(done) {
lib.prepare_vout(data.txA().vout, data.txA().txid, function(prepared) {
expect(prepared[150].amount).toEqual(2.1006);
expect(prepared[150].addresses).toEqual(['XyPreJfnUxSSY1QbYqQxDXpymc26VFQPDV']);
@@ -105,15 +105,15 @@ describe("explorer", function() {
});
describe("calculate_total", function() {
describe('calculate_total', function() {
var originalTimeout;
beforeEach(function() {
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
});
it("should calculate correct total", function(done) {
it('should calculate correct total', function(done) {
lib.prepare_vout(data.txA().vout, data.txA().txid, function(prepared) {
lib.calculate_total(prepared, function(total) {
expect(total).toEqual(700200000);
@@ -127,22 +127,22 @@ describe("explorer", function() {
});
});
describe("prepare_vin", function() {
describe('prepare_vin', function() {
var originalTimeout;
beforeEach(function() {
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
});
it("should return array of correct length", function(done) {
it('should return array of correct length', function(done) {
lib.prepare_vin(data.txB(), function(prepared) {
expect(prepared.length).toEqual(18);
done();
});
});
it("should get correct input addresses", function(done) {
it('should get correct input addresses', function(done) {
lib.prepare_vin(data.txB(), function(prepared) {
expect(prepared[3].amount).toEqual(10.00000001);
expect(prepared[3].addresses).toEqual('XjYC7q5QwG7dGnytYDoCURhL4CATj6WQhZ');
View
@@ -2,7 +2,7 @@ extends layout
block content
- var balance = (address.received - address.sent) / 100000000;
- var sent = address.sent / 100000000
- var sent = address.sent /100000000
- var received = address.received / 100000000
.row(style='margin-top:5px;')
.col-md-12(style='text-align:center;')
View
@@ -92,7 +92,8 @@ block content
td #{txn.vout.length}
if txn.vout.length > 0
if txn.vout[0].addresses[0] != txn.vin[0].addresses
td #{txn.total.toFixed(8)}
- var total = txn.total / 100000000
td #{total.toFixed(8)}
else
- var total = txn.vout[0].amount - txn.vin[0].amount
td #{total.toFixed(8)}
View
@@ -4,7 +4,8 @@ block content
- var t_sent = 0;
if txs.length > 0
each e in txs
- t_sent = (parseFloat(t_sent) + parseFloat(e.total)).toFixed(8);
- t_sent = t_sent + parseFloat(e.total);
- t_sent = (t_sent / 100000000).toFixed(8);
- var time = format_unixtime(stats.timestamp)
.row
.col-md-10.col-md-offset-1
@@ -86,7 +87,8 @@ block content
td #{txn.vout.length}
if txn.vout.length > 0
if txn.vout[0].addresses[0] != txn.vin[0].addresses
td #{txn.total.toFixed(8)}
- var total = txn.total / 100000000
td #{total.toFixed(8)}
else
- var total = txn.vout[0].amount - txn.vin[0].amount
td #{total.toFixed(8)}
View
@@ -7,8 +7,6 @@ html
link(rel='stylesheet', href='//cdn.datatables.net/plug-ins/725b2a2115b/integration/bootstrap/3/dataTables.bootstrap.css')
link(rel='stylesheet', href='//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css')
link(rel='stylesheet', href='/stylesheets/style.css')
script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js')
script(src='//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js')
script(src='/vendor/jqplot/jquery.jqplot.min.js')
@@ -34,6 +32,11 @@ html
animation: true,
delay: { hide: 500 },
});
$('.history-table').dataTable( {
searching: false,
ordering: false,
responsive: true
});
});
body
- function format_unixtime(unixtime) {
View
@@ -33,18 +33,18 @@ block content
.container-fluid
.collapse.navbar-collapse(id='navbar-collapse')
ul.nav.navbar-nav
if settings.markets.mintpal == true
if market == 'mintpal'
li.active
a.navbar-link.loading(href='/mintpal') MintPal
else
li
a.navbar-link.loading(href='/mintpal') MintPal
if settings.markets.bittrex == true
if market == 'bittrex'
li.active
a.navbar-link.loading(href='/bittrex') Bittrex
else
li
a.navbar-link.loading(href='/bittrex') Bittrex
if settings.markets.poloniex == true
if market == 'poloniex'
li.active
a.navbar-link.loading(href='/poloniex') Poloniex
else
li
a.navbar-link.loading(href='/poloniex') Poloniex
block market_view

0 comments on commit 4252286

Please sign in to comment.