mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-02-24 00:38:28 +00:00
commit
59b0d446f2
@ -1,21 +1,22 @@
|
|||||||
export const GENERATE_WALLET_SHOW_PASSWORD = 'GENERATE_WALLET_SHOW_PASSWORD';
|
import {
|
||||||
export const GENERATE_WALLET_FILE = 'GENERATE_WALLET_FILE'
|
GENERATE_WALLET_CONFIRM_CONTINUE_TO_PAPER,
|
||||||
export const GENERATE_WALLET_HAS_DOWNLOADED_FILE = 'GENERATE_WALLET_HAS_DOWNLOADED_FILE'
|
GENERATE_WALLET_FILE,
|
||||||
export const GENERATE_WALLET_CONTINUE_TO_PAPER = 'GENERATE_WALLET_CONTINUE_TO_PAPER'
|
GENERATE_WALLET_DOWNLOAD_FILE,
|
||||||
|
GENERATE_WALLET_SHOW_PASSWORD
|
||||||
|
} from 'actions/generateWalletConstants';
|
||||||
|
|
||||||
|
export const showPasswordGenerateWallet = () => {
|
||||||
|
return { type: GENERATE_WALLET_SHOW_PASSWORD };
|
||||||
|
};
|
||||||
|
|
||||||
export const SHOW_GENERATE_WALLET_PASSWORD_ACTION = () => Object ({
|
export const generateFileGenerateWallet = () => {
|
||||||
type: GENERATE_WALLET_SHOW_PASSWORD
|
return { type: GENERATE_WALLET_FILE };
|
||||||
})
|
};
|
||||||
|
|
||||||
export const GENERATE_WALLET_FILE_ACTION = () => Object ({
|
export const downloadFileGenerateWallet = () => {
|
||||||
type: GENERATE_WALLET_FILE
|
return { type: GENERATE_WALLET_DOWNLOAD_FILE };
|
||||||
})
|
};
|
||||||
|
|
||||||
export const GENERATE_WALLET_HAS_DOWNLOADED_FILE_ACTION = () => Object ({
|
export const confirmContinueToPaperGenerateWallet = () => {
|
||||||
type: GENERATE_WALLET_HAS_DOWNLOADED_FILE
|
return { type: GENERATE_WALLET_CONFIRM_CONTINUE_TO_PAPER };
|
||||||
})
|
};
|
||||||
|
|
||||||
export const GENERATE_WALLET_CONTINUE_TO_PAPER_ACTION = () => Object ({
|
|
||||||
type: GENERATE_WALLET_CONTINUE_TO_PAPER
|
|
||||||
})
|
|
||||||
|
5
common/actions/generateWalletConstants.js
Normal file
5
common/actions/generateWalletConstants.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export const GENERATE_WALLET_SHOW_PASSWORD = 'GENERATE_WALLET_SHOW_PASSWORD';
|
||||||
|
export const GENERATE_WALLET_FILE = 'GENERATE_WALLET_FILE';
|
||||||
|
export const GENERATE_WALLET_DOWNLOAD_FILE = 'GENERATE_WALLET_DOWNLOAD_FILE';
|
||||||
|
export const GENERATE_WALLET_CONFIRM_CONTINUE_TO_PAPER =
|
||||||
|
'GENERATE_WALLET_CONFIRM_CONTINUE_TO_PAPER';
|
@ -6,35 +6,35 @@ import {
|
|||||||
SWAP_UPDATE_BITY_RATES
|
SWAP_UPDATE_BITY_RATES
|
||||||
} from './swapConstants';
|
} from './swapConstants';
|
||||||
|
|
||||||
export const SWAP_ORIGIN_KIND_TO = value => {
|
export const originKindSwap = value => {
|
||||||
return {
|
return {
|
||||||
type: SWAP_ORIGIN_KIND,
|
type: SWAP_ORIGIN_KIND,
|
||||||
value
|
value
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SWAP_DESTINATION_KIND_TO = value => {
|
export const destinationKindSwap = value => {
|
||||||
return {
|
return {
|
||||||
type: SWAP_DESTINATION_KIND,
|
type: SWAP_DESTINATION_KIND,
|
||||||
value
|
value
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SWAP_ORIGIN_AMOUNT_TO = value => {
|
export const originAmountSwap = value => {
|
||||||
return {
|
return {
|
||||||
type: SWAP_ORIGIN_AMOUNT,
|
type: SWAP_ORIGIN_AMOUNT,
|
||||||
value
|
value
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SWAP_DESTINATION_AMOUNT_TO = value => {
|
export const destinationAmountSwap = value => {
|
||||||
return {
|
return {
|
||||||
type: SWAP_DESTINATION_AMOUNT,
|
type: SWAP_DESTINATION_AMOUNT,
|
||||||
value
|
value
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SWAP_UPDATE_BITY_RATES_TO = value => {
|
export const updateBityRatesSwap = value => {
|
||||||
return {
|
return {
|
||||||
type: SWAP_UPDATE_BITY_RATES,
|
type: SWAP_UPDATE_BITY_RATES,
|
||||||
value
|
value
|
||||||
|
@ -5,63 +5,56 @@ import GenerateWalletPasswordInputComponent from './GenerateWalletPasswordInputC
|
|||||||
import LedgerTrezorWarning from './LedgerTrezorWarning';
|
import LedgerTrezorWarning from './LedgerTrezorWarning';
|
||||||
import translate from 'translations';
|
import translate from 'translations';
|
||||||
|
|
||||||
|
|
||||||
// VALIDATORS
|
// VALIDATORS
|
||||||
const minLength = min => value => {
|
const minLength = min => value => {
|
||||||
return value && value.length < min ? `Must be ${min} characters or more` : undefined
|
return value && value.length < min
|
||||||
|
? `Must be ${min} characters or more`
|
||||||
|
: undefined;
|
||||||
};
|
};
|
||||||
const minLength9 = minLength(9);
|
const minLength9 = minLength(9);
|
||||||
const required = value => value ? undefined : 'Required';
|
const required = value => (value ? undefined : 'Required');
|
||||||
|
|
||||||
|
|
||||||
class GenerateWalletPasswordComponent extends Component {
|
class GenerateWalletPasswordComponent extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
// state
|
||||||
title: PropTypes.string,
|
title: PropTypes.string,
|
||||||
body: PropTypes.string,
|
body: PropTypes.string,
|
||||||
userId: PropTypes.number,
|
userId: PropTypes.number,
|
||||||
id: PropTypes.number,
|
id: PropTypes.number,
|
||||||
generateWalletPassword: PropTypes.object,
|
generateWalletPassword: PropTypes.object,
|
||||||
showPassword: PropTypes.bool,
|
showPassword: PropTypes.bool,
|
||||||
showGenerateWalletPasswordAction: PropTypes.func,
|
|
||||||
generateWalletFileAction: PropTypes.func,
|
|
||||||
generateWalletHasDownloadedFileAction: PropTypes.func,
|
|
||||||
generateWalletFile: PropTypes.bool,
|
generateWalletFile: PropTypes.bool,
|
||||||
hasDownloadedWalletFile: PropTypes.bool,
|
hasDownloadedWalletFile: PropTypes.bool,
|
||||||
generateWalletContinueToPaperAction: PropTypes.func,
|
canProceedToPaper: PropTypes.bool,
|
||||||
canProceedToPaper: PropTypes.bool
|
// actions
|
||||||
|
showPasswordGenerateWallet: PropTypes.func,
|
||||||
|
generateFileGenerateWallet: PropTypes.func,
|
||||||
|
downloadFileGenerateWallet: PropTypes.func,
|
||||||
|
confirmContinueToPaperGenerateWallet: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
|
continueToPaper() {}
|
||||||
continueToPaper() {
|
|
||||||
}
|
|
||||||
|
|
||||||
downloaded() {
|
downloaded() {
|
||||||
let nextState = this.state;
|
let nextState = this.state;
|
||||||
nextState.hasDownloadedWalletFile = true;
|
nextState.hasDownloadedWalletFile = true;
|
||||||
this.setState(nextState)
|
this.setState(nextState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
// handleSubmit,
|
|
||||||
// pristine,
|
|
||||||
// reset,
|
|
||||||
// submitting,
|
|
||||||
generateWalletPassword,
|
generateWalletPassword,
|
||||||
showPassword,
|
showPassword,
|
||||||
showGenerateWalletPasswordAction,
|
|
||||||
generateWalletFileAction,
|
|
||||||
generateWalletFile,
|
generateWalletFile,
|
||||||
hasDownloadedWalletFile,
|
hasDownloadedWalletFile,
|
||||||
generateWalletHasDownloadedFileAction,
|
showPasswordGenerateWallet,
|
||||||
generateWalletContinueToPaperAction
|
generateFileGenerateWallet,
|
||||||
// canProceedToPaper
|
downloadFileGenerateWallet,
|
||||||
|
confirmContinueToPaperGenerateWallet
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -69,8 +62,7 @@ class GenerateWalletPasswordComponent extends Component {
|
|||||||
<div className="tab-content">
|
<div className="tab-content">
|
||||||
<main className="tab-pane active text-center" role="main">
|
<main className="tab-pane active text-center" role="main">
|
||||||
<br />
|
<br />
|
||||||
{
|
{!generateWalletFile &&
|
||||||
!generateWalletFile && (
|
|
||||||
<div>
|
<div>
|
||||||
<section className="row">
|
<section className="row">
|
||||||
<h1 aria-live="polite">{translate('NAV_GenerateWallet')}</h1>
|
<h1 aria-live="polite">{translate('NAV_GenerateWallet')}</h1>
|
||||||
@ -80,59 +72,85 @@ class GenerateWalletPasswordComponent extends Component {
|
|||||||
validate={[required, minLength9]}
|
validate={[required, minLength9]}
|
||||||
component={GenerateWalletPasswordInputComponent}
|
component={GenerateWalletPasswordInputComponent}
|
||||||
showPassword={showPassword}
|
showPassword={showPassword}
|
||||||
showGenerateWalletPasswordAction={showGenerateWalletPasswordAction}
|
showPasswordGenerateWallet={showPasswordGenerateWallet}
|
||||||
name="password"
|
name="password"
|
||||||
type="text"/>
|
type="text"
|
||||||
|
/>
|
||||||
<br />
|
<br />
|
||||||
<button onClick={() => generateWalletFileAction()}
|
<button
|
||||||
disabled={generateWalletPassword ? generateWalletPassword.syncErrors : true}
|
onClick={() => generateFileGenerateWallet()}
|
||||||
className="btn btn-primary btn-block">
|
disabled={
|
||||||
|
generateWalletPassword
|
||||||
|
? generateWalletPassword.syncErrors
|
||||||
|
: true
|
||||||
|
}
|
||||||
|
className="btn btn-primary btn-block"
|
||||||
|
>
|
||||||
{translate('NAV_GenerateWallet')}
|
{translate('NAV_GenerateWallet')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<LedgerTrezorWarning />
|
<LedgerTrezorWarning />
|
||||||
</div>
|
</div>}
|
||||||
)
|
{generateWalletFile &&
|
||||||
}
|
|
||||||
{
|
|
||||||
generateWalletFile && (
|
|
||||||
<section role="main" className="row">
|
<section role="main" className="row">
|
||||||
<h1>{translate('GEN_Label_2')}</h1>
|
<h1>{translate('GEN_Label_2')}</h1>
|
||||||
<br />
|
<br />
|
||||||
<div className="col-sm-8 col-sm-offset-2">
|
<div className="col-sm-8 col-sm-offset-2">
|
||||||
<div aria-hidden="true" className="account-help-icon"><img
|
<div aria-hidden="true" className="account-help-icon">
|
||||||
src="https://myetherwallet.com/images/icon-help.svg" className="help-icon"/>
|
<img
|
||||||
<p className="account-help-text">{translate('x_KeystoreDesc')}</p>
|
src="https://myetherwallet.com/images/icon-help.svg"
|
||||||
|
className="help-icon"
|
||||||
|
/>
|
||||||
|
<p className="account-help-text">
|
||||||
|
{translate('x_KeystoreDesc')}
|
||||||
|
</p>
|
||||||
<h4>{translate('x_Keystore2')}</h4>
|
<h4>{translate('x_Keystore2')}</h4>
|
||||||
</div>
|
</div>
|
||||||
<a role="button" className="btn btn-primary btn-block"
|
<a
|
||||||
|
role="button"
|
||||||
|
className="btn btn-primary btn-block"
|
||||||
href="blob:https://myetherwallet.com/2455ae32-916f-4224-a806-414bbe680168"
|
href="blob:https://myetherwallet.com/2455ae32-916f-4224-a806-414bbe680168"
|
||||||
download="UTC--2017-04-26T23-07-03.538Z--c5b7fff4e1669e38e8d6bc8fffe7e562b2b70f43"
|
download="UTC--2017-04-26T23-07-03.538Z--c5b7fff4e1669e38e8d6bc8fffe7e562b2b70f43"
|
||||||
aria-label="Download Keystore File (UTC / JSON · Recommended · Encrypted)"
|
aria-label="Download Keystore File (UTC / JSON · Recommended · Encrypted)"
|
||||||
aria-describedby="x_KeystoreDesc"
|
aria-describedby="x_KeystoreDesc"
|
||||||
onClick={() => generateWalletHasDownloadedFileAction()}>{translate('x_Download')}</a>
|
onClick={() => downloadFileGenerateWallet()}
|
||||||
<p className="sr-only" id="x_KeystoreDesc">{translate('x_KeystoreDesc')}</p>
|
>
|
||||||
|
{translate('x_Download')}
|
||||||
|
</a>
|
||||||
|
<p className="sr-only" id="x_KeystoreDesc">
|
||||||
|
{translate('x_KeystoreDesc')}
|
||||||
|
</p>
|
||||||
<br /><br /><br /><br />
|
<br /><br /><br /><br />
|
||||||
</div>
|
</div>
|
||||||
<div className="col-xs-12 alert alert-danger">
|
<div className="col-xs-12 alert alert-danger">
|
||||||
<span>
|
<span>
|
||||||
MyEtherWallet.com is not a web wallet & does not store or transmit this secret information at any time. <br/>
|
MyEtherWallet.com is not a web wallet & does not store
|
||||||
<strong>If you do not save your wallet file and password, we cannot recover them.</strong><br/>
|
or transmit this secret information at any time. <br />
|
||||||
Save your wallet file now & back it up in a second location (not on your computer).
|
<strong>
|
||||||
|
If you do not save your wallet file and password, we
|
||||||
|
cannot recover them.
|
||||||
|
</strong>
|
||||||
|
<br />
|
||||||
|
Save your wallet file now & back it up in a second
|
||||||
|
location (not on your computer).
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<a role="button"
|
<a
|
||||||
className={`btn btn-info ${hasDownloadedWalletFile ? '' : 'disabled'}`}
|
role="button"
|
||||||
onClick={() => generateWalletContinueToPaperAction()}> I understand. Continue. </a>
|
className={`btn btn-info ${hasDownloadedWalletFile
|
||||||
|
? ''
|
||||||
|
: 'disabled'}`}
|
||||||
|
onClick={() => confirmContinueToPaperGenerateWallet()}
|
||||||
|
>
|
||||||
|
{' '}I understand. Continue.{' '}
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>}
|
||||||
)
|
|
||||||
}
|
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,40 +1,44 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
|
||||||
export default class GenerateWalletPasswordInputComponent extends Component {
|
export default class GenerateWalletPasswordInputComponent extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
showGenerateWalletPasswordAction: PropTypes.func,
|
showPasswordGenerateWallet: PropTypes.func,
|
||||||
showPassword: PropTypes.bool,
|
showPassword: PropTypes.bool,
|
||||||
input: PropTypes.object,
|
input: PropTypes.object,
|
||||||
meta: PropTypes.object
|
meta: PropTypes.object
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<div className="input-group" style={{ width: '100%' }}>
|
<div className="input-group" style={{ width: '100%' }}>
|
||||||
<input {...this.props.input}
|
<input
|
||||||
|
{...this.props.input}
|
||||||
name="password"
|
name="password"
|
||||||
className={this.props.meta.error ? 'form-control is-invalid' : 'form-control'}
|
className={
|
||||||
|
this.props.meta.error
|
||||||
|
? 'form-control is-invalid'
|
||||||
|
: 'form-control'
|
||||||
|
}
|
||||||
type={this.props.showPassword ? 'text' : 'password'}
|
type={this.props.showPassword ? 'text' : 'password'}
|
||||||
placeholder="Do NOT forget to save this!"
|
placeholder="Do NOT forget to save this!"
|
||||||
aria-label="Enter a strong password (at least 9 characters)"/>
|
aria-label="Enter a strong password (at least 9 characters)"
|
||||||
|
/>
|
||||||
<span
|
<span
|
||||||
onClick={() => this.props.showGenerateWalletPasswordAction()}
|
onClick={() => this.props.showPasswordGenerateWallet()}
|
||||||
aria-label="make password visible"
|
aria-label="make password visible"
|
||||||
role="button"
|
role="button"
|
||||||
className="input-group-addon eye"/>
|
className="input-group-addon eye"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
const LedgerTrezorWarning = () => (
|
const LedgerTrezorWarning = () =>
|
||||||
<section className="row">
|
<section className="row">
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
@ -8,14 +8,16 @@ const LedgerTrezorWarning = () => (
|
|||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<p className="strong">Ledger & TREZOR users: Do not generate a new
|
<p className="strong">
|
||||||
|
Ledger & TREZOR users: Do not generate a new
|
||||||
wallet—your
|
wallet—your
|
||||||
hardware device <em> is </em> your wallet.<br />
|
hardware device <em> is </em> your wallet.<br />
|
||||||
<a>You
|
<a>
|
||||||
|
You
|
||||||
can connect to your device, see your addresses, or send ETH or Tokens
|
can connect to your device, see your addresses, or send ETH or Tokens
|
||||||
here.</a>
|
here.
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>;
|
||||||
);
|
|
||||||
|
|
||||||
export default LedgerTrezorWarning;
|
export default LedgerTrezorWarning;
|
||||||
|
@ -1,35 +1,30 @@
|
|||||||
import GenerateWalletPasswordComponent from './components/GenerateWalletPasswordComponent';
|
import GenerateWalletPasswordComponent from './components/GenerateWalletPasswordComponent';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import * as generateWalletActions from 'actions/generateWallet';
|
||||||
GENERATE_WALLET_FILE_ACTION,
|
|
||||||
GENERATE_WALLET_HAS_DOWNLOADED_FILE_ACTION,
|
|
||||||
SHOW_GENERATE_WALLET_PASSWORD_ACTION,
|
|
||||||
GENERATE_WALLET_CONTINUE_TO_PAPER_ACTION
|
|
||||||
} from 'actions/generateWallet';
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
class GenerateWallet extends Component {
|
class GenerateWallet extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
// state
|
||||||
generateWalletPassword: PropTypes.object,
|
generateWalletPassword: PropTypes.object,
|
||||||
showPassword: PropTypes.bool,
|
showPassword: PropTypes.bool,
|
||||||
hasDownloadedWalletFile: PropTypes.bool,
|
hasDownloadedWalletFile: PropTypes.bool,
|
||||||
showGenerateWalletPasswordAction: PropTypes.func,
|
|
||||||
generateWalletFileAction: PropTypes.func,
|
|
||||||
generateWalletHasDownloadedFileAction: PropTypes.func,
|
|
||||||
generateWalletFile: PropTypes.bool,
|
generateWalletFile: PropTypes.bool,
|
||||||
generateWalletContinueToPaperAction: PropTypes.func,
|
canProceedToPaper: PropTypes.bool,
|
||||||
canProceedToPaper: PropTypes.bool
|
// actions
|
||||||
}
|
showPasswordGenerateWallet: PropTypes.func,
|
||||||
|
generateFileGenerateWallet: PropTypes.func,
|
||||||
|
downloadFileGenerateWallet: PropTypes.func,
|
||||||
|
confirmContinueToPaperGenerateWallet: PropTypes.func
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return <GenerateWalletPasswordComponent {...this.props} />;
|
||||||
<GenerateWalletPasswordComponent {...this.props}/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,24 +35,7 @@ function mapStateToProps(state) {
|
|||||||
showPassword: state.generateWallet.showPassword,
|
showPassword: state.generateWallet.showPassword,
|
||||||
hasDownloadedWalletFile: state.generateWallet.hasDownloadedWalletFile,
|
hasDownloadedWalletFile: state.generateWallet.hasDownloadedWalletFile,
|
||||||
canProceedToPaper: state.generateWallet.canProceedToPaper
|
canProceedToPaper: state.generateWallet.canProceedToPaper
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
export default connect(mapStateToProps, generateWalletActions)(GenerateWallet);
|
||||||
return {
|
|
||||||
showGenerateWalletPasswordAction: () => {
|
|
||||||
dispatch(SHOW_GENERATE_WALLET_PASSWORD_ACTION())
|
|
||||||
},
|
|
||||||
generateWalletFileAction: () => {
|
|
||||||
dispatch(GENERATE_WALLET_FILE_ACTION())
|
|
||||||
},
|
|
||||||
generateWalletHasDownloadedFileAction: () => {
|
|
||||||
dispatch(GENERATE_WALLET_HAS_DOWNLOADED_FILE_ACTION())
|
|
||||||
},
|
|
||||||
generateWalletContinueToPaperAction: () => {
|
|
||||||
dispatch(GENERATE_WALLET_CONTINUE_TO_PAPER_ACTION())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(GenerateWallet)
|
|
||||||
|
@ -44,10 +44,10 @@ export default class WantToSwapMy extends Component {
|
|||||||
destinationKind: PropTypes.string,
|
destinationKind: PropTypes.string,
|
||||||
destinationKindOptions: PropTypes.array,
|
destinationKindOptions: PropTypes.array,
|
||||||
originKindOptions: PropTypes.array,
|
originKindOptions: PropTypes.array,
|
||||||
SWAP_ORIGIN_KIND_TO: PropTypes.func,
|
originKindSwap: PropTypes.func,
|
||||||
SWAP_DESTINATION_KIND_TO: PropTypes.func,
|
destinationKindSwap: PropTypes.func,
|
||||||
SWAP_ORIGIN_AMOUNT_TO: PropTypes.func,
|
originAmountSwap: PropTypes.func,
|
||||||
SWAP_DESTINATION_AMOUNT_TO: PropTypes.func
|
destinationAmountSwap: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
onClickStartSwap() {}
|
onClickStartSwap() {}
|
||||||
@ -60,38 +60,38 @@ export default class WantToSwapMy extends Component {
|
|||||||
this.props.destinationKind
|
this.props.destinationKind
|
||||||
);
|
);
|
||||||
let bityRate = this.props.bityRates[pairName];
|
let bityRate = this.props.bityRates[pairName];
|
||||||
this.props.SWAP_ORIGIN_AMOUNT_TO(originAmountAsNumber);
|
this.props.originAmountSwap(originAmountAsNumber);
|
||||||
this.props.SWAP_DESTINATION_AMOUNT_TO(originAmountAsNumber * bityRate);
|
this.props.destinationAmountSwap(originAmountAsNumber * bityRate);
|
||||||
} else {
|
} else {
|
||||||
this.props.SWAP_ORIGIN_AMOUNT_TO('');
|
this.props.originAmountSwap('');
|
||||||
this.props.SWAP_DESTINATION_AMOUNT_TO('');
|
this.props.destinationAmountSwap('');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onChangeDestinationAmount(amount) {
|
onChangeDestinationAmount(amount) {
|
||||||
let destinationAmountAsNumber = parseFloat(amount);
|
let destinationAmountAsNumber = parseFloat(amount);
|
||||||
if (destinationAmountAsNumber) {
|
if (destinationAmountAsNumber) {
|
||||||
this.props.SWAP_DESTINATION_AMOUNT_TO(destinationAmountAsNumber);
|
this.props.destinationAmountSwap(destinationAmountAsNumber);
|
||||||
let pairName = combineAndUpper(
|
let pairName = combineAndUpper(
|
||||||
this.props.destinationKind,
|
this.props.destinationKind,
|
||||||
this.props.originKind
|
this.props.originKind
|
||||||
);
|
);
|
||||||
let bityRate = this.props.bityRates[pairName];
|
let bityRate = this.props.bityRates[pairName];
|
||||||
this.props.SWAP_ORIGIN_AMOUNT_TO(destinationAmountAsNumber * bityRate);
|
this.props.originAmountSwap(destinationAmountAsNumber * bityRate);
|
||||||
} else {
|
} else {
|
||||||
this.props.SWAP_ORIGIN_AMOUNT_TO('');
|
this.props.originAmountSwap('');
|
||||||
this.props.SWAP_DESTINATION_AMOUNT_TO('');
|
this.props.destinationAmountSwap('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async onChangeDestinationKind(event) {
|
async onChangeDestinationKind(event) {
|
||||||
let newDestinationKind = event.target.value;
|
let newDestinationKind = event.target.value;
|
||||||
this.props.SWAP_DESTINATION_KIND_TO(newDestinationKind);
|
this.props.destinationKindSwap(newDestinationKind);
|
||||||
}
|
}
|
||||||
|
|
||||||
async onChangeOriginKind(event) {
|
async onChangeOriginKind(event) {
|
||||||
let newOriginKind = event.target.value;
|
let newOriginKind = event.target.value;
|
||||||
this.props.SWAP_ORIGIN_KIND_TO(newOriginKind);
|
this.props.originKindSwap(newOriginKind);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -21,11 +21,11 @@ class Swap extends Component {
|
|||||||
destinationKind: PropTypes.string,
|
destinationKind: PropTypes.string,
|
||||||
destinationKindOptions: PropTypes.array,
|
destinationKindOptions: PropTypes.array,
|
||||||
originKindOptions: PropTypes.array,
|
originKindOptions: PropTypes.array,
|
||||||
SWAP_ORIGIN_KIND_TO: PropTypes.func,
|
originKindSwap: PropTypes.func,
|
||||||
SWAP_DESTINATION_KIND_TO: PropTypes.func,
|
destinationKindSwap: PropTypes.func,
|
||||||
SWAP_ORIGIN_AMOUNT_TO: PropTypes.func,
|
originAmountSwap: PropTypes.func,
|
||||||
SWAP_DESTINATION_AMOUNT_TO: PropTypes.func,
|
destinationAmountSwap: PropTypes.func,
|
||||||
SWAP_UPDATE_BITY_RATES_TO: PropTypes.func
|
updateBityRatesSwap: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@ -38,7 +38,7 @@ class Swap extends Component {
|
|||||||
!bityRates.BTCREP
|
!bityRates.BTCREP
|
||||||
) {
|
) {
|
||||||
this.bity.getAllRates().then(data => {
|
this.bity.getAllRates().then(data => {
|
||||||
this.props.SWAP_UPDATE_BITY_RATES_TO(data);
|
this.props.updateBityRatesSwap(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,10 +52,10 @@ class Swap extends Component {
|
|||||||
destinationKind,
|
destinationKind,
|
||||||
destinationKindOptions,
|
destinationKindOptions,
|
||||||
originKindOptions,
|
originKindOptions,
|
||||||
SWAP_ORIGIN_KIND_TO,
|
originKindSwap,
|
||||||
SWAP_DESTINATION_KIND_TO,
|
destinationKindSwap,
|
||||||
SWAP_ORIGIN_AMOUNT_TO,
|
originAmountSwap,
|
||||||
SWAP_DESTINATION_AMOUNT_TO
|
destinationAmountSwap
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
let wantToSwapMyProps = {
|
let wantToSwapMyProps = {
|
||||||
@ -66,10 +66,10 @@ class Swap extends Component {
|
|||||||
destinationKind,
|
destinationKind,
|
||||||
destinationKindOptions,
|
destinationKindOptions,
|
||||||
originKindOptions,
|
originKindOptions,
|
||||||
SWAP_ORIGIN_KIND_TO,
|
originKindSwap,
|
||||||
SWAP_DESTINATION_KIND_TO,
|
destinationKindSwap,
|
||||||
SWAP_ORIGIN_AMOUNT_TO,
|
originAmountSwap,
|
||||||
SWAP_DESTINATION_AMOUNT_TO
|
destinationAmountSwap
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
import {
|
import {
|
||||||
GENERATE_WALLET_SHOW_PASSWORD,
|
GENERATE_WALLET_SHOW_PASSWORD,
|
||||||
GENERATE_WALLET_FILE,
|
GENERATE_WALLET_FILE,
|
||||||
GENERATE_WALLET_HAS_DOWNLOADED_FILE,
|
GENERATE_WALLET_DOWNLOAD_FILE,
|
||||||
GENERATE_WALLET_CONTINUE_TO_PAPER
|
GENERATE_WALLET_CONFIRM_CONTINUE_TO_PAPER
|
||||||
|
} from 'actions/generateWalletConstants';
|
||||||
} from 'actions/generateWallet';
|
|
||||||
|
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
showPassword: false,
|
showPassword: false,
|
||||||
generateWalletFile: false,
|
generateWalletFile: false,
|
||||||
hasDownloadedWalletFile: false,
|
hasDownloadedWalletFile: false,
|
||||||
canProceedToPaper: false
|
canProceedToPaper: false
|
||||||
}
|
};
|
||||||
|
|
||||||
export function generateWallet(state = initialState, action) {
|
export function generateWallet(state = initialState, action) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
@ -20,31 +18,31 @@ export function generateWallet(state = initialState, action) {
|
|||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
showPassword: !state.showPassword
|
showPassword: !state.showPassword
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
case GENERATE_WALLET_FILE: {
|
case GENERATE_WALLET_FILE: {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
generateWalletFile: true
|
generateWalletFile: true
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
case GENERATE_WALLET_HAS_DOWNLOADED_FILE: {
|
case GENERATE_WALLET_DOWNLOAD_FILE: {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
hasDownloadedWalletFile: true
|
hasDownloadedWalletFile: true
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
case GENERATE_WALLET_CONTINUE_TO_PAPER: {
|
case GENERATE_WALLET_CONFIRM_CONTINUE_TO_PAPER: {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
canProceedToPaper: true
|
canProceedToPaper: true
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user