Liquid gets block reward data from coinbase

This commit is contained in:
softsimon
2024-05-22 16:16:47 +07:00
parent aa80fa550b
commit ea0a4d1d67
3 changed files with 15 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ export class BlockTransactionsComponent implements OnInit {
@Input() previousBlockHash: string;
@Input() block$: Observable<any>;
@Input() paginationMaxSize: number;
@Output() blockReward = new EventEmitter<number>();
itemsPerPage = this.stateService.env.ITEMS_PER_PAGE;
page = 1;
@@ -50,6 +51,13 @@ export class BlockTransactionsComponent implements OnInit {
return of([]);
}))
),
tap((transactions: Transaction[]) => {
// The block API doesn't contain the block rewards on Liquid
if (this.stateService.isLiquid() && transactions && transactions[0] && transactions[0].vin[0].is_coinbase) {
const blockReward = transactions[0].vout.reduce((acc: number, curr: Vout) => acc + curr.value, 0) / 100000000;
this.blockReward.emit(blockReward);
}
})
);
this.txsLoadingStatus$ = this.route.paramMap