diff --git a/README.md b/README.md index 86d515377..8a1eda46c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # MetaMask Browser Extension [![Build Status](https://circleci.com/gh/MetaMask/metamask-extension.svg?style=shield&circle-token=a1ddcf3cd38e29267f254c9c59d556d513e3a1fd)](https://circleci.com/gh/MetaMask/metamask-extension) [![Coverage Status](https://coveralls.io/repos/github/MetaMask/metamask-extension/badge.svg?branch=master)](https://coveralls.io/github/MetaMask/metamask-extension?branch=master) [![Greenkeeper badge](https://badges.greenkeeper.io/MetaMask/metamask-extension.svg)](https://greenkeeper.io/) [![Stories in Ready](https://badge.waffle.io/MetaMask/metamask-extension.png?label=in%20progress&title=waffle.io)](https://waffle.io/MetaMask/metamask-extension) -🚨 As of 7/25/18, the MetaMask extension has been removed from the Chrome Web Store. In the meantime, you can download the latest version of MetaMask on our [Releases](https://github.com/MetaMask/metamask-extension/releases) page and load it in Chrome by visiting `chrome://extensions`. For more detailed steps, see our [help center](https://consensys.zendesk.com/hc/en-us/articles/360004134152-How-to-Install-MetaMask-Manually). Follow [@metamask_io](https://twitter.com/metamask_io) on Twitter for updates. 🚨 - ## Support If you're a user seeking support, [here is our support site](https://metamask.helpscoutdocs.com/). diff --git a/app/images/ethereum-metamask-chrome.png b/app/images/ethereum-metamask-chrome.png new file mode 100644 index 000000000..0b886babb Binary files /dev/null and b/app/images/ethereum-metamask-chrome.png differ diff --git a/app/manifest.json b/app/manifest.json index 52256c5b7..ed328f19f 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -67,7 +67,8 @@ "notifications" ], "web_accessible_resources": [ - "inpage.js" + "inpage.js", + "phishing.html" ], "externally_connectable": { "matches": [ diff --git a/app/phishing.html b/app/phishing.html new file mode 100644 index 000000000..86f2985cc --- /dev/null +++ b/app/phishing.html @@ -0,0 +1,60 @@ + + + + + + Phishing Warning + + + + + + + + +
+ + +

ATTENTION

+

MetaMask believes this domain to have malicious intent and has prevented you from interacting with it.

+

This is because the site tested positive on the Ethereum Phishing Detector.

+

You can turn MetaMask off to interact with this site, but it's advised not to.

+

If you think this domain is incorrectly flagged, please file an issue.

+ +
+ + \ No newline at end of file diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js index 7b7114c35..b7496f318 100644 --- a/app/scripts/contentscript.js +++ b/app/scripts/contentscript.js @@ -197,6 +197,7 @@ function blacklistedDomainCheck () { * Redirects the current page to a phishing information page */ function redirectToPhishingWarning () { - console.log('MetaMask - redirecting to phishing warning') - window.location.href = 'https://metamask.io/phishing.html' + console.log('MetaMask - routing to Phishing Warning component') + let extensionURL = extension.runtime.getURL('phishing.html') + window.location.href = extensionURL } diff --git a/app/scripts/lib/inpage-provider.js b/app/scripts/lib/inpage-provider.js index 4e65f0a23..6ef511453 100644 --- a/app/scripts/lib/inpage-provider.js +++ b/app/scripts/lib/inpage-provider.js @@ -54,6 +54,11 @@ function MetamaskInpageProvider (connectionStream) { // also remap ids inbound and outbound MetamaskInpageProvider.prototype.sendAsync = function (payload, cb) { const self = this + + if (payload.method === 'eth_signTypedData') { + console.warn('MetaMask: This experimental version of eth_signTypedData will be deprecated in the next release in favor of the standard as defined in EIP-712. See https://git.io/fNzPl for more information on the new standard.') + } + self.rpcEngine.handle(payload, cb) } diff --git a/ui/app/components/confirm-page-container/confirm-detail-row/index.scss b/ui/app/components/confirm-page-container/confirm-detail-row/index.scss index 84d0d56ed..dd6f87c17 100644 --- a/ui/app/components/confirm-page-container/confirm-detail-row/index.scss +++ b/ui/app/components/confirm-page-container/confirm-detail-row/index.scss @@ -15,14 +15,21 @@ &__details { flex: 1; text-align: end; + min-width: 0; } &__fiat { font-size: 1.5rem; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } &__eth { color: $oslo-gray; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } &__header-text { diff --git a/ui/app/components/pages/confirm-token-transaction-base/confirm-token-transaction-base.component.js b/ui/app/components/pages/confirm-token-transaction-base/confirm-token-transaction-base.component.js index 365ae216e..acaed383a 100644 --- a/ui/app/components/pages/confirm-token-transaction-base/confirm-token-transaction-base.component.js +++ b/ui/app/components/pages/confirm-token-transaction-base/confirm-token-transaction-base.component.js @@ -5,6 +5,7 @@ import { formatCurrency, convertTokenToFiat, addFiat, + roundExponential, } from '../../../helpers/confirm-transaction/util' export default class ConfirmTokenTransactionBase extends Component { @@ -42,7 +43,8 @@ export default class ConfirmTokenTransactionBase extends Component { return this.context.t('noConversionRateAvailable') } else { const fiatTransactionAmount = this.getFiatTransactionAmount() - return formatCurrency(fiatTransactionAmount, currentCurrency) + const roundedFiatTransactionAmount = roundExponential(fiatTransactionAmount) + return formatCurrency(roundedFiatTransactionAmount, currentCurrency) } } @@ -54,7 +56,8 @@ export default class ConfirmTokenTransactionBase extends Component { } else { const fiatTransactionAmount = this.getFiatTransactionAmount() const fiatTotal = addFiat(fiatTransactionAmount, fiatTransactionTotal) - return formatCurrency(fiatTotal, currentCurrency) + const roundedFiatTotal = roundExponential(fiatTotal) + return formatCurrency(roundedFiatTotal, currentCurrency) } } diff --git a/ui/app/helpers/confirm-transaction/util.js b/ui/app/helpers/confirm-transaction/util.js index f015b2bf5..a37778c19 100644 --- a/ui/app/helpers/confirm-transaction/util.js +++ b/ui/app/helpers/confirm-transaction/util.js @@ -3,6 +3,7 @@ import currencies from 'currency-formatter/currencies' import abi from 'human-standard-token-abi' import abiDecoder from 'abi-decoder' import ethUtil from 'ethereumjs-util' +import BigNumber from 'bignumber.js' abiDecoder.addABI(abi) @@ -137,3 +138,11 @@ export function convertTokenToFiat ({ export function hasUnconfirmedTransactions (state) { return unconfirmedTransactionsCountSelector(state) > 0 } + +export function roundExponential (value) { + const PRECISION = 4 + const bigNumberValue = new BigNumber(value) + + // In JS, numbers with exponentials greater than 20 get displayed as an exponential. + return bigNumberValue.e > 20 ? Number(bigNumberValue.toPrecision(PRECISION)) : value +} diff --git a/ui/app/selectors/confirm-transaction.js b/ui/app/selectors/confirm-transaction.js index 8f8e0ea74..9548cf75e 100644 --- a/ui/app/selectors/confirm-transaction.js +++ b/ui/app/selectors/confirm-transaction.js @@ -1,6 +1,7 @@ import { createSelector } from 'reselect' import txHelper from '../../lib/tx-helper' import { calcTokenAmount } from '../token-util' +import { roundExponential } from '../helpers/confirm-transaction/util' const unapprovedTxsSelector = state => state.metamask.unapprovedTxs const unapprovedMsgsSelector = state => state.metamask.unapprovedMsgs @@ -133,7 +134,8 @@ export const tokenAmountAndToAddressSelector = createSelector( const toParam = params.find(param => param.name === TOKEN_PARAM_TO) const valueParam = params.find(param => param.name === TOKEN_PARAM_VALUE) toAddress = toParam ? toParam.value : params[0].value - tokenAmount = valueParam ? Number(valueParam.value) : Number(params[1].value) + const value = valueParam ? Number(valueParam.value) : Number(params[1].value) + tokenAmount = roundExponential(value) } return { @@ -151,7 +153,8 @@ export const approveTokenAmountAndToAddressSelector = createSelector( if (params && params.length) { toAddress = params.find(param => param.name === TOKEN_PARAM_SPENDER).value - tokenAmount = Number(params.find(param => param.name === TOKEN_PARAM_VALUE).value) + const value = Number(params.find(param => param.name === TOKEN_PARAM_VALUE).value) + tokenAmount = roundExponential(value) } return { @@ -170,11 +173,13 @@ export const sendTokenTokenAmountAndToAddressSelector = createSelector( if (params && params.length) { toAddress = params.find(param => param.name === TOKEN_PARAM_TO).value - tokenAmount = Number(params.find(param => param.name === TOKEN_PARAM_VALUE).value) + let value = Number(params.find(param => param.name === TOKEN_PARAM_VALUE).value) if (tokenDecimals) { - tokenAmount = calcTokenAmount(tokenAmount, tokenDecimals) + value = calcTokenAmount(value, tokenDecimals) } + + tokenAmount = roundExponential(value) } return {