mirror of
https://github.com/mempool/mempool.git
synced 2025-03-01 01:00:00 +01:00
27 lines
1 KiB
TypeScript
27 lines
1 KiB
TypeScript
|
import { Component, ChangeDetectionStrategy, Input, OnChanges } from '@angular/core';
|
||
|
import { BisqTransaction } from 'src/app/interfaces/bisq.interfaces';
|
||
|
|
||
|
@Component({
|
||
|
selector: 'app-bisq-transaction-details',
|
||
|
templateUrl: './bisq-transaction-details.component.html',
|
||
|
styleUrls: ['./bisq-transaction-details.component.scss'],
|
||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||
|
})
|
||
|
export class BisqTransactionDetailsComponent implements OnChanges {
|
||
|
@Input() tx: BisqTransaction;
|
||
|
|
||
|
totalInput: number;
|
||
|
totalOutput: number;
|
||
|
totalIssued: number;
|
||
|
|
||
|
constructor() { }
|
||
|
|
||
|
ngOnChanges() {
|
||
|
this.totalInput = this.tx.inputs.filter((input) => input.isVerified).reduce((acc, input) => acc + input.bsqAmount, 0);
|
||
|
this.totalOutput = this.tx.outputs.filter((output) => output.isVerified).reduce((acc, output) => acc + output.bsqAmount, 0);
|
||
|
this.totalIssued = this.tx.outputs
|
||
|
.filter((output) => output.isVerified && output.txOutputType === 'ISSUANCE_CANDIDATE_OUTPUT')
|
||
|
.reduce((acc, output) => acc + output.bsqAmount, 0);
|
||
|
}
|
||
|
}
|