1import Maybe from 'folktale/maybe';
2import React from 'react';
3import { Button } from '../components/old/Base';
8} from '../components/old/Base';
9import { 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';
16import View from 'components/View';
18class PrivateKey extends React.Component {
26 this.handlePrivateKeyInput = this.handlePrivateKeyInput.bind(this);
29 handlePrivateKeyInput(privateKey) {
30 this.setState({ privateKey });
31 this.constructWallet(privateKey);
34 constructWallet(privateKey) {
35 const { setWallet } = this.props;
36 if (/^[0-9A-Fa-f]{64}$/g.test(privateKey) === true) {
37 const sec = Buffer.from(privateKey, 'hex');
38 const wallet = new EthereumWallet(sec);
39 setWallet(Maybe.Just(wallet));
41 setWallet(Maybe.Nothing());
46 const { history, wallet } = this.props;
47 const { privateKey } = this.state;
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)}>
81export 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