mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge branch 'develop' of github.com:MetaMask/metamask-extension into qr-code-scan
This commit is contained in:
commit
b6592ba95f
@ -1,8 +1,6 @@
|
|||||||
# MetaMask Browser Extension
|
# MetaMask Browser Extension
|
||||||
[](https://circleci.com/gh/MetaMask/metamask-extension) [](https://coveralls.io/github/MetaMask/metamask-extension?branch=master) [](https://greenkeeper.io/) [](https://waffle.io/MetaMask/metamask-extension)
|
[](https://circleci.com/gh/MetaMask/metamask-extension) [](https://coveralls.io/github/MetaMask/metamask-extension?branch=master) [](https://greenkeeper.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
|
## Support
|
||||||
|
|
||||||
If you're a user seeking support, [here is our support site](https://metamask.helpscoutdocs.com/).
|
If you're a user seeking support, [here is our support site](https://metamask.helpscoutdocs.com/).
|
||||||
|
BIN
app/images/ethereum-metamask-chrome.png
Normal file
BIN
app/images/ethereum-metamask-chrome.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 59 KiB |
@ -67,7 +67,8 @@
|
|||||||
"notifications"
|
"notifications"
|
||||||
],
|
],
|
||||||
"web_accessible_resources": [
|
"web_accessible_resources": [
|
||||||
"inpage.js"
|
"inpage.js",
|
||||||
|
"phishing.html"
|
||||||
],
|
],
|
||||||
"externally_connectable": {
|
"externally_connectable": {
|
||||||
"matches": [
|
"matches": [
|
||||||
|
60
app/phishing.html
Normal file
60
app/phishing.html
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>Phishing Warning</title>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background: #c50000;
|
||||||
|
padding: 50px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
|
.centered {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
color: white;
|
||||||
|
max-width: 600px;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
|
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||||
|
ga('create', 'UA-37075177-6', 'auto');
|
||||||
|
ga('send', 'pageview');
|
||||||
|
//Send referral data to EAL
|
||||||
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
|
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||||
|
ga('create', 'UA-68598031-1', 'auto' {'allowLinker':true});
|
||||||
|
ga('send', 'pageview');
|
||||||
|
ga('require', 'linker');
|
||||||
|
ga('linker:autoLink', ['harrydenley.com', 'metamask.io'], false, true);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="centered">
|
||||||
|
|
||||||
|
<img src="/images/ethereum-metamask-chrome.png" style="width:100%">
|
||||||
|
<h3>ATTENTION</h3>
|
||||||
|
<p>MetaMask believes this domain to have malicious intent and has prevented you from interacting with it.</p>
|
||||||
|
<p>This is because the site tested positive on the <a href="https://github.com/metamask/eth-phishing-detect">Ethereum Phishing Detector</a>.</p>
|
||||||
|
<p>You can turn MetaMask off to interact with this site, but it's advised not to.</p>
|
||||||
|
<p>If you think this domain is incorrectly flagged, <a href="https://github.com/metamask/eth-phishing-detect/issues/new">please file an issue</a>.</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -197,6 +197,7 @@ function blacklistedDomainCheck () {
|
|||||||
* Redirects the current page to a phishing information page
|
* Redirects the current page to a phishing information page
|
||||||
*/
|
*/
|
||||||
function redirectToPhishingWarning () {
|
function redirectToPhishingWarning () {
|
||||||
console.log('MetaMask - redirecting to phishing warning')
|
console.log('MetaMask - routing to Phishing Warning component')
|
||||||
window.location.href = 'https://metamask.io/phishing.html'
|
let extensionURL = extension.runtime.getURL('phishing.html')
|
||||||
|
window.location.href = extensionURL
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,11 @@ function MetamaskInpageProvider (connectionStream) {
|
|||||||
// also remap ids inbound and outbound
|
// also remap ids inbound and outbound
|
||||||
MetamaskInpageProvider.prototype.sendAsync = function (payload, cb) {
|
MetamaskInpageProvider.prototype.sendAsync = function (payload, cb) {
|
||||||
const self = this
|
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)
|
self.rpcEngine.handle(payload, cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,14 +15,21 @@
|
|||||||
&__details {
|
&__details {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
text-align: end;
|
text-align: end;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__fiat {
|
&__fiat {
|
||||||
font-size: 1.5rem;
|
font-size: 1.5rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__eth {
|
&__eth {
|
||||||
color: $oslo-gray;
|
color: $oslo-gray;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__header-text {
|
&__header-text {
|
||||||
|
@ -5,6 +5,7 @@ import {
|
|||||||
formatCurrency,
|
formatCurrency,
|
||||||
convertTokenToFiat,
|
convertTokenToFiat,
|
||||||
addFiat,
|
addFiat,
|
||||||
|
roundExponential,
|
||||||
} from '../../../helpers/confirm-transaction/util'
|
} from '../../../helpers/confirm-transaction/util'
|
||||||
|
|
||||||
export default class ConfirmTokenTransactionBase extends Component {
|
export default class ConfirmTokenTransactionBase extends Component {
|
||||||
@ -42,7 +43,8 @@ export default class ConfirmTokenTransactionBase extends Component {
|
|||||||
return this.context.t('noConversionRateAvailable')
|
return this.context.t('noConversionRateAvailable')
|
||||||
} else {
|
} else {
|
||||||
const fiatTransactionAmount = this.getFiatTransactionAmount()
|
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 {
|
} else {
|
||||||
const fiatTransactionAmount = this.getFiatTransactionAmount()
|
const fiatTransactionAmount = this.getFiatTransactionAmount()
|
||||||
const fiatTotal = addFiat(fiatTransactionAmount, fiatTransactionTotal)
|
const fiatTotal = addFiat(fiatTransactionAmount, fiatTransactionTotal)
|
||||||
return formatCurrency(fiatTotal, currentCurrency)
|
const roundedFiatTotal = roundExponential(fiatTotal)
|
||||||
|
return formatCurrency(roundedFiatTotal, currentCurrency)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ import currencies from 'currency-formatter/currencies'
|
|||||||
import abi from 'human-standard-token-abi'
|
import abi from 'human-standard-token-abi'
|
||||||
import abiDecoder from 'abi-decoder'
|
import abiDecoder from 'abi-decoder'
|
||||||
import ethUtil from 'ethereumjs-util'
|
import ethUtil from 'ethereumjs-util'
|
||||||
|
import BigNumber from 'bignumber.js'
|
||||||
|
|
||||||
abiDecoder.addABI(abi)
|
abiDecoder.addABI(abi)
|
||||||
|
|
||||||
@ -137,3 +138,11 @@ export function convertTokenToFiat ({
|
|||||||
export function hasUnconfirmedTransactions (state) {
|
export function hasUnconfirmedTransactions (state) {
|
||||||
return unconfirmedTransactionsCountSelector(state) > 0
|
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
|
||||||
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { createSelector } from 'reselect'
|
import { createSelector } from 'reselect'
|
||||||
import txHelper from '../../lib/tx-helper'
|
import txHelper from '../../lib/tx-helper'
|
||||||
import { calcTokenAmount } from '../token-util'
|
import { calcTokenAmount } from '../token-util'
|
||||||
|
import { roundExponential } from '../helpers/confirm-transaction/util'
|
||||||
|
|
||||||
const unapprovedTxsSelector = state => state.metamask.unapprovedTxs
|
const unapprovedTxsSelector = state => state.metamask.unapprovedTxs
|
||||||
const unapprovedMsgsSelector = state => state.metamask.unapprovedMsgs
|
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 toParam = params.find(param => param.name === TOKEN_PARAM_TO)
|
||||||
const valueParam = params.find(param => param.name === TOKEN_PARAM_VALUE)
|
const valueParam = params.find(param => param.name === TOKEN_PARAM_VALUE)
|
||||||
toAddress = toParam ? toParam.value : params[0].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 {
|
return {
|
||||||
@ -151,7 +153,8 @@ export const approveTokenAmountAndToAddressSelector = createSelector(
|
|||||||
|
|
||||||
if (params && params.length) {
|
if (params && params.length) {
|
||||||
toAddress = params.find(param => param.name === TOKEN_PARAM_SPENDER).value
|
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 {
|
return {
|
||||||
@ -170,11 +173,13 @@ export const sendTokenTokenAmountAndToAddressSelector = createSelector(
|
|||||||
|
|
||||||
if (params && params.length) {
|
if (params && params.length) {
|
||||||
toAddress = params.find(param => param.name === TOKEN_PARAM_TO).value
|
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) {
|
if (tokenDecimals) {
|
||||||
tokenAmount = calcTokenAmount(tokenAmount, tokenDecimals)
|
value = calcTokenAmount(value, tokenDecimals)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tokenAmount = roundExponential(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user