From 0719a0455d3d4a5c6c8a0dbcb58ec67a9e80c353 Mon Sep 17 00:00:00 2001 From: Alexis Hernandez Date: Sat, 24 Mar 2018 18:40:39 -0600 Subject: [PATCH] web-ui: Display total rewards on BlockDetails view --- web-ui/src/app/app.component.ts | 3 +- .../block-details.component.html | 12 ++++++- .../block-details/block-details.component.ts | 32 +++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/web-ui/src/app/app.component.ts b/web-ui/src/app/app.component.ts index 2f12b18..a4bd5ae 100644 --- a/web-ui/src/app/app.component.ts +++ b/web-ui/src/app/app.component.ts @@ -87,7 +87,8 @@ export class AppComponent { 'label.tposContract': 'Contract', 'label.owner': 'Owner', - 'label.merchant': 'Merchant' + 'label.merchant': 'Merchant', + 'label.total': 'Total' }; } } diff --git a/web-ui/src/app/components/block-details/block-details.component.html b/web-ui/src/app/components/block-details/block-details.component.html index cef522e..f4eb7e3 100644 --- a/web-ui/src/app/components/block-details/block-details.component.html +++ b/web-ui/src/app/components/block-details/block-details.component.html @@ -110,6 +110,11 @@ +
+ + +
+
@@ -146,7 +151,12 @@
- + +
+ + +
+
diff --git a/web-ui/src/app/components/block-details/block-details.component.ts b/web-ui/src/app/components/block-details/block-details.component.ts index dc14b3d..348e72f 100644 --- a/web-ui/src/app/components/block-details/block-details.component.ts +++ b/web-ui/src/app/components/block-details/block-details.component.ts @@ -66,4 +66,36 @@ export class BlockDetailsComponent implements OnInit { isTPoS(details: BlockDetails): boolean { return !this.isPoW(details) && details.block.tposContract != null; } + + getPoSTotalReward(details: BlockDetails): number { + let total = 0; + + if (details.rewards.masternode != null) { + total += details.rewards.masternode.value; + } + + if (details.rewards.coinstake != null) { + total += details.rewards.coinstake.value; + } + + return total; + } + + getTPoSTotalReward(details: BlockDetails): number { + let total = 0; + + if (details.rewards.masternode != null) { + total += details.rewards.masternode.value; + } + + if (details.rewards.owner != null) { + total += details.rewards.owner.value; + } + + if (details.rewards.merchant != null) { + total += details.rewards.merchant.value; + } + + return total; + } }