|
|
@ -11,14 +11,22 @@ const ReadOnlyInput = require('../readonly-input') |
|
|
|
const copyToClipboard = require('copy-to-clipboard') |
|
|
|
const copyToClipboard = require('copy-to-clipboard') |
|
|
|
const { checksumAddress } = require('../../util') |
|
|
|
const { checksumAddress } = require('../../util') |
|
|
|
|
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
|
function mapStateToPropsFactory () { |
|
|
|
|
|
|
|
let selectedIdentity = null |
|
|
|
|
|
|
|
return function mapStateToProps (state) { |
|
|
|
|
|
|
|
// We should **not** change the identity displayed here even if it changes from underneath us.
|
|
|
|
|
|
|
|
// If we do, we will be showing the user one private key and a **different** address and name.
|
|
|
|
|
|
|
|
// Note that the selected identity **will** change from underneath us when we unlock the keyring
|
|
|
|
|
|
|
|
// which is the expected behavior that we are side-stepping.
|
|
|
|
|
|
|
|
selectedIdentity = selectedIdentity || getSelectedIdentity(state) |
|
|
|
return { |
|
|
|
return { |
|
|
|
warning: state.appState.warning, |
|
|
|
warning: state.appState.warning, |
|
|
|
privateKey: state.appState.accountDetail.privateKey, |
|
|
|
privateKey: state.appState.accountDetail.privateKey, |
|
|
|
network: state.metamask.network, |
|
|
|
network: state.metamask.network, |
|
|
|
selectedIdentity: getSelectedIdentity(state), |
|
|
|
selectedIdentity, |
|
|
|
previousModalState: state.appState.modal.previousModalState.name, |
|
|
|
previousModalState: state.appState.modal.previousModalState.name, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function mapDispatchToProps (dispatch) { |
|
|
|
function mapDispatchToProps (dispatch) { |
|
|
@ -43,7 +51,7 @@ ExportPrivateKeyModal.contextTypes = { |
|
|
|
t: PropTypes.func, |
|
|
|
t: PropTypes.func, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module.exports = connect(mapStateToProps, mapDispatchToProps)(ExportPrivateKeyModal) |
|
|
|
module.exports = connect(mapStateToPropsFactory, mapDispatchToProps)(ExportPrivateKeyModal) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ExportPrivateKeyModal.prototype.exportAccountAndGetPrivateKey = function (password, address) { |
|
|
|
ExportPrivateKeyModal.prototype.exportAccountAndGetPrivateKey = function (password, address) { |
|
|
@ -113,6 +121,7 @@ ExportPrivateKeyModal.prototype.render = function () { |
|
|
|
const { privateKey } = this.state |
|
|
|
const { privateKey } = this.state |
|
|
|
|
|
|
|
|
|
|
|
return h(AccountModalContainer, { |
|
|
|
return h(AccountModalContainer, { |
|
|
|
|
|
|
|
selectedIdentity, |
|
|
|
showBackButton: previousModalState === 'ACCOUNT_DETAILS', |
|
|
|
showBackButton: previousModalState === 'ACCOUNT_DETAILS', |
|
|
|
backButtonAction: () => showAccountDetailModal(), |
|
|
|
backButtonAction: () => showAccountDetailModal(), |
|
|
|
}, [ |
|
|
|
}, [ |
|
|
|