Adding median fee to block.
This commit is contained in:
parent
9b33baa4c1
commit
dbf8d025e9
@ -1,3 +1,5 @@
|
||||
const config = require('../../mempool-config.json');
|
||||
|
||||
import * as WebSocket from 'ws';
|
||||
import * as fs from 'fs';
|
||||
import { Block, TransactionExtended, Statistic } from '../interfaces';
|
||||
@ -68,7 +70,7 @@ class WebsocketHandler {
|
||||
client.send(JSON.stringify({
|
||||
'mempoolInfo': memPool.getMempoolInfo(),
|
||||
'vBytesPerSecond': memPool.getVBytesPerSecond(),
|
||||
'blocks': _blocks,
|
||||
'blocks': _blocks.slice(config.INITIAL_BLOCK_AMOUNT),
|
||||
'conversions': fiatConversion.getTickers()['BTCUSD'],
|
||||
'mempool-blocks': mempoolBlocks.getMempoolBlocks(),
|
||||
'git-commit': this.latestGitCommitHash
|
||||
|
@ -48,11 +48,11 @@
|
||||
<td class="mobile-width">Hash</td>
|
||||
<td><a [routerLink]="['/block/', block.id]" title="{{ block.id }}">{{ block.id | shortenString : 16 }}</a> <app-clipboard [text]="block.id"></app-clipboard></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Previous Block</td>
|
||||
<td><a [routerLink]="['/block/', block.previousblockhash]" [state]="{ data: { blockHeight: blockHeight - 1 } }" title="{{ block.previousblockhash }}">{{ block.previousblockhash | shortenString : 16 }}</a></td>
|
||||
<tr *ngIf="block.medianFee !== undefined">
|
||||
<td>Median fee</td>
|
||||
<td>~{{ block.medianFee | ceil }} sats/vB (<app-fiat [value]="block.medianFee * 250" digitsInfo="1.2-2"></app-fiat>)</td>
|
||||
</tr>
|
||||
<ng-template [ngIf]="fees" [ngIfElse]="loadingFees">
|
||||
<ng-template [ngIf]="fees !== undefined" [ngIfElse]="loadingFees">
|
||||
<tr>
|
||||
<td>Total fees</td>
|
||||
<td><span title="{{ fees | number: '1.2-8' }} BTC">{{ fees | number: '1.2-2' }} BTC</span> (<app-fiat [value]="fees * 100000000" digitsInfo="1.0-0"></app-fiat>)</td>
|
||||
|
@ -89,7 +89,7 @@ export class BlockComponent implements OnInit {
|
||||
this.transactions = null;
|
||||
this.electrsApiService.getBlockTransactions$(hash)
|
||||
.subscribe((transactions: any) => {
|
||||
if (!this.fees) {
|
||||
if (this.fees === undefined) {
|
||||
this.fees = transactions[0].vout.reduce((acc: number, curr: Vout) => acc + curr.value, 0) / 100000000 - this.blockSubsidy;
|
||||
}
|
||||
this.transactions = transactions;
|
||||
|
@ -7,7 +7,7 @@
|
||||
</div>
|
||||
<div class="block-body">
|
||||
<div class="fees">
|
||||
<span class="yellow-color">~{{ block.medianFee | ceil }} sat/vB</span>
|
||||
<span class="yellow-color">~{{ block.medianFee | ceil }} sats/vB</span>
|
||||
</div>
|
||||
<div class="block-size">{{ block.size | bytes: 2 }}</div>
|
||||
<div class="transaction-count">{{ block.tx_count }} transactions</div>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="bitcoin-block text-center mempool-block" id="mempool-block-{{ i }}" [ngStyle]="getStyleForMempoolBlockAtIndex(i)">
|
||||
<div class="block-body" *ngIf="mempoolBlocks?.length">
|
||||
<div class="fees">
|
||||
<span class="yellow-color">~{{ projectedBlock.medianFee | ceil }} sat/vB</span>
|
||||
<span class="yellow-color">~{{ projectedBlock.medianFee | ceil }} sats/vB</span>
|
||||
</div>
|
||||
<div class="block-size">{{ projectedBlock.blockSize | bytes: 2 }}</div>
|
||||
<div class="transaction-count">{{ projectedBlock.nTx }} transactions</div>
|
||||
|
@ -45,12 +45,12 @@
|
||||
</tr>
|
||||
<ng-template [ngIf]="tx.fee">
|
||||
<tr>
|
||||
<td>Fees</td>
|
||||
<td>Fee</td>
|
||||
<td>{{ tx.fee | number }} sats (<app-fiat [value]="tx.fee"></app-fiat>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Fees per vByte</td>
|
||||
<td>{{ tx.fee / (tx.weight / 4) | number : '1.2-2' }} sat/vB</td>
|
||||
<td>Fee per vByte</td>
|
||||
<td>{{ tx.fee / (tx.weight / 4) | number : '1.2-2' }} sats/vB</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</tbody>
|
||||
@ -85,7 +85,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Fees per vByte</td>
|
||||
<td>{{ tx.fee / (tx.weight / 4) | number : '1.2-2' }} sat/vB</td>
|
||||
<td>{{ tx.fee / (tx.weight / 4) | number : '1.2-2' }} sats/vB</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
Loading…
x
Reference in New Issue
Block a user