1import { Just, Nothing } from 'folktale/maybe';
2import React, { useEffect } from 'react';
3import { Input } from 'indigo-react';
5import View from 'components/View';
6import { usePassphraseInput } from 'components/Inputs';
7import { ForwardButton } from 'components/Buttons';
9import { useWallet } from 'store/wallet';
11import { EthereumWallet, WALLET_TYPES } from 'lib/wallet';
12import useWalletType from 'lib/useWalletType';
13import useResetPointCursor from 'lib/useResetPointCursor';
15export default function PrivateKey({ loginCompleted }) {
16 useResetPointCursor();
17 useWalletType(WALLET_TYPES.PRIVATE_KEY);
18 const { wallet, setWallet } = useWallet();
20 const privateKeyInput = usePassphraseInput({
25 const privateKey = privateKeyInput.data;
28 if (/^[0-9A-Fa-f]{64}$/g.test(privateKey) === true) {
29 const sec = Buffer.from(privateKey, 'hex');
30 const newWallet = new EthereumWallet(sec);
31 setWallet(Just(newWallet));
35 }, [privateKey, setWallet]);
39 Please enter your raw Ethereum private key here.
40 <Input {...privateKeyInput} />
43 disabled={Nothing.hasInstance(wallet)}
44 onClick={loginCompleted}>
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