Skip to content

Commit

Permalink
Display reward info per block on account page
Browse files Browse the repository at this point in the history
  • Loading branch information
alex01011 committed May 12, 2023
1 parent 0db5231 commit 064a68a
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions app/scripts/controllers/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,40 @@ module.controller('AccountsController', function($location, $q, $scope, modals,
return false
}

$scope.showRewardInfo = function (height) {

api.engine.socket().callAPIFunction({
requestType: 'getRewardTotals',
fromHeight: height,
toHeight: height + 1
}).then(function(response) {
var rewardTotals = response.rewardTotals
var rewardTotalsDisplayed
if (rewardTotals) {
rewardTotalsDisplayed = rewardTotals.map(function(item) {
var amountFormatted = nxt.util.commaFormat(nxt.util.convertToQNTf(item.amount, item.decimals))
var result = item.name + " <b>" + amountFormatted + " " + item.assetName + "</b> &#8594; " + item.accountRS
if (item.campaignId && !(item.campaignId == 0 || item.campaignId == -1)) {
result = result + "<br><small><i>campaign " + item.campaignId + "</i></small>"
}
return result
})
}
var displayingObject = {
"Items": rewardTotalsDisplayed
}

var inspector = plugins.get('inspector');
inspector.inspect({
title: "Reward amounts at height " + height,
object: displayingObject,
name: "rewardTotals"
});
});

return false;
}


});

Expand Down

0 comments on commit 064a68a

Please sign in to comment.