This commit is contained in:
softsimon 2020-07-24 14:11:49 +07:00
parent 959e2b55cb
commit 24182a6fb3
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7
5 changed files with 21 additions and 14 deletions

View File

@ -18,15 +18,15 @@
<tbody>
<tr>
<td>Total received</td>
<td><app-amount [satoshis]="receieved"></app-amount></td>
<td><app-amount [satoshis]="receieved" [noFiat]="true"></app-amount></td>
</tr>
<tr>
<td>Total sent</td>
<td><app-amount [satoshis]="sent"></app-amount></td>
<td><app-amount [satoshis]="sent" [noFiat]="true"></app-amount></td>
</tr>
<tr>
<td>Balance</td>
<td><app-amount [satoshis]="receieved - sent"></app-amount> (<app-fiat [value]="receieved - sent"></app-fiat>)</td>
<td><app-amount [satoshis]="receieved - sent" [noFiat]="true"></app-amount> (<app-fiat [value]="receieved - sent"></app-fiat>)</td>
</tr>
</tbody>
</table>

View File

@ -22,7 +22,7 @@
</tr>
<tr>
<td>Total fees</td>
<td><app-amount [satoshis]="mempoolBlock.totalFees" [digitsInfo]="'1.2-2'"></app-amount> (<app-fiat [value]="mempoolBlock.totalFees" digitsInfo="1.0-0"></app-fiat>)</td>
<td><app-amount [satoshis]="mempoolBlock.totalFees" [digitsInfo]="'1.2-2'" [noFiat]="true"></app-amount> (<app-fiat [value]="mempoolBlock.totalFees" digitsInfo="1.0-0"></app-fiat>)</td>
</tr>
<tr>
<td>Transactions</td>

View File

@ -31,6 +31,12 @@ export class MempoolBlockComponent implements OnInit, OnDestroy {
this.mempoolBlockIndex = parseInt(params.get('id'), 10) || 0;
return this.stateService.mempoolBlocks$
.pipe(
map((blocks) => {
if (!blocks.length) {
return [{ index: 0, blockSize: 0, blockVSize: 0, feeRange: [0, 0], medianFee: 0, nTx: 0, totalFees: 0 }];
}
return blocks;
}),
filter((mempoolBlocks) => mempoolBlocks.length > 0),
map((mempoolBlocks) => {
while (!mempoolBlocks[this.mempoolBlockIndex]) {

View File

@ -1,9 +1,9 @@
import { Component, OnInit, OnDestroy, HostListener } from '@angular/core';
import { Subscription } from 'rxjs';
import { Subscription, pipe } from 'rxjs';
import { MempoolBlock } from 'src/app/interfaces/websocket.interface';
import { StateService } from 'src/app/services/state.service';
import { Router } from '@angular/router';
import { take } from 'rxjs/operators';
import { take, map } from 'rxjs/operators';
import { feeLevels, mempoolFeeColors } from 'src/app/app.constants';
@Component({
@ -42,6 +42,14 @@ export class MempoolBlocksComponent implements OnInit, OnDestroy {
this.stateService.isTabHidden$.subscribe((tabHidden) => this.tabHidden = tabHidden);
this.mempoolBlocksSubscription = this.stateService.mempoolBlocks$
.pipe(
map((blocks) => {
if (!blocks.length) {
return [{ index: 0, blockSize: 0, blockVSize: 0, feeRange: [0, 0], medianFee: 0, nTx: 0, totalFees: 0 }];
}
return blocks;
}),
)
.subscribe((blocks) => {
blocks.forEach((block, i) => {
block.index = this.blockIndex + i;

View File

@ -25,14 +25,7 @@ export class StateService {
conversions$ = new ReplaySubject<any>(1);
bsqPrice$ = new ReplaySubject<number>(1);
mempoolStats$ = new ReplaySubject<MemPoolState>(1);
mempoolBlocks$ = new ReplaySubject<MempoolBlock[]>(1).pipe(
map((blocks) => {
if (!blocks.length) {
return [{ blockSize: 0, blockVSize: 0, feeRange: [0, 0], medianFee: 0, nTx: 0, totalFees: 0 }];
}
return blocks;
})
);
mempoolBlocks$ = new ReplaySubject<MempoolBlock[]>(1);
txReplaced$ = new Subject<Transaction>();
mempoolTransactions$ = new Subject<Transaction>();
blockTransactions$ = new Subject<Transaction>();