From 064a68a66f83e301b20a60c2461eb8202737ee73 Mon Sep 17 00:00:00 2001 From: alex01011 Date: Fri, 12 May 2023 17:12:47 +0300 Subject: [PATCH] Display reward info per block on account page --- app/scripts/controllers/accounts.js | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/app/scripts/controllers/accounts.js b/app/scripts/controllers/accounts.js index c2f0dc1..ec8be80 100644 --- a/app/scripts/controllers/accounts.js +++ b/app/scripts/controllers/accounts.js @@ -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 + " " + amountFormatted + " " + item.assetName + " → " + item.accountRS + if (item.campaignId && !(item.campaignId == 0 || item.campaignId == -1)) { + result = result + "
campaign " + item.campaignId + "" + } + 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; + } + });