Simplify recent transactions observable
This commit is contained in:
parent
c12e664b9a
commit
8427127545
@ -189,17 +189,7 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
this.transactions$ = this.stateService.transactions$
|
this.transactions$ = this.stateService.transactions$;
|
||||||
.pipe(
|
|
||||||
scan((acc, tx) => {
|
|
||||||
if (acc.find((t) => t.txid == tx.txid)) {
|
|
||||||
return acc;
|
|
||||||
}
|
|
||||||
acc.unshift(tx);
|
|
||||||
acc = acc.slice(0, 6);
|
|
||||||
return acc;
|
|
||||||
}, []),
|
|
||||||
);
|
|
||||||
|
|
||||||
this.blocks$ = this.stateService.blocks$
|
this.blocks$ = this.stateService.blocks$
|
||||||
.pipe(
|
.pipe(
|
||||||
|
@ -101,7 +101,7 @@ export class StateService {
|
|||||||
lightningChanged$ = new ReplaySubject<boolean>(1);
|
lightningChanged$ = new ReplaySubject<boolean>(1);
|
||||||
blocksSubject$ = new BehaviorSubject<BlockExtended[]>([]);
|
blocksSubject$ = new BehaviorSubject<BlockExtended[]>([]);
|
||||||
blocks$: Observable<BlockExtended[]>;
|
blocks$: Observable<BlockExtended[]>;
|
||||||
transactions$ = new ReplaySubject<TransactionStripped>(6);
|
transactions$ = new BehaviorSubject<TransactionStripped[]>(null);
|
||||||
conversions$ = new ReplaySubject<any>(1);
|
conversions$ = new ReplaySubject<any>(1);
|
||||||
bsqPrice$ = new ReplaySubject<number>(1);
|
bsqPrice$ = new ReplaySubject<number>(1);
|
||||||
mempoolInfo$ = new ReplaySubject<MempoolInfo>(1);
|
mempoolInfo$ = new ReplaySubject<MempoolInfo>(1);
|
||||||
@ -217,7 +217,7 @@ export class StateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.networkChanged$.subscribe((network) => {
|
this.networkChanged$.subscribe((network) => {
|
||||||
this.transactions$ = new ReplaySubject<TransactionStripped>(6);
|
this.transactions$ = new BehaviorSubject<TransactionStripped[]>(null);
|
||||||
this.blocksSubject$.next([]);
|
this.blocksSubject$.next([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ export class WebsocketService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (response.transactions) {
|
if (response.transactions) {
|
||||||
response.transactions.forEach((tx) => this.stateService.transactions$.next(tx));
|
this.stateService.transactions$.next(response.transactions.slice(0, 6));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response['bsq-price']) {
|
if (response['bsq-price']) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user