1import Maybe from 'folktale/maybe';
2import React from 'react';
3import { Button } from '../components/old/Base';
8} from '../components/old/Base';
9import { Row, Col, H1 } from '../components/old/Base';
11import { ROUTE_NAMES } from '../lib/routeNames';
12import { withHistory } from '../store/history';
13import { EthereumWallet } from '../lib/wallet';
14import { compose } from '../lib/lib';
15import { withWallet } from '../store/wallet';
17class PrivateKey extends React.Component {
25 this.handlePrivateKeyInput = this.handlePrivateKeyInput.bind(this);
28 handlePrivateKeyInput(privateKey) {
29 this.setState({ privateKey });
30 this.constructWallet(privateKey);
33 constructWallet(privateKey) {
34 const { setWallet } = this.props;
35 if (/^[0-9A-Fa-f]{64}$/g.test(privateKey) === true) {
36 const sec = Buffer.from(privateKey, 'hex');
37 const wallet = new EthereumWallet(sec);
38 setWallet(Maybe.Just(wallet));
40 setWallet(Maybe.Nothing());
45 const { history, wallet } = this.props;
46 const { privateKey } = this.state;
50 <Col className={'measure-md'}>
51 <H1 className={'mb-4'}>{'Enter Your Private Key'}</H1>
53 {`Please enter your raw Ethereum private key here.`}
59 prop-format="innerLabel"
62 onChange={this.handlePrivateKeyInput}
66 <InnerLabel>{'Private Key'}</InnerLabel>
72 disabled={Maybe.Nothing.hasInstance(wallet)}
73 onClick={() => history.popAndPush(ROUTE_NAMES.SHIPS)}>
82export default compose(
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