Skip to content

Commit

Permalink
Merge pull request #140 from ApolloFoundation/APL-169
Browse files Browse the repository at this point in the history
APL-198 (Implement boosting of blocks)
  • Loading branch information
0486 committed Aug 3, 2018
2 parents 55108fb + e9443ab commit e4adec9
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions html/www/js/nrs.transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var NRS = (function(NRS, $, undefined) {
this.privateKey = null;
this.sharedKey = null;
this.serverKey = null;
this.blockHeight = null;

$(this.target).parent().find('[data-transactions-pagination]').click(function(e) {

Expand Down Expand Up @@ -318,9 +319,35 @@ var NRS = (function(NRS, $, undefined) {
var that = this;
setInterval(function() {
that.getItems();

}, 60000)
};

this.blocksPulling = function() {
var that = this;

setInterval(function(){
$.ajax({
url: API + 'requestType=getBlock',
type: 'GET',
cache: false,
success: function(data) {
data = JSON.parse(data);

if (that.blockHeight && that.blockHeight !== data.height) {
that.blockHeight = data.height;
that.getItems();
}
if (!that.blockHeight) {
that.blockHeight = data.height;
that.getItems();
}
},
error: function(data) {
console.log('err: ', data);
}
});
},2000);
}
this.destroyTable = function() {
$('#transactions_table').find('tbody').empty();

Expand Down Expand Up @@ -392,6 +419,8 @@ var NRS = (function(NRS, $, undefined) {

this.renderItems();
this.logPulling();

this.blocksPulling();
};

NRS.myTransactionPagination;
Expand Down Expand Up @@ -529,8 +558,6 @@ var NRS = (function(NRS, $, undefined) {
}

NRS.sendRequest("getBlockchainTransactions", {


"account": NRS.account,
"firstIndex": 0,
"lastIndex": 16
Expand Down Expand Up @@ -1316,9 +1343,10 @@ var NRS = (function(NRS, $, undefined) {
}
return NRS.formatAmount(entry.change);
});

decimalParams.holdingChangeDecimals = NRS.getNumberOfDecimals(entries, "change", function(entry) {
if (isHoldingEntry(entry)) {
return NRS.formatQuantity(entry.change, entry.holdingInfo.decimals);
if (isHoldingEntry(entry)) {
return NRS.formatQuantity(entry.change, entry.holdingInfo.decimals);
}
return "";
});
Expand All @@ -1330,7 +1358,7 @@ var NRS = (function(NRS, $, undefined) {
});
decimalParams.holdingBalanceDecimals = NRS.getNumberOfDecimals(entries, "balance", function(entry) {
if (isHoldingEntry(entry)) {
return NRS.formatQuantity(entry.balance, entry.holdingInfo.decimals);
return NRS.formatQuantity(entry.balance, entry.holdingInfo.decimals);
}
return "";
});
Expand Down

0 comments on commit e4adec9

Please sign in to comment.