diff --git a/.github/workflows/validate-conventional-commits.yml b/.github/workflows/validate-conventional-commits.yml index 922bdddd7db5..aaed4ee1e6ec 100644 --- a/.github/workflows/validate-conventional-commits.yml +++ b/.github/workflows/validate-conventional-commits.yml @@ -1,6 +1,8 @@ name: Validate Conventional Commit Title on: pull_request: + branches: + - develop types: [opened, edited, reopened] jobs: diff --git a/CHANGELOG.md b/CHANGELOG.md index 37914aea36cd..7d01d7fbd885 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,127 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ## [11.13.0] +## [11.12.4] +### Fixed +- Ensure native network balance is visible in home screen balance display ([#23614](https://github.com/MetaMask/metamask-extension/pull/23614)) + +## [11.12.3] +### Fixed +- [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)) +- [MMI] Fixes a bug for some custodians that don't send us the env property when connection to MMI ([#23494](https://github.com/MetaMask/metamask-extension/pull/23494)) + +## [11.12.2] +### Fixed +- Fix transaction confirmations so that they correctly show estimated fees instead of max possible fees + - For non-layer 2 network, and non-token send, transactions([#23203](https://github.com/MetaMask/metamask-extension/pull/23203)) + - For layer 2 networks and for erc20 transfers ([#23511](https://github.com/MetaMask/metamask-extension/pull/23511)) + +## [11.12.1] +### Changed +- Updated styling for missing petnames to prevent misinterpretation as malicious ([#23458](https://github.com/MetaMask/metamask-extension/pull/23458)) + +## [11.12.0] +### Added +- Introduced deprecation warnings for Arbitrum Goerli and OP Goerli test networks ([#23071](https://github.com/MetaMask/metamask-extension/pull/23071)) +- Added origin details to personal sign page ([#22763](https://github.com/MetaMask/metamask-extension/pull/22763)) +- Enhanced snap functionality with dynamic interfaces, customizable timeouts, and faster installations ([#22828](https://github.com/MetaMask/metamask-extension/pull/22828)) +- Added a 'Connect Account' button in the account list menu for easier account connections ([#22941](https://github.com/MetaMask/metamask-extension/pull/22941)) +- [FLASK] Added signature insights ([#22485](https://github.com/MetaMask/metamask-extension/pull/22485)) +- [MMI] Enhanced error tracking in MMI controllers ([#22994](https://github.com/MetaMask/metamask-extension/pull/22994)) +- [MMI] Updated MMI dependencies and refactored code ([#22546](https://github.com/MetaMask/metamask-extension/pull/22546)) + +### Changed +- Updated Confirm/Sign button to red for malicious requests ([#23004](https://github.com/MetaMask/metamask-extension/pull/23004)) +- Updated the 'Discover Snaps' link to direct users to snaps.metamask.io ([#22909](https://github.com/MetaMask/metamask-extension/pull/22909)) +- Displayed total account balances on Accounts Menu and home screen ([#22186](https://github.com/MetaMask/metamask-extension/pull/22186)) +- Updated style of app header ([#22637](https://github.com/MetaMask/metamask-extension/pull/22637)) +- Enhanced settings search for better navigation ([#22967](https://github.com/MetaMask/metamask-extension/pull/22967)) +- Enhanced Send Flow by displaying account names during search ([#22824](https://github.com/MetaMask/metamask-extension/pull/22824)) +- Improved send flow by directly showing NFTs tab when sending an NFT ([#23033](https://github.com/MetaMask/metamask-extension/pull/23033)) +- Simplified send flow by removing outdated gas options ([#22951](https://github.com/MetaMask/metamask-extension/pull/22951)) +- [MMI] Improved custodian search by using environment names for unique identification ([#23073](https://github.com/MetaMask/metamask-extension/pull/23073)) +- [MMI] Enhanced MMI keyring configuration for improved mv3 version compatibility ([#22968](https://github.com/MetaMask/metamask-extension/pull/22968)) + +### Fixed +- Improved accuracy of fee details for Optimism transactions ([#22997](https://github.com/MetaMask/metamask-extension/pull/22997)) +- Ensured password prompt appears every time 'Show private key' is selected ([#22867](https://github.com/MetaMask/metamask-extension/pull/22867)) +- Adjusted menu positioning ensuring visibility of all options ([#22889](https://github.com/MetaMask/metamask-extension/pull/22889)) +- Corrected asset list to display native currency symbols instead of fiat on the home page ([#22760](https://github.com/MetaMask/metamask-extension/pull/22760)) +- Fixed tokens being added to incorrect networks after switching networks ([#22814](https://github.com/MetaMask/metamask-extension/pull/22814)) +- Fixed an issue where NFTs disappeared or couldn't be re-imported after account switching ([#22856](https://github.com/MetaMask/metamask-extension/pull/22856)) +- Fixed an issue with saving very low default gas fees ([#22790](https://github.com/MetaMask/metamask-extension/pull/22790)) +- Removed the subtle background behind setting icons ([#22982](https://github.com/MetaMask/metamask-extension/pull/22982)) +- Improved 'See Details' in alerts to stop auto-scrolling ([#22932](https://github.com/MetaMask/metamask-extension/pull/22932)) +- Improved security checks for transactions ([#22978](https://github.com/MetaMask/metamask-extension/pull/22978)) +- Ensured gas fee editing remains accessible even when currency rate checks are disabled ([#22890](https://github.com/MetaMask/metamask-extension/pull/22890)) +- Updated modal overlay for better visibility and focus on content in both light and dark modes ([#23102](https://github.com/MetaMask/metamask-extension/pull/23102)) +- Fixed behavior for manually added networks to show a modal with the option to switch, rather than auto-switching ([#22832](https://github.com/MetaMask/metamask-extension/pull/22832)) +- Corrected link alignment in Snap UI ([#23045](https://github.com/MetaMask/metamask-extension/pull/23045)) +- Resolved an issue that prevented cancelling permission requests without crashing the extension ([#22915](https://github.com/MetaMask/metamask-extension/pull/22915)) +- Fixed badge color in app-header to accurately reflect connection status ([#23126](https://github.com/MetaMask/metamask-extension/pull/23126)) +- Fixed a glitch in the Product Tour where step numbers were not displaying correctly ([#23100](https://github.com/MetaMask/metamask-extension/pull/23100)) +- Enhanced handling of long account names ([#23096](https://github.com/MetaMask/metamask-extension/pull/23096)) +- Resolved issue with tabs overlapping content in the send flow ([#23028](https://github.com/MetaMask/metamask-extension/pull/23028)) +- Ensured consistent balance display in Eth Overview and account list ([#23059](https://github.com/MetaMask/metamask-extension/pull/23059)) +- [MMI] Corrected custody type determination to support various types ([#22950](https://github.com/MetaMask/metamask-extension/pull/22950)) + +## [11.11.4] +### Changed +- Enable Snaps home pages ([#23383](https://github.com/MetaMask/metamask-extension/pull/23383)) + +### Fixed +- Fix intermittent Snaps installation issues due to faulty validation ([#23380](https://github.com/MetaMask/metamask-extension/pull/23380)) + +## [11.11.3] + +## [11.11.2] +### Changed +- Update the image in the Staking button What's New popup ([#23330](https://github.com/MetaMask/metamask-extension/pull/23330)) + +### Fixed +- [MMI] Fixed bug that prevents MMI users from submitting multiple Txs ([#23342](https://github.com/MetaMask/metamask-extension/pull/23342)) +- Fix the display of the native currency token symbol in the asset list + - ([#23355](https://github.com/MetaMask/metamask-extension/pull/23355)) + - ([#23327](https://github.com/MetaMask/metamask-extension/pull/23327)) + +## [11.11.1] +### Added +- Adds a staking button to the mainnet Ethereum token list item ([#22347](https://github.com/MetaMask/metamask-extension/pull/22347)) + +## [11.11.0] +### Added +- Added 'Pet Names' feature, allowing users to see preferred or suggested nicknames in the places of addesses + - Added 'What's New' popup for Petnames feature ([#22780](https://github.com/MetaMask/metamask-extension/pull/22780)) + - Introduced toggle for Petnames in experimental settings ([#22456](https://github.com/MetaMask/metamask-extension/pull/22456)) + - UI enhancements for initial petnames release, including new "Recognized" category and visual refinements ([#22772](https://github.com/MetaMask/metamask-extension/pull/22772)) + - Enhanced token name display with pet names ([#22734](https://github.com/MetaMask/metamask-extension/pull/22734)) +- Added title to Personal Sign component in confirmation design ([#22749](https://github.com/MetaMask/metamask-extension/pull/22749)) +- Added progress indicator for scanning QR codes with hardware wallets ([#20947](https://github.com/MetaMask/metamask-extension/pull/20947)) + +### Changed +- Moved security alerts from Experimental to Security & Privacy settings ([#22813](https://github.com/MetaMask/metamask-extension/pull/22813)) +- Updated BlockaidBannerAlert to support false positive reporting for failed types ([#22742](https://github.com/MetaMask/metamask-extension/pull/22742)) +- Enhanced BlockaidBannerAlert functionality and display ([#22625](https://github.com/MetaMask/metamask-extension/pull/22625)) +- Disabled smart swaps for Snap accounts ([#22731](https://github.com/MetaMask/metamask-extension/pull/22731)) +- Disabled MetaMask on Battle.net to fix a 2FA login issue ([#20396](https://github.com/MetaMask/metamask-extension/pull/20396)) +- Revised warning copy for mismatched chainID and currency symbol when adding custom networks ([#22648](https://github.com/MetaMask/metamask-extension/pull/22648)) +- Improved UX to display multiple custom networks with the same ID but different RPC URLs in network selection ([#22693](https://github.com/MetaMask/metamask-extension/pull/22693)) +- Updated the connections icon to display the connected dapp icon ([#22634](https://github.com/MetaMask/metamask-extension/pull/22634)) +- Added title to Personal Sign page ([#22749](https://github.com/MetaMask/metamask-extension/pull/22749)) +- Update padding in accounts details modal ([#22775](https://github.com/MetaMask/metamask-extension/pull/22775)) +- [MMI] Refactored display of custodian deep link to improve efficiency and fix potential race conditions ([#22825](https://github.com/MetaMask/metamask-extension/pull/22825)) +- [MMI] Hid the new buy & receive button under MMI build for a cleaner interface ([#22384](https://github.com/MetaMask/metamask-extension/pull/22384)) + +### Fixed +- Fixed cancel transaction signing from activity list ([#22676](https://github.com/MetaMask/metamask-extension/pull/22676)) +- Fixed incorrect account name display in account details and receive list ([#22844](https://github.com/MetaMask/metamask-extension/pull/22844)) +- Fixed IPFS NFTs fetching issue for manually imported NFTs ([#22627](https://github.com/MetaMask/metamask-extension/pull/22627)) +- Fixed "send max" ETH calculation issue to adjust for gas changes ([#22694](https://github.com/MetaMask/metamask-extension/pull/22694)) +- Fixed sign button color and updated deprecated components in SignatureRequestOriginalWarning for visual consistency ([#22741](https://github.com/MetaMask/metamask-extension/pull/22741)) + +## [11.10.1] +### Fixed +- Fix custom network editing, via Settings, for some networks ([#23140](https://github.com/MetaMask/metamask-extension/pull/23140)) ## [11.10.0] ### Added @@ -4394,6 +4515,18 @@ Update styles and spacing on the critical error page ([#20350](https://github.c [Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v11.13.0...HEAD [11.13.0]: https://github.com/MetaMask/metamask-extension/compare/v11.10.0...v11.13.0 +[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v11.12.4...HEAD +[11.12.4]: https://github.com/MetaMask/metamask-extension/compare/v11.12.3...v11.12.4 +[11.12.3]: https://github.com/MetaMask/metamask-extension/compare/v11.12.2...v11.12.3 +[11.12.2]: https://github.com/MetaMask/metamask-extension/compare/v11.12.1...v11.12.2 +[11.12.1]: https://github.com/MetaMask/metamask-extension/compare/v11.12.0...v11.12.1 +[11.12.0]: https://github.com/MetaMask/metamask-extension/compare/v11.11.4...v11.12.0 +[11.11.4]: https://github.com/MetaMask/metamask-extension/compare/v11.11.3...v11.11.4 +[11.11.3]: https://github.com/MetaMask/metamask-extension/compare/v11.11.2...v11.11.3 +[11.11.2]: https://github.com/MetaMask/metamask-extension/compare/v11.11.1...v11.11.2 +[11.11.1]: https://github.com/MetaMask/metamask-extension/compare/v11.11.0...v11.11.1 +[11.11.0]: https://github.com/MetaMask/metamask-extension/compare/v11.10.1...v11.11.0 +[11.10.1]: https://github.com/MetaMask/metamask-extension/compare/v11.10.0...v11.10.1 [11.10.0]: https://github.com/MetaMask/metamask-extension/compare/v11.9.5...v11.10.0 [11.9.5]: https://github.com/MetaMask/metamask-extension/compare/v11.9.4...v11.9.5 [11.9.4]: https://github.com/MetaMask/metamask-extension/compare/v11.9.3...v11.9.4 diff --git a/app/scripts/lib/createRPCMethodTrackingMiddleware.js b/app/scripts/lib/createRPCMethodTrackingMiddleware.js index d934a87eff41..ee1d1d0a4b56 100644 --- a/app/scripts/lib/createRPCMethodTrackingMiddleware.js +++ b/app/scripts/lib/createRPCMethodTrackingMiddleware.js @@ -321,6 +321,7 @@ export default function createRPCMethodTrackingMiddleware({ let blockaidMetricProps = {}; + ///: BEGIN:ONLY_INCLUDE_IF(blockaid) if (!isDisabledRPCMethod) { if (SIGNING_METHODS.includes(method)) { const securityAlertResponse = @@ -333,6 +334,7 @@ export default function createRPCMethodTrackingMiddleware({ }); } } + ///: END:ONLY_INCLUDE_IF const properties = { ...eventProperties, diff --git a/builds.yml b/builds.yml index ba9a588171e6..c0eddc332e86 100644 --- a/builds.yml +++ b/builds.yml @@ -100,6 +100,7 @@ buildTypes: features: - build-mmi - snaps + - blockaid env: - INFURA_MMI_PROJECT_ID - SEGMENT_MMI_WRITE_KEY diff --git a/lavamoat/browserify/mmi/policy.json b/lavamoat/browserify/mmi/policy.json index 90cceecc2a8a..79bfe739f706 100644 --- a/lavamoat/browserify/mmi/policy.json +++ b/lavamoat/browserify/mmi/policy.json @@ -1856,6 +1856,40 @@ "webpack>events": true } }, + "@metamask/ppom-validator": { + "globals": { + "URL": true, + "console.error": true, + "crypto": true + }, + "packages": { + "@metamask/controller-utils": true, + "@metamask/eth-query>json-rpc-random-id": true, + "@metamask/ppom-validator>@metamask/base-controller": true, + "@metamask/ppom-validator>crypto-js": true, + "@metamask/ppom-validator>elliptic": true, + "await-semaphore": true, + "browserify>buffer": true + } + }, + "@metamask/ppom-validator>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, + "@metamask/ppom-validator>crypto-js": { + "globals": { + "crypto": true, + "define": true, + "msCrypto": true + }, + "packages": { + "browserify>browser-resolve": true + } + }, "@metamask/ppom-validator>elliptic": { "packages": { "@metamask/ppom-validator>elliptic>brorand": true, diff --git a/shared/constants/metametrics.ts b/shared/constants/metametrics.ts index 397fa0472039..4a02b88d461c 100644 --- a/shared/constants/metametrics.ts +++ b/shared/constants/metametrics.ts @@ -662,7 +662,7 @@ export enum MetaMetricsEventName { ///: BEGIN:ONLY_INCLUDE_IF(snaps) SnapInstallStarted = 'Snap Install Started', SnapInstallFailed = 'Snap Install Failed', - SnapInstallRejected = 'Snap Update Rejected', + SnapInstallRejected = 'Snap Install Rejected', SnapInstalled = 'Snap Installed', SnapUninstalled = 'Snap Uninstalled', SnapUpdateStarted = 'Snap Update Started', diff --git a/shared/constants/permissions.test.js b/shared/constants/permissions.test.js index 14b279d8c0e4..38dc1e1c87a4 100644 --- a/shared/constants/permissions.test.js +++ b/shared/constants/permissions.test.js @@ -15,7 +15,6 @@ describe('EndowmentPermissions', () => { expect(Object.keys(EndowmentPermissions).sort()).toStrictEqual( [ 'endowment:name-lookup', - 'endowment:page-home', 'endowment:signature-insight', ...Object.keys(endowmentPermissionBuilders).filter( (targetName) => diff --git a/shared/constants/snaps/permissions.ts b/shared/constants/snaps/permissions.ts index 160a02f7507b..f0c798e05e0b 100644 --- a/shared/constants/snaps/permissions.ts +++ b/shared/constants/snaps/permissions.ts @@ -6,8 +6,8 @@ export const EndowmentPermissions = Object.freeze({ 'endowment:rpc': 'endowment:rpc', 'endowment:webassembly': 'endowment:webassembly', 'endowment:lifecycle-hooks': 'endowment:lifecycle-hooks', - ///: BEGIN:ONLY_INCLUDE_IF(build-flask) 'endowment:page-home': 'endowment:page-home', + ///: BEGIN:ONLY_INCLUDE_IF(build-flask) 'endowment:signature-insight': 'endowment:signature-insight', 'endowment:name-lookup': 'endowment:name-lookup', ///: END:ONLY_INCLUDE_IF @@ -24,8 +24,6 @@ export const ExcludedSnapPermissions = Object.freeze({ export const ExcludedSnapEndowments = Object.freeze({ ///: BEGIN:ONLY_INCLUDE_IF(build-main) - 'endowment:page-home': - 'This endowment is experimental and therefore not available.', 'endowment:name-lookup': 'This endowment is experimental and therefore not available.', 'endowment:signature-insight': diff --git a/test/e2e/helpers.js b/test/e2e/helpers.js index e51345334df0..7b2e0c2de3d8 100644 --- a/test/e2e/helpers.js +++ b/test/e2e/helpers.js @@ -826,16 +826,11 @@ const TEST_SEED_PHRASE_TWO = // Usually happens when onboarded to make sure the state is retrieved from metamaskState properly, or after txn is made const locateAccountBalanceDOM = async (driver, ganacheServer) => { - const balance = (await ganacheServer.getFiatBalance()).toLocaleString( - undefined, - { - minimumFractionDigits: 2, - }, - ); + const balance = await ganacheServer.getBalance(); await driver.findElement({ css: '[data-testid="eth-overview__primary-currency"]', - text: `$ ${balance} USD`, + text: `${balance} ETH`, }); }; diff --git a/test/e2e/tests/account-token-list.spec.js b/test/e2e/tests/account-token-list.spec.js index 1285027ed3e3..f0f08ae8fcdb 100644 --- a/test/e2e/tests/account-token-list.spec.js +++ b/test/e2e/tests/account-token-list.spec.js @@ -19,7 +19,9 @@ describe('Settings', function () { await logInWithBalanceValidation(driver, ganacheServer); await driver.clickElement('[data-testid="home__asset-tab"]'); + const tokenValue = '25 ETH'; + const tokenListAmount = await driver.findElement( '[data-testid="multichain-token-list-item-value"]', ); @@ -63,7 +65,7 @@ describe('Settings', function () { const tokenListAmount = await driver.findElement( '.eth-overview__primary-container', ); - assert.equal(await tokenListAmount.getText(), '$42,500.00\nUSD'); + assert.equal(await tokenListAmount.getText(), '25\nETH'); await driver.clickElement('[data-testid="account-menu-icon"]'); const accountTokenValue = await driver.waitForSelector( '.multichain-account-list-item .multichain-account-list-item__asset', diff --git a/test/e2e/tests/contract-interactions.spec.js b/test/e2e/tests/contract-interactions.spec.js index 3f87e112a21e..d59ece2d97ed 100644 --- a/test/e2e/tests/contract-interactions.spec.js +++ b/test/e2e/tests/contract-interactions.spec.js @@ -1,4 +1,3 @@ -const { strict: assert } = require('assert'); const { defaultGanacheOptions, withFixtures, @@ -6,6 +5,7 @@ const { unlockWallet, largeDelayMs, WINDOW_TITLES, + locateAccountBalanceDOM, } = require('../helpers'); const { SMART_CONTRACTS } = require('../seeder/smart-contracts'); @@ -25,7 +25,7 @@ describe('Deploy contract and call contract methods', function () { smartContract, title: this.test.fullTitle(), }, - async ({ driver, contractRegistry }) => { + async ({ driver, contractRegistry, ganacheServer }) => { const contractAddress = await contractRegistry.getContractAddress( smartContract, ); @@ -87,10 +87,7 @@ describe('Deploy contract and call contract methods', function () { await driver.switchToWindowWithTitle( WINDOW_TITLES.ExtensionInFullScreenView, ); - const balance = await driver.findElement( - '[data-testid="eth-overview__primary-currency"]', - ); - assert.equal(await balance.getText(), '$37,399.05\nUSD'); + await locateAccountBalanceDOM(driver, ganacheServer); }, ); }); diff --git a/test/e2e/tests/incremental-security.spec.js b/test/e2e/tests/incremental-security.spec.js index 709ce1c36f03..857cd79e3e8d 100644 --- a/test/e2e/tests/incremental-security.spec.js +++ b/test/e2e/tests/incremental-security.spec.js @@ -112,10 +112,10 @@ describe('Incremental Security', function () { // should have the correct amount of eth let currencyDisplay = await driver.waitForSelector({ css: '.currency-display-component__text', - text: '$1,700.00', + text: '1', }); let balance = await currencyDisplay.getText(); - assert.strictEqual(balance, '$1,700.00'); + assert.strictEqual(balance, '1'); // backs up the Secret Recovery Phrase // should show a backup reminder @@ -163,11 +163,11 @@ describe('Incremental Security', function () { // should have the correct amount of eth currencyDisplay = await driver.waitForSelector({ css: '.currency-display-component__text', - text: '$1,700.00', + text: '1', }); balance = await currencyDisplay.getText(); - assert.strictEqual(balance, '$1,700.00'); + assert.strictEqual(balance, '1'); // The previous currencyDisplay wait already serves as the guard here for the assertElementNotPresent await driver.assertElementNotPresent('.backup-notification'); diff --git a/test/e2e/tests/localization.spec.js b/test/e2e/tests/localization.spec.js index 6c0e0295f097..7c8c35d3d169 100644 --- a/test/e2e/tests/localization.spec.js +++ b/test/e2e/tests/localization.spec.js @@ -27,7 +27,7 @@ describe('Localization', function () { await unlockWallet(driver); const secondaryBalance = await driver.findElement( - '[data-testid="eth-overview__primary-currency"]', + '[data-testid="eth-overview__secondary-currency"]', ); const secondaryBalanceText = await secondaryBalance.getText(); const [fiatAmount, fiatUnit] = secondaryBalanceText diff --git a/test/e2e/tests/lock-account.spec.js b/test/e2e/tests/lock-account.spec.js index 9ef084b17a7c..a4d23ab7838f 100644 --- a/test/e2e/tests/lock-account.spec.js +++ b/test/e2e/tests/lock-account.spec.js @@ -30,7 +30,7 @@ describe('Lock and unlock', function () { const walletBalance = await driver.findElement( '.eth-overview__primary-balance', ); - assert.equal(await walletBalance.getText(), '$42,500.00\nUSD'); + assert.equal(/^25\s*ETH$/u.test(await walletBalance.getText()), true); }, ); }); diff --git a/test/e2e/tests/metamask-responsive-ui.spec.js b/test/e2e/tests/metamask-responsive-ui.spec.js index ece480115603..7f80c8380284 100644 --- a/test/e2e/tests/metamask-responsive-ui.spec.js +++ b/test/e2e/tests/metamask-responsive-ui.spec.js @@ -72,10 +72,10 @@ describe('MetaMask Responsive UI', function () { await driver.clickElement('[data-testid="pin-extension-done"]'); await driver.assertElementNotPresent('.loading-overlay__spinner'); // assert balance - await driver.findElement({ - css: '[data-testid="eth-overview__primary-currency"]', - text: `$ 0.00 USD`, - }); + const balance = await driver.findElement( + '[data-testid="eth-overview__primary-currency"]', + ); + assert.ok(/^0\sETH$/u.test(await balance.getText())); }, ); }); diff --git a/test/e2e/tests/migrate-old-vault.spec.js b/test/e2e/tests/migrate-old-vault.spec.js index 82b6c846b2d9..93bd07010bbe 100644 --- a/test/e2e/tests/migrate-old-vault.spec.js +++ b/test/e2e/tests/migrate-old-vault.spec.js @@ -32,7 +32,7 @@ describe('Migrate vault with old encryption', function () { const walletBalance = await driver.findElement( '.eth-overview__primary-balance', ); - assert.equal(await walletBalance.getText(), '$42,500.00\nUSD'); + assert.equal(/^25\s*ETH$/u.test(await walletBalance.getText()), true); }, ); }); diff --git a/test/e2e/tests/send-eth.spec.js b/test/e2e/tests/send-eth.spec.js index 66e57bd7ded3..331887de97c6 100644 --- a/test/e2e/tests/send-eth.spec.js +++ b/test/e2e/tests/send-eth.spec.js @@ -185,10 +185,10 @@ describe('Send ETH', function () { await driver.clickElement({ text: 'Confirm', tag: 'button' }); // Go back to home screen to check txn - await driver.findElement({ - css: '[data-testid="eth-overview__primary-currency"]', - text: '$42,496.38', - }); + const balance = await driver.findElement( + '[data-testid="eth-overview__primary-currency"]', + ); + assert.ok(/^[\d.]+\sETH$/u.test(await balance.getText())); await driver.clickElement('[data-testid="home__activity-tab"]'); await driver.findElement( @@ -216,11 +216,12 @@ describe('Send ETH', function () { async ({ driver }) => { await unlockWallet(driver); + const balance = await driver.findElement( + '[data-testid="eth-overview__primary-currency"]', + ); + await driver.isElementPresent('.loading-overlay__spinner'); await driver.assertElementNotPresent('.loading-overlay__spinner'); - await driver.findElement({ - css: '[data-testid="eth-overview__primary-currency"]', - text: '$42,500.00', - }); + assert.ok(/^[\d.]+\sETH$/u.test(await balance.getText())); await openActionMenuAndStartSendFlow(driver); // choose to scan via QR code @@ -431,12 +432,12 @@ describe('Send ETH', function () { }, async ({ driver }) => { await unlockWallet(driver); - + const balance = await driver.findElement( + '[data-testid="eth-overview__primary-currency"]', + ); + await driver.isElementPresent('.loading-overlay__spinner'); await driver.assertElementNotPresent('.loading-overlay__spinner'); - await driver.findElement({ - css: '[data-testid="eth-overview__primary-currency"]', - text: '$42,500.00', - }); + assert.ok(/^[\d.]+\sETH$/u.test(await balance.getText())); await openActionMenuAndStartSendFlow(driver); await driver.fill( diff --git a/ui/components/app/asset-list/asset-list.js b/ui/components/app/asset-list/asset-list.js index 154454e42de1..e0425e5eb8f2 100644 --- a/ui/components/app/asset-list/asset-list.js +++ b/ui/components/app/asset-list/asset-list.js @@ -66,6 +66,7 @@ const AssetList = ({ onClickAsset }) => { const showFiat = useSelector(getShouldShowFiat); const currentNetwork = useSelector(getCurrentNetwork); const currentLocale = useSelector(getCurrentLocale); + const isMainnet = useSelector(getIsMainnet); const { useNativeCurrencyAsPrimaryCurrency } = useSelector(getPreferences); const { ticker, type } = useSelector(getProviderConfig); diff --git a/ui/components/app/name/index.scss b/ui/components/app/name/index.scss index afbfd40df00b..4c38c5f76806 100644 --- a/ui/components/app/name/index.scss +++ b/ui/components/app/name/index.scss @@ -8,10 +8,10 @@ max-width: 100%; &__missing { - background-color: var(--color-error-muted); + background-color: var(--color-background-alternative); .name__value { - color: var(--color-error-default); + color: var(--color-text-default); } } @@ -32,7 +32,7 @@ } &__missing &__icon { - color: var(--color-error-default); + color: var(--color-text-default); } &__saved &__icon { diff --git a/ui/components/app/wallet-overview/eth-overview.js b/ui/components/app/wallet-overview/eth-overview.js index b797bfe0a119..dee531fc81a9 100644 --- a/ui/components/app/wallet-overview/eth-overview.js +++ b/ui/components/app/wallet-overview/eth-overview.js @@ -28,14 +28,12 @@ import UserPreferencedCurrencyDisplay from '../user-preferenced-currency-display import { PRIMARY, SECONDARY } from '../../../helpers/constants/common'; import { isBalanceCached, + getShouldShowFiat, getIsSwapsChain, getCurrentChainId, getPreferences, getSelectedInternalAccount, - getShouldHideZeroBalanceTokens, - getCurrentNetwork, getSelectedAccountCachedBalance, - getShowFiatInTestnets, ///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) getSwapsDefaultToken, getCurrentKeyring, @@ -66,11 +64,9 @@ import { IconColor } from '../../../helpers/constants/design-system'; import useRamps from '../../../hooks/experiences/useRamps'; import { getPortfolioUrl } from '../../../helpers/utils/portfolio'; ///: END:ONLY_INCLUDE_IF -import { useAccountTotalFiatBalance } from '../../../hooks/useAccountTotalFiatBalance'; import { useIsOriginalNativeTokenSymbol } from '../../../hooks/useIsOriginalNativeTokenSymbol'; import { getProviderConfig } from '../../../ducks/metamask/metamask'; import { showPrimaryCurrency } from '../../../../shared/modules/currency-display.utils'; -import { TEST_NETWORKS } from '../../../../shared/constants/network'; import WalletOverview from './wallet-overview'; const EthOverview = ({ className, showAddress }) => { @@ -88,36 +84,17 @@ const EthOverview = ({ className, showAddress }) => { const defaultSwapsToken = useSelector(getSwapsDefaultToken); ///: END:ONLY_INCLUDE_IF const balanceIsCached = useSelector(isBalanceCached); + const showFiat = useSelector(getShouldShowFiat); const { useNativeCurrencyAsPrimaryCurrency } = useSelector(getPreferences); const chainId = useSelector(getCurrentChainId); const { ticker, type } = useSelector(getProviderConfig); - const currentNetwork = useSelector(getCurrentNetwork); const balance = useSelector(getSelectedAccountCachedBalance); const isOriginalNativeSymbol = useIsOriginalNativeTokenSymbol( chainId, ticker, type, ); - - // Total fiat balance const account = useSelector(getSelectedInternalAccount); - const selectedAddress = account.address; - const shouldHideZeroBalanceTokens = useSelector( - getShouldHideZeroBalanceTokens, - ); - const { totalWeiBalance } = useAccountTotalFiatBalance( - selectedAddress, - shouldHideZeroBalanceTokens, - ); - const showFiatInTestnets = useSelector(getShowFiatInTestnets); - const showFiat = - TEST_NETWORKS.includes(currentNetwork?.nickname) && !showFiatInTestnets; - - let balanceToUse = totalWeiBalance; - - if (showFiat) { - balanceToUse = balance; - } const isSwapsChain = useSelector(getIsSwapsChain); const isSigningEnabled = @@ -226,14 +203,14 @@ const EthOverview = ({ className, showAddress }) => { >
- {balanceToUse ? ( + {balance ? ( { ? PRIMARY : SECONDARY } - showFiat={ - !showFiat || - !TEST_NETWORKS.includes(currentNetwork?.nickname) - } ethNumberOfDecimals={4} hideTitle /> @@ -259,6 +232,19 @@ const EthOverview = ({ className, showAddress }) => { * ) : null}
+ {showFiat && isOriginalNativeSymbol && balance && ( + + )}
} diff --git a/ui/components/app/wallet-overview/eth-overview.test.js b/ui/components/app/wallet-overview/eth-overview.test.js index d48296622973..ed5612b8cf4c 100644 --- a/ui/components/app/wallet-overview/eth-overview.test.js +++ b/ui/components/app/wallet-overview/eth-overview.test.js @@ -172,7 +172,7 @@ describe('EthOverview', () => { const primaryBalance = queryByTestId(ETH_OVERVIEW_PRIMARY_CURRENCY); expect(primaryBalance).toBeInTheDocument(); - expect(primaryBalance).toHaveTextContent('$0.00USD'); + expect(primaryBalance).toHaveTextContent('<0.000001ETH'); expect(queryByText('*')).not.toBeInTheDocument(); }); @@ -203,7 +203,7 @@ describe('EthOverview', () => { const primaryBalance = queryByTestId(ETH_OVERVIEW_PRIMARY_CURRENCY); expect(primaryBalance).toBeInTheDocument(); - expect(primaryBalance).toHaveTextContent('$0.02USD'); + expect(primaryBalance).toHaveTextContent('0.0104ETH'); expect(queryByText('*')).toBeInTheDocument(); }); diff --git a/ui/ducks/swaps/swaps.js b/ui/ducks/swaps/swaps.js index 4b0cc084241b..d1f2bae2a40d 100644 --- a/ui/ducks/swaps/swaps.js +++ b/ui/ducks/swaps/swaps.js @@ -996,6 +996,7 @@ export const signAndSendSwapsSmartTransaction = ({ updatedApproveTxParams.gas = `0x${decimalToHex( fees.approvalTxFees?.gasLimit || 0, )}`; + updatedApproveTxParams.chainId = chainId; approvalTxUuid = await dispatch( signAndSendSmartTransaction({ unsignedTransaction: updatedApproveTxParams, @@ -1006,6 +1007,7 @@ export const signAndSendSwapsSmartTransaction = ({ unsignedTransaction.gas = `0x${decimalToHex( fees.tradeTxFees?.gasLimit || 0, )}`; + unsignedTransaction.chainId = chainId; const uuid = await dispatch( signAndSendSmartTransaction({ unsignedTransaction, diff --git a/ui/pages/confirmations/components/fee-details-component/fee-details-component.js b/ui/pages/confirmations/components/fee-details-component/fee-details-component.js index b329d6704951..0c84336bed3e 100644 --- a/ui/pages/confirmations/components/fee-details-component/fee-details-component.js +++ b/ui/pages/confirmations/components/fee-details-component/fee-details-component.js @@ -43,10 +43,7 @@ export default function FeeDetailsComponent({ const t = useI18nContext(); - const { - maximumCostInHexWei: hexMaximumTransactionFee, - minimumCostInHexWei: hexMinimumTransactionFee, - } = useGasFeeContext(); + const { minimumCostInHexWei: hexMinimumTransactionFee } = useGasFeeContext(); useEffect(() => { if (isMultiLayerFeeNetwork) { fetchEstimatedL1Fee(txData?.chainId, txData) @@ -61,11 +58,11 @@ export default function FeeDetailsComponent({ const getTransactionFeeTotal = useMemo(() => { if (isMultiLayerFeeNetwork) { - return addHexes(hexMaximumTransactionFee, estimatedL1Fees || 0); + return addHexes(hexMinimumTransactionFee, estimatedL1Fees || 0); } - return hexMaximumTransactionFee; - }, [isMultiLayerFeeNetwork, hexMaximumTransactionFee, estimatedL1Fees]); + return hexMinimumTransactionFee; + }, [isMultiLayerFeeNetwork, hexMinimumTransactionFee, estimatedL1Fees]); const renderTotalDetailText = useCallback( (value) => { @@ -109,7 +106,7 @@ export default function FeeDetailsComponent({ justifyContent={JustifyContent.center} flexDirection={FlexDirection.Column} > - {!hideGasDetails && ( + {!hideGasDetails && isMultiLayerFeeNetwork && ( { }; describe('FeeDetailsComponent', () => { - it('renders "Fee details"', () => { - render(); + it('renders "Fee details"', async () => { + await render({ + ...mockState, + metamask: { + ...mockState.metamask, + providerConfig: { + chainId: CHAIN_IDS.OPTIMISM, + }, + }, + }); expect(screen.queryByText('Fee details')).toBeInTheDocument(); }); - it('should expand when button is clicked', () => { - render(); + it('should expand when button is clicked', async () => { + await render({ + ...mockState, + metamask: { + ...mockState.metamask, + providerConfig: { + chainId: CHAIN_IDS.OPTIMISM, + }, + }, + }); expect(screen.queryByTitle('0 ETH')).not.toBeInTheDocument(); - screen.getByRole('button').click(); - expect(screen.queryByTitle('0 ETH')).toBeInTheDocument(); + await act(async () => { + screen.getByRole('button').click(); + }); + expect(screen.getAllByTitle('0 ETH')).toHaveLength(2); + expect(screen.getAllByTitle('0 ETH')[0]).toBeInTheDocument(); }); - it('should be displayed for even legacy network', () => { - render({ + it('should be displayed for layer 2 network', async () => { + await render({ ...mockState, metamask: { ...mockState.metamask, @@ -41,6 +60,17 @@ describe('FeeDetailsComponent', () => { 1559: false, }, }, + networksMetadata: { + goerli: { + EIPS: { + 1559: false, + }, + status: 'available', + }, + }, + providerConfig: { + chainId: CHAIN_IDS.OPTIMISM, + }, }, }); expect(screen.queryByText('Fee details')).toBeInTheDocument(); diff --git a/ui/pages/confirmations/confirm-approve/confirm-approve-content/__snapshots__/confirm-approve-content.component.test.js.snap b/ui/pages/confirmations/confirm-approve/confirm-approve-content/__snapshots__/confirm-approve-content.component.test.js.snap index 84374e307205..a4bd02de6c35 100644 --- a/ui/pages/confirmations/confirm-approve/confirm-approve-content/__snapshots__/confirm-approve-content.component.test.js.snap +++ b/ui/pages/confirmations/confirm-approve/confirm-approve-content/__snapshots__/confirm-approve-content.component.test.js.snap @@ -115,31 +115,7 @@ exports[`ConfirmApproveContent Component should render Confirm approve page corr >
-
- -
-
+ />
-
- -
-
+ />
-
- -
-
+ />
-
- -
-
+ />
-
- -
-
+ />
diff --git a/ui/pages/confirmations/confirm-signature-request/index.js b/ui/pages/confirmations/confirm-signature-request/index.js index 5ef1e7c1927b..b3fceade04b6 100644 --- a/ui/pages/confirmations/confirm-signature-request/index.js +++ b/ui/pages/confirmations/confirm-signature-request/index.js @@ -203,6 +203,7 @@ const ConfirmTxScreen = ({ match }) => { ///: BEGIN:ONLY_INCLUDE_IF(build-flask) const { warnings } = useSignatureInsights({ txData }); ///: END:ONLY_INCLUDE_IF + const resolvedSecurityAlertResponse = signatureSecurityAlertResponses?.[ txData.securityAlertResponse?.securityAlertId diff --git a/ui/pages/confirmations/confirm-transaction-base/__snapshots__/confirm-transaction-base.test.js.snap b/ui/pages/confirmations/confirm-transaction-base/__snapshots__/confirm-transaction-base.test.js.snap index 2f64281591fc..6fde90864dde 100644 --- a/ui/pages/confirmations/confirm-transaction-base/__snapshots__/confirm-transaction-base.test.js.snap +++ b/ui/pages/confirmations/confirm-transaction-base/__snapshots__/confirm-transaction-base.test.js.snap @@ -405,31 +405,7 @@ exports[`Confirm Transaction Base should match snapshot 1`] = `
-
- -
-
+ /> diff --git a/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.component.js b/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.component.js index ec4b68217fa6..5ff6bd63e59c 100644 --- a/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.component.js +++ b/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.component.js @@ -7,6 +7,8 @@ import { import ConfirmPageContainer from '../components/confirm-page-container'; import { isBalanceSufficient } from '../send/send.utils'; import { DEFAULT_ROUTE } from '../../../helpers/constants/routes'; +import fetchEstimatedL1Fee from '../../../helpers/utils/optimism/fetchEstimatedL1Fee'; + import { INSUFFICIENT_FUNDS_ERROR_KEY, GAS_LIMIT_TOO_LOW_ERROR_KEY, @@ -47,7 +49,7 @@ import { MIN_GAS_LIMIT_DEC } from '../send/send.constants'; import { NETWORK_TO_NAME_MAP } from '../../../../shared/constants/network'; import { - addHexes, + sumHexes, hexToDecimal, } from '../../../../shared/modules/conversion.utils'; import TransactionAlerts from '../components/transaction-alerts'; @@ -159,6 +161,7 @@ export default class ConfirmTransactionBase extends Component { isUserOpContractDeployError: PropTypes.bool, useMaxValue: PropTypes.bool, maxValue: PropTypes.string, + isMultiLayerFeeNetwork: PropTypes.bool, }; state = { @@ -169,6 +172,7 @@ export default class ConfirmTransactionBase extends Component { editingGas: false, userAcknowledgedGasMissing: false, showWarningModal: false, + estimatedL1Fees: 0, ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) noteText: '', ///: END:ONLY_INCLUDE_IF @@ -188,6 +192,7 @@ export default class ConfirmTransactionBase extends Component { setDefaultHomeActiveTabName, hexMaximumTransactionFee, useMaxValue, + txData, } = this.props; const { customNonceValue: prevCustomNonceValue, @@ -242,11 +247,21 @@ export default class ConfirmTransactionBase extends Component { } } - if ( - hexMaximumTransactionFee !== prevHexMaximumTransactionFee && - useMaxValue - ) { - this.updateValueToMax(); + if (hexMaximumTransactionFee !== prevHexMaximumTransactionFee) { + fetchEstimatedL1Fee(txData?.chainId, txData) + .then((result) => { + this.setState({ + estimatedL1Fees: result, + }); + }) + .catch((_err) => { + this.setState({ + estimatedL1Fees: 0, + }); + }); + if (useMaxValue) { + this.updateValueToMax(); + } } } @@ -377,10 +392,11 @@ export default class ConfirmTransactionBase extends Component { useCurrencyRateCheck, tokenSymbol, isUsingPaymaster, + isMultiLayerFeeNetwork, } = this.props; const { t } = this.context; - const { userAcknowledgedGasMissing } = this.state; + const { userAcknowledgedGasMissing, estimatedL1Fees } = this.state; const { valid } = this.getErrorKey(); const isDisabled = () => { @@ -394,9 +410,10 @@ export default class ConfirmTransactionBase extends Component { const networkName = NETWORK_TO_NAME_MAP[txData.chainId]; const getTotalAmount = (useMaxFee) => { - return addHexes( + return sumHexes( txData.txParams.value, useMaxFee ? hexMaximumTransactionFee : hexMinimumTransactionFee, + isMultiLayerFeeNetwork ? estimatedL1Fees : 0, ); }; @@ -417,8 +434,11 @@ export default class ConfirmTransactionBase extends Component { } // Token send - return useNativeCurrencyAsPrimaryCurrency + const primaryTotal = useMaxFee ? primaryTotalTextOverrideMaxAmount + : primaryTotalTextOverride; + return useNativeCurrencyAsPrimaryCurrency + ? primaryTotal : secondaryTotalTextOverride; }; diff --git a/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.container.js b/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.container.js index 99d9eef361fa..41529d638d84 100644 --- a/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.container.js +++ b/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.container.js @@ -267,6 +267,9 @@ const mapStateToProps = (state, ownProps) => { const isUserOpContractDeployError = fullTxData.isUserOperation && type === TransactionType.deployContract; + ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) + isSigningOrSubmitting = false; + ///: END:ONLY_INCLUDE_IF return { balance,