"show more" instead of "show all" txos in lists

This commit is contained in:
Mononaut
2022-11-07 20:02:59 -06:00
parent a78569f233
commit e3e43f1996
2 changed files with 23 additions and 6 deletions

View File

@@ -18,6 +18,7 @@ import { ApiService } from '../../services/api.service';
export class TransactionsListComponent implements OnInit, OnChanges {
network = '';
nativeAssetId = this.stateService.network === 'liquidtestnet' ? environment.nativeTestAssetId : environment.nativeAssetId;
showMoreIncrement = 40;
@Input() transactions: Transaction[];
@Input() showConfirmations = false;
@@ -218,6 +219,22 @@ export class TransactionsListComponent implements OnInit, OnChanges {
});
}
showMoreInputs(tx: Transaction): void {
tx['@vinLimit'] = this.getVinLimit(tx, true);
}
showMoreOutputs(tx: Transaction): void {
tx['@voutLimit'] = this.getVoutLimit(tx, true);
}
getVinLimit(tx: Transaction, next = false): number {
return Math.min(Math.max(tx['@vinLimit'] || 0, this.inputRowLimit) + (next ? this.showMoreIncrement : 0), tx.vin.length);
}
getVoutLimit(tx: Transaction, next = false): number {
return Math.min(Math.max(tx['@voutLimit'] || 0, this.outputRowLimit) + (next ? this.showMoreIncrement : 0), tx.vout.length);
}
ngOnDestroy(): void {
this.outspendsSubscription.unsubscribe();
}