Fix ethereum private key format
authorIan Coleman <ian@iancoleman.io>
Fri, 7 Feb 2020 10:25:57 +0000 (21:25 +1100)
committerIan Coleman <ian@iancoleman.io>
Fri, 7 Feb 2020 10:25:57 +0000 (21:25 +1100)
src/js/index.js

index 102c7c5fb70435d93990799305fe0fe5e5e7f412..3981e8107ee882ea2c4e28cf0e4469936581872a 100644 (file)
                     var hexAddress = addressBuffer.toString('hex');
                     var checksumAddress = libs.ethUtil.toChecksumAddress(hexAddress);
                     address = libs.ethUtil.addHexPrefix(checksumAddress);
-                    privkey = libs.ethUtil.addHexPrefix(privkey);
                     pubkey = libs.ethUtil.addHexPrefix(pubkey);
+                    if (hasPrivkey) {
+                        privkey = libs.ethUtil.bufferToHex(keyPair.d.toBuffer());
+                    }
                 }
 
                 // Stellar is different