<commit_before>import { Component, ViewChild } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { App, ModalController, NavController, NavParams } from 'ionic-angular';
import * as _ from 'lodash';

// pages
import { FinishModalPage } from '../finish/finish';
import { TabsPage } from '../tabs/tabs';

// providers
import { ActionSheetProvider } from '../../providers/action-sheet/action-sheet';
import { BwcErrorProvider } from '../../providers/bwc-error/bwc-error';
import { BwcProvider } from '../../providers/bwc/bwc';
import { Coin, CoinsMap } from '../../providers/currency/currency';
import { FeeProvider } from '../../providers/fee/fee';
import { Logger } from '../../providers/logger/logger';
import { OnGoingProcessProvider } from '../../providers/on-going-process/on-going-process';
import { PlatformProvider } from '../../providers/platform/platform';
import { PopupProvider } from '../../providers/popup/popup';
import { ProfileProvider } from '../../providers/profile/profile';
import { WalletOptions, WalletProvider } from '../../providers/wallet/wallet';

@Component({
  selector: 'page-paper-wallet',
  templateUrl: 'paper-wallet.html'
})
export class PaperWalletPage {
  @ViewChild('slideButton')
  slideButton;

  public selectedWallet;
  public wallet = {} as CoinsMap<any>;
  public walletName: string;
  public M: number;
  public N: number;
  public totalBalanceStr: string;
  public network: string;
  public wallets;
  // All coins for which we have a usable wallet to sweep to
  public coins: Coin[];
  public scannedKey: string;
  public isPkEncrypted: boolean;
  public passphrase: string;
  public balances = [];
  public balanceHidden: boolean;
  public error: boolean;
  public isOpenSelector: boolean;
  private bitcore;

  // Platform info
  public isCordova: boolean;

  constructor(
    private app: App,
    private actionSheetProvider: ActionSheetProvider,
    private navCtrl: NavController,
    private navParams: NavParams,
    private bwcProvider: BwcProvider,
    private onGoingProcessProvider: OnGoingProcessProvider,
    private popupProvider: PopupProvider,
    private logger: Logger,
    private walletProvider: WalletProvider,
    private feeProvider: FeeProvider,
    private profileProvider: ProfileProvider,
    private modalCtrl: ModalController,
    private translate: TranslateService,
    private platformProvider: PlatformProvider,
    private bwcErrorProvider: BwcErrorProvider
  ) {
    this.bitcore = this.bwcProvider.getBitcore();
    this.isCordova = this.platformProvider.isCordova;
    this.isOpenSelector = false;
    this.scannedKey = this.navParams.data.privateKey;
    this.isPkEncrypted = this.scannedKey
      ? this.scannedKey.substring(0, 2) == '6P'
      : null;
    this.error = false;
    this.wallets = this.profileProvider.getWallets({
      onlyComplete: true,
      network: 'livenet'
    });

    this.wallets = _.filter(_.clone(this.wallets), wallet => {
      return !wallet.needsBackup && wallet.coin !== 'eth';
    });

    this.coins = _.uniq(
      _.map(this.wallets, (wallet: Partial<WalletOptions>) => wallet.coin)
    );

    for (const coin of this.coins) {<commit_msg>Fix: sweep paper wallets<commit_after>import { Component, ViewChild } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { App, ModalController, NavController, NavParams } from 'ionic-angular';
import * as _ from 'lodash';

// pages
import { FinishModalPage } from '../finish/finish';
import { TabsPage } from '../tabs/tabs';

// providers
import { ActionSheetProvider } from '../../providers/action-sheet/action-sheet';
import { BwcErrorProvider } from '../../providers/bwc-error/bwc-error';
import { BwcProvider } from '../../providers/bwc/bwc';
import {
  Coin,
  CoinsMap,
  CurrencyProvider
} from '../../providers/currency/currency';
import { FeeProvider } from '../../providers/fee/fee';
import { Logger } from '../../providers/logger/logger';
import { OnGoingProcessProvider } from '../../providers/on-going-process/on-going-process';
import { PlatformProvider } from '../../providers/platform/platform';
import { PopupProvider } from '../../providers/popup/popup';
import { ProfileProvider } from '../../providers/profile/profile';
import { WalletOptions, WalletProvider } from '../../providers/wallet/wallet';

@Component({
  selector: 'page-paper-wallet',
  templateUrl: 'paper-wallet.html'
})
export class PaperWalletPage {
  @ViewChild('slideButton')
  slideButton;

  public selectedWallet;
  public wallet = {} as CoinsMap<any>;
  public walletName: string;
  public M: number;
  public N: number;
  public totalBalanceStr: string;
  public network: string;
  public wallets;
  // All coins for which we have a usable wallet to sweep to
  public coins: Coin[];
  public scannedKey: string;
  public isPkEncrypted: boolean;
  public passphrase: string;
  public balances = [];
  public balanceHidden: boolean;
  public error: boolean;
  public isOpenSelector: boolean;
  private bitcore;

  // Platform info
  public isCordova: boolean;

  constructor(
    private app: App,
    private actionSheetProvider: ActionSheetProvider,
    private navCtrl: NavController,
    private navParams: NavParams,
    private bwcProvider: BwcProvider,
    private onGoingProcessProvider: OnGoingProcessProvider,
    private popupProvider: PopupProvider,
    private logger: Logger,
    private walletProvider: WalletProvider,
    private feeProvider: FeeProvider,
    private profileProvider: ProfileProvider,
    private modalCtrl: ModalController,
    private translate: TranslateService,
    private platformProvider: PlatformProvider,
    private bwcErrorProvider: BwcErrorProvider,
    private currencyProvider: CurrencyProvider
  ) {
    this.bitcore = this.bwcProvider.getBitcore();
    this.isCordova = this.platformProvider.isCordova;
    this.isOpenSelector = false;
    this.scannedKey = this.navParams.data.privateKey;
    this.isPkEncrypted = this.scannedKey
      ? this.scannedKey.substring(0, 2) == '6P'
      : null;
    this.error = false;
    this.wallets = this.profileProvider.getWallets({
      onlyComplete: true,
      network: 'livenet'
    });

    this.wallets = _.filter(_.clone(this.wallets), wallet => {
      return (
        !wallet.needsBackup && this.currencyProvider.isUtxoCoin(wallet.coin)
      );
    });

    this.coins = _.uniq(
      _.map(this.wallets, (wallet: Partial<WalletOptions>) => wallet.coin)
    );

    for (const coin of this.coins) {
{'fraction_non_alphanumeric': 0.12628510050636796, 'fraction_numerical': 0.0009206690194874942, 'mean_word_length': 3.7926470588235293, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '1443508', 'n_tokens_mistral': 1896, 'n_tokens_neox': 1901, 'n_words': 480}