From 2c12f194422a386f4728aa8bb287e03ac173fa01 Mon Sep 17 00:00:00 2001 From: MetaMask Bot Date: Tue, 9 Mar 2021 22:16:55 +0000 Subject: [PATCH 1/4] Version v9.2.0 --- CHANGELOG.md | 2 ++ app/manifest/_base.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc20d601f..6c49e1d78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Current Develop Branch +## 9.2.0 Tue Mar 09 2021 + ## 9.1.1 Wed Mar 03 2021 - [#10560](https://github.com/MetaMask/metamask-extension/pull/10560): Fix ENS resolution related crashes when switching networks on send screen - [#10561](https://github.com/MetaMask/metamask-extension/pull/10561): Fix crash when speeding up an attempt to cancel a transaction on custom networks diff --git a/app/manifest/_base.json b/app/manifest/_base.json index 8c04191bb..d32f75c3f 100644 --- a/app/manifest/_base.json +++ b/app/manifest/_base.json @@ -78,6 +78,6 @@ "notifications" ], "short_name": "__MSG_appName__", - "version": "9.1.1", + "version": "9.2.0", "web_accessible_resources": ["inpage.js", "phishing.html"] } From df9b4f933ac1663c083bcc22b00e1a074e7a95ef Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Tue, 9 Mar 2021 19:13:06 -0330 Subject: [PATCH 2/4] Revert "add fsevents entry from allow-scripts for mac os x (#10605)" This reverts commit 59f516ade249360d9969bdfe663aaec03e2336da. --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 690fd6096..a3cb1f318 100644 --- a/package.json +++ b/package.json @@ -317,8 +317,7 @@ "gc-stats": false, "github:assemblyscript/assemblyscript": false, "tiny-secp256k1": false, - "@lavamoat/preinstall-always-fail": false, - "fsevents": false + "@lavamoat/preinstall-always-fail": false } } } From e4d1f874f81740a9960b6286c2090722062beaf8 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Wed, 10 Mar 2021 13:05:41 -0330 Subject: [PATCH 3/4] Update changelog for v9.2.0 (#10621) All user-facing changes have been included, and descriptions have been updated to be more easily understood. --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c49e1d78..b585b20d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,17 @@ ## Current Develop Branch ## 9.2.0 Tue Mar 09 2021 +- [#10546](https://github.com/MetaMask/metamask-extension/pull/10546): Add a warning when sending a token to its own contract address +- [#10563](https://github.com/MetaMask/metamask-extension/pull/10563): Update references to MetaMask support +- [#10126](https://github.com/MetaMask/metamask-extension/pull/10126): Update Italian translation +- [#10591](https://github.com/MetaMask/metamask-extension/pull/10591): Fix mobile sync of ERC20 tokens +- [#10582](https://github.com/MetaMask/metamask-extension/pull/10582): Adding warnings for excessive custom gas input +- [#10601](https://github.com/MetaMask/metamask-extension/pull/10601): Fix activity title text truncation +- [#10598](https://github.com/MetaMask/metamask-extension/pull/10598): Remove 'Ethereum' from custom RPC endpoint warning +- [#10606](https://github.com/MetaMask/metamask-extension/pull/10606): Show loading screen while fetching token data for approve screen +- [#10486](https://github.com/MetaMask/metamask-extension/pull/10486): Add setting to hide zero balance tokens +- [#10505](https://github.com/MetaMask/metamask-extension/pull/10505): Add support for multiple Ledger & Trezor hardware accounts +- [#10587](https://github.com/MetaMask/metamask-extension/pull/10587): Show correct block explorer for custom RPC endpoints for built-in networks ## 9.1.1 Wed Mar 03 2021 - [#10560](https://github.com/MetaMask/metamask-extension/pull/10560): Fix ENS resolution related crashes when switching networks on send screen From bcd04cdd935df1b633b196e5e0660cd50f7ef60b Mon Sep 17 00:00:00 2001 From: David Walsh Date: Thu, 11 Mar 2021 12:07:41 -0600 Subject: [PATCH 4/4] Hide zero balance tokens at useTokenTracker layer (#10630) --- .../components/app/token-list/token-list.js | 11 +++------ ui/app/ducks/metamask/metamask.js | 3 --- ui/app/hooks/useTokenTracker.js | 23 +++++++++++++------ 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/ui/app/components/app/token-list/token-list.js b/ui/app/components/app/token-list/token-list.js index 3fcc71d38..9d0fdc77e 100644 --- a/ui/app/components/app/token-list/token-list.js +++ b/ui/app/components/app/token-list/token-list.js @@ -10,10 +10,7 @@ import { getAssetImages, getShouldHideZeroBalanceTokens, } from '../../../selectors'; -import { - getTokens, - getTokensWithBalance, -} from '../../../ducks/metamask/metamask'; +import { getTokens } from '../../../ducks/metamask/metamask'; export default function TokenList({ onTokenClick }) { const t = useI18nContext(); @@ -25,13 +22,11 @@ export default function TokenList({ onTokenClick }) { // from the background so it has a new reference with each background update, // even if the tokens haven't changed const tokens = useSelector(getTokens, isEqual); - const tokensWithBalance = useSelector(getTokensWithBalance, isEqual); - const { loading, tokensWithBalances } = useTokenTracker( - shouldHideZeroBalanceTokens ? tokensWithBalance : tokens, + tokens, true, + shouldHideZeroBalanceTokens, ); - if (loading) { return (
state.metamask.unconnectedAccountAlertShownOrigins; export const getTokens = (state) => state.metamask.tokens; - -export const getTokensWithBalance = (state) => - state.metamask.tokens.filter((token) => Number(token.balance) > 0); diff --git a/ui/app/hooks/useTokenTracker.js b/ui/app/hooks/useTokenTracker.js index ea7892b08..2b2411d1e 100644 --- a/ui/app/hooks/useTokenTracker.js +++ b/ui/app/hooks/useTokenTracker.js @@ -4,21 +4,30 @@ import { useSelector } from 'react-redux'; import { getCurrentNetwork, getSelectedAddress } from '../selectors'; import { useEqualityCheck } from './useEqualityCheck'; -export function useTokenTracker(tokens, includeFailedTokens = false) { +export function useTokenTracker( + tokens, + includeFailedTokens = false, + hideZeroBalanceTokens = false, +) { const network = useSelector(getCurrentNetwork); const userAddress = useSelector(getSelectedAddress); - const [loading, setLoading] = useState(() => tokens?.length >= 0); const [tokensWithBalances, setTokensWithBalances] = useState([]); const [error, setError] = useState(null); const tokenTracker = useRef(null); const memoizedTokens = useEqualityCheck(tokens); - const updateBalances = useCallback((tokenWithBalances) => { - setTokensWithBalances(tokenWithBalances); - setLoading(false); - setError(null); - }, []); + const updateBalances = useCallback( + (tokenWithBalances) => { + const matchingTokens = hideZeroBalanceTokens + ? tokenWithBalances.filter((token) => Number(token.balance) > 0) + : tokenWithBalances; + setTokensWithBalances(matchingTokens); + setLoading(false); + setError(null); + }, + [hideZeroBalanceTokens], + ); const showError = useCallback((err) => { setError(err);