// @flow import './DownloadWallet.scss'; import React, { Component } from 'react'; import translate from 'translations'; import type PrivKeyWallet from 'libs/wallet/privkey'; import { makeBlob } from 'utils/blob'; import { getV3Filename } from 'libs/keystore'; import type { UtcKeystore } from 'libs/keystore'; import Template from './Template'; type Props = { wallet: PrivKeyWallet, password: string, continueToPaper: Function }; type State = { hasDownloadedWallet: boolean, address: string, keystore: UtcKeystore | null }; export default class DownloadWallet extends Component { props: Props; state: State = { hasDownloadedWallet: false, address: '', keystore: null }; componentDidMount() { this.props.wallet.getAddress().then(addr => { this.setState({ address: addr }); }); } componentWillMount() { this.props.wallet.toKeystore(this.props.password).then(utcKeystore => { this.setState({ keystore: utcKeystore }); }); } componentWillUpdate(nextProps: Props) { if (this.props.wallet !== nextProps.wallet) { nextProps.wallet.toKeystore(nextProps.password).then(utcKeystore => { this.setState({ keystore: utcKeystore }); }); } } _markDownloaded = () => { if (this.state.keystore) { this.setState({ hasDownloadedWallet: true }); } }; _handleContinue = () => { if (this.state.hasDownloadedWallet) { this.props.continueToPaper(); } }; render() { const { hasDownloadedWallet } = this.state; const filename = this.getFilename(); const content = (

{translate('GEN_Label_2')}

{translate('x_Download')} {translate('x_Keystore2')}

Do not lose it! It cannot be recovered if you lose it.

Do not share it! Your funds will be stolen if you use this file on a malicious/phishing site.

Make a backup! Secure it like the millions of dollars it may one day be worth.

); const help = (

{translate('GEN_Help_8')}

{translate('GEN_Help_11')}

{translate('GEN_Help_4')}

); return