1import Maybe from 'folktale/maybe'
2import React from 'react'
3import { Button } from '../components/Base'
4import { RequiredInput, InnerLabel, InputCaption } from '../components/Base'
5import { Row, Col, H1 } from '../components/Base'
7import { ROUTE_NAMES } from '../lib/router'
8import { EthereumWallet } from '../lib/wallet'
10const secre = /[0-9A-Fa-f]{64}/g
12class PrivateKey extends React.Component {
21 this.handlePrivateKeyInput = this.handlePrivateKeyInput.bind(this)
24 handlePrivateKeyInput(privateKey) {
25 this.setState({ privateKey })
26 this.constructWallet(privateKey)
29 constructWallet(privateKey) {
30 const { setWallet } = this.props
31 if (secre.test(privateKey) === true) {
32 const sec = Buffer.from(privateKey, 'hex')
33 const wallet = new EthereumWallet(sec)
34 setWallet(Maybe.Just(wallet))
36 setWallet(Maybe.Nothing())
41 const { pushRoute, popRoute, wallet } = this.props
42 const { privateKey } = this.state
46 <Col className={'measure-md'}>
47 <H1 className={'mb-4'}>{ 'Enter Your Private Key' }</H1>
49 { `Please enter your raw Ethereum private key here.` }
55 prop-format='innerLabel'
58 onChange={ this.handlePrivateKeyInput }
62 <InnerLabel>{'Private Key'}</InnerLabel>
67 prop-size={ 'wide lg' }
68 disabled={ Maybe.Nothing.hasInstance(wallet) }
71 pushRoute(ROUTE_NAMES.SHIPS)
85export default PrivateKey
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list