Skip to content

Commit

Permalink
Merge pull request #8937 from MetaMask/Version-v8.0.4
Browse files Browse the repository at this point in the history
Version v8.0.4 RC
  • Loading branch information
Gudahtt authored Jul 8, 2020
2 parents dd6dd9f + 5213e9e commit 5a3ae85
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 26 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Current Develop Branch

## 8.0.4 Tue Jul 07 2020
- [#8934](https://github.com/MetaMask/metamask-extension/pull/8934): Fix transaction activity on custom networks
- [#8936](https://github.com/MetaMask/metamask-extension/pull/8936): Fix account tracker optimization

## 8.0.3 Mon Jul 06 2020
- [#8921](https://github.com/MetaMask/metamask-extension/pull/8921): Restore missing 'data' provider event, and fix 'notification' event
- [#8923](https://github.com/MetaMask/metamask-extension/pull/8923): Normalize the 'from' parameter for `eth_sendTransaction`
Expand Down
2 changes: 1 addition & 1 deletion app/manifest/_base.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "__MSG_appName__",
"short_name": "__MSG_appName__",
"version": "8.0.3",
"version": "8.0.4",
"manifest_version": 2,
"author": "https://metamask.io",
"description": "__MSG_appDescription__",
Expand Down
8 changes: 4 additions & 4 deletions app/scripts/lib/account-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,19 @@ export default class AccountTracker {
const currentNetwork = this.network.getNetworkState()

switch (currentNetwork) {
case MAINNET_NETWORK_ID:
case MAINNET_NETWORK_ID.toString():
await this._updateAccountsViaBalanceChecker(addresses, SINGLE_CALL_BALANCES_ADDRESS)
break

case RINKEBY_NETWORK_ID:
case RINKEBY_NETWORK_ID.toString():
await this._updateAccountsViaBalanceChecker(addresses, SINGLE_CALL_BALANCES_ADDRESS_RINKEBY)
break

case ROPSTEN_NETWORK_ID:
case ROPSTEN_NETWORK_ID.toString():
await this._updateAccountsViaBalanceChecker(addresses, SINGLE_CALL_BALANCES_ADDRESS_ROPSTEN)
break

case KOVAN_NETWORK_ID:
case KOVAN_NETWORK_ID.toString():
await this._updateAccountsViaBalanceChecker(addresses, SINGLE_CALL_BALANCES_ADDRESS_KOVAN)
break

Expand Down
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = function (api) {
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-nullish-coalescing-operator',
],
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4",
"@babel/plugin-proposal-object-rest-spread": "^7.5.5",
"@babel/plugin-proposal-optional-chaining": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.5.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ export default class TransactionActivityLog extends PureComponent {
const ethValue = index === 0
? `${getValueFromWeiHex({
value,
fromCurrency: nativeCurrency,
toCurrency: nativeCurrency,
fromCurrency: 'ETH',
toCurrency: 'ETH',
conversionRate,
numberOfDecimals: 6,
})} ${nativeCurrency}`
: getEthConversionFromWeiHex({
value,
fromCurrency: nativeCurrency,
fromCurrency: 'ETH',
conversionRate,
numberOfDecimals: 3,
})
Expand Down
20 changes: 20 additions & 0 deletions ui/app/helpers/utils/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,23 @@ export function isExtensionUrl (urlLike) {
}
return false
}

/**
* Checks whether an address is in a passed list of objects with address properties. The check is performed on the
* lowercased version of the addresses.
*
* @param {string} address - The hex address to check
* @param {array} list - The array of objects to check
* @returns {boolean} Whether or not the address is in the list
*/
export function checkExistingAddresses (address, list = []) {
if (!address) {
return false
}

const matchesAddress = (obj) => {
return obj.address.toLowerCase() === address.toLowerCase()
}

return list.some(matchesAddress)
}
29 changes: 29 additions & 0 deletions ui/app/helpers/utils/util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,4 +319,33 @@ describe('util', function () {
})
})
})

describe('checkExistingAddresses', function () {
const tokenList = [
{ address: 'A' },
{ address: 'n' },
{ address: 'Q' },
{ address: 'z' },
]

it('should return true when a lowercase address matches an uppercase address in the passed list', function () {
assert(util.checkExistingAddresses('q', tokenList) === true)
})

it('should return true when an uppercase address matches a lowercase address in the passed list', function () {
assert(util.checkExistingAddresses('N', tokenList) === true)
})

it('should return true when a lowercase address matches a lowercase address in the passed list', function () {
assert(util.checkExistingAddresses('z', tokenList) === true)
})

it('should return true when an uppercase address matches an uppercase address in the passed list', function () {
assert(util.checkExistingAddresses('Q', tokenList) === true)
})

it('should return false when the passed address is not in the passed list', function () {
assert(util.checkExistingAddresses('b', tokenList) === false)
})
})
})
2 changes: 1 addition & 1 deletion ui/app/pages/add-token/add-token.component.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import ethUtil from 'ethereumjs-util'
import { checkExistingAddresses } from './util'
import { checkExistingAddresses } from '../../helpers/utils/util'
import { tokenInfoGetter } from '../../helpers/utils/token-util'
import { CONFIRM_ADD_TOKEN_ROUTE } from '../../helpers/constants/routes'
import TextField from '../../components/ui/text-field'
Expand Down
2 changes: 1 addition & 1 deletion ui/app/pages/add-token/token-list/token-list.component.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames'
import { checkExistingAddresses } from '../util'
import { checkExistingAddresses } from '../../../helpers/utils/util'
import TokenListPlaceholder from './token-list-placeholder'

export default class InfoBox extends Component {
Expand Down
13 changes: 0 additions & 13 deletions ui/app/pages/add-token/util.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import {
INVALID_RECIPIENT_ADDRESS_NOT_ETH_NETWORK_ERROR,
} from '../../send.constants'

import { isValidAddress, isEthNetwork } from '../../../../helpers/utils/util'
import { checkExistingAddresses } from '../../../add-token/util'

import { isValidAddress, isEthNetwork, checkExistingAddresses } from '../../../../helpers/utils/util'
import ethUtil from 'ethereumjs-util'
import contractMap from 'eth-contract-metadata'

Expand Down
20 changes: 20 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250"
integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA==

"@babel/helper-plugin-utils@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz#2f75a831269d4f677de49986dff59927533cf375"
integrity sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==

"@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz#9ea293be19babc0f52ff8ca88b34c3611b208670"
Expand Down Expand Up @@ -342,6 +347,14 @@
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-syntax-json-strings" "^7.2.0"

"@babel/plugin-proposal-nullish-coalescing-operator@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.10.4.tgz#02a7e961fc32e6d5b2db0649e01bf80ddee7e04a"
integrity sha512-wq5n1M3ZUlHl9sqT2ok1T2/MTt6AXE0e1Lz4WzWBr95LsAZ5qDXe4KnFuauYyEyLiohvXFMdbsOTMyLZs91Zlw==
dependencies:
"@babel/helper-plugin-utils" "^7.10.4"
"@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.0"

"@babel/plugin-proposal-object-rest-spread@^7.4.4", "@babel/plugin-proposal-object-rest-spread@^7.5.5", "@babel/plugin-proposal-object-rest-spread@^7.6.2":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.8.3.tgz#eb5ae366118ddca67bed583b53d7554cad9951bb"
Expand Down Expand Up @@ -410,6 +423,13 @@
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"

"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.0":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9"
integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==
dependencies:
"@babel/helper-plugin-utils" "^7.8.0"

"@babel/plugin-syntax-object-rest-spread@^7.2.0":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e"
Expand Down

0 comments on commit 5a3ae85

Please sign in to comment.