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';
14export default function PrivateKey({ loginCompleted }) {
15 useWalletType(WALLET_TYPES.PRIVATE_KEY);
16 const { wallet, setWallet } = useWallet();
18 const privateKeyInput = usePassphraseInput({
23 const privateKey = privateKeyInput.data;
26 if (/^[0-9A-Fa-f]{64}$/g.test(privateKey) === true) {
27 const sec = Buffer.from(privateKey, 'hex');
28 const newWallet = new EthereumWallet(sec);
29 setWallet(Just(newWallet));
33 }, [privateKey, setWallet]);
37 Please enter your raw Ethereum private key here.
38 <Input {...privateKeyInput} />
41 disabled={Nothing.hasInstance(wallet)}
42 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