Skip to content
This repository has been archived by the owner on Nov 21, 2019. It is now read-only.

Commit

Permalink
Merge branch 'mercury' of https://github.com/kvhnuke/etherwallet into…
Browse files Browse the repository at this point in the history
… mercury

* 'mercury' of https://github.com/kvhnuke/etherwallet:
  identicooooooooooooooooooon
  helpers error correction in nibble of a priv key

# Conflicts:
#	chrome-extension/js/etherwallet-master.js
#	dist/js/etherwallet-master.js
  • Loading branch information
tayvano committed Jun 18, 2017
2 parents 2df967e + 1acd552 commit 4b74386
Show file tree
Hide file tree
Showing 22 changed files with 98,378 additions and 113,139 deletions.
3 changes: 2 additions & 1 deletion app/includes/generateWallet.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@

<section class="block--help">
<ul>
<li><strong><a href="hhttps://myetherwallet.groovehq.com/knowledge_base/topics/protecting-yourself-and-your-funds" target="_blank" rel="noopener"><strong>Preventing loss &amp; theft of your funds.</strong></a></li>
<li><strong><a href="https://myetherwallet.groovehq.com/knowledge_base/topics/how-do-i-save-slash-backup-my-wallet" target="_blank" rel="noopener"><strong>How to Save & Backup Your Wallet.</strong></a></li>
<li><strong><a href="https://myetherwallet.groovehq.com/knowledge_base/topics/protecting-yourself-and-your-funds" target="_blank" rel="noopener"><strong>Preventing loss &amp; theft of your funds.</strong></a></li>
<li><strong><a href="https://myetherwallet.groovehq.com/knowledge_base/topics/what-are-the-different-formats-of-a-private-key" target="_blank" rel="noopener">What are these Different Formats?</a></strong></li>
</ul>

Expand Down
2 changes: 1 addition & 1 deletion app/includes/header.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

<div class="tagline"><span style="max-width: 395px">Open-Source & Client-Side Ether Wallet</span>

&middot; v3.9.1 &nbsp;&nbsp;
&middot; v3.9.2 &nbsp;&nbsp;

<span class="dropdown" ng-cloak>
<a tabindex="0" aria-haspopup="true" aria-expanded="false" aria-label="change language. current language {{curLang}}" class="dropdown-toggle" ng-click="dropdown = !dropdown">{{curLang}}<i class="caret"></i></a>
Expand Down
16 changes: 10 additions & 6 deletions app/includes/helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,7 @@
</tr>
</table>
</p>
</div>


<br /><br /><br />
<br /><br /><br />

<h1> Mistyped Private Key </h1>

Expand All @@ -298,14 +295,21 @@
<label> Address You Sent To </label>
<input class="form-control" type="text" ng-model="mistypedAddr" />
</div>
<div class="form-group">
<a class="btn btn-primary" ng-click="findMyPrivateKey()"> Start the Search! </a>
</div>
<div class="form-group">
<label> Actual Private Key </label>
<input class="form-control" type="text" ng-model="actualPK" readonly />
<ol>
</div>
<div class="form-group">
<ul>
<li class="text-danger">Consider yourself very, very lucky.</li>
<li> Now you need to create a new secure wallet and move all funds to it.</li>
<li>In order to prevent the same thing from happening, <strong> please make sure your address you are sending to matches the address on your paper wallet</strong></li>
<li><a href="https://myetherwallet.groovehq.com/knowledge_base/topics/how-do-i-create-a-new-wallet" target="_blank" rel="noopener">Read this guide for more information.</a></li>
<li><a href="https://myetherwallet.groovehq.com/knowledge_base/topics/protecting-yourself-and-your-funds?from_search=true" target="_blank" rel="noopener">Learn how to protect yourself and your funds.</a></li>
</ol>
</ul>
</div>

</div>
2 changes: 1 addition & 1 deletion app/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "MyEtherWallet CX",
"version": "3.9.1",
"version": "3.9.2",
"manifest_version": 2,
"description": "MyEtherWallet Chrome Extension",
"homepage_url": "https://www.myetherwallet.com/",
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "MyEtherWallet",
"version": "3.9.1",
"version": "3.9.2",
"description": "An NPM dist of MyEtherWallet. For easier downloading & updating via CLI.",
"author": "MyEtherWallet",
"license": "ISC",
Expand Down
225 changes: 125 additions & 100 deletions app/scripts/controllers/helpersCtrl.js
Original file line number Diff line number Diff line change
@@ -1,105 +1,130 @@
'use strict';
var helpersCtrl = function($scope) {
var ENS = new ens();

var unitNames = ['wei', 'kwei', 'mwei', 'gwei', 'szabo', 'finney', 'ether', 'kether', 'mether', 'gether', 'tether']

$scope.units = {
ether: 1
};

$scope.decimalNumber = 10;
$scope.inputText = 'hello';

$scope.convertUnit = function (currentUnit) {
unitNames.forEach(function (unit) {
if (currentUnit !== unit) {
$scope.units[unit] = $scope.units[currentUnit] ? etherUnits.unitToUnit($scope.units[currentUnit], currentUnit, unit) : '';
}
})
}

$scope.decimalToHex = function () {
$scope.hexNumber = $scope.decimalNumber ? ethFuncs.decimalToHex($scope.decimalNumber) : '';
$scope.hexToPaddedHex();
}

$scope.hexToDecimal = function () {
$scope.decimalNumber = $scope.hexNumber ? ethFuncs.hexToDecimal($scope.hexNumber) : '';
$scope.hexToPaddedHex();
}

$scope.hexToPaddedHex = function () {
$scope.hexPaddedLeft = $scope.hexNumber ? ethFuncs.padLeft($scope.hexNumber, 64, '0') : '';
}

$scope.toSHA3 = function () {
$scope.outputText = $scope.inputText ? ethUtil.sha3($scope.inputText).toString('hex') : '';
}


/* ENS STUFF */
$scope.toEnsLabelHash = function () {
$scope.ensLabelHash = $scope.ensLabel ? ENS.getSHA3($scope.ensLabel) : '';
$scope.allTheThings();
}

$scope.toEnsSecretHash = function () {
$scope.ensSecretHash = $scope.ensSecret ? ENS.getSHA3($scope.ensSecret.trim()) : '';
$scope.allTheThings();
}

$scope.toBidWei = function () {
$scope.bidWei = $scope.bidEth ? Number(etherUnits.toWei($scope.bidEth, 'ether')) : '';
$scope.toBidHex();
}

$scope.toBidEth = function () {
$scope.bidEth = $scope.bidWei ? Number(etherUnits.toEther($scope.bidWei, 'wei')) : '';
$scope.toBidHex();
}

$scope.toBidHex = function () {
$scope.bidHex = $scope.bidWei ? ethFuncs.padLeft( ethFuncs.decimalToHex($scope.bidWei), 64, '0' ) : '';
$scope.allTheThings();
}

$scope.allTheThings = function() {
$scope.getStartAuctionData();
$scope.getShaBid();
$scope.getRevealBidData();
$scope.getFinalizeAuctionData();
}

$scope.getStartAuctionData = function() {
$scope.startAuctionData = $scope.ensLabel ? ENS.getStartAuctionData($scope.ensLabel) : '';
}

$scope.getShaBid = function() {
if ($scope.ensLabelHash && $scope.ensAddress && $scope.bidWei && $scope.ensSecretHash) {
ENS.shaBid($scope.ensLabelHash, $scope.ensAddress.toLowerCase(), $scope.bidWei, $scope.ensSecretHash, function(data) {
$scope.shaBid = ENS.getNewBidData(data.data)
});
} else {
$scope.shaBid = '';
}
}

$scope.getRevealBidData = function() {
if ($scope.ensLabel && $scope.bidWei && $scope.ensSecret) {
$scope.revealBidData = ENS.getRevealBidData($scope.ensLabel, $scope.bidWei, $scope.ensSecret)
} else {
$scope.revealBidData = '';
}
}

$scope.getFinalizeAuctionData = function() {
$scope.finalizeAuctionData = $scope.ensLabel ? ENS.getFinalizeAuctionData($scope.ensLabel) : '';
}

$scope.convertUnit('ether');
$scope.decimalToHex();
$scope.toSHA3();
var ENS = new ens();

var unitNames = ['wei', 'kwei', 'mwei', 'gwei', 'szabo', 'finney', 'ether', 'kether', 'mether', 'gether', 'tether']

$scope.units = {
ether: 1
};

$scope.decimalNumber = 10;
$scope.inputText = 'hello';

$scope.convertUnit = function(currentUnit) {
unitNames.forEach(function(unit) {
if (currentUnit !== unit) {
$scope.units[unit] = $scope.units[currentUnit] ? etherUnits.unitToUnit($scope.units[currentUnit], currentUnit, unit) : '';
}
})
}

$scope.decimalToHex = function() {
$scope.hexNumber = $scope.decimalNumber ? ethFuncs.decimalToHex($scope.decimalNumber) : '';
$scope.hexToPaddedHex();
}

$scope.hexToDecimal = function() {
$scope.decimalNumber = $scope.hexNumber ? ethFuncs.hexToDecimal($scope.hexNumber) : '';
$scope.hexToPaddedHex();
}

$scope.hexToPaddedHex = function() {
$scope.hexPaddedLeft = $scope.hexNumber ? ethFuncs.padLeft($scope.hexNumber, 64, '0') : '';
}

$scope.toSHA3 = function() {
$scope.outputText = $scope.inputText ? ethUtil.sha3($scope.inputText).toString('hex') : '';
}


/* ENS STUFF */
$scope.toEnsLabelHash = function() {
$scope.ensLabelHash = $scope.ensLabel ? ENS.getSHA3($scope.ensLabel) : '';
$scope.allTheThings();
}

$scope.toEnsSecretHash = function() {
$scope.ensSecretHash = $scope.ensSecret ? ENS.getSHA3($scope.ensSecret.trim()) : '';
$scope.allTheThings();
}

$scope.toBidWei = function() {
$scope.bidWei = $scope.bidEth ? Number(etherUnits.toWei($scope.bidEth, 'ether')) : '';
$scope.toBidHex();
}

$scope.toBidEth = function() {
$scope.bidEth = $scope.bidWei ? Number(etherUnits.toEther($scope.bidWei, 'wei')) : '';
$scope.toBidHex();
}

$scope.toBidHex = function() {
$scope.bidHex = $scope.bidWei ? ethFuncs.padLeft(ethFuncs.decimalToHex($scope.bidWei), 64, '0') : '';
$scope.allTheThings();
}

$scope.allTheThings = function() {
$scope.getStartAuctionData();
$scope.getShaBid();
$scope.getRevealBidData();
$scope.getFinalizeAuctionData();
}

$scope.getStartAuctionData = function() {
$scope.startAuctionData = $scope.ensLabel ? ENS.getStartAuctionData($scope.ensLabel) : '';
}

$scope.getShaBid = function() {
if ($scope.ensLabelHash && $scope.ensAddress && $scope.bidWei && $scope.ensSecretHash) {
ENS.shaBid($scope.ensLabelHash, $scope.ensAddress.toLowerCase(), $scope.bidWei, $scope.ensSecretHash, function(data) {
$scope.shaBid = ENS.getNewBidData(data.data)
});
} else {
$scope.shaBid = '';
}
}

$scope.getRevealBidData = function() {
if ($scope.ensLabel && $scope.bidWei && $scope.ensSecret) {
$scope.revealBidData = ENS.getRevealBidData($scope.ensLabel, $scope.bidWei, $scope.ensSecret)
} else {
$scope.revealBidData = '';
}
}

$scope.getFinalizeAuctionData = function() {
$scope.finalizeAuctionData = $scope.ensLabel ? ENS.getFinalizeAuctionData($scope.ensLabel) : '';
}

$scope.findMyPrivateKey = function() {
var setCharAt = function(str, index, chr) {
if (index > str.length - 1) return str;
return str.substr(0, index) + chr + str.substr(index + 1);
}
var basePrivateKey = $scope.mistypedPK;
var targetPublicAddress = $scope.mistypedAddr;
basePrivateKey = basePrivateKey.substring(0, 2) == '0x' ? basePrivateKey.substring(2) : basePrivateKey;
var characters = ['a', 'b', 'c', 'd', 'e', 'f', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
var isFound = false;
for (var keyPosition = 0; keyPosition < basePrivateKey.length; keyPosition++) {
for (var character = 0; character < characters.length; character++) {
var privateKeyGuess = setCharAt(basePrivateKey, keyPosition, characters[character]);
var wallet = Wallet.fromPrivateKey(privateKeyGuess);
var publicAddress = wallet.getAddressString();
if (publicAddress.toLowerCase() == targetPublicAddress.toLowerCase()) {
$scope.actualPK = privateKeyGuess;
isFound = true;
}
}
}
if (!isFound)
$scope.actualPK = "Sorry not found :(";
}

$scope.convertUnit('ether');
$scope.decimalToHex();
$scope.toSHA3();
};

module.exports = helpersCtrl;
Expand Down
3 changes: 0 additions & 3 deletions app/scripts/controllers/sendTxCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,6 @@ var sendTxCtrl = function($scope, $sce, walletService) {
var bExStr = $scope.ajaxReq.type != nodes.nodeTypes.Custom ? "<a class='btn btn-xs btn-info' href='" + txHashLink + "' class='strong' target='_blank' rel='noopener'>Verify Transaction</a>" : '';
var emailLink = '<a class="btn btn-xs btn-info" href="mailto:[email protected]?Subject=Issue%20regarding%20my%20TX%20&Body=%0A%0AI%20was%20trying%20to..............%0A%0A%0A%0ABut%20I%27m%20confused%20because...............%0A%0A%0A%0A%0A' + "%0ATo%20Address%3A%20https%3A%2F%2Fetherscan.io%2Faddress%2F" + $scope.tx.to + "%0A%0AFrom%20Address%3A%20https%3A%2F%2Fetherscan.io%2Faddress%2F" + $scope.wallet.getAddressString() + "%0A%0ATX%20Hash%3A%20https%3A%2F%2Fetherscan.io%2Ftx%2F" + resp.data + "%0A%0AAmount%3A%20" + $scope.tx.value + "%20" + $scope.unitReadable + "%0ANode%3A%20" + $scope.ajaxReq.type + "%0AToken%20To%20Addr%3A%20" + $scope.tokenTx.to + "%0AToken%20Amount%3A%20" + $scope.tokenTx.value + "%20" + $scope.unitReadable + "%0AData%3A%20" + $scope.tx.data + "%0AGas%20Limit%3A%20" + $scope.tx.gasLimit + "%0AGas%20Price%3A%20" + $scope.tx.gasPrice + '" target="_blank" rel="noopener">Confused? Email Us.</a>';
$scope.notifier.success("<p>" + globalFuncs.successMsgs[2] + '<strong>' + resp.data + "</strong></p><p>" + bExStr + " " + emailLink + "</p>");
var tWin = window.open();
tWin.opener = null;
tWin.location = txHashLink;
$scope.wallet.setBalance(applyScope);
if ($scope.tx.sendMode == 'token') $scope.wallet.tokenObjs[$scope.tokenTx.id].setBalance();
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/globalFuncs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ globalFuncs.getBlockie = function(address) {
}
globalFuncs.printPaperWallets = function(strJson) {
var win = window.open("about:blank", "_blank");
var data = "<html><head><link rel=\"stylesheet\" href=\"css\/etherwallet-master.min.css\"\/><script type=\"text\/javascript\" src=\"js\/jquery-1.12.3.min.js\"><\/script><script type=\"text\/javascript\" src=\"js\/etherwallet-static.min.js\"><\/script><script type=\"text\/javascript\">function generateWallets(){ var json = JSON.parse($(\"#printwalletjson\").html()); for(var i=0;i<json.length;i++){ var walletTemplate = $(\'<div\/>\').append($(\"#print-container\").clone()); new QRCode($(walletTemplate).find(\"#paperwalletaddqr\")[0], {\t\t text: json[i][\'address\'],\t\t colorDark: \"#000000\",\t\t colorLight: \"#ffffff\",\t\tcorrectLevel: QRCode.CorrectLevel.H\t }); new QRCode($(walletTemplate).find(\"#paperwalletprivqr\")[0], {\t\t text: json[i][\'private\'],\t\t colorDark: \"#000000\",\t\t colorLight: \"#ffffff\",\t\tcorrectLevel: QRCode.CorrectLevel.H\t }); $(walletTemplate).find(\"#paperwalletadd\").html(json[i][\'address\']);$(walletTemplate).find(\"#paperwalletpriv\").html(json[i][\'private\']); walletTemplate = $(walletTemplate).find(\"#print-container\").show();$(\"body\").append(walletTemplate); } setTimeout(function(){window.print();},2000);}<\/script><\/head><body><span id=\"printwalletjson\" style=\"display: none;\">{{WALLETJSON}}<\/span><div class=\"print-container\" style=\"display: none; margin-bottom: 50px;\" id=\"print-container\"><img src=\"images\/logo-ethereum-1.png\" class=\"ether-logo-1\" height=\"100%\" width=\"auto\"\/><img src=\"images\/logo-ethereum-2.png\" class=\"ether-logo-2\"\/> <img src=\"images\/print-sidebar.png\" height=\"100%\" width=\"auto\" class=\"print-title\"\/><div class=\"print-qr-code-1\"> <div id=\"paperwalletaddqr\"><\/div> <p class=\"print-text\" style=\"padding-top: 25px;\">YOUR ADDRESS<\/p><\/div><div class=\"print-notes\"><img src=\"images\/notes-bg.png\" width=\"90%;\" height=\"auto\" class=\"pull-left\" \/><p class=\"print-text\">AMOUNT \/ NOTES<\/p><\/div><div class=\"print-qr-code-2\"> <div id=\"paperwalletprivqr\"><\/div> <p class=\"print-text\" style=\"padding-top: 30px;\">YOUR PRIVATE KEY<\/p><\/div><div class=\"print-address-container\"><p><strong>Your Address:<\/strong><br \/><span id=\"paperwalletadd\"><\/span><\/p><p><strong>Your Private Key:<\/strong><br \/><span id=\"paperwalletpriv\"><\/span><\/p><\/div><\/div><\/body><\/html>";
var data = "<html>\r\n\r\n<head>\r\n <link rel=\"stylesheet\" href=\"css\/etherwallet-master.min.css\" \/>\r\n <script type=\"text\/javascript\" src=\"js\/jquery-1.12.3.min.js\"><\/script>\r\n <script type=\"text\/javascript\" src=\"js\/etherwallet-static.min.js\"><\/script>\r\n <script type=\"text\/javascript\">\r\n function getBlockie(address) {\r\n return blockies.create({\r\n seed: address.toLowerCase(),\r\n size: 8,\r\n scale: 16\r\n }).toDataURL();\r\n }\r\n function generateWallets() {\r\n var json = JSON.parse($(\"#printwalletjson\").html());\r\n for (var i = 0; i < json.length; i++) {\r\n var walletTemplate = $(\'<div\/>\').append($(\"#print-container\").clone());\r\n new QRCode($(walletTemplate).find(\"#paperwalletaddqr\")[0], {\r\n text: json[i][\'address\'],\r\n colorDark: \"#000000\",\r\n colorLight: \"#ffffff\",\r\n correctLevel: QRCode.CorrectLevel.H\r\n });\r\n new QRCode($(walletTemplate).find(\"#paperwalletprivqr\")[0], {\r\n text: json[i][\'private\'],\r\n colorDark: \"#000000\",\r\n colorLight: \"#ffffff\",\r\n correctLevel: QRCode.CorrectLevel.H\r\n });\r\n $(walletTemplate).find(\"#paperwalletadd\").html(json[i][\'address\']);\r\n $(walletTemplate).find(\"#paperwalletpriv\").html(json[i][\'private\']);\r\n $(walletTemplate).find(\"#identicon\").css(\'background-image\',\'url(\' + getBlockie(json[i][\'address\']) +\')\');\r\n walletTemplate = $(walletTemplate).find(\"#print-container\").show();\r\n $(\"body\").append(walletTemplate);\r\n }\r\n setTimeout(function() {\r\n window.print();\r\n }, 2000);\r\n }\r\n <\/script>\r\n<\/head>\r\n\r\n<body><span id=\"printwalletjson\" style=\"display: none;\">{{WALLETJSON}}<\/span>\r\n <div class=\"print-container\" style=\"display: none; margin-bottom: 50px;\" id=\"print-container\"><img src=\"images\/logo-ethereum-1.png\" class=\"ether-logo-1\" height=\"100%\" width=\"auto\" \/> <div id=\"identicon\" class=\"addressIdenticon med float\"><\/div>\r\n <img src=\"images\/print-sidebar.png\" height=\"100%\" width=\"auto\" class=\"print-title\" \/>\r\n <div class=\"print-qr-code-1\">\r\n <div id=\"paperwalletaddqr\"><\/div>\r\n <p class=\"print-text\" style=\"padding-top: 25px;\">YOUR ADDRESS<\/p>\r\n <\/div>\r\n <div class=\"print-notes\"><img src=\"images\/notes-bg.png\" width=\"90%;\" height=\"auto\" class=\"pull-left\" \/>\r\n <p class=\"print-text\">AMOUNT \/ NOTES<\/p>\r\n <\/div>\r\n <div class=\"print-qr-code-2\">\r\n <div id=\"paperwalletprivqr\"><\/div>\r\n <p class=\"print-text\" style=\"padding-top: 30px;\">YOUR PRIVATE KEY<\/p>\r\n <\/div>\r\n <div class=\"print-address-container\">\r\n <p><strong>Your Address:<\/strong>\r\n <br \/><span id=\"paperwalletadd\"><\/span><\/p>\r\n <p><strong>Your Private Key:<\/strong>\r\n <br \/><span id=\"paperwalletpriv\"><\/span><\/p>\r\n <\/div>\r\n <\/div>\r\n<\/body>\r\n\r\n<\/html>\r\n";
data = data.replace("{{WALLETJSON}}", strJson);
win.document.write(data);
win.document.write("<script>generateWallets();</script>");
Expand Down
2 changes: 1 addition & 1 deletion app/styles/bootstrap/print.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*,
*:before,
*:after {
background: transparent !important;
//background: transparent !important;
color: #000 !important; // Black prints faster: h5bp.com/s
box-shadow: none !important;
text-shadow: none !important;
Expand Down
1 change: 1 addition & 0 deletions app/styles/etherwallet-new.less
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
}
h2 {
font-size: 1.15rem;
font-weight: 400;
}
}

Expand Down
15 changes: 15 additions & 0 deletions app/styles/etherwallet-print.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@
border: 1px solid gray;
margin-bottom: 50px;
position: relative;
#identicon {
-webkit-print-color-adjust: exact;
position: absolute;
right: 7.5rem;
bottom: 3rem;
}
#identicon:after {
content: "Always look for this icon when sending to this wallet.";
font-size: 9px;
width: 120px;
position: absolute;
bottom: .75rem;
text-align: center;
right: -7.5rem;
}
}

.print-title {
Expand Down
Loading

0 comments on commit 4b74386

Please sign in to comment.