2016-04-14 00:28:44 +02:00
|
|
|
const inherits = require('util').inherits
|
|
|
|
const Component = require('react').Component
|
2018-03-16 01:29:45 +01:00
|
|
|
const connect = require('../../metamask-connect')
|
2016-04-14 00:28:44 +02:00
|
|
|
const h = require('react-hyperscript')
|
2016-10-31 19:35:09 +01:00
|
|
|
const actions = require('../../actions')
|
2017-09-12 01:48:02 +02:00
|
|
|
const exportAsFile = require('../../util').exportAsFile
|
2016-04-14 00:28:44 +02:00
|
|
|
|
|
|
|
module.exports = connect(mapStateToProps)(CreateVaultCompleteScreen)
|
|
|
|
|
|
|
|
inherits(CreateVaultCompleteScreen, Component)
|
2016-06-21 22:18:32 +02:00
|
|
|
function CreateVaultCompleteScreen () {
|
2016-04-14 00:28:44 +02:00
|
|
|
Component.call(this)
|
|
|
|
}
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function mapStateToProps (state) {
|
2016-04-14 00:28:44 +02:00
|
|
|
return {
|
2016-06-03 02:11:12 +02:00
|
|
|
seed: state.appState.currentView.seedWords,
|
2016-04-14 00:28:44 +02:00
|
|
|
cachedSeed: state.metamask.seedWords,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
CreateVaultCompleteScreen.prototype.render = function () {
|
2016-04-14 00:28:44 +02:00
|
|
|
var state = this.props
|
2017-06-26 23:01:09 +02:00
|
|
|
var seed = state.seed || state.cachedSeed || ''
|
2016-04-14 00:28:44 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
h('.initialize-screen.flex-column.flex-center.flex-grow', [
|
|
|
|
|
2016-05-27 00:11:22 +02:00
|
|
|
// // subtitle and nav
|
|
|
|
// h('.section-title.flex-row.flex-center', [
|
|
|
|
// h('h2.page-subtitle', 'Vault Created'),
|
|
|
|
// ]),
|
|
|
|
|
|
|
|
h('h3.flex-center.text-transform-uppercase', {
|
|
|
|
style: {
|
|
|
|
background: '#EBEBEB',
|
|
|
|
color: '#AEAEAE',
|
2016-12-16 19:04:57 +01:00
|
|
|
marginTop: 36,
|
2016-05-27 00:11:22 +02:00
|
|
|
marginBottom: 8,
|
|
|
|
width: '100%',
|
|
|
|
fontSize: '20px',
|
|
|
|
padding: 6,
|
|
|
|
},
|
|
|
|
}, [
|
|
|
|
'Vault Created',
|
2016-04-14 00:28:44 +02:00
|
|
|
]),
|
|
|
|
|
2017-03-29 17:51:04 +02:00
|
|
|
h('div', {
|
2016-04-14 00:28:44 +02:00
|
|
|
style: {
|
2017-03-29 17:51:04 +02:00
|
|
|
fontSize: '1em',
|
|
|
|
marginTop: '10px',
|
2016-04-14 00:28:44 +02:00
|
|
|
textAlign: 'center',
|
2016-06-21 22:18:32 +02:00
|
|
|
},
|
2017-03-29 17:51:04 +02:00
|
|
|
}, [
|
2017-06-21 03:23:49 +02:00
|
|
|
h('span.error', 'These 12 words are the only way to restore your MetaMask accounts.\nSave them somewhere safe and secret.'),
|
2017-03-29 17:51:04 +02:00
|
|
|
]),
|
2016-04-14 00:28:44 +02:00
|
|
|
|
|
|
|
h('textarea.twelve-word-phrase', {
|
|
|
|
readOnly: true,
|
|
|
|
value: seed,
|
|
|
|
}),
|
|
|
|
|
2016-05-27 00:11:22 +02:00
|
|
|
h('button.primary', {
|
2017-08-30 10:30:55 +02:00
|
|
|
onClick: () => this.confirmSeedWords()
|
|
|
|
.then(account => this.showAccountDetail(account)),
|
2016-05-27 00:11:22 +02:00
|
|
|
style: {
|
2016-12-16 19:04:57 +01:00
|
|
|
margin: '24px',
|
|
|
|
fontSize: '0.9em',
|
2017-09-12 01:48:02 +02:00
|
|
|
marginBottom: '10px',
|
2016-05-27 00:11:22 +02:00
|
|
|
},
|
|
|
|
}, 'I\'ve copied it somewhere safe'),
|
2017-09-12 01:48:02 +02:00
|
|
|
|
|
|
|
h('button.primary', {
|
|
|
|
onClick: () => exportAsFile(`MetaMask Seed Words`, seed),
|
|
|
|
style: {
|
|
|
|
margin: '10px',
|
|
|
|
fontSize: '0.9em',
|
|
|
|
},
|
|
|
|
}, 'Save Seed Words As File'),
|
2016-04-14 00:28:44 +02:00
|
|
|
])
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
CreateVaultCompleteScreen.prototype.confirmSeedWords = function () {
|
2017-08-30 10:30:55 +02:00
|
|
|
return this.props.dispatch(actions.confirmSeedWords())
|
|
|
|
}
|
|
|
|
|
|
|
|
CreateVaultCompleteScreen.prototype.showAccountDetail = function (account) {
|
|
|
|
return this.props.dispatch(actions.showAccountDetail(account))
|
2016-04-14 00:28:44 +02:00
|
|
|
}
|