William O'Beirne 5d3e461301 Read-Only Address Wallet (#386)
* Check in.

* Add read only wallet and new types for that. Convert some components to require full wallet.

* Fix readonly property, fix uncaught throw.

* Disable address only on some tabs.

* Use FullWalletOnly render callback to handle signing.

* Work around uncertain wallet type.

* Fix function args.

* Undo bug fix that should be done in another branch.

* Disable button while address is bad.

* Remove log.

* Convert anonymous functions to class functions.
2017-11-29 17:14:57 -06:00

33 lines
1021 B
TypeScript

import { fromPrivateKey, fromEthSale, fromV3 } from 'ethereumjs-wallet';
import { fromEtherWallet } from 'ethereumjs-wallet/thirdparty';
import { signWrapper } from './helpers';
import { decryptPrivKey } from 'libs/decrypt';
import Web3Wallet from './web3';
import AddressOnlyWallet from './address';
const EncryptedPrivateKeyWallet = (
encryptedPrivateKey: string,
password: string
) => signWrapper(fromPrivateKey(decryptPrivKey(encryptedPrivateKey, password)));
const PresaleWallet = (keystore: string, password: string) =>
signWrapper(fromEthSale(keystore, password));
const MewV1Wallet = (keystore: string, password: string) =>
signWrapper(fromEtherWallet(keystore, password));
const PrivKeyWallet = (privkey: Buffer) => signWrapper(fromPrivateKey(privkey));
const UtcWallet = (keystore: string, password: string) =>
signWrapper(fromV3(keystore, password, true));
export {
EncryptedPrivateKeyWallet,
PresaleWallet,
MewV1Wallet,
PrivKeyWallet,
UtcWallet,
Web3Wallet,
AddressOnlyWallet
};