mirror of
https://github.com/mempool/mempool.git
synced 2025-03-01 01:00:00 +01:00
34 lines
1 KiB
TypeScript
34 lines
1 KiB
TypeScript
import { Component, ChangeDetectionStrategy, OnChanges, Input } from '@angular/core';
|
|
import { calcSegwitFeeGains } from '../../bitcoin.utils';
|
|
import { Transaction } from '../../interfaces/electrs.interface';
|
|
|
|
@Component({
|
|
selector: 'app-tx-features',
|
|
templateUrl: './tx-features.component.html',
|
|
styleUrls: ['./tx-features.component.scss'],
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
})
|
|
export class TxFeaturesComponent implements OnChanges {
|
|
@Input() tx: Transaction;
|
|
|
|
segwitGains = {
|
|
realizedSegwitGains: 0,
|
|
potentialSegwitGains: 0,
|
|
potentialP2shSegwitGains: 0,
|
|
potentialTaprootGains: 0,
|
|
realizedTaprootGains: 0
|
|
};
|
|
isRbfTransaction: boolean;
|
|
isTaproot: boolean;
|
|
|
|
constructor() { }
|
|
|
|
ngOnChanges() {
|
|
if (!this.tx) {
|
|
return;
|
|
}
|
|
this.segwitGains = calcSegwitFeeGains(this.tx);
|
|
this.isRbfTransaction = this.tx.vin.some((v) => v.sequence < 0xfffffffe);
|
|
this.isTaproot = this.tx.vin.some((v) => v.prevout && v.prevout.scriptpubkey_type === 'v1_p2tr');
|
|
}
|
|
}
|