<commit_before>import { Component, Input, OnInit } from '@angular/core';
import { Nav, NavParams } from 'ionic-angular';
import _ from 'lodash';
import { ApiProvider, ChainNetwork } from '../../providers/api/api';
import { BlocksProvider } from '../../providers/blocks/blocks';
import { CurrencyProvider } from '../../providers/currency/currency';
import { RedirProvider } from '../../providers/redir/redir';
import {
  ApiCoin,
  TxsProvider
} from '../../providers/transactions/transactions';

/**
 * Generated class for the TransactionDetailsComponent component.
 *
 * See https://angular.io/docs/ts/latest/api/core/index/ComponentMetadata-class.html
 * for more info on Angular Components.
 */
@Component({
  selector: 'transaction-details',
  templateUrl: 'transaction-details.html'
})
export class TransactionDetailsComponent implements OnInit {
  public expanded = false;
  @Input()
  public tx: any = {};
  @Input()
  public showCoins = true;
  @Input()
  public chainNetwork: ChainNetwork;
  public confirmations: number;
  @Input()
  public page: string;

  private COIN = 100000000;
  private DEFAULT_RBF_SEQNUMBER = 0xffffffff;

  constructor(
    public currencyProvider: CurrencyProvider,
    public apiProvider: ApiProvider,
    public txProvider: TxsProvider,
    public redirProvider: RedirProvider,
    public blocksProvider: BlocksProvider,
    public nav: Nav,
    public navParams: NavParams
  ) {}

  public ngOnInit(): void {
    if (this.chainNetwork.chain !== 'ETH') {
      this.getConfirmations();
    }
  }

  public getCoins(): void {
    this.txProvider
      .getCoins(this.tx.txid, this.chainNetwork)
      .subscribe(data => {
        this.tx.vin = data.inputs;
        this.tx.vout = data.outputs;
        this.tx.fee = this.txProvider.getFee(this.tx);
        this.tx.isRBF = _.some(data.inputs, input => {
          return input.sequenceNumber && input.sequenceNumber < this.DEFAULT_RBF_SEQNUMBER - 1;
        });
        this.tx.hasUnconfirmedInputs = _.some(data.inputs, input => {
          return input.mintHeight < 0;
        });
        this.tx.valueOut = data.outputs.reduce((a, b) => a + b.value, 0);
        this.getConfirmations();
      });
  }

  public getAddress(v: ApiCoin): string {
    if (v.address === 'false') {<commit_msg>fix coins bug in tx-details page<commit_after>import { Component, Input, OnInit } from '@angular/core';
import { Nav, NavParams } from 'ionic-angular';
import _ from 'lodash';
import { ApiProvider, ChainNetwork } from '../../providers/api/api';
import { BlocksProvider } from '../../providers/blocks/blocks';
import { CurrencyProvider } from '../../providers/currency/currency';
import { RedirProvider } from '../../providers/redir/redir';
import {
  ApiCoin,
  TxsProvider
} from '../../providers/transactions/transactions';

/**
 * Generated class for the TransactionDetailsComponent component.
 *
 * See https://angular.io/docs/ts/latest/api/core/index/ComponentMetadata-class.html
 * for more info on Angular Components.
 */
@Component({
  selector: 'transaction-details',
  templateUrl: 'transaction-details.html'
})
export class TransactionDetailsComponent implements OnInit {
  public expanded = false;
  @Input()
  public tx: any = {};
  @Input()
  public showCoins = true;
  @Input()
  public chainNetwork: ChainNetwork;
  public confirmations: number;
  @Input()
  public page: string;

  private COIN = 100000000;
  private DEFAULT_RBF_SEQNUMBER = 0xffffffff;

  constructor(
    public currencyProvider: CurrencyProvider,
    public apiProvider: ApiProvider,
    public txProvider: TxsProvider,
    public redirProvider: RedirProvider,
    public blocksProvider: BlocksProvider,
    public nav: Nav,
    public navParams: NavParams
  ) {}

  public ngOnInit(): void {
    if (this.chainNetwork.chain !== 'ETH') {
      this.getCoins();
      this.getConfirmations();
    }
  }

  public getCoins(): void {
    this.txProvider
      .getCoins(this.tx.txid, this.chainNetwork)
      .subscribe(data => {
        this.tx.vin = data.inputs;
        this.tx.vout = data.outputs;
        this.tx.fee = this.txProvider.getFee(this.tx);
        this.tx.isRBF = _.some(data.inputs, input => {
          return input.sequenceNumber && input.sequenceNumber < this.DEFAULT_RBF_SEQNUMBER - 1;
        });
        this.tx.hasUnconfirmedInputs = _.some(data.inputs, input => {
          return input.mintHeight < 0;
        });
        this.tx.valueOut = data.outputs.reduce((a, b) => a + b.value, 0);
        this.getConfirmations();
      });
  }

  public getAddress(v: ApiCoin): string {
    if (v.address === 'false') {
{'fraction_non_alphanumeric': 0.135, 'fraction_numerical': 0.005652173913043478, 'mean_word_length': 3.2249770431588614, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6745858', 'n_tokens_mistral': 1414, 'n_tokens_neox': 1379, 'n_words': 322}