diff --git a/backend/src/api/blocks.ts b/backend/src/api/blocks.ts index 116a99340..e080285ed 100644 --- a/backend/src/api/blocks.ts +++ b/backend/src/api/blocks.ts @@ -283,11 +283,13 @@ class Blocks { extras.matchRate = null; extras.expectedFees = null; + extras.expectedWeight = null; if (config.MEMPOOL.AUDIT) { const auditScore = await BlocksAuditsRepository.$getBlockAuditScore(block.id); if (auditScore != null) { extras.matchRate = auditScore.matchRate; extras.expectedFees = auditScore.expectedFees; + extras.expectedWeight = auditScore.expectedWeight; } } } diff --git a/backend/src/api/websocket-handler.ts b/backend/src/api/websocket-handler.ts index b2c529220..8aaab5ab5 100644 --- a/backend/src/api/websocket-handler.ts +++ b/backend/src/api/websocket-handler.ts @@ -602,6 +602,7 @@ class WebsocketHandler { if (block.extras) { block.extras.matchRate = matchRate; block.extras.expectedFees = totalFees; + block.extras.expectedWeight = totalWeight; block.extras.similarity = similarity; } } diff --git a/backend/src/repositories/BlocksRepository.ts b/backend/src/repositories/BlocksRepository.ts index 9b07e6f03..2689e19b3 100644 --- a/backend/src/repositories/BlocksRepository.ts +++ b/backend/src/repositories/BlocksRepository.ts @@ -1033,6 +1033,7 @@ class BlocksRepository { // Match rate is not part of the blocks table, but it is part of APIs so we must include it extras.matchRate = null; extras.expectedFees = null; + extras.expectedWeight = null; if (config.MEMPOOL.AUDIT) { const auditScore = await BlocksAuditsRepository.$getBlockAuditScore(dbBlk.id); if (auditScore != null) { diff --git a/frontend/src/app/components/blocks-list/blocks-list.component.html b/frontend/src/app/components/blocks-list/blocks-list.component.html index 6748da448..727ca2782 100644 --- a/frontend/src/app/components/blocks-list/blocks-list.component.html +++ b/frontend/src/app/components/blocks-list/blocks-list.component.html @@ -13,14 +13,12 @@ Pool Timestamp - Mined Health - Expected fees Reward Fees + vs Expected TXs Transactions @@ -44,9 +42,6 @@ ‎{{ block.timestamp * 1000 | date:'yyyy-MM-dd HH:mm' }} - - - - - - + + + {{ block.extras.feeDelta > 0 ? '+' : '' }}{{ (block.extras.feeDelta * 100) | amountShortener: 2 }}% + + {{ block.tx_count | number }} diff --git a/frontend/src/app/components/blocks-list/blocks-list.component.scss b/frontend/src/app/components/blocks-list/blocks-list.component.scss index ea6e93347..39d6b55b0 100644 --- a/frontend/src/app/components/blocks-list/blocks-list.component.scss +++ b/frontend/src/app/components/blocks-list/blocks-list.component.scss @@ -23,6 +23,17 @@ tr, td, th { border: 0px; padding-top: 0.65rem !important; padding-bottom: 0.7rem !important; + + .difference { + margin-left: 0.5em; + + &.positive { + color: rgb(66, 183, 71); + } + &.negative { + color: rgb(183, 66, 66); + } + } } .clear-link { @@ -90,7 +101,7 @@ tr, td, th { } .timestamp { - width: 18%; + width: 10%; @media (max-width: 1100px) { display: none; } @@ -123,8 +134,8 @@ tr, td, th { } .txs { - padding-right: 40px; - width: 8%; + padding-right: 20px; + width: 6%; @media (max-width: 1100px) { padding-right: 10px; } @@ -160,6 +171,15 @@ tr, td, th { .fees.widget { width: 20%; } +.fee-delta { + width: 6%; + @media (max-width: 991px) { + display: none; + } +} +.fee-delta.widget { + display: none; +} .reward { width: 8%; @@ -214,7 +234,7 @@ tr, td, th { .health { width: 10%; - @media (max-width: 1105px) { + @media (max-width: 1100px) { width: 13%; } @media (max-width: 560px) { diff --git a/frontend/src/app/components/blocks-list/blocks-list.component.ts b/frontend/src/app/components/blocks-list/blocks-list.component.ts index 0086ff902..9ec09bfa9 100644 --- a/frontend/src/app/components/blocks-list/blocks-list.component.ts +++ b/frontend/src/app/components/blocks-list/blocks-list.component.ts @@ -112,7 +112,14 @@ export class BlocksList implements OnInit, OnDestroy { acc = acc.slice(0, this.widget ? 6 : 15); } return acc; - }, []) + }, []), + switchMap((blocks) => { + console.log(blocks); + blocks.forEach(block => { + block.extras.feeDelta = block.extras.expectedFees ? (block.extras.totalFees - block.extras.expectedFees) / block.extras.expectedFees : 0; + }); + return of(blocks); + }) ); if (this.indexingAvailable && this.auditAvailable) { diff --git a/frontend/src/app/interfaces/node-api.interface.ts b/frontend/src/app/interfaces/node-api.interface.ts index cf1ae1fc0..2e58c79e4 100644 --- a/frontend/src/app/interfaces/node-api.interface.ts +++ b/frontend/src/app/interfaces/node-api.interface.ts @@ -134,6 +134,8 @@ export interface BlockExtension { coinbaseRaw?: string; matchRate?: number; expectedFees?: number; + expectedWeight?: number; + feeDelta?: number; similarity?: number; pool?: { id: number;