Skip to content

Commit 6d3dc01

Browse files
authored
Merge pull request #23616 from MetaMask/Version-v11.12.4
Version v11.12.4
2 parents a06fd11 + cda3bdd commit 6d3dc01

14 files changed

+48
-64
lines changed

CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [11.12.4]
10+
### Fixed
11+
- Ensure native network balance is visible in home screen balance display ([#23614](https://github.com/MetaMask/metamask-extension/pull/23614))
12+
913
## [11.12.3]
1014
### Fixed
1115
- [MMI] Fixes an error related with a missing code fence, when the MMI build didn't have the blockaid feature ([#23516](https://github.com/MetaMask/metamask-extension/pull/23516))
@@ -4507,7 +4511,8 @@ Update styles and spacing on the critical error page ([#20350](https://github.c
45074511
### Uncategorized
45084512
- Added the ability to restore accounts from seed words.
45094513

4510-
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v11.12.3...HEAD
4514+
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v11.12.4...HEAD
4515+
[11.12.4]: https://github.com/MetaMask/metamask-extension/compare/v11.12.3...v11.12.4
45114516
[11.12.3]: https://github.com/MetaMask/metamask-extension/compare/v11.12.2...v11.12.3
45124517
[11.12.2]: https://github.com/MetaMask/metamask-extension/compare/v11.12.1...v11.12.2
45134518
[11.12.1]: https://github.com/MetaMask/metamask-extension/compare/v11.12.0...v11.12.1

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "metamask-crx",
3-
"version": "11.12.3",
3+
"version": "11.12.4",
44
"private": true,
55
"repository": {
66
"type": "git",

shared/constants/metametrics.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ export enum MetaMetricsEventName {
662662
///: BEGIN:ONLY_INCLUDE_IF(snaps)
663663
SnapInstallStarted = 'Snap Install Started',
664664
SnapInstallFailed = 'Snap Install Failed',
665-
SnapInstallRejected = 'Snap Update Rejected',
665+
SnapInstallRejected = 'Snap Install Rejected',
666666
SnapInstalled = 'Snap Installed',
667667
SnapUninstalled = 'Snap Uninstalled',
668668
SnapUpdateStarted = 'Snap Update Started',

test/e2e/helpers.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -808,16 +808,11 @@ const TEST_SEED_PHRASE_TWO =
808808

809809
// Usually happens when onboarded to make sure the state is retrieved from metamaskState properly, or after txn is made
810810
const locateAccountBalanceDOM = async (driver, ganacheServer) => {
811-
const balance = (await ganacheServer.getFiatBalance()).toLocaleString(
812-
undefined,
813-
{
814-
minimumFractionDigits: 2,
815-
},
816-
);
811+
const balance = await ganacheServer.getBalance();
817812

818813
await driver.findElement({
819814
css: '[data-testid="eth-overview__primary-currency"]',
820-
text: `$ ${balance} USD`,
815+
text: `${balance} ETH`,
821816
});
822817
};
823818

test/e2e/tests/account-token-list.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('Settings', function () {
6565
const tokenListAmount = await driver.findElement(
6666
'.eth-overview__primary-container',
6767
);
68-
assert.equal(await tokenListAmount.getText(), '$42,500.00\nUSD');
68+
assert.equal(await tokenListAmount.getText(), '25\nETH');
6969
await driver.clickElement('[data-testid="account-menu-icon"]');
7070
const accountTokenValue = await driver.waitForSelector(
7171
'.multichain-account-list-item .multichain-account-list-item__asset',

test/e2e/tests/contract-interactions.spec.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
const { strict: assert } = require('assert');
21
const {
32
defaultGanacheOptions,
43
withFixtures,
54
openDapp,
65
unlockWallet,
76
largeDelayMs,
87
WINDOW_TITLES,
8+
locateAccountBalanceDOM,
99
} = require('../helpers');
1010

1111
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
@@ -25,7 +25,7 @@ describe('Deploy contract and call contract methods', function () {
2525
smartContract,
2626
title: this.test.fullTitle(),
2727
},
28-
async ({ driver, contractRegistry }) => {
28+
async ({ driver, contractRegistry, ganacheServer }) => {
2929
const contractAddress = await contractRegistry.getContractAddress(
3030
smartContract,
3131
);
@@ -87,10 +87,7 @@ describe('Deploy contract and call contract methods', function () {
8787
await driver.switchToWindowWithTitle(
8888
WINDOW_TITLES.ExtensionInFullScreenView,
8989
);
90-
const balance = await driver.findElement(
91-
'[data-testid="eth-overview__primary-currency"]',
92-
);
93-
assert.equal(await balance.getText(), '$37,399.05\nUSD');
90+
await locateAccountBalanceDOM(driver, ganacheServer);
9491
},
9592
);
9693
});

test/e2e/tests/incremental-security.spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ describe('Incremental Security', function () {
112112
// should have the correct amount of eth
113113
let currencyDisplay = await driver.waitForSelector({
114114
css: '.currency-display-component__text',
115-
text: '$1,700.00',
115+
text: '1',
116116
});
117117
let balance = await currencyDisplay.getText();
118-
assert.strictEqual(balance, '$1,700.00');
118+
assert.strictEqual(balance, '1');
119119

120120
// backs up the Secret Recovery Phrase
121121
// should show a backup reminder
@@ -163,11 +163,11 @@ describe('Incremental Security', function () {
163163
// should have the correct amount of eth
164164
currencyDisplay = await driver.waitForSelector({
165165
css: '.currency-display-component__text',
166-
text: '$1,700.00',
166+
text: '1',
167167
});
168168
balance = await currencyDisplay.getText();
169169

170-
assert.strictEqual(balance, '$1,700.00');
170+
assert.strictEqual(balance, '1');
171171

172172
// should not show a backup reminder
173173
await driver.assertElementNotPresent('.backup-notification');

test/e2e/tests/localization.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('Localization', function () {
2727
await unlockWallet(driver);
2828

2929
const secondaryBalance = await driver.findElement(
30-
'[data-testid="eth-overview__primary-currency"]',
30+
'[data-testid="eth-overview__secondary-currency"]',
3131
);
3232
const secondaryBalanceText = await secondaryBalance.getText();
3333
const [fiatAmount, fiatUnit] = secondaryBalanceText

test/e2e/tests/lock-account.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('Lock and unlock', function () {
3030
const walletBalance = await driver.findElement(
3131
'.eth-overview__primary-balance',
3232
);
33-
assert.equal(await walletBalance.getText(), '$42,500.00\nUSD');
33+
assert.equal(/^25\s*ETH$/u.test(await walletBalance.getText()), true);
3434
},
3535
);
3636
});

test/e2e/tests/metamask-responsive-ui.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ describe('MetaMask Responsive UI', function () {
7474
await driver.waitForElementNotPresent('.loading-overlay__spinner');
7575
// assert balance
7676
const balance = await driver.findElement(
77-
'.eth-overview__primary-container',
77+
'[data-testid="eth-overview__primary-currency"]',
7878
);
79-
assert.equal(await balance.getText(), '$0.00\nUSD');
79+
assert.ok(/^0\sETH$/u.test(await balance.getText()));
8080
},
8181
);
8282
});

test/e2e/tests/migrate-old-vault.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('Migrate vault with old encryption', function () {
3232
const walletBalance = await driver.findElement(
3333
'.eth-overview__primary-balance',
3434
);
35-
assert.equal(await walletBalance.getText(), '$42,500.00\nUSD');
35+
assert.equal(/^25\s*ETH$/u.test(await walletBalance.getText()), true);
3636
},
3737
);
3838
});

test/e2e/tests/send-eth.spec.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ describe('Send ETH', function () {
190190
const balance = await driver.findElement(
191191
'[data-testid="eth-overview__primary-currency"]',
192192
);
193-
assert.equal(await balance.getText(), '$42,496.38\nUSD');
193+
assert.ok(/^[\d.]+\sETH$/u.test(await balance.getText()));
194194
await driver.clickElement('[data-testid="home__activity-tab"]');
195195

196196
await driver.findElement(
@@ -215,12 +215,14 @@ describe('Send ETH', function () {
215215
return;
216216
}
217217
await unlockWallet(driver);
218+
218219
const balance = await driver.findElement(
219220
'[data-testid="eth-overview__primary-currency"]',
220221
);
221222
await driver.isElementPresent('.loading-overlay__spinner');
222223
await driver.waitForElementNotPresent('.loading-overlay__spinner');
223-
assert.equal(await balance.getText(), '$42,500.00\nUSD');
224+
assert.ok(/^[\d.]+\sETH$/u.test(await balance.getText()));
225+
224226
await openActionMenuAndStartSendFlow(driver);
225227
// choose to scan via QR code
226228
await driver.clickElement('[data-testid="ens-qr-scan-button"]');
@@ -419,13 +421,13 @@ describe('Send ETH', function () {
419421
},
420422
async ({ driver }) => {
421423
await unlockWallet(driver);
424+
422425
const balance = await driver.findElement(
423426
'[data-testid="eth-overview__primary-currency"]',
424427
);
425-
426428
await driver.isElementPresent('.loading-overlay__spinner');
427429
await driver.waitForElementNotPresent('.loading-overlay__spinner');
428-
assert.equal(await balance.getText(), '$42,500.00\nUSD');
430+
assert.ok(/^[\d.]+\sETH$/u.test(await balance.getText()));
429431

430432
await openActionMenuAndStartSendFlow(driver);
431433
if (process.env.MULTICHAIN) {

ui/components/app/wallet-overview/eth-overview.js

+17-32
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,11 @@ import UserPreferencedCurrencyDisplay from '../user-preferenced-currency-display
2727
import { PRIMARY, SECONDARY } from '../../../helpers/constants/common';
2828
import {
2929
isBalanceCached,
30+
getShouldShowFiat,
3031
getIsSwapsChain,
3132
getCurrentChainId,
3233
getPreferences,
33-
getSelectedAddress,
34-
getShouldHideZeroBalanceTokens,
35-
getCurrentNetwork,
3634
getSelectedAccountCachedBalance,
37-
getShowFiatInTestnets,
3835
///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask)
3936
getSwapsDefaultToken,
4037
getCurrentKeyring,
@@ -65,11 +62,9 @@ import { IconColor } from '../../../helpers/constants/design-system';
6562
import useRamps from '../../../hooks/experiences/useRamps';
6663
import { getPortfolioUrl } from '../../../helpers/utils/portfolio';
6764
///: END:ONLY_INCLUDE_IF
68-
import { useAccountTotalFiatBalance } from '../../../hooks/useAccountTotalFiatBalance';
6965
import { useIsOriginalNativeTokenSymbol } from '../../../hooks/useIsOriginalNativeTokenSymbol';
7066
import { getProviderConfig } from '../../../ducks/metamask/metamask';
7167
import { showPrimaryCurrency } from '../../../../shared/modules/currency-display.utils';
72-
import { TEST_NETWORKS } from '../../../../shared/constants/network';
7368
import WalletOverview from './wallet-overview';
7469

7570
const EthOverview = ({ className, showAddress }) => {
@@ -87,36 +82,17 @@ const EthOverview = ({ className, showAddress }) => {
8782
const defaultSwapsToken = useSelector(getSwapsDefaultToken);
8883
///: END:ONLY_INCLUDE_IF
8984
const balanceIsCached = useSelector(isBalanceCached);
85+
const showFiat = useSelector(getShouldShowFiat);
9086
const { useNativeCurrencyAsPrimaryCurrency } = useSelector(getPreferences);
9187
const chainId = useSelector(getCurrentChainId);
9288
const { ticker, type } = useSelector(getProviderConfig);
93-
const currentNetwork = useSelector(getCurrentNetwork);
9489
const balance = useSelector(getSelectedAccountCachedBalance);
9590
const isOriginalNativeSymbol = useIsOriginalNativeTokenSymbol(
9691
chainId,
9792
ticker,
9893
type,
9994
);
10095

101-
// Total fiat balance
102-
const selectedAddress = useSelector(getSelectedAddress);
103-
const shouldHideZeroBalanceTokens = useSelector(
104-
getShouldHideZeroBalanceTokens,
105-
);
106-
const { totalWeiBalance } = useAccountTotalFiatBalance(
107-
selectedAddress,
108-
shouldHideZeroBalanceTokens,
109-
);
110-
const showFiatInTestnets = useSelector(getShowFiatInTestnets);
111-
const showFiat =
112-
TEST_NETWORKS.includes(currentNetwork?.nickname) && !showFiatInTestnets;
113-
114-
let balanceToUse = totalWeiBalance;
115-
116-
if (showFiat) {
117-
balanceToUse = balance;
118-
}
119-
12096
const isSwapsChain = useSelector(getIsSwapsChain);
12197

12298
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
@@ -186,14 +162,14 @@ const EthOverview = ({ className, showAddress }) => {
186162
>
187163
<div className="eth-overview__balance">
188164
<div className="eth-overview__primary-container">
189-
{balanceToUse ? (
165+
{balance ? (
190166
<UserPreferencedCurrencyDisplay
191167
style={{ display: 'contents' }}
192168
className={classnames('eth-overview__primary-balance', {
193169
'eth-overview__cached-balance': balanceIsCached,
194170
})}
195171
data-testid="eth-overview__primary-currency"
196-
value={balanceToUse}
172+
value={balance}
197173
type={
198174
showPrimaryCurrency(
199175
isOriginalNativeSymbol,
@@ -202,10 +178,6 @@ const EthOverview = ({ className, showAddress }) => {
202178
? PRIMARY
203179
: SECONDARY
204180
}
205-
showFiat={
206-
!showFiat ||
207-
!TEST_NETWORKS.includes(currentNetwork?.nickname)
208-
}
209181
ethNumberOfDecimals={4}
210182
hideTitle
211183
/>
@@ -219,6 +191,19 @@ const EthOverview = ({ className, showAddress }) => {
219191
<span className="eth-overview__cached-star">*</span>
220192
) : null}
221193
</div>
194+
{showFiat && isOriginalNativeSymbol && balance && (
195+
<UserPreferencedCurrencyDisplay
196+
className={classnames({
197+
'eth-overview__cached-secondary-balance': balanceIsCached,
198+
'eth-overview__secondary-balance': !balanceIsCached,
199+
})}
200+
data-testid="eth-overview__secondary-currency"
201+
value={balance}
202+
type={SECONDARY}
203+
ethNumberOfDecimals={4}
204+
hideTitle
205+
/>
206+
)}
222207
</div>
223208
</Tooltip>
224209
}

ui/components/app/wallet-overview/eth-overview.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ describe('EthOverview', () => {
171171

172172
const primaryBalance = queryByTestId(ETH_OVERVIEW_PRIMARY_CURRENCY);
173173
expect(primaryBalance).toBeInTheDocument();
174-
expect(primaryBalance).toHaveTextContent('$0.00USD');
174+
expect(primaryBalance).toHaveTextContent('<0.000001ETH');
175175
expect(queryByText('*')).not.toBeInTheDocument();
176176
});
177177

@@ -202,7 +202,7 @@ describe('EthOverview', () => {
202202

203203
const primaryBalance = queryByTestId(ETH_OVERVIEW_PRIMARY_CURRENCY);
204204
expect(primaryBalance).toBeInTheDocument();
205-
expect(primaryBalance).toHaveTextContent('$0.02USD');
205+
expect(primaryBalance).toHaveTextContent('0.0104ETH');
206206
expect(queryByText('*')).toBeInTheDocument();
207207
});
208208

0 commit comments

Comments
 (0)