on master help sign in
Handle EthereumWallet's private key as a Buffer.
a529165Jared Tobin
src/lib/wallet.js+2−3
@@ -20,9 +20,8 @@ const WALLET_NAMES = {
20}
20}
21
21
22function EthereumWallet(privateKey) {
22function EthereumWallet(privateKey) {
23− const sec = Buffer.from(privateKey, 'hex')
24− this.privateKey = sec
23+ this.privateKey = privateKey
25− this.publicKey = secp256k1.publicKeyCreate(sec)
24+ this.publicKey = secp256k1.publicKeyCreate(this.privateKey)
26 const pub = this.publicKey.toString('hex')
25 const pub = this.publicKey.toString('hex')
27 this.address = addressFromSecp256k1Public(pub)
26 this.address = addressFromSecp256k1Public(pub)
28}
27}
src/views/PrivateKey.js+2−1
@@ -29,7 +29,8 @@ class PrivateKey extends React.Component {
29 constructWallet(privateKey) {
29 constructWallet(privateKey) {
30 const { setWallet } = this.props
30 const { setWallet } = this.props
31 if (secre.test(privateKey) === true) {
31 if (secre.test(privateKey) === true) {
32+ const sec = Buffer.from(privateKey, 'hex')
32− const wallet = new EthereumWallet(privateKey)
33+ const wallet = new EthereumWallet(sec)
33 setWallet(Maybe.Just(wallet))
34 setWallet(Maybe.Just(wallet))
34 } else {
35 } else {
35 setWallet(Maybe.Nothing())
36 setWallet(Maybe.Nothing())