// @flow 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'; 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; return (

{translate('GEN_Label_2')}


{translate('x_Download')}

{translate('x_KeystoreDesc')}





MyEtherWallet.com is not a web wallet & does not store or transmit this secret information at any time.
If you do not save your wallet file and password, we cannot recover them.
Save your wallet file now & back it up in a second location (not on your computer).

I understand. Continue.
); } getBlob() { if (this.state.keystore) { return makeBlob('text/json;charset=UTF-8', this.state.keystore); } } getFilename() { return getV3Filename(this.state.address); } }