Fix load more inputs for non-esplora backends
This commit is contained in:
		
							parent
							
								
									d107286344
								
							
						
					
					
						commit
						6cd1f9e870
					
				@ -283,7 +283,7 @@
 | 
			
		||||
      <div class="float-left mt-2-5" *ngIf="!transactionPage && !tx.vin[0].is_coinbase && tx.fee !== -1">
 | 
			
		||||
        {{ tx.fee / (tx.weight / 4) | feeRounding }} <span class="symbol" i18n="shared.sat-vbyte|sat/vB">sat/vB</span> <span class="d-none d-sm-inline-block"> – {{ tx.fee | number }} <span class="symbol" i18n="shared.sat|sat">sat</span> <span class="fiat"><app-fiat [value]="tx.fee"></app-fiat></span></span>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="float-left mt-2-5 grey-info-text" *ngIf="tx.fee === -1" i18n="transactions-list.load-to-reveal-fee-info">Show all inputs to reveal fee data</div>
 | 
			
		||||
      <div class="float-left mt-2-5 grey-info-text" *ngIf="tx.fee === -1" i18n="transactions-list.load-to-reveal-fee-info">Show more inputs to reveal fee data</div>
 | 
			
		||||
 | 
			
		||||
      <div class="float-right">
 | 
			
		||||
        <ng-container *ngIf="showConfirmations && latestBlock$ | async as latestBlock">
 | 
			
		||||
 | 
			
		||||
@ -209,17 +209,19 @@ export class TransactionsListComponent implements OnInit, OnChanges {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  loadMoreInputs(tx: Transaction): void {
 | 
			
		||||
    tx['@vinLimit'] = false;
 | 
			
		||||
 | 
			
		||||
    this.electrsApiService.getTransaction$(tx.txid)
 | 
			
		||||
      .subscribe((newTx) => {
 | 
			
		||||
        tx.vin = newTx.vin;
 | 
			
		||||
        tx.fee = newTx.fee;
 | 
			
		||||
        this.ref.markForCheck();
 | 
			
		||||
      });
 | 
			
		||||
    if (!tx['@vinLoaded']) {
 | 
			
		||||
      this.electrsApiService.getTransaction$(tx.txid)
 | 
			
		||||
        .subscribe((newTx) => {
 | 
			
		||||
          tx['@vinLoaded'] = true;
 | 
			
		||||
          tx.vin = newTx.vin;
 | 
			
		||||
          tx.fee = newTx.fee;
 | 
			
		||||
          this.ref.markForCheck();
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  showMoreInputs(tx: Transaction): void {
 | 
			
		||||
    this.loadMoreInputs(tx);
 | 
			
		||||
    tx['@vinLimit'] = this.getVinLimit(tx, true);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -228,11 +230,19 @@ export class TransactionsListComponent implements OnInit, OnChanges {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getVinLimit(tx: Transaction, next = false): number {
 | 
			
		||||
    return Math.min(Math.max(tx['@vinLimit'] || 0, this.inputRowLimit) + (next ? this.showMoreIncrement : 0), tx.vin.length);
 | 
			
		||||
    if ((tx['@vinLimit'] || 0) > this.inputRowLimit) {
 | 
			
		||||
      return Math.min(tx['@vinLimit'] + (next ? this.showMoreIncrement : 0), tx.vin.length);
 | 
			
		||||
    } else {
 | 
			
		||||
      return Math.min((next ? this.showMoreIncrement : this.inputRowLimit), 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);
 | 
			
		||||
    if ((tx['@voutLimit'] || 0) > this.outputRowLimit) {
 | 
			
		||||
      return Math.min(tx['@voutLimit'] + (next ? this.showMoreIncrement : 0), tx.vout.length);
 | 
			
		||||
    } else {
 | 
			
		||||
      return Math.min((next ? this.showMoreIncrement : this.outputRowLimit), tx.vout.length);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngOnDestroy(): void {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user