From 4d3224d4bfb62710d351155c2d7ecf9c5e9d5be4 Mon Sep 17 00:00:00 2001 From: gamalielhere Date: Mon, 29 Oct 2018 14:29:32 -0700 Subject: [PATCH 1/3] Release: v3.23.1 --- CHANGELOG.md | 4 ++++ chrome-extension/background/extension.js | 12 +++++++----- chrome-extension/contest.html | 2 ++ chrome-extension/helpers.html | 2 ++ chrome-extension/js/etherwallet-master.js | 10 ++++++++++ chrome-extension/privacy-policy.html | 2 ++ dist/contest.html | 2 ++ dist/helpers.html | 2 ++ dist/index.html | 2 ++ dist/js/etherwallet-master.js | 10 ++++++++++ dist/phishing.html | 2 ++ dist/privacy-policy.html | 2 ++ 12 files changed, 47 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75c42bb972..06c14a4b48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ### New +- Add C20 contract abi [#2122](https://github.com/kvhnuke/etherwallet/pull/2122) +- Adds VIC tokens [#2120](https://github.com/kvhnuke/etherwallet/pull/2120) +- Adds VIC contracts [#2121](https://github.com/kvhnuke/etherwallet/pull/2121) +- Adds phishfort extension [#2113](https://github.com/kvhnuke/etherwallet/pull/2113) - Update POA block explorrer [#2111](https://github.com/kvhnuke/etherwallet/pull/2111) - Fix trezor signing [#2109](https://github.com/kvhnuke/etherwallet/pull/2109) - Add Credits custom gas [#2107](https://github.com/kvhnuke/etherwallet/pull/2107) diff --git a/chrome-extension/background/extension.js b/chrome-extension/background/extension.js index 413f05b83c..e80336848e 100644 --- a/chrome-extension/background/extension.js +++ b/chrome-extension/background/extension.js @@ -5,7 +5,7 @@ localStorage.getItem("iosiro-blacklisted-domains") === null ? getDomains("iosiro") : checkIfDataIsRecent("iosiro"); - localStorage.getItem("phishfort-blacklisted-domains") === null + localStorage.getItem("phishfort-blacklisted-domains") === null ? getDomains("phishfort") : checkIfDataIsRecent("phishfort"); @@ -71,12 +71,14 @@ function querycB(tabs) { const ealBlacklisted = localStorage.getItem("eal-blacklisted-domains") ? JSON.parse(localStorage.getItem("eal-blacklisted-domains")) : eal; + const iosiroBlacklisted = localStorage.getItem("iosiro-blacklisted-domains") ? JSON.parse(localStorage.getItem("iosiro-blacklisted-domains")) : iosiro; + const phishfortBlacklisted = localStorage.getItem("phishfort-blacklisted-domains") - ? JSON.parse(localStorage.getItem("phishfort-blacklisted-domains")) - : phishfort; + ? JSON.parse(localStorage.getItem("phishfort-blacklisted-domains")) + : phishfort; const whitelisted = localStorage.getItem("409h-whitelisted-domains") ? JSON.parse(localStorage.getItem("409h-whitelisted-domains")) @@ -197,10 +199,10 @@ function getDomains(str) { let newName; - if (str && str !== "" && (str === "eal" || str === "iosiro" || str === "phishfort")) { + if (str && str !== "" && (str === "eal" || str === "iosiro" || str == "phishfort")) { newName = str + "-blacklisted-domains"; setInStorage(blackListDomains[str], newName); - } else if (str && str !== "" && (str !== "eal" || str !== "iosiro" || str !== "phishfort")) { + } else if (str && str !== "" && (str !== "eal" || str !== "iosiro" || str != "phishfort")) { newName = str + "-whitelisted-domains"; setInStorage(whiteListDomains[str], newName); } else { diff --git a/chrome-extension/contest.html b/chrome-extension/contest.html index e808f624eb..e25736ad3a 100644 --- a/chrome-extension/contest.html +++ b/chrome-extension/contest.html @@ -87,6 +87,8 @@ or MetaMask or + PhishFort + or Cryptonite diff --git a/chrome-extension/helpers.html b/chrome-extension/helpers.html index 2d6ec42573..c376c8a5c1 100644 --- a/chrome-extension/helpers.html +++ b/chrome-extension/helpers.html @@ -88,6 +88,8 @@ or MetaMask or + PhishFort + or Cryptonite diff --git a/chrome-extension/js/etherwallet-master.js b/chrome-extension/js/etherwallet-master.js index 4bdb94a22d..93c0bae2e8 100644 --- a/chrome-extension/js/etherwallet-master.js +++ b/chrome-extension/js/etherwallet-master.js @@ -162,6 +162,12 @@ module.exports=[ "abi": '[{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"earlyBirds","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"removeWhitelistOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRIBUTION_MAX","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"contributors","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tranches","outputs":[{"name":"untilToken","type":"uint256"},{"name":"tokensPerEther","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PUBLIC_START_TIME","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"},{"name":"weiAmount","type":"uint256"}],"name":"addEarlyBird","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"END_TIME","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"finalize","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalWeiRaised","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokenContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCurrentTokensPerEther","outputs":[{"name":"tokensPerEther","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EXA","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"addWhitelistOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"COMPANY_ALLOCATION","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"whitelistOperators","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"removeFromWhitelist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"earlyBirdInvestments","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"burnUnsoldTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenContract","type":"address"}],"name":"connectToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"whitelist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"fundingWalletAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"weiAmount","type":"uint256"}],"name":"calculateTokenAmount","outputs":[{"name":"tokens","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"finalized","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalTokenSold","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRIBUTION_MIN","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"currentTime","outputs":[{"name":"_currentTime","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getTokensLeft","outputs":[{"name":"tokensLeft","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"addToWhitelist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_fundingWalletAddress","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_account","type":"address"}],"name":"LogWhitelistUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_account","type":"address"},{"indexed":false,"name":"_cost","type":"uint256"},{"indexed":false,"name":"_tokens","type":"uint256"},{"indexed":false,"name":"_totalTokenSold","type":"uint256"}],"name":"LogTokensPurchased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_amount","type":"uint256"}],"name":"UnsoldTokensBurnt","type":"event"},{"anonymous":false,"inputs":[],"name":"Finalized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]' }, + { + "name": "CRYPTO20", + "address": "0x26E75307Fc0C021472fEb8F727839531F112f317", + "abi": + '[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newWaitTime","type":"uint256"}],"name":"changeWaitTime","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newFundingStartBlock","type":"uint256"}],"name":"updateFundingStartBlock","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"previousUpdateTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newControlWallet","type":"address"}],"name":"changeControlWallet","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"vestingContract","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"halt","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"participant","type":"address"}],"name":"verifyParticipant","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"fundWallet","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newFundWallet","type":"address"}],"name":"changeFundWallet","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"vestingContractInput","type":"address"}],"name":"setVestingContract","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"withdrawals","outputs":[{"name":"tokens","type":"uint256"},{"name":"time","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"controlWallet","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"enableTrading","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newNumerator","type":"uint256"}],"name":"updatePrice","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"amountTokensToWithdraw","type":"uint256"}],"name":"checkWithdrawValue","outputs":[{"name":"etherValue","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"participant","type":"address"},{"name":"amountTokens","type":"uint256"}],"name":"allocatePresaleTokens","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"fundingEndBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_oldValue","type":"uint256"},{"name":"_newValue","type":"uint256"}],"name":"changeApproval","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"whitelist","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"minAmount","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"removeLiquidity","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"currentPrice","outputs":[{"name":"numerator","type":"uint256"},{"name":"denominator","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"amountTokensToWithdraw","type":"uint256"}],"name":"requestWithdrawal","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"buy","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"halted","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"prices","outputs":[{"name":"numerator","type":"uint256"},{"name":"denominator","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"unhalt","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"waitTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"fundingStartBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newDenominator","type":"uint256"}],"name":"updatePriceDenominator","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"participant","type":"address"}],"name":"buyTo","outputs":[],"payable":true,"type":"function"},{"constant":true,"inputs":[],"name":"tokenCap","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newFundingEndBlock","type":"uint256"}],"name":"updateFundingEndBlock","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"addLiquidity","outputs":[],"payable":true,"type":"function"},{"constant":true,"inputs":[],"name":"tradeable","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"icoDenominatorPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[{"name":"controlWalletInput","type":"address"},{"name":"priceNumeratorInput","type":"uint256"},{"name":"startBlockInput","type":"uint256"},{"name":"endBlockInput","type":"uint256"}],"payable":false,"type":"constructor"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"participant","type":"address"},{"indexed":true,"name":"beneficiary","type":"address"},{"indexed":false,"name":"ethValue","type":"uint256"},{"indexed":false,"name":"amountTokens","type":"uint256"}],"name":"Buy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"participant","type":"address"},{"indexed":false,"name":"amountTokens","type":"uint256"}],"name":"AllocatePresale","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"participant","type":"address"}],"name":"Whitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"numerator","type":"uint256"},{"indexed":false,"name":"denominator","type":"uint256"}],"name":"PriceUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"ethAmount","type":"uint256"}],"name":"AddLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"ethAmount","type":"uint256"}],"name":"RemoveLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"participant","type":"address"},{"indexed":false,"name":"amountTokens","type":"uint256"}],"name":"WithdrawRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"participant","type":"address"},{"indexed":false,"name":"amountTokens","type":"uint256"},{"indexed":false,"name":"etherAmount","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}]' + }, { "name": "CryptoKitties", "address": "0x06012c8cf97bead5deae237070f9587f8e7a266d", @@ -3743,6 +3749,10 @@ var darklist = function darklist() { address: "0x21918461C6aecA5EAEc825B4746D64a0D4028dF6", comment: "Scam address of phishing email sent to leaked Everex investor database", date: "2017-09-05" + }, { + address: "0xDdd6854A002A6fbcDF695385cD5ed630c9E27C3e", + comment: "Scam address contacted Trust Wallet users in Telegram group depicting admin image and username", + date: "2018-10-25" }]; }; diff --git a/chrome-extension/privacy-policy.html b/chrome-extension/privacy-policy.html index a6e612d3e8..44481af3a9 100644 --- a/chrome-extension/privacy-policy.html +++ b/chrome-extension/privacy-policy.html @@ -87,6 +87,8 @@ or MetaMask or + PhishFort + or Cryptonite diff --git a/dist/contest.html b/dist/contest.html index e808f624eb..e25736ad3a 100644 --- a/dist/contest.html +++ b/dist/contest.html @@ -87,6 +87,8 @@ or MetaMask or + PhishFort + or Cryptonite diff --git a/dist/helpers.html b/dist/helpers.html index 2d6ec42573..c376c8a5c1 100644 --- a/dist/helpers.html +++ b/dist/helpers.html @@ -88,6 +88,8 @@ or MetaMask or + PhishFort + or Cryptonite diff --git a/dist/index.html b/dist/index.html index 1eba51643e..36758e8b1c 100644 --- a/dist/index.html +++ b/dist/index.html @@ -88,6 +88,8 @@ or MetaMask or + PhishFort + or Cryptonite diff --git a/dist/js/etherwallet-master.js b/dist/js/etherwallet-master.js index 4bdb94a22d..93c0bae2e8 100644 --- a/dist/js/etherwallet-master.js +++ b/dist/js/etherwallet-master.js @@ -162,6 +162,12 @@ module.exports=[ "abi": '[{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"earlyBirds","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"removeWhitelistOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"CONTRIBUTION_MAX","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"contributors","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tranches","outputs":[{"name":"untilToken","type":"uint256"},{"name":"tokensPerEther","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PUBLIC_START_TIME","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"},{"name":"weiAmount","type":"uint256"}],"name":"addEarlyBird","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"END_TIME","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"finalize","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalWeiRaised","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokenContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCurrentTokensPerEther","outputs":[{"name":"tokensPerEther","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EXA","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"addWhitelistOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"COMPANY_ALLOCATION","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"whitelistOperators","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"removeFromWhitelist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"earlyBirdInvestments","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"burnUnsoldTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenContract","type":"address"}],"name":"connectToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"whitelist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"fundingWalletAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"weiAmount","type":"uint256"}],"name":"calculateTokenAmount","outputs":[{"name":"tokens","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"finalized","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalTokenSold","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRIBUTION_MIN","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"currentTime","outputs":[{"name":"_currentTime","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getTokensLeft","outputs":[{"name":"tokensLeft","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"addToWhitelist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_fundingWalletAddress","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_account","type":"address"}],"name":"LogWhitelistUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_account","type":"address"},{"indexed":false,"name":"_cost","type":"uint256"},{"indexed":false,"name":"_tokens","type":"uint256"},{"indexed":false,"name":"_totalTokenSold","type":"uint256"}],"name":"LogTokensPurchased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_amount","type":"uint256"}],"name":"UnsoldTokensBurnt","type":"event"},{"anonymous":false,"inputs":[],"name":"Finalized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]' }, + { + "name": "CRYPTO20", + "address": "0x26E75307Fc0C021472fEb8F727839531F112f317", + "abi": + '[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newWaitTime","type":"uint256"}],"name":"changeWaitTime","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newFundingStartBlock","type":"uint256"}],"name":"updateFundingStartBlock","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"previousUpdateTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newControlWallet","type":"address"}],"name":"changeControlWallet","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"vestingContract","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"halt","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"participant","type":"address"}],"name":"verifyParticipant","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"fundWallet","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newFundWallet","type":"address"}],"name":"changeFundWallet","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"vestingContractInput","type":"address"}],"name":"setVestingContract","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"withdrawals","outputs":[{"name":"tokens","type":"uint256"},{"name":"time","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"controlWallet","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"enableTrading","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newNumerator","type":"uint256"}],"name":"updatePrice","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"amountTokensToWithdraw","type":"uint256"}],"name":"checkWithdrawValue","outputs":[{"name":"etherValue","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"participant","type":"address"},{"name":"amountTokens","type":"uint256"}],"name":"allocatePresaleTokens","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"fundingEndBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_oldValue","type":"uint256"},{"name":"_newValue","type":"uint256"}],"name":"changeApproval","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"whitelist","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"minAmount","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"removeLiquidity","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"currentPrice","outputs":[{"name":"numerator","type":"uint256"},{"name":"denominator","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"amountTokensToWithdraw","type":"uint256"}],"name":"requestWithdrawal","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"buy","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"halted","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"prices","outputs":[{"name":"numerator","type":"uint256"},{"name":"denominator","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"unhalt","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"waitTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"fundingStartBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newDenominator","type":"uint256"}],"name":"updatePriceDenominator","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"participant","type":"address"}],"name":"buyTo","outputs":[],"payable":true,"type":"function"},{"constant":true,"inputs":[],"name":"tokenCap","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"claimTokens","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newFundingEndBlock","type":"uint256"}],"name":"updateFundingEndBlock","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"addLiquidity","outputs":[],"payable":true,"type":"function"},{"constant":true,"inputs":[],"name":"tradeable","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"icoDenominatorPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[{"name":"controlWalletInput","type":"address"},{"name":"priceNumeratorInput","type":"uint256"},{"name":"startBlockInput","type":"uint256"},{"name":"endBlockInput","type":"uint256"}],"payable":false,"type":"constructor"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"participant","type":"address"},{"indexed":true,"name":"beneficiary","type":"address"},{"indexed":false,"name":"ethValue","type":"uint256"},{"indexed":false,"name":"amountTokens","type":"uint256"}],"name":"Buy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"participant","type":"address"},{"indexed":false,"name":"amountTokens","type":"uint256"}],"name":"AllocatePresale","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"participant","type":"address"}],"name":"Whitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"numerator","type":"uint256"},{"indexed":false,"name":"denominator","type":"uint256"}],"name":"PriceUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"ethAmount","type":"uint256"}],"name":"AddLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"ethAmount","type":"uint256"}],"name":"RemoveLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"participant","type":"address"},{"indexed":false,"name":"amountTokens","type":"uint256"}],"name":"WithdrawRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"participant","type":"address"},{"indexed":false,"name":"amountTokens","type":"uint256"},{"indexed":false,"name":"etherAmount","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}]' + }, { "name": "CryptoKitties", "address": "0x06012c8cf97bead5deae237070f9587f8e7a266d", @@ -3743,6 +3749,10 @@ var darklist = function darklist() { address: "0x21918461C6aecA5EAEc825B4746D64a0D4028dF6", comment: "Scam address of phishing email sent to leaked Everex investor database", date: "2017-09-05" + }, { + address: "0xDdd6854A002A6fbcDF695385cD5ed630c9E27C3e", + comment: "Scam address contacted Trust Wallet users in Telegram group depicting admin image and username", + date: "2018-10-25" }]; }; diff --git a/dist/phishing.html b/dist/phishing.html index 43544da16f..4d01452977 100644 --- a/dist/phishing.html +++ b/dist/phishing.html @@ -87,6 +87,8 @@ or MetaMask or + PhishFort + or Cryptonite diff --git a/dist/privacy-policy.html b/dist/privacy-policy.html index a6e612d3e8..44481af3a9 100644 --- a/dist/privacy-policy.html +++ b/dist/privacy-policy.html @@ -87,6 +87,8 @@ or MetaMask or + PhishFort + or Cryptonite From f6eca559ae371ae3fb97e4e8714dfbe81c50a3bc Mon Sep 17 00:00:00 2001 From: gamalielhere Date: Mon, 29 Oct 2018 14:38:58 -0700 Subject: [PATCH 2/3] Release: v3.24.0 --- CHANGELOG.md | 2 ++ app/includes/header.tpl | 6 +++--- app/manifest.json | 2 +- chrome-extension/contest.html | 4 ++-- chrome-extension/cx-wallet.html | 4 ++-- chrome-extension/helpers.html | 4 ++-- chrome-extension/manifest.json | 2 +- chrome-extension/phishing.html | 4 ++-- chrome-extension/privacy-policy.html | 4 ++-- dist/contest.html | 4 ++-- dist/helpers.html | 4 ++-- dist/index.html | 4 ++-- dist/phishing.html | 4 ++-- dist/privacy-policy.html | 4 ++-- 14 files changed, 27 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06c14a4b48..d8f997c407 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### Release v3.24.0 + ### New - Add C20 contract abi [#2122](https://github.com/kvhnuke/etherwallet/pull/2122) diff --git a/app/includes/header.tpl b/app/includes/header.tpl index 7aa41d4555..0ced62a2dd 100644 --- a/app/includes/header.tpl +++ b/app/includes/header.tpl @@ -100,18 +100,18 @@ @@if (site === 'mew' ) { MyEtherWallet -

3.23.1

+

3.24.0

} @@if (site === 'cx' ) { MyEtherWallet -

3.23.1

+

3.24.0

}
- + diff --git a/app/manifest.json b/app/manifest.json index 930f02e5f3..944b063797 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,6 +1,6 @@ { "name": "MyEtherWallet", - "version": "3.23.1", + "version": "3.24.0", "manifest_version": 2, "description": "MyEtherWallet Chrome Extension", "homepage_url": "https://www.myetherwallet.com/", diff --git a/chrome-extension/contest.html b/chrome-extension/contest.html index e25736ad3a..af8dbd0ee3 100644 --- a/chrome-extension/contest.html +++ b/chrome-extension/contest.html @@ -100,13 +100,13 @@ MyEtherWallet -

3.23.1

+

3.24.0

- + diff --git a/chrome-extension/cx-wallet.html b/chrome-extension/cx-wallet.html index 5ec8ec333f..3566186a65 100644 --- a/chrome-extension/cx-wallet.html +++ b/chrome-extension/cx-wallet.html @@ -83,12 +83,12 @@ MyEtherWallet -

3.23.1

+

3.24.0

- + diff --git a/chrome-extension/helpers.html b/chrome-extension/helpers.html index c376c8a5c1..631c6874f7 100644 --- a/chrome-extension/helpers.html +++ b/chrome-extension/helpers.html @@ -101,13 +101,13 @@ MyEtherWallet -

3.23.1

+

3.24.0

- + diff --git a/chrome-extension/manifest.json b/chrome-extension/manifest.json index 930f02e5f3..944b063797 100644 --- a/chrome-extension/manifest.json +++ b/chrome-extension/manifest.json @@ -1,6 +1,6 @@ { "name": "MyEtherWallet", - "version": "3.23.1", + "version": "3.24.0", "manifest_version": 2, "description": "MyEtherWallet Chrome Extension", "homepage_url": "https://www.myetherwallet.com/", diff --git a/chrome-extension/phishing.html b/chrome-extension/phishing.html index 4d01452977..445c4a8e04 100644 --- a/chrome-extension/phishing.html +++ b/chrome-extension/phishing.html @@ -100,13 +100,13 @@ MyEtherWallet -

3.23.1

+

3.24.0

- + diff --git a/chrome-extension/privacy-policy.html b/chrome-extension/privacy-policy.html index 44481af3a9..d85cfe32c3 100644 --- a/chrome-extension/privacy-policy.html +++ b/chrome-extension/privacy-policy.html @@ -100,13 +100,13 @@ MyEtherWallet -

3.23.1

+

3.24.0

- + diff --git a/dist/contest.html b/dist/contest.html index e25736ad3a..af8dbd0ee3 100644 --- a/dist/contest.html +++ b/dist/contest.html @@ -100,13 +100,13 @@ MyEtherWallet -

3.23.1

+

3.24.0

- + diff --git a/dist/helpers.html b/dist/helpers.html index c376c8a5c1..631c6874f7 100644 --- a/dist/helpers.html +++ b/dist/helpers.html @@ -101,13 +101,13 @@ MyEtherWallet -

3.23.1

+

3.24.0

- + diff --git a/dist/index.html b/dist/index.html index 36758e8b1c..76abe26cee 100644 --- a/dist/index.html +++ b/dist/index.html @@ -101,13 +101,13 @@ MyEtherWallet -

3.23.1

+

3.24.0

- + diff --git a/dist/phishing.html b/dist/phishing.html index 4d01452977..445c4a8e04 100644 --- a/dist/phishing.html +++ b/dist/phishing.html @@ -100,13 +100,13 @@ MyEtherWallet -

3.23.1

+

3.24.0

- + diff --git a/dist/privacy-policy.html b/dist/privacy-policy.html index 44481af3a9..d85cfe32c3 100644 --- a/dist/privacy-policy.html +++ b/dist/privacy-policy.html @@ -100,13 +100,13 @@ MyEtherWallet -

3.23.1

+

3.24.0

- + From 4aca35e8eec1633d6ec5c7c1bc9d82f87675e0da Mon Sep 17 00:00:00 2001 From: gamalielhere Date: Mon, 29 Oct 2018 15:15:48 -0700 Subject: [PATCH 3/3] Prepare for metamask breaking change --- app/scripts/controllers/decryptWalletCtrl.js | 386 +++++++++++++------ chrome-extension/js/etherwallet-master.js | 144 ++++--- dist/js/etherwallet-master.js | 144 ++++--- 3 files changed, 444 insertions(+), 230 deletions(-) diff --git a/app/scripts/controllers/decryptWalletCtrl.js b/app/scripts/controllers/decryptWalletCtrl.js index 94c27e06f9..74d7b5f07a 100644 --- a/app/scripts/controllers/decryptWalletCtrl.js +++ b/app/scripts/controllers/decryptWalletCtrl.js @@ -1,11 +1,11 @@ -'use strict'; +"use strict"; var decryptWalletCtrl = function($scope, $sce, walletService) { $scope.walletType = ""; $scope.requireFPass = $scope.requirePPass = $scope.showFDecrypt = $scope.showPDecrypt = $scope.showAOnly = $scope.showParityDecrypt = false; $scope.filePassword = ""; $scope.fileContent = ""; $scope.Validator = Validator; - $scope.isSSL = window.location.protocol == 'https:'; + $scope.isSSL = window.location.protocol == "https:"; $scope.ajaxReq = ajaxReq; $scope.nodeType = $scope.ajaxReq.type; $scope.HDWallet = { @@ -14,43 +14,43 @@ var decryptWalletCtrl = function($scope, $sce, walletService) { wallets: [], id: 0, hdk: null, - dPath: '', - defaultDPath: "m/44'/60'/0'/0", // first address: m/44'/60'/0'/0/0 - alternativeDPath: "m/44'/60'/0'", // first address: m/44'/60'/0/0 - customDPath: "m/44'/60'/1'/0", // first address: m/44'/60'/1'/0/0 - ledgerPath: "m/44'/60'/0'", // first address: m/44'/60'/0/0 + dPath: "", + defaultDPath: "m/44'/60'/0'/0", // first address: m/44'/60'/0'/0/0 + alternativeDPath: "m/44'/60'/0'", // first address: m/44'/60'/0/0 + customDPath: "m/44'/60'/1'/0", // first address: m/44'/60'/1'/0/0 + ledgerPath: "m/44'/60'/0'", // first address: m/44'/60'/0/0 ledgerClassicPath: "m/44'/60'/160720'/0'", // first address: m/44'/60'/160720'/0/0 - trezorTestnetPath: "m/44'/1'/0'/0", // first address: m/44'/1'/0'/0/0 - trezorClassicPath: "m/44'/61'/0'/0", // first address: m/44'/61'/0'/0/0 - trezorPath: "m/44'/60'/0'/0", // first address: m/44'/60'/0'/0/0 - hwUbqPath: "m/44'/108'/0'/0", // first address: m/44'/40'/0'/0/0 - hwExpansePath: "m/44'/40'/0'/0", // first address: m/44'/40'/0'/0/0 - hwEllaismPath: "m/44'/163'/0'/0", // first address: m/44'/163'/0'/0/0 - hwPirlPath: "m/44'/164'/0'/0", // first address: m/44'/164'/0'/0/0 - hwEtherGemPath: "m/44'/1987'/0'/0", // first address: m/44'/1987'/0'/0/0 - hwCallistoPath: "m/44'/820'/0'/0", // first address: m/44'/820'/0'/0/0 - hwSocialPath: "m/44'/1128'/0'/0", // first address: m/44'/1128'/0'/0/0 - hwMusicoinPath: "m/44'/184'/0'/0", // first address: m/44'/184'/0'/0/0 - singularDTVPath: "m/0'/0'/0'", // first address: m/0'/0'/0'/0 - goPath: "m/44'/6060'/0'/0", // first address: m/44'/6060'/0'/0/0 - hwEOSClassicPath: "m/44'/2018'/0'/0", // first address: m/44'/2018'/0'/0/0 - hwAkromaPath: "m/44'/200625'/0'/0", // first address: m/44'/200625'/0'/0/0 - hwESNetworkPath: "m/44'/31102'/0'/0", // first address: m/44'/31102'/0'/0/0 - hwEther1Path: "m/44'/1313114'/0'/0", // first address: m/44'/1313114'/0'/0/0 - hwAtheiosPath: "m/44'/1620'/0'/0", // first address: m/44'/1620'/0'/0/0 - hwIolitePath: "m/44'/1171337'/0'/0", // first address: m/44'/1171337'/0'/0/0 - tomoPath: "m/44'/889'/0'/0", // first address: m/44'/889'/0'/0/0 - hwMixPath: "m/44'/76'/0'/0", // first address: m/44'/76'/0'/0/0 + trezorTestnetPath: "m/44'/1'/0'/0", // first address: m/44'/1'/0'/0/0 + trezorClassicPath: "m/44'/61'/0'/0", // first address: m/44'/61'/0'/0/0 + trezorPath: "m/44'/60'/0'/0", // first address: m/44'/60'/0'/0/0 + hwUbqPath: "m/44'/108'/0'/0", // first address: m/44'/40'/0'/0/0 + hwExpansePath: "m/44'/40'/0'/0", // first address: m/44'/40'/0'/0/0 + hwEllaismPath: "m/44'/163'/0'/0", // first address: m/44'/163'/0'/0/0 + hwPirlPath: "m/44'/164'/0'/0", // first address: m/44'/164'/0'/0/0 + hwEtherGemPath: "m/44'/1987'/0'/0", // first address: m/44'/1987'/0'/0/0 + hwCallistoPath: "m/44'/820'/0'/0", // first address: m/44'/820'/0'/0/0 + hwSocialPath: "m/44'/1128'/0'/0", // first address: m/44'/1128'/0'/0/0 + hwMusicoinPath: "m/44'/184'/0'/0", // first address: m/44'/184'/0'/0/0 + singularDTVPath: "m/0'/0'/0'", // first address: m/0'/0'/0'/0 + goPath: "m/44'/6060'/0'/0", // first address: m/44'/6060'/0'/0/0 + hwEOSClassicPath: "m/44'/2018'/0'/0", // first address: m/44'/2018'/0'/0/0 + hwAkromaPath: "m/44'/200625'/0'/0", // first address: m/44'/200625'/0'/0/0 + hwESNetworkPath: "m/44'/31102'/0'/0", // first address: m/44'/31102'/0'/0/0 + hwEther1Path: "m/44'/1313114'/0'/0", // first address: m/44'/1313114'/0'/0/0 + hwAtheiosPath: "m/44'/1620'/0'/0", // first address: m/44'/1620'/0'/0/0 + hwIolitePath: "m/44'/1171337'/0'/0", // first address: m/44'/1171337'/0'/0/0 + tomoPath: "m/44'/889'/0'/0", // first address: m/44'/889'/0'/0/0 + hwMixPath: "m/44'/76'/0'/0" // first address: m/44'/76'/0'/0/0 }; $scope.canUseMewConnect = MewConnectEth.checkWebRTCAvailable(); $scope.mewConnectMayFail = MewConnectEth.checkBrowser(); $scope.HDWallet.dPath = $scope.HDWallet.defaultDPath; - $scope.mnemonicModel = new Modal(document.getElementById('mnemonicModel')); - $scope.$watch('ajaxReq.type', function() { + $scope.mnemonicModel = new Modal(document.getElementById("mnemonicModel")); + $scope.$watch("ajaxReq.type", function() { $scope.nodeType = $scope.ajaxReq.type; $scope.setdPath(); }); - $scope.$watch('walletType', function() { + $scope.$watch("walletType", function() { $scope.setdPath(); }); $scope.setdPath = function() { @@ -244,30 +244,38 @@ var decryptWalletCtrl = function($scope, $sce, walletService) { $scope.HDWallet.dPath = $scope.HDWallet.defaultDPath; } } - } + }; $scope.onHDDPathChange = function(password = $scope.mnemonicPassword) { $scope.HDWallet.numWallets = 0; - if ($scope.walletType == 'pastemnemonic') { - $scope.HDWallet.hdk = hd.HDKey.fromMasterSeed(hd.bip39.mnemonicToSeed($scope.manualmnemonic.trim(), password)); - $scope.setHDAddresses($scope.HDWallet.numWallets, $scope.HDWallet.walletsPerDialog); - } else if ($scope.walletType == 'ledger') { + if ($scope.walletType == "pastemnemonic") { + $scope.HDWallet.hdk = hd.HDKey.fromMasterSeed( + hd.bip39.mnemonicToSeed($scope.manualmnemonic.trim(), password) + ); + $scope.setHDAddresses( + $scope.HDWallet.numWallets, + $scope.HDWallet.walletsPerDialog + ); + } else if ($scope.walletType == "ledger") { $scope.scanLedger(); - } else if ($scope.walletType == 'trezor') { + } else if ($scope.walletType == "trezor") { $scope.scanTrezor(); - } else if ($scope.walletType == 'digitalBitbox') { + } else if ($scope.walletType == "digitalBitbox") { $scope.scanDigitalBitbox(); - } else if ($scope.walletType == 'secalot') { + } else if ($scope.walletType == "secalot") { $scope.scanSecalot(); - } else if ($scope.walletType == 'mewConnect') { - $scope.scanMewConnect() + } else if ($scope.walletType == "mewConnect") { + $scope.scanMewConnect(); } - } + }; $scope.onCustomHDDPathChange = function() { $scope.HDWallet.dPath = $scope.HDWallet.customDPath; $scope.onHDDPathChange(); - } + }; $scope.showContent = function($fileContent) { - $scope.notifier.info(globalFuncs.successMsgs[4] + document.getElementById('fselector').files[0].name); + $scope.notifier.info( + globalFuncs.successMsgs[4] + + document.getElementById("fselector").files[0].name + ); try { $scope.requireFPass = Wallet.walletRequirePass($fileContent); $scope.showFDecrypt = !$scope.requireFPass; @@ -278,7 +286,7 @@ var decryptWalletCtrl = function($scope, $sce, walletService) { }; $scope.openFileDialog = function($fileContent) { $scope.showAOnly = false; - document.getElementById('fselector').click(); + document.getElementById("fselector").click(); }; $scope.onFilePassChange = function() { $scope.showAOnly = false; @@ -288,7 +296,8 @@ var decryptWalletCtrl = function($scope, $sce, walletService) { $scope.showAOnly = false; const manualprivkey = fixPkey($scope.manualprivkey); - $scope.requirePPass = manualprivkey.length == 128 || manualprivkey.length == 132; + $scope.requirePPass = + manualprivkey.length == 128 || manualprivkey.length == 132; $scope.showPDecrypt = manualprivkey.length == 64; }; $scope.onPrivKeyPassChange = function() { @@ -310,73 +319,157 @@ var decryptWalletCtrl = function($scope, $sce, walletService) { $scope.setHDAddresses = function(start, limit) { $scope.HDWallet.wallets = []; for (var i = start; i < start + limit; i++) { - $scope.HDWallet.wallets.push(new Wallet($scope.HDWallet.hdk.derive($scope.HDWallet.dPath + "/" + i)._privateKey)); - $scope.HDWallet.wallets[$scope.HDWallet.wallets.length - 1].setBalance(false); + $scope.HDWallet.wallets.push( + new Wallet( + $scope.HDWallet.hdk.derive( + $scope.HDWallet.dPath + "/" + i + )._privateKey + ) + ); + $scope.HDWallet.wallets[$scope.HDWallet.wallets.length - 1].setBalance( + false + ); } $scope.HDWallet.id = 0; $scope.HDWallet.numWallets = start + limit; - } + }; $scope.setHDAddressesHWWallet = function(start, limit, ledger) { $scope.HDWallet.wallets = []; for (var i = start; i < start + limit; i++) { var derivedKey = $scope.HDWallet.hdk.derive("m/" + i); if ($scope.walletType == "ledger") { - $scope.HDWallet.wallets.push(new Wallet(undefined, derivedKey.publicKey, $scope.HDWallet.dPath + "/" + i, $scope.walletType, $scope.ledger)); + $scope.HDWallet.wallets.push( + new Wallet( + undefined, + derivedKey.publicKey, + $scope.HDWallet.dPath + "/" + i, + $scope.walletType, + $scope.ledger + ) + ); } else if ($scope.walletType == "digitalBitbox") { - $scope.HDWallet.wallets.push(new Wallet(undefined, derivedKey.publicKey, $scope.HDWallet.dPath + "/" + i, $scope.walletType, $scope.digitalBitbox)); + $scope.HDWallet.wallets.push( + new Wallet( + undefined, + derivedKey.publicKey, + $scope.HDWallet.dPath + "/" + i, + $scope.walletType, + $scope.digitalBitbox + ) + ); } else if ($scope.walletType == "secalot") { - $scope.HDWallet.wallets.push(new Wallet(undefined, derivedKey.publicKey, $scope.HDWallet.dPath + "/" + i, $scope.walletType, $scope.secalot)); - } else if ($scope.walletType == 'mewConnect') { - $scope.HDWallet.wallets.push(new Wallet(undefined, derivedKey.publicKey, $scope.HDWallet.dPath + '/' + i, $scope.walletType, $scope.mewConnect)) + $scope.HDWallet.wallets.push( + new Wallet( + undefined, + derivedKey.publicKey, + $scope.HDWallet.dPath + "/" + i, + $scope.walletType, + $scope.secalot + ) + ); + } else if ($scope.walletType == "mewConnect") { + $scope.HDWallet.wallets.push( + new Wallet( + undefined, + derivedKey.publicKey, + $scope.HDWallet.dPath + "/" + i, + $scope.walletType, + $scope.mewConnect + ) + ); } else { - $scope.HDWallet.wallets.push(new Wallet(undefined, derivedKey.publicKey, $scope.HDWallet.dPath + "/" + i, $scope.walletType)); + $scope.HDWallet.wallets.push( + new Wallet( + undefined, + derivedKey.publicKey, + $scope.HDWallet.dPath + "/" + i, + $scope.walletType + ) + ); } - $scope.HDWallet.wallets[$scope.HDWallet.wallets.length - 1].type = "addressOnly"; - $scope.HDWallet.wallets[$scope.HDWallet.wallets.length - 1].setBalance(false); + $scope.HDWallet.wallets[$scope.HDWallet.wallets.length - 1].type = + "addressOnly"; + $scope.HDWallet.wallets[$scope.HDWallet.wallets.length - 1].setBalance( + false + ); } $scope.HDWallet.id = 0; $scope.HDWallet.numWallets = start + limit; - } + }; $scope.AddRemoveHDAddresses = function(isAdd) { - if ($scope.walletType == "ledger" || $scope.walletType == "trezor" || $scope.walletType == "digitalBitbox" || $scope.walletType == "secalot" || $scope.walletType == 'mewConnect') { - if (isAdd) $scope.setHDAddressesHWWallet($scope.HDWallet.numWallets, $scope.HDWallet.walletsPerDialog); - else $scope.setHDAddressesHWWallet($scope.HDWallet.numWallets - 2 * $scope.HDWallet.walletsPerDialog, $scope.HDWallet.walletsPerDialog); + if ( + $scope.walletType == "ledger" || + $scope.walletType == "trezor" || + $scope.walletType == "digitalBitbox" || + $scope.walletType == "secalot" || + $scope.walletType == "mewConnect" + ) { + if (isAdd) + $scope.setHDAddressesHWWallet( + $scope.HDWallet.numWallets, + $scope.HDWallet.walletsPerDialog + ); + else + $scope.setHDAddressesHWWallet( + $scope.HDWallet.numWallets - 2 * $scope.HDWallet.walletsPerDialog, + $scope.HDWallet.walletsPerDialog + ); } else { - if (isAdd) $scope.setHDAddresses($scope.HDWallet.numWallets, $scope.HDWallet.walletsPerDialog); - else $scope.setHDAddresses($scope.HDWallet.numWallets - 2 * $scope.HDWallet.walletsPerDialog, $scope.HDWallet.walletsPerDialog); + if (isAdd) + $scope.setHDAddresses( + $scope.HDWallet.numWallets, + $scope.HDWallet.walletsPerDialog + ); + else + $scope.setHDAddresses( + $scope.HDWallet.numWallets - 2 * $scope.HDWallet.walletsPerDialog, + $scope.HDWallet.walletsPerDialog + ); } - } + }; $scope.setHDWallet = function() { - walletService.wallet = $scope.wallet = $scope.HDWallet.wallets[$scope.HDWallet.id]; + walletService.wallet = $scope.wallet = + $scope.HDWallet.wallets[$scope.HDWallet.id]; $scope.mnemonicModel.close(); $scope.notifier.info(globalFuncs.successMsgs[1]); $scope.wallet.type = "default"; - } + }; $scope.decryptWallet = function() { $scope.wallet = null; try { if ($scope.showPDecrypt && $scope.requirePPass) { - $scope.wallet = Wallet.fromMyEtherWalletKey($scope.manualprivkey, $scope.privPassword); + $scope.wallet = Wallet.fromMyEtherWalletKey( + $scope.manualprivkey, + $scope.privPassword + ); walletService.password = $scope.privPassword; } else if ($scope.showPDecrypt && !$scope.requirePPass) { - let privKey = $scope.manualprivkey.indexOf("0x") === 0 ? $scope.manualprivkey : "0x" + $scope.manualprivkey; + let privKey = + $scope.manualprivkey.indexOf("0x") === 0 + ? $scope.manualprivkey + : "0x" + $scope.manualprivkey; if (!$scope.Validator.isValidHex($scope.manualprivkey)) { $scope.notifier.danger(globalFuncs.errorMsgs[37]); return; - } else if(!ethUtil.isValidPrivate(ethUtil.toBuffer(privKey))) { + } else if (!ethUtil.isValidPrivate(ethUtil.toBuffer(privKey))) { $scope.wallet = null; $scope.notifier.danger(globalFuncs.errorMsgs[40]); return; } else { $scope.wallet = new Wallet(fixPkey($scope.manualprivkey)); - walletService.password = ''; + walletService.password = ""; } } else if ($scope.showFDecrypt) { - $scope.wallet = Wallet.getWalletFromPrivKeyFile($scope.fileContent, $scope.filePassword); + $scope.wallet = Wallet.getWalletFromPrivKeyFile( + $scope.fileContent, + $scope.filePassword + ); walletService.password = $scope.filePassword; } else if ($scope.showMDecrypt) { - $scope.mnemonicModel = new Modal(document.getElementById('mnemonicModel')); + $scope.mnemonicModel = new Modal( + document.getElementById("mnemonicModel") + ); $scope.mnemonicModel.open(); $scope.onHDDPathChange($scope.mnemonicPassword); } else if ($scope.showParityDecrypt) { @@ -406,45 +499,61 @@ var decryptWalletCtrl = function($scope, $sce, walletService) { }, setBalance: tempWallet.setBalance, setTokens: tempWallet.setTokens - } + }; $scope.notifier.info(globalFuncs.successMsgs[1]); walletService.wallet = $scope.wallet; } - } + }; $scope.HWWalletCreate = function(publicKey, chainCode, walletType, path) { - $scope.mnemonicModel = new Modal(document.getElementById('mnemonicModel')); + $scope.mnemonicModel = new Modal(document.getElementById("mnemonicModel")); $scope.mnemonicModel.open(); $scope.HDWallet.hdk = new hd.HDKey(); - $scope.HDWallet.hdk.publicKey = new Buffer(publicKey, 'hex'); - $scope.HDWallet.hdk.chainCode = new Buffer(chainCode, 'hex'); + $scope.HDWallet.hdk.publicKey = new Buffer(publicKey, "hex"); + $scope.HDWallet.hdk.chainCode = new Buffer(chainCode, "hex"); $scope.HDWallet.numWallets = 0; $scope.HDWallet.dPath = path; - $scope.setHDAddressesHWWallet($scope.HDWallet.numWallets, $scope.HDWallet.walletsPerDialog, walletType); + $scope.setHDAddressesHWWallet( + $scope.HDWallet.numWallets, + $scope.HDWallet.walletsPerDialog, + walletType + ); walletService.wallet = null; - } + }; $scope.ledgerCallback = function(result, error) { if (typeof result != "undefined") { - $scope.HWWalletCreate(result['publicKey'], result['chainCode'], "ledger", $scope.getLedgerPath()); - } - else { + $scope.HWWalletCreate( + result["publicKey"], + result["chainCode"], + "ledger", + $scope.getLedgerPath() + ); + } else { $scope.ledgerError = true; $scope.ledgerErrorString = error; $scope.$apply(); } - } + }; $scope.digitalBitboxCallback = function(result, error) { - $scope.HDWallet.digitalBitboxSecret = ''; + $scope.HDWallet.digitalBitboxSecret = ""; if (typeof result != "undefined") { - $scope.HWWalletCreate(result['publicKey'], result['chainCode'], "digitalBitbox", $scope.HDWallet.dPath); - } else - $scope.notifier.danger(error); - } + $scope.HWWalletCreate( + result["publicKey"], + result["chainCode"], + "digitalBitbox", + $scope.HDWallet.dPath + ); + } else $scope.notifier.danger(error); + }; $scope.secalotCallback = function(result, error) { if (typeof result != "undefined") { - $scope.HWWalletCreate(result['publicKey'], result['chainCode'], "secalot", $scope.HDWallet.dPath); - } else - $scope.notifier.danger(error); - } + $scope.HWWalletCreate( + result["publicKey"], + result["chainCode"], + "secalot", + $scope.HDWallet.dPath + ); + } else $scope.notifier.danger(error); + }; $scope.scanLedger = function() { $scope.ledgerError = false; $scope.ledger = new Ledger3("w0w"); @@ -454,7 +563,10 @@ var decryptWalletCtrl = function($scope, $sce, walletService) { }; $scope.scanDigitalBitbox = function() { $scope.digitalBitbox = new DigitalBitboxUsb(); - var app = new DigitalBitboxEth($scope.digitalBitbox, $scope.HDWallet.digitalBitboxSecret); + var app = new DigitalBitboxEth( + $scope.digitalBitbox, + $scope.HDWallet.digitalBitboxSecret + ); var path = $scope.HDWallet.dPath; app.getAddress(path, $scope.digitalBitboxCallback); }; @@ -507,24 +619,24 @@ var decryptWalletCtrl = function($scope, $sce, walletService) { $scope.mewConnect = MewConnect.init(); - Reflect.defineProperty(MewConnect, 'instance', { + Reflect.defineProperty(MewConnect, "instance", { value: $scope.mewConnect }); - $scope.$on('$destroy', function() { + $scope.$on("$destroy", function() { globalFuncs.MEWconnectStatus.newTabOpenedTrigger(false); globalFuncs.MEWconnectStatus.update(0); $scope.mewConnect.disconnectRTC(); if (MewConnect.instance) { - Reflect.deleteProperty(MewConnect, 'instance'); + Reflect.deleteProperty(MewConnect, "instance"); } }); - $scope.mewConnect.on('codeDisplay', codeDisplay); - $scope.mewConnect.on('RtcConnectedEvent', rtcConnected); - $scope.mewConnect.on('RtcClosedEvent', rtcClosed); - $scope.mewConnect.on('RtcDisconnectEvent', rtcDisconnected); - $scope.mewConnect.on('address', makeWallet); + $scope.mewConnect.on("codeDisplay", codeDisplay); + $scope.mewConnect.on("RtcConnectedEvent", rtcConnected); + $scope.mewConnect.on("RtcClosedEvent", rtcClosed); + $scope.mewConnect.on("RtcDisconnectEvent", rtcDisconnected); + $scope.mewConnect.on("address", makeWallet); app.setMewConnect($scope.mewConnect); app.signalerConnect(); @@ -538,8 +650,8 @@ var decryptWalletCtrl = function($scope, $sce, walletService) { globalFuncs.MEWconnectStatus.update(2); if ($scope.mewConnectionStatus !== 2) { $scope.connectionCodeTimeout = null; - uiFuncs.notifier.info('Connected Via MEWconnect'); - $scope.mewConnect.sendRtcMessage('address', ''); + uiFuncs.notifier.info("Connected Via MEWconnect"); + $scope.mewConnect.sendRtcMessage("address", ""); $scope.mewConnectionStatus = 2; } } @@ -550,7 +662,7 @@ var decryptWalletCtrl = function($scope, $sce, walletService) { $scope.mewConnectionStatus = 4; $scope.wallet = null; walletService.wallet = null; - uiFuncs.notifier.danger('Disconnected', 10000); + uiFuncs.notifier.danger("Disconnected", 10000); if (!$scope.$$phase) $scope.$apply(); } } @@ -561,7 +673,7 @@ var decryptWalletCtrl = function($scope, $sce, walletService) { $scope.mewConnectionStatus = 4; $scope.wallet = null; walletService.wallet = null; - uiFuncs.notifier.danger('Disconnected', 10000); + uiFuncs.notifier.danger("Disconnected", 10000); if (!$scope.$$phase) $scope.$apply(); } } @@ -592,40 +704,66 @@ var decryptWalletCtrl = function($scope, $sce, walletService) { //= ================ Mew Connect (end)============================== $scope.getLedgerPath = function() { return $scope.HDWallet.dPath; - } + }; $scope.getTrezorPath = function() { return $scope.HDWallet.dPath; }; - $scope.scanMetamask = function() { - if (window.web3 === undefined) { - window.addEventListener('message', ({data}) => { - if (data && data.type && data.type === 'ETHEREUM_PROVIDER_SUCCESS') { - window.web3 = new Web3(ethereum); - } - }); - window.postMessage({ type: 'ETHEREUM_PROVIDER_REQUEST', web3: true }, '*'); - } - window.web3.eth.getAccounts(function (err, accounts) { - if (err) $scope.notifier.danger(err + '. Are you sure you are on a secure (SSL / HTTPS) connection?') + + function setWeb3Wallet() { + window.web3.eth.getAccounts(function(err, accounts) { + if (err) + $scope.notifier.danger( + err + ". Are you sure you are on a secure (SSL / HTTPS) connection?" + ); if (!accounts.length) { - $scope.notifier.danger('Could not read your accounts from MetaMask. Try unlocking it.'); + $scope.notifier.danger( + "Could not read your accounts from MetaMask. Try unlocking it." + ); return; } - var address = accounts[0] - var addressBuffer = Buffer.from(address.slice(2), 'hex'); + var address = accounts[0]; + var addressBuffer = Buffer.from(address.slice(2), "hex"); var wallet = new Web3Wallet(addressBuffer); wallet.setBalance(false); // set wallet - $scope.wallet = wallet - walletService.wallet = wallet - $scope.notifier.info(globalFuncs.successMsgs[6]) + $scope.wallet = wallet; + walletService.wallet = wallet; + $scope.notifier.info(globalFuncs.successMsgs[6]); $scope.wallet.type = "default"; }); + } + $scope.scanMetamask = async function() { + // if (window.web3 === undefined) { + // window.addEventListener('message', ({data}) => { + // if (data && data.type && data.type === 'ETHEREUM_PROVIDER_SUCCESS') { + // window.web3 = new Web3(ethereum); + // } + // }); + // window.postMessage({ type: 'ETHEREUM_PROVIDER_REQUEST', web3: true }, '*'); + // } + if (window.ethereum) { + window.web3 = new Web3(ethereum); + try { + await ethereum.enable(); + setWeb3Wallet(); + } catch (e) { + $scope.notifier.danger( + "Could not read your accounts from MetaMask. Try unlocking it." + ); + } + } else if (window.web3) { + window.web3 = new Web3(web3.currentProvider); + setWeb3Wallet(); + } else { + $scope.notifier.danger( + "Non-Ethereum browser detected. You should consider trying MetaMask!" + ); + } }; // helper function that removes 0x prefix from strings function fixPkey(key) { - if (key.indexOf('0x') === 0) { + if (key.indexOf("0x") === 0) { return key.slice(2); } return key; diff --git a/chrome-extension/js/etherwallet-master.js b/chrome-extension/js/etherwallet-master.js index 93c0bae2e8..386299ab32 100644 --- a/chrome-extension/js/etherwallet-master.js +++ b/chrome-extension/js/etherwallet-master.js @@ -4772,7 +4772,9 @@ module.exports = contractsCtrl; },{}],35:[function(require,module,exports){ (function (Buffer){ -'use strict'; +"use strict"; + +function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) { $scope.walletType = ""; @@ -4780,7 +4782,7 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.filePassword = ""; $scope.fileContent = ""; $scope.Validator = Validator; - $scope.isSSL = window.location.protocol == 'https:'; + $scope.isSSL = window.location.protocol == "https:"; $scope.ajaxReq = ajaxReq; $scope.nodeType = $scope.ajaxReq.type; $scope.HDWallet = { @@ -4789,7 +4791,7 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) wallets: [], id: 0, hdk: null, - dPath: '', + dPath: "", defaultDPath: "m/44'/60'/0'/0", // first address: m/44'/60'/0'/0/0 alternativeDPath: "m/44'/60'/0'", // first address: m/44'/60'/0/0 customDPath: "m/44'/60'/1'/0", // first address: m/44'/60'/1'/0/0 @@ -4820,12 +4822,12 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.canUseMewConnect = MewConnectEth.checkWebRTCAvailable(); $scope.mewConnectMayFail = MewConnectEth.checkBrowser(); $scope.HDWallet.dPath = $scope.HDWallet.defaultDPath; - $scope.mnemonicModel = new Modal(document.getElementById('mnemonicModel')); - $scope.$watch('ajaxReq.type', function () { + $scope.mnemonicModel = new Modal(document.getElementById("mnemonicModel")); + $scope.$watch("ajaxReq.type", function () { $scope.nodeType = $scope.ajaxReq.type; $scope.setdPath(); }); - $scope.$watch('walletType', function () { + $scope.$watch("walletType", function () { $scope.setdPath(); }); $scope.setdPath = function () { @@ -5024,18 +5026,18 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) var password = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $scope.mnemonicPassword; $scope.HDWallet.numWallets = 0; - if ($scope.walletType == 'pastemnemonic') { + if ($scope.walletType == "pastemnemonic") { $scope.HDWallet.hdk = hd.HDKey.fromMasterSeed(hd.bip39.mnemonicToSeed($scope.manualmnemonic.trim(), password)); $scope.setHDAddresses($scope.HDWallet.numWallets, $scope.HDWallet.walletsPerDialog); - } else if ($scope.walletType == 'ledger') { + } else if ($scope.walletType == "ledger") { $scope.scanLedger(); - } else if ($scope.walletType == 'trezor') { + } else if ($scope.walletType == "trezor") { $scope.scanTrezor(); - } else if ($scope.walletType == 'digitalBitbox') { + } else if ($scope.walletType == "digitalBitbox") { $scope.scanDigitalBitbox(); - } else if ($scope.walletType == 'secalot') { + } else if ($scope.walletType == "secalot") { $scope.scanSecalot(); - } else if ($scope.walletType == 'mewConnect') { + } else if ($scope.walletType == "mewConnect") { $scope.scanMewConnect(); } }; @@ -5044,7 +5046,7 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.onHDDPathChange(); }; $scope.showContent = function ($fileContent) { - $scope.notifier.info(globalFuncs.successMsgs[4] + document.getElementById('fselector').files[0].name); + $scope.notifier.info(globalFuncs.successMsgs[4] + document.getElementById("fselector").files[0].name); try { $scope.requireFPass = Wallet.walletRequirePass($fileContent); $scope.showFDecrypt = !$scope.requireFPass; @@ -5055,7 +5057,7 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) }; $scope.openFileDialog = function ($fileContent) { $scope.showAOnly = false; - document.getElementById('fselector').click(); + document.getElementById("fselector").click(); }; $scope.onFilePassChange = function () { $scope.showAOnly = false; @@ -5102,8 +5104,8 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.HDWallet.wallets.push(new Wallet(undefined, derivedKey.publicKey, $scope.HDWallet.dPath + "/" + i, $scope.walletType, $scope.digitalBitbox)); } else if ($scope.walletType == "secalot") { $scope.HDWallet.wallets.push(new Wallet(undefined, derivedKey.publicKey, $scope.HDWallet.dPath + "/" + i, $scope.walletType, $scope.secalot)); - } else if ($scope.walletType == 'mewConnect') { - $scope.HDWallet.wallets.push(new Wallet(undefined, derivedKey.publicKey, $scope.HDWallet.dPath + '/' + i, $scope.walletType, $scope.mewConnect)); + } else if ($scope.walletType == "mewConnect") { + $scope.HDWallet.wallets.push(new Wallet(undefined, derivedKey.publicKey, $scope.HDWallet.dPath + "/" + i, $scope.walletType, $scope.mewConnect)); } else { $scope.HDWallet.wallets.push(new Wallet(undefined, derivedKey.publicKey, $scope.HDWallet.dPath + "/" + i, $scope.walletType)); } @@ -5114,7 +5116,7 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.HDWallet.numWallets = start + limit; }; $scope.AddRemoveHDAddresses = function (isAdd) { - if ($scope.walletType == "ledger" || $scope.walletType == "trezor" || $scope.walletType == "digitalBitbox" || $scope.walletType == "secalot" || $scope.walletType == 'mewConnect') { + if ($scope.walletType == "ledger" || $scope.walletType == "trezor" || $scope.walletType == "digitalBitbox" || $scope.walletType == "secalot" || $scope.walletType == "mewConnect") { if (isAdd) $scope.setHDAddressesHWWallet($scope.HDWallet.numWallets, $scope.HDWallet.walletsPerDialog);else $scope.setHDAddressesHWWallet($scope.HDWallet.numWallets - 2 * $scope.HDWallet.walletsPerDialog, $scope.HDWallet.walletsPerDialog); } else { if (isAdd) $scope.setHDAddresses($scope.HDWallet.numWallets, $scope.HDWallet.walletsPerDialog);else $scope.setHDAddresses($scope.HDWallet.numWallets - 2 * $scope.HDWallet.walletsPerDialog, $scope.HDWallet.walletsPerDialog); @@ -5144,13 +5146,13 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) return; } else { $scope.wallet = new Wallet(fixPkey($scope.manualprivkey)); - walletService.password = ''; + walletService.password = ""; } } else if ($scope.showFDecrypt) { $scope.wallet = Wallet.getWalletFromPrivKeyFile($scope.fileContent, $scope.filePassword); walletService.password = $scope.filePassword; } else if ($scope.showMDecrypt) { - $scope.mnemonicModel = new Modal(document.getElementById('mnemonicModel')); + $scope.mnemonicModel = new Modal(document.getElementById("mnemonicModel")); $scope.mnemonicModel.open(); $scope.onHDDPathChange($scope.mnemonicPassword); } else if ($scope.showParityDecrypt) { @@ -5186,11 +5188,11 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) } }; $scope.HWWalletCreate = function (publicKey, chainCode, walletType, path) { - $scope.mnemonicModel = new Modal(document.getElementById('mnemonicModel')); + $scope.mnemonicModel = new Modal(document.getElementById("mnemonicModel")); $scope.mnemonicModel.open(); $scope.HDWallet.hdk = new hd.HDKey(); - $scope.HDWallet.hdk.publicKey = new Buffer(publicKey, 'hex'); - $scope.HDWallet.hdk.chainCode = new Buffer(chainCode, 'hex'); + $scope.HDWallet.hdk.publicKey = new Buffer(publicKey, "hex"); + $scope.HDWallet.hdk.chainCode = new Buffer(chainCode, "hex"); $scope.HDWallet.numWallets = 0; $scope.HDWallet.dPath = path; $scope.setHDAddressesHWWallet($scope.HDWallet.numWallets, $scope.HDWallet.walletsPerDialog, walletType); @@ -5198,7 +5200,7 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) }; $scope.ledgerCallback = function (result, error) { if (typeof result != "undefined") { - $scope.HWWalletCreate(result['publicKey'], result['chainCode'], "ledger", $scope.getLedgerPath()); + $scope.HWWalletCreate(result["publicKey"], result["chainCode"], "ledger", $scope.getLedgerPath()); } else { $scope.ledgerError = true; $scope.ledgerErrorString = error; @@ -5206,14 +5208,14 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) } }; $scope.digitalBitboxCallback = function (result, error) { - $scope.HDWallet.digitalBitboxSecret = ''; + $scope.HDWallet.digitalBitboxSecret = ""; if (typeof result != "undefined") { - $scope.HWWalletCreate(result['publicKey'], result['chainCode'], "digitalBitbox", $scope.HDWallet.dPath); + $scope.HWWalletCreate(result["publicKey"], result["chainCode"], "digitalBitbox", $scope.HDWallet.dPath); } else $scope.notifier.danger(error); }; $scope.secalotCallback = function (result, error) { if (typeof result != "undefined") { - $scope.HWWalletCreate(result['publicKey'], result['chainCode'], "secalot", $scope.HDWallet.dPath); + $scope.HWWalletCreate(result["publicKey"], result["chainCode"], "secalot", $scope.HDWallet.dPath); } else $scope.notifier.danger(error); }; $scope.scanLedger = function () { @@ -5268,24 +5270,24 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.mewConnect = MewConnect.init(); - Reflect.defineProperty(MewConnect, 'instance', { + Reflect.defineProperty(MewConnect, "instance", { value: $scope.mewConnect }); - $scope.$on('$destroy', function () { + $scope.$on("$destroy", function () { globalFuncs.MEWconnectStatus.newTabOpenedTrigger(false); globalFuncs.MEWconnectStatus.update(0); $scope.mewConnect.disconnectRTC(); if (MewConnect.instance) { - Reflect.deleteProperty(MewConnect, 'instance'); + Reflect.deleteProperty(MewConnect, "instance"); } }); - $scope.mewConnect.on('codeDisplay', codeDisplay); - $scope.mewConnect.on('RtcConnectedEvent', rtcConnected); - $scope.mewConnect.on('RtcClosedEvent', rtcClosed); - $scope.mewConnect.on('RtcDisconnectEvent', rtcDisconnected); - $scope.mewConnect.on('address', makeWallet); + $scope.mewConnect.on("codeDisplay", codeDisplay); + $scope.mewConnect.on("RtcConnectedEvent", rtcConnected); + $scope.mewConnect.on("RtcClosedEvent", rtcClosed); + $scope.mewConnect.on("RtcDisconnectEvent", rtcDisconnected); + $scope.mewConnect.on("address", makeWallet); app.setMewConnect($scope.mewConnect); app.signalerConnect(); @@ -5299,8 +5301,8 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) globalFuncs.MEWconnectStatus.update(2); if ($scope.mewConnectionStatus !== 2) { $scope.connectionCodeTimeout = null; - uiFuncs.notifier.info('Connected Via MEWconnect'); - $scope.mewConnect.sendRtcMessage('address', ''); + uiFuncs.notifier.info("Connected Via MEWconnect"); + $scope.mewConnect.sendRtcMessage("address", ""); $scope.mewConnectionStatus = 2; } } @@ -5311,7 +5313,7 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.mewConnectionStatus = 4; $scope.wallet = null; walletService.wallet = null; - uiFuncs.notifier.danger('Disconnected', 10000); + uiFuncs.notifier.danger("Disconnected", 10000); if (!$scope.$$phase) $scope.$apply(); } } @@ -5322,7 +5324,7 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.mewConnectionStatus = 4; $scope.wallet = null; walletService.wallet = null; - uiFuncs.notifier.danger('Disconnected', 10000); + uiFuncs.notifier.danger("Disconnected", 10000); if (!$scope.$$phase) $scope.$apply(); } } @@ -5357,25 +5359,16 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.getTrezorPath = function () { return $scope.HDWallet.dPath; }; - $scope.scanMetamask = function () { - if (window.web3 === undefined) { - window.addEventListener('message', function (_ref2) { - var data = _ref2.data; - if (data && data.type && data.type === 'ETHEREUM_PROVIDER_SUCCESS') { - window.web3 = new Web3(ethereum); - } - }); - window.postMessage({ type: 'ETHEREUM_PROVIDER_REQUEST', web3: true }, '*'); - } + function setWeb3Wallet() { window.web3.eth.getAccounts(function (err, accounts) { - if (err) $scope.notifier.danger(err + '. Are you sure you are on a secure (SSL / HTTPS) connection?'); + if (err) $scope.notifier.danger(err + ". Are you sure you are on a secure (SSL / HTTPS) connection?"); if (!accounts.length) { - $scope.notifier.danger('Could not read your accounts from MetaMask. Try unlocking it.'); + $scope.notifier.danger("Could not read your accounts from MetaMask. Try unlocking it."); return; } var address = accounts[0]; - var addressBuffer = Buffer.from(address.slice(2), 'hex'); + var addressBuffer = Buffer.from(address.slice(2), "hex"); var wallet = new Web3Wallet(addressBuffer); wallet.setBalance(false); // set wallet @@ -5384,11 +5377,56 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.notifier.info(globalFuncs.successMsgs[6]); $scope.wallet.type = "default"; }); - }; + } + $scope.scanMetamask = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (!window.ethereum) { + _context.next = 13; + break; + } + + window.web3 = new Web3(ethereum); + _context.prev = 2; + _context.next = 5; + return ethereum.enable(); + + case 5: + setWeb3Wallet(); + _context.next = 11; + break; + + case 8: + _context.prev = 8; + _context.t0 = _context["catch"](2); + + $scope.notifier.danger("Could not read your accounts from MetaMask. Try unlocking it."); + + case 11: + _context.next = 14; + break; + + case 13: + if (window.web3) { + window.web3 = new Web3(web3.currentProvider); + setWeb3Wallet(); + } else { + $scope.notifier.danger("Non-Ethereum browser detected. You should consider trying MetaMask!"); + } + + case 14: + case "end": + return _context.stop(); + } + } + }, _callee, this, [[2, 8]]); + })); // helper function that removes 0x prefix from strings function fixPkey(key) { - if (key.indexOf('0x') === 0) { + if (key.indexOf("0x") === 0) { return key.slice(2); } return key; diff --git a/dist/js/etherwallet-master.js b/dist/js/etherwallet-master.js index 93c0bae2e8..386299ab32 100644 --- a/dist/js/etherwallet-master.js +++ b/dist/js/etherwallet-master.js @@ -4772,7 +4772,9 @@ module.exports = contractsCtrl; },{}],35:[function(require,module,exports){ (function (Buffer){ -'use strict'; +"use strict"; + +function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) { $scope.walletType = ""; @@ -4780,7 +4782,7 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.filePassword = ""; $scope.fileContent = ""; $scope.Validator = Validator; - $scope.isSSL = window.location.protocol == 'https:'; + $scope.isSSL = window.location.protocol == "https:"; $scope.ajaxReq = ajaxReq; $scope.nodeType = $scope.ajaxReq.type; $scope.HDWallet = { @@ -4789,7 +4791,7 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) wallets: [], id: 0, hdk: null, - dPath: '', + dPath: "", defaultDPath: "m/44'/60'/0'/0", // first address: m/44'/60'/0'/0/0 alternativeDPath: "m/44'/60'/0'", // first address: m/44'/60'/0/0 customDPath: "m/44'/60'/1'/0", // first address: m/44'/60'/1'/0/0 @@ -4820,12 +4822,12 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.canUseMewConnect = MewConnectEth.checkWebRTCAvailable(); $scope.mewConnectMayFail = MewConnectEth.checkBrowser(); $scope.HDWallet.dPath = $scope.HDWallet.defaultDPath; - $scope.mnemonicModel = new Modal(document.getElementById('mnemonicModel')); - $scope.$watch('ajaxReq.type', function () { + $scope.mnemonicModel = new Modal(document.getElementById("mnemonicModel")); + $scope.$watch("ajaxReq.type", function () { $scope.nodeType = $scope.ajaxReq.type; $scope.setdPath(); }); - $scope.$watch('walletType', function () { + $scope.$watch("walletType", function () { $scope.setdPath(); }); $scope.setdPath = function () { @@ -5024,18 +5026,18 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) var password = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $scope.mnemonicPassword; $scope.HDWallet.numWallets = 0; - if ($scope.walletType == 'pastemnemonic') { + if ($scope.walletType == "pastemnemonic") { $scope.HDWallet.hdk = hd.HDKey.fromMasterSeed(hd.bip39.mnemonicToSeed($scope.manualmnemonic.trim(), password)); $scope.setHDAddresses($scope.HDWallet.numWallets, $scope.HDWallet.walletsPerDialog); - } else if ($scope.walletType == 'ledger') { + } else if ($scope.walletType == "ledger") { $scope.scanLedger(); - } else if ($scope.walletType == 'trezor') { + } else if ($scope.walletType == "trezor") { $scope.scanTrezor(); - } else if ($scope.walletType == 'digitalBitbox') { + } else if ($scope.walletType == "digitalBitbox") { $scope.scanDigitalBitbox(); - } else if ($scope.walletType == 'secalot') { + } else if ($scope.walletType == "secalot") { $scope.scanSecalot(); - } else if ($scope.walletType == 'mewConnect') { + } else if ($scope.walletType == "mewConnect") { $scope.scanMewConnect(); } }; @@ -5044,7 +5046,7 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.onHDDPathChange(); }; $scope.showContent = function ($fileContent) { - $scope.notifier.info(globalFuncs.successMsgs[4] + document.getElementById('fselector').files[0].name); + $scope.notifier.info(globalFuncs.successMsgs[4] + document.getElementById("fselector").files[0].name); try { $scope.requireFPass = Wallet.walletRequirePass($fileContent); $scope.showFDecrypt = !$scope.requireFPass; @@ -5055,7 +5057,7 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) }; $scope.openFileDialog = function ($fileContent) { $scope.showAOnly = false; - document.getElementById('fselector').click(); + document.getElementById("fselector").click(); }; $scope.onFilePassChange = function () { $scope.showAOnly = false; @@ -5102,8 +5104,8 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.HDWallet.wallets.push(new Wallet(undefined, derivedKey.publicKey, $scope.HDWallet.dPath + "/" + i, $scope.walletType, $scope.digitalBitbox)); } else if ($scope.walletType == "secalot") { $scope.HDWallet.wallets.push(new Wallet(undefined, derivedKey.publicKey, $scope.HDWallet.dPath + "/" + i, $scope.walletType, $scope.secalot)); - } else if ($scope.walletType == 'mewConnect') { - $scope.HDWallet.wallets.push(new Wallet(undefined, derivedKey.publicKey, $scope.HDWallet.dPath + '/' + i, $scope.walletType, $scope.mewConnect)); + } else if ($scope.walletType == "mewConnect") { + $scope.HDWallet.wallets.push(new Wallet(undefined, derivedKey.publicKey, $scope.HDWallet.dPath + "/" + i, $scope.walletType, $scope.mewConnect)); } else { $scope.HDWallet.wallets.push(new Wallet(undefined, derivedKey.publicKey, $scope.HDWallet.dPath + "/" + i, $scope.walletType)); } @@ -5114,7 +5116,7 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.HDWallet.numWallets = start + limit; }; $scope.AddRemoveHDAddresses = function (isAdd) { - if ($scope.walletType == "ledger" || $scope.walletType == "trezor" || $scope.walletType == "digitalBitbox" || $scope.walletType == "secalot" || $scope.walletType == 'mewConnect') { + if ($scope.walletType == "ledger" || $scope.walletType == "trezor" || $scope.walletType == "digitalBitbox" || $scope.walletType == "secalot" || $scope.walletType == "mewConnect") { if (isAdd) $scope.setHDAddressesHWWallet($scope.HDWallet.numWallets, $scope.HDWallet.walletsPerDialog);else $scope.setHDAddressesHWWallet($scope.HDWallet.numWallets - 2 * $scope.HDWallet.walletsPerDialog, $scope.HDWallet.walletsPerDialog); } else { if (isAdd) $scope.setHDAddresses($scope.HDWallet.numWallets, $scope.HDWallet.walletsPerDialog);else $scope.setHDAddresses($scope.HDWallet.numWallets - 2 * $scope.HDWallet.walletsPerDialog, $scope.HDWallet.walletsPerDialog); @@ -5144,13 +5146,13 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) return; } else { $scope.wallet = new Wallet(fixPkey($scope.manualprivkey)); - walletService.password = ''; + walletService.password = ""; } } else if ($scope.showFDecrypt) { $scope.wallet = Wallet.getWalletFromPrivKeyFile($scope.fileContent, $scope.filePassword); walletService.password = $scope.filePassword; } else if ($scope.showMDecrypt) { - $scope.mnemonicModel = new Modal(document.getElementById('mnemonicModel')); + $scope.mnemonicModel = new Modal(document.getElementById("mnemonicModel")); $scope.mnemonicModel.open(); $scope.onHDDPathChange($scope.mnemonicPassword); } else if ($scope.showParityDecrypt) { @@ -5186,11 +5188,11 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) } }; $scope.HWWalletCreate = function (publicKey, chainCode, walletType, path) { - $scope.mnemonicModel = new Modal(document.getElementById('mnemonicModel')); + $scope.mnemonicModel = new Modal(document.getElementById("mnemonicModel")); $scope.mnemonicModel.open(); $scope.HDWallet.hdk = new hd.HDKey(); - $scope.HDWallet.hdk.publicKey = new Buffer(publicKey, 'hex'); - $scope.HDWallet.hdk.chainCode = new Buffer(chainCode, 'hex'); + $scope.HDWallet.hdk.publicKey = new Buffer(publicKey, "hex"); + $scope.HDWallet.hdk.chainCode = new Buffer(chainCode, "hex"); $scope.HDWallet.numWallets = 0; $scope.HDWallet.dPath = path; $scope.setHDAddressesHWWallet($scope.HDWallet.numWallets, $scope.HDWallet.walletsPerDialog, walletType); @@ -5198,7 +5200,7 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) }; $scope.ledgerCallback = function (result, error) { if (typeof result != "undefined") { - $scope.HWWalletCreate(result['publicKey'], result['chainCode'], "ledger", $scope.getLedgerPath()); + $scope.HWWalletCreate(result["publicKey"], result["chainCode"], "ledger", $scope.getLedgerPath()); } else { $scope.ledgerError = true; $scope.ledgerErrorString = error; @@ -5206,14 +5208,14 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) } }; $scope.digitalBitboxCallback = function (result, error) { - $scope.HDWallet.digitalBitboxSecret = ''; + $scope.HDWallet.digitalBitboxSecret = ""; if (typeof result != "undefined") { - $scope.HWWalletCreate(result['publicKey'], result['chainCode'], "digitalBitbox", $scope.HDWallet.dPath); + $scope.HWWalletCreate(result["publicKey"], result["chainCode"], "digitalBitbox", $scope.HDWallet.dPath); } else $scope.notifier.danger(error); }; $scope.secalotCallback = function (result, error) { if (typeof result != "undefined") { - $scope.HWWalletCreate(result['publicKey'], result['chainCode'], "secalot", $scope.HDWallet.dPath); + $scope.HWWalletCreate(result["publicKey"], result["chainCode"], "secalot", $scope.HDWallet.dPath); } else $scope.notifier.danger(error); }; $scope.scanLedger = function () { @@ -5268,24 +5270,24 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.mewConnect = MewConnect.init(); - Reflect.defineProperty(MewConnect, 'instance', { + Reflect.defineProperty(MewConnect, "instance", { value: $scope.mewConnect }); - $scope.$on('$destroy', function () { + $scope.$on("$destroy", function () { globalFuncs.MEWconnectStatus.newTabOpenedTrigger(false); globalFuncs.MEWconnectStatus.update(0); $scope.mewConnect.disconnectRTC(); if (MewConnect.instance) { - Reflect.deleteProperty(MewConnect, 'instance'); + Reflect.deleteProperty(MewConnect, "instance"); } }); - $scope.mewConnect.on('codeDisplay', codeDisplay); - $scope.mewConnect.on('RtcConnectedEvent', rtcConnected); - $scope.mewConnect.on('RtcClosedEvent', rtcClosed); - $scope.mewConnect.on('RtcDisconnectEvent', rtcDisconnected); - $scope.mewConnect.on('address', makeWallet); + $scope.mewConnect.on("codeDisplay", codeDisplay); + $scope.mewConnect.on("RtcConnectedEvent", rtcConnected); + $scope.mewConnect.on("RtcClosedEvent", rtcClosed); + $scope.mewConnect.on("RtcDisconnectEvent", rtcDisconnected); + $scope.mewConnect.on("address", makeWallet); app.setMewConnect($scope.mewConnect); app.signalerConnect(); @@ -5299,8 +5301,8 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) globalFuncs.MEWconnectStatus.update(2); if ($scope.mewConnectionStatus !== 2) { $scope.connectionCodeTimeout = null; - uiFuncs.notifier.info('Connected Via MEWconnect'); - $scope.mewConnect.sendRtcMessage('address', ''); + uiFuncs.notifier.info("Connected Via MEWconnect"); + $scope.mewConnect.sendRtcMessage("address", ""); $scope.mewConnectionStatus = 2; } } @@ -5311,7 +5313,7 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.mewConnectionStatus = 4; $scope.wallet = null; walletService.wallet = null; - uiFuncs.notifier.danger('Disconnected', 10000); + uiFuncs.notifier.danger("Disconnected", 10000); if (!$scope.$$phase) $scope.$apply(); } } @@ -5322,7 +5324,7 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.mewConnectionStatus = 4; $scope.wallet = null; walletService.wallet = null; - uiFuncs.notifier.danger('Disconnected', 10000); + uiFuncs.notifier.danger("Disconnected", 10000); if (!$scope.$$phase) $scope.$apply(); } } @@ -5357,25 +5359,16 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.getTrezorPath = function () { return $scope.HDWallet.dPath; }; - $scope.scanMetamask = function () { - if (window.web3 === undefined) { - window.addEventListener('message', function (_ref2) { - var data = _ref2.data; - if (data && data.type && data.type === 'ETHEREUM_PROVIDER_SUCCESS') { - window.web3 = new Web3(ethereum); - } - }); - window.postMessage({ type: 'ETHEREUM_PROVIDER_REQUEST', web3: true }, '*'); - } + function setWeb3Wallet() { window.web3.eth.getAccounts(function (err, accounts) { - if (err) $scope.notifier.danger(err + '. Are you sure you are on a secure (SSL / HTTPS) connection?'); + if (err) $scope.notifier.danger(err + ". Are you sure you are on a secure (SSL / HTTPS) connection?"); if (!accounts.length) { - $scope.notifier.danger('Could not read your accounts from MetaMask. Try unlocking it.'); + $scope.notifier.danger("Could not read your accounts from MetaMask. Try unlocking it."); return; } var address = accounts[0]; - var addressBuffer = Buffer.from(address.slice(2), 'hex'); + var addressBuffer = Buffer.from(address.slice(2), "hex"); var wallet = new Web3Wallet(addressBuffer); wallet.setBalance(false); // set wallet @@ -5384,11 +5377,56 @@ var decryptWalletCtrl = function decryptWalletCtrl($scope, $sce, walletService) $scope.notifier.info(globalFuncs.successMsgs[6]); $scope.wallet.type = "default"; }); - }; + } + $scope.scanMetamask = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (!window.ethereum) { + _context.next = 13; + break; + } + + window.web3 = new Web3(ethereum); + _context.prev = 2; + _context.next = 5; + return ethereum.enable(); + + case 5: + setWeb3Wallet(); + _context.next = 11; + break; + + case 8: + _context.prev = 8; + _context.t0 = _context["catch"](2); + + $scope.notifier.danger("Could not read your accounts from MetaMask. Try unlocking it."); + + case 11: + _context.next = 14; + break; + + case 13: + if (window.web3) { + window.web3 = new Web3(web3.currentProvider); + setWeb3Wallet(); + } else { + $scope.notifier.danger("Non-Ethereum browser detected. You should consider trying MetaMask!"); + } + + case 14: + case "end": + return _context.stop(); + } + } + }, _callee, this, [[2, 8]]); + })); // helper function that removes 0x prefix from strings function fixPkey(key) { - if (key.indexOf('0x') === 0) { + if (key.indexOf("0x") === 0) { return key.slice(2); } return key;