2017-07-16 21:02:13 +00:00
|
|
|
// @flow
|
v3 Style Import (#151)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
2017-09-05 19:52:01 +00:00
|
|
|
import './DownloadWallet.scss';
|
2017-07-16 21:02:13 +00:00
|
|
|
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';
|
2017-08-24 08:34:08 +00:00
|
|
|
import type { UtcKeystore } from 'libs/keystore';
|
v3 Style Import (#151)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
2017-09-05 19:52:01 +00:00
|
|
|
import Template from './Template';
|
2017-07-16 21:02:13 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
wallet: PrivKeyWallet,
|
|
|
|
password: string,
|
2017-07-27 17:05:09 +00:00
|
|
|
continueToPaper: Function
|
2017-07-16 21:02:13 +00:00
|
|
|
};
|
|
|
|
|
2017-08-24 08:34:08 +00:00
|
|
|
type State = {
|
|
|
|
hasDownloadedWallet: boolean,
|
|
|
|
address: string,
|
|
|
|
keystore: UtcKeystore | null
|
|
|
|
};
|
|
|
|
|
2017-07-16 21:02:13 +00:00
|
|
|
export default class DownloadWallet extends Component {
|
|
|
|
props: Props;
|
2017-08-24 08:34:08 +00:00
|
|
|
state: State = {
|
2017-08-09 12:01:34 +00:00
|
|
|
hasDownloadedWallet: false,
|
2017-08-24 08:34:08 +00:00
|
|
|
address: '',
|
|
|
|
keystore: null
|
2017-07-16 21:02:13 +00:00
|
|
|
};
|
2017-07-27 17:05:09 +00:00
|
|
|
|
2017-08-09 12:01:34 +00:00
|
|
|
componentDidMount() {
|
|
|
|
this.props.wallet.getAddress().then(addr => {
|
|
|
|
this.setState({ address: addr });
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-07-16 21:02:13 +00:00
|
|
|
componentWillMount() {
|
2017-08-24 08:34:08 +00:00
|
|
|
this.props.wallet.toKeystore(this.props.password).then(utcKeystore => {
|
|
|
|
this.setState({ keystore: utcKeystore });
|
|
|
|
});
|
2017-07-16 21:02:13 +00:00
|
|
|
}
|
|
|
|
componentWillUpdate(nextProps: Props) {
|
|
|
|
if (this.props.wallet !== nextProps.wallet) {
|
2017-08-24 08:34:08 +00:00
|
|
|
nextProps.wallet.toKeystore(nextProps.password).then(utcKeystore => {
|
|
|
|
this.setState({ keystore: utcKeystore });
|
|
|
|
});
|
2017-07-16 21:02:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-27 17:05:09 +00:00
|
|
|
_markDownloaded = () => {
|
2017-08-24 08:34:08 +00:00
|
|
|
if (this.state.keystore) {
|
|
|
|
this.setState({ hasDownloadedWallet: true });
|
|
|
|
}
|
2017-07-27 17:05:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_handleContinue = () => {
|
|
|
|
if (this.state.hasDownloadedWallet) {
|
|
|
|
this.props.continueToPaper();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-07-16 21:02:13 +00:00
|
|
|
render() {
|
2017-07-27 17:05:09 +00:00
|
|
|
const { hasDownloadedWallet } = this.state;
|
v3 Style Import (#151)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
2017-09-05 19:52:01 +00:00
|
|
|
const filename = this.getFilename();
|
2017-07-16 21:02:13 +00:00
|
|
|
|
v3 Style Import (#151)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
2017-09-05 19:52:01 +00:00
|
|
|
const content = (
|
|
|
|
<div className="DlWallet">
|
|
|
|
<h1 className="DlWallet-title">
|
2017-07-16 21:02:13 +00:00
|
|
|
{translate('GEN_Label_2')}
|
|
|
|
</h1>
|
v3 Style Import (#151)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
2017-09-05 19:52:01 +00:00
|
|
|
|
|
|
|
<a
|
|
|
|
role="button"
|
|
|
|
className="DlWallet-download btn btn-primary btn-lg"
|
|
|
|
aria-label="Download Keystore File (UTC / JSON · Recommended · Encrypted)"
|
|
|
|
aria-describedby="x_KeystoreDesc"
|
|
|
|
disabled={!this.state.keystore}
|
|
|
|
download={filename}
|
|
|
|
href={this.getBlob()}
|
|
|
|
onClick={this._markDownloaded}
|
|
|
|
>
|
|
|
|
{translate('x_Download')} {translate('x_Keystore2')}
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<div className="DlWallet-warning">
|
|
|
|
<p>
|
|
|
|
<strong>Do not lose it!</strong> It cannot be recovered if you lose
|
|
|
|
it.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<strong>Do not share it!</strong> Your funds will be stolen if you
|
|
|
|
use this file on a malicious/phishing site.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<strong>Make a backup!</strong> Secure it like the millions of
|
|
|
|
dollars it may one day be worth.
|
2017-07-16 21:02:13 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
v3 Style Import (#151)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
2017-09-05 19:52:01 +00:00
|
|
|
|
|
|
|
<button
|
|
|
|
className="DlWallet-continue btn btn-danger"
|
|
|
|
role="button"
|
|
|
|
onClick={this._handleContinue}
|
|
|
|
disabled={!hasDownloadedWallet}
|
|
|
|
>
|
|
|
|
I understand. Continue.
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
const help = (
|
|
|
|
<div>
|
|
|
|
<h4>
|
|
|
|
{translate('GEN_Help_8')}
|
|
|
|
</h4>
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
{translate('GEN_Help_9')}
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
{' '}{translate('GEN_Help_10')}
|
|
|
|
</li>
|
|
|
|
<input value={filename} className="form-control input-sm" disabled />
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<h4>
|
|
|
|
{translate('GEN_Help_11')}
|
|
|
|
</h4>
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
{translate('GEN_Help_12')}
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<h4>
|
|
|
|
{translate('GEN_Help_4')}
|
|
|
|
</h4>
|
|
|
|
<ul>
|
|
|
|
<li>
|
2017-07-16 21:02:13 +00:00
|
|
|
<a
|
v3 Style Import (#151)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
2017-09-05 19:52:01 +00:00
|
|
|
href="https://myetherwallet.groovehq.com/knowledge_base/topics/how-do-i-save-slash-backup-my-wallet"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener"
|
2017-07-16 21:02:13 +00:00
|
|
|
>
|
v3 Style Import (#151)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
2017-09-05 19:52:01 +00:00
|
|
|
<strong>
|
|
|
|
{translate('GEN_Help_13')}
|
|
|
|
</strong>
|
2017-07-16 21:02:13 +00:00
|
|
|
</a>
|
v3 Style Import (#151)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
2017-09-05 19:52:01 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<a
|
|
|
|
href="https://myetherwallet.groovehq.com/knowledge_base/topics/what-are-the-different-formats-of-a-private-key"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener"
|
|
|
|
>
|
|
|
|
<strong>
|
|
|
|
{translate('GEN_Help_14')}
|
|
|
|
</strong>
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2017-07-16 21:02:13 +00:00
|
|
|
</div>
|
|
|
|
);
|
v3 Style Import (#151)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
2017-09-05 19:52:01 +00:00
|
|
|
|
|
|
|
return <Template content={content} help={help} />;
|
2017-07-16 21:02:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
getBlob() {
|
2017-08-24 08:34:08 +00:00
|
|
|
if (this.state.keystore) {
|
|
|
|
return makeBlob('text/json;charset=UTF-8', this.state.keystore);
|
|
|
|
}
|
2017-07-16 21:02:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
getFilename() {
|
2017-08-09 12:01:34 +00:00
|
|
|
return getV3Filename(this.state.address);
|
2017-07-16 21:02:13 +00:00
|
|
|
}
|
|
|
|
}
|