diff --git a/.storybook/test-data.js b/.storybook/test-data.js index 13006e5d1ff7..4ef6de0a689c 100644 --- a/.storybook/test-data.js +++ b/.storybook/test-data.js @@ -682,6 +682,7 @@ const state = { order: 'dsc', sortCallback: 'stringNumeric', }, + tokenNetworkFilter: {}, }, incomingTransactionsPreferences: { [CHAIN_IDS.MAINNET]: true, diff --git a/app/scripts/constants/sentry-state.ts b/app/scripts/constants/sentry-state.ts index 5146e38e8a41..f8bf83db88b2 100644 --- a/app/scripts/constants/sentry-state.ts +++ b/app/scripts/constants/sentry-state.ts @@ -245,6 +245,7 @@ export const SENTRY_BACKGROUND_STATE = { showFiatInTestnets: true, showTestNetworks: true, smartTransactionsOptInStatus: true, + tokenNetworkFilter: {}, showNativeTokenAsMainBalance: true, petnamesEnabled: true, showConfirmationAdvancedDetails: true, diff --git a/builds.yml b/builds.yml index 316e8f943eb1..851bad0f7610 100644 --- a/builds.yml +++ b/builds.yml @@ -284,8 +284,6 @@ env: - BARAD_DUR: '' # Determines if feature flagged Chain permissions - CHAIN_PERMISSIONS: '' - # Determines if Portfolio View UI should be shown - - PORTFOLIO_VIEW: '' # Enables use of test gas fee flow to debug gas fee estimation - TEST_GAS_FEE_FLOWS: false # Temporary mechanism to enable security alerts API prior to release diff --git a/lavamoat/build-system/policy.json b/lavamoat/build-system/policy.json index 5338922720ef..06d6042f6433 100644 --- a/lavamoat/build-system/policy.json +++ b/lavamoat/build-system/policy.json @@ -2040,7 +2040,8 @@ "chokidar>normalize-path": true, "chokidar>readdirp": true, "del>is-glob": true, - "eslint>glob-parent": true + "eslint>glob-parent": true, + "tsx>fsevents": true } }, "chokidar>anymatch": { @@ -8838,6 +8839,13 @@ "typescript": true } }, + "tsx>fsevents": { + "globals": { + "console.assert": true, + "process.platform": true + }, + "native": true + }, "typescript": { "builtin": { "buffer.Buffer": true, diff --git a/test/e2e/default-fixture.js b/test/e2e/default-fixture.js index fd2d5be42891..704bd7332ad8 100644 --- a/test/e2e/default-fixture.js +++ b/test/e2e/default-fixture.js @@ -224,6 +224,7 @@ function defaultFixture(inputChainId = CHAIN_IDS.LOCALHOST) { order: 'dsc', sortCallback: 'stringNumeric', }, + tokenNetworkFilter: {}, shouldShowAggregatedBalancePopover: true, }, selectedAddress: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', diff --git a/test/e2e/fixture-builder.js b/test/e2e/fixture-builder.js index bea9e9bad77f..844c4766db3e 100644 --- a/test/e2e/fixture-builder.js +++ b/test/e2e/fixture-builder.js @@ -89,6 +89,7 @@ function onboardingFixture() { order: 'dsc', sortCallback: 'stringNumeric', }, + tokenNetworkFilter: {}, shouldShowAggregatedBalancePopover: true, }, useExternalServices: true, @@ -126,6 +127,7 @@ function onboardingFixture() { }, showTestNetworks: false, smartTransactionsOptInStatus: true, + tokenNetworkFilter: {}, }, QueuedRequestController: { queuedRequestCount: 0, @@ -664,6 +666,7 @@ class FixtureBuilder { return this.withPreferencesController({ preferences: { smartTransactionsOptInStatus: true, + tokenNetworkFilter: {}, }, }); } diff --git a/test/e2e/tests/confirmations/transactions/erc20-approve-redesign.spec.ts b/test/e2e/tests/confirmations/transactions/erc20-approve-redesign.spec.ts index baa3638330b6..4e340f5ef3ac 100644 --- a/test/e2e/tests/confirmations/transactions/erc20-approve-redesign.spec.ts +++ b/test/e2e/tests/confirmations/transactions/erc20-approve-redesign.spec.ts @@ -118,6 +118,7 @@ async function mocks(server: MockttpServer) { export async function importTST(driver: Driver) { await driver.switchToWindowWithTitle(WINDOW_TITLES.ExtensionInFullScreenView); await driver.clickElement('[data-testid="import-token-button"]'); + await driver.clickElement('[data-testid="importTokens"]'); await driver.waitForSelector({ css: '.import-tokens-modal__button-tab', diff --git a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json index e47cfcd806b9..0bc7ac694b2c 100644 --- a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json +++ b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json @@ -67,38 +67,38 @@ "srcNetworkAllowlist": { "0": "string", "1": "string", "2": "string" }, "destNetworkAllowlist": { "0": "string", "1": "string", "2": "string" } }, + "srcTokens": {}, + "srcTopAssets": {}, "destTokens": {}, "destTopAssets": {}, "quoteRequest": { - "slippage": 0.5, - "srcTokenAddress": "0x0000000000000000000000000000000000000000" + "srcTokenAddress": "0x0000000000000000000000000000000000000000", + "slippage": 0.5 }, "quotes": {}, - "quotesRefreshCount": 0, - "srcTokens": {}, - "srcTopAssets": {} + "quotesRefreshCount": 0 } }, "CronjobController": { "jobs": "object" }, "CurrencyController": { + "currentCurrency": "usd", "currencyRates": { "ETH": { "conversionDate": "number", "conversionRate": 1700, "usdConversionRate": 1700 }, - "LineaETH": { + "SepoliaETH": { "conversionDate": "number", "conversionRate": 1700, "usdConversionRate": 1700 }, - "SepoliaETH": { + "LineaETH": { "conversionDate": "number", "conversionRate": 1700, "usdConversionRate": 1700 } - }, - "currentCurrency": "usd" + } }, "DecryptMessageController": { "unapprovedDecryptMsgs": "object", @@ -234,10 +234,17 @@ "petnamesEnabled": true, "showMultiRpcModal": "boolean", "isRedesignedConfirmationsDeveloperEnabled": "boolean", - "redesignedConfirmationsEnabled": true, - "redesignedTransactionsEnabled": "boolean", "tokenSortConfig": "object", - "shouldShowAggregatedBalancePopover": "boolean" + "tokenNetworkFilter": { + "0x1": "boolean", + "0xaa36a7": "boolean", + "0xe705": "boolean", + "0xe708": "boolean", + "0x539": "boolean" + }, + "shouldShowAggregatedBalancePopover": "boolean", + "redesignedConfirmationsEnabled": true, + "redesignedTransactionsEnabled": "boolean" }, "ipfsGateway": "string", "isIpfsGatewayEnabled": "boolean", @@ -314,9 +321,7 @@ "swapsFeatureFlags": {} } }, - "TokenBalancesController": { - "tokenBalances": "object" - }, + "TokenBalancesController": { "tokenBalances": "object" }, "TokenListController": { "tokenList": "object", "tokensChainsCache": { @@ -339,7 +344,6 @@ }, "TxController": { "methodData": "object", - "submitHistory": "object", "transactions": "object", "lastFetchedBlockNumbers": "object", "submitHistory": "object" diff --git a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json index 7fd8501eb2b8..981bd22b7661 100644 --- a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json +++ b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json @@ -35,17 +35,22 @@ "petnamesEnabled": true, "showMultiRpcModal": "boolean", "isRedesignedConfirmationsDeveloperEnabled": "boolean", - "redesignedConfirmationsEnabled": true, - "redesignedTransactionsEnabled": "boolean", "tokenSortConfig": "object", - "showMultiRpcModal": "boolean", - "shouldShowAggregatedBalancePopover": "boolean" + "tokenNetworkFilter": { + "0x1": "boolean", + "0xaa36a7": "boolean", + "0xe705": "boolean", + "0xe708": "boolean", + "0x539": "boolean" + }, + "shouldShowAggregatedBalancePopover": "boolean", + "redesignedConfirmationsEnabled": true, + "redesignedTransactionsEnabled": "boolean" }, "firstTimeFlowType": "import", "completedOnboarding": true, "knownMethodData": "object", "use4ByteResolution": true, - "showIncomingTransactions": "object", "participateInMetaMetrics": true, "dataCollectionForMarketing": "boolean", "nextNonce": null, @@ -55,12 +60,12 @@ "conversionRate": 1700, "usdConversionRate": 1700 }, - "LineaETH": { + "SepoliaETH": { "conversionDate": "number", "conversionRate": 1700, "usdConversionRate": 1700 }, - "SepoliaETH": { + "LineaETH": { "conversionDate": "number", "conversionRate": 1700, "usdConversionRate": 1700 @@ -135,7 +140,6 @@ "forgottenPassword": false, "ipfsGateway": "string", "isIpfsGatewayEnabled": "boolean", - "isMultiAccountBalancesEnabled": "boolean", "useAddressBarEnsResolution": true, "ledgerTransportType": "webhid", "snapRegistryList": "object", @@ -145,6 +149,8 @@ "useTransactionSimulations": true, "enableMV3TimestampSave": true, "useExternalServices": "boolean", + "isMultiAccountBalancesEnabled": "boolean", + "showIncomingTransactions": "object", "metaMetricsId": "fake-metrics-id", "marketingCampaignCookieId": null, "eventsBeforeMetricsOptIn": "object", @@ -189,6 +195,7 @@ "allTokens": {}, "allIgnoredTokens": {}, "allDetectedTokens": {}, + "tokenBalances": "object", "smartTransactionsState": { "fees": {}, "feesByChainId": "object", @@ -239,11 +246,11 @@ "accounts": "object", "accountsByChainId": "object", "marketData": "object", - "signatureRequests": "object", "unapprovedDecryptMsgs": "object", "unapprovedDecryptMsgCount": 0, "unapprovedEncryptionPublicKeyMsgs": "object", "unapprovedEncryptionPublicKeyMsgCount": 0, + "signatureRequests": "object", "unapprovedPersonalMsgs": "object", "unapprovedTypedMessages": "object", "unapprovedPersonalMsgCount": 0, @@ -283,16 +290,16 @@ "srcNetworkAllowlist": { "0": "string", "1": "string", "2": "string" }, "destNetworkAllowlist": { "0": "string", "1": "string", "2": "string" } }, + "srcTokens": {}, + "srcTopAssets": {}, "destTokens": {}, "destTopAssets": {}, "quoteRequest": { - "slippage": 0.5, - "srcTokenAddress": "0x0000000000000000000000000000000000000000" + "srcTokenAddress": "0x0000000000000000000000000000000000000000", + "slippage": 0.5 }, "quotes": {}, - "quotesRefreshCount": 0, - "srcTokens": {}, - "srcTopAssets": {} + "quotesRefreshCount": 0 }, "ensEntries": "object", "ensResolutionsByAddress": "object", diff --git a/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-background-state.json b/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-background-state.json index fa1a00cbe4ef..fbae3e53463a 100644 --- a/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-background-state.json +++ b/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-background-state.json @@ -50,6 +50,27 @@ }, "snapsInstallPrivacyWarningShown": true }, + "BridgeController": { + "bridgeState": { + "bridgeFeatureFlags": { + "extensionSupport": "boolean", + "srcNetworkAllowlist": { + "0": "string", + "1": "string", + "2": "string" + }, + "destNetworkAllowlist": { + "0": "string", + "1": "string", + "2": "string" + } + }, + "destTokens": {}, + "destTopAssets": {}, + "srcTokens": {}, + "srcTopAssets": {} + } + }, "CurrencyController": { "currentCurrency": "usd", "currencyRates": { @@ -115,10 +136,11 @@ "smartTransactionsOptInStatus": true, "showNativeTokenAsMainBalance": true, "petnamesEnabled": true, + "showMultiRpcModal": "boolean", "isRedesignedConfirmationsDeveloperEnabled": "boolean", "showConfirmationAdvancedDetails": false, "tokenSortConfig": "object", - "showMultiRpcModal": "boolean", + "tokenNetworkFilter": {}, "shouldShowAggregatedBalancePopover": "boolean" }, "selectedAddress": "string", @@ -145,27 +167,6 @@ "smartTransactions": "object" } }, - "BridgeController": { - "bridgeState": { - "bridgeFeatureFlags": { - "extensionSupport": "boolean", - "srcNetworkAllowlist": { - "0": "string", - "1": "string", - "2": "string" - }, - "destNetworkAllowlist": { - "0": "string", - "1": "string", - "2": "string" - } - }, - "destTokens": {}, - "destTopAssets": {}, - "srcTokens": {}, - "srcTopAssets": {} - } - }, "SubjectMetadataController": { "subjectMetadata": "object" }, "TokensController": { "allDetectedTokens": {}, diff --git a/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-ui-state.json b/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-ui-state.json index b3fa8d117beb..4d3e78f5aa46 100644 --- a/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-ui-state.json +++ b/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-ui-state.json @@ -64,7 +64,11 @@ "1": "string", "2": "string" } - } + }, + "destTokens": {}, + "destTopAssets": {}, + "srcTokens": {}, + "srcTopAssets": {} } }, "CurrencyController": { @@ -132,10 +136,11 @@ "smartTransactionsOptInStatus": true, "showNativeTokenAsMainBalance": true, "petnamesEnabled": true, + "showMultiRpcModal": "boolean", "isRedesignedConfirmationsDeveloperEnabled": "boolean", "showConfirmationAdvancedDetails": false, "tokenSortConfig": "object", - "showMultiRpcModal": "boolean", + "tokenNetworkFilter": {}, "shouldShowAggregatedBalancePopover": "boolean" }, "selectedAddress": "string", @@ -171,27 +176,6 @@ "ignoredTokens": "object", "tokens": "object" }, - "BridgeController": { - "bridgeState": { - "bridgeFeatureFlags": { - "extensionSupport": "boolean", - "srcNetworkAllowlist": { - "0": "string", - "1": "string", - "2": "string" - }, - "destNetworkAllowlist": { - "0": "string", - "1": "string", - "2": "string" - } - }, - "destTokens": {}, - "destTopAssets": {}, - "srcTokens": {}, - "srcTopAssets": {} - } - }, "TransactionController": { "transactions": "object" }, "config": "object", "firstTimeInfo": "object" diff --git a/test/e2e/tests/privacy-mode/privacy-mode.spec.js b/test/e2e/tests/privacy-mode/privacy-mode.spec.js index a4d2c2245752..ede37f900e66 100644 --- a/test/e2e/tests/privacy-mode/privacy-mode.spec.js +++ b/test/e2e/tests/privacy-mode/privacy-mode.spec.js @@ -18,7 +18,7 @@ describe('Privacy Mode', function () { async ({ driver }) => { async function checkForHeaderValue(value) { const balanceElement = await driver.findElement( - '[data-testid="eth-overview__primary-currency"] .currency-display-component__text', + '[data-testid="account-value-and-suffix"]', ); const surveyText = await balanceElement.getText(); assert.equal( @@ -30,7 +30,7 @@ describe('Privacy Mode', function () { async function checkForTokenValue(value) { const balanceElement = await driver.findElement( - '[data-testid="multichain-token-list-item-secondary-value"]', + '[data-testid="multichain-token-list-item-value"]', ); const surveyText = await balanceElement.getText(); assert.equal(surveyText, value, `Token balance should be "${value}"`); @@ -38,7 +38,7 @@ describe('Privacy Mode', function () { async function checkForPrivacy() { await checkForHeaderValue('••••••'); - await checkForTokenValue('•••••••••'); + await checkForTokenValue('••••••'); } async function checkForNoPrivacy() { @@ -48,7 +48,7 @@ describe('Privacy Mode', function () { async function togglePrivacy() { const balanceElement = await driver.findElement( - '[data-testid="eth-overview__primary-currency"] .currency-display-component__text', + '[data-testid="account-value-and-suffix"]', ); const initialText = await balanceElement.getText(); @@ -81,7 +81,7 @@ describe('Privacy Mode', function () { async function togglePrivacy() { const balanceElement = await driver.findElement( - '[data-testid="eth-overview__primary-currency"] .currency-display-component__text', + '[data-testid="account-value-and-suffix"]', ); const initialText = await balanceElement.getText(); diff --git a/test/e2e/tests/privacy/basic-functionality.spec.js b/test/e2e/tests/privacy/basic-functionality.spec.js index e6439c569339..a3c6362b31e2 100644 --- a/test/e2e/tests/privacy/basic-functionality.spec.js +++ b/test/e2e/tests/privacy/basic-functionality.spec.js @@ -102,7 +102,8 @@ describe('MetaMask onboarding @no-mmi', function () { // Wait until network is fully switched and refresh tokens before asserting to mitigate flakiness await driver.assertElementNotPresent('.loading-overlay'); - await driver.clickElement('[data-testid="refresh-list-button"]'); + await driver.clickElement('[data-testid="import-token-button"]'); + await driver.clickElement('[data-testid="refreshList"]'); for (let i = 0; i < mockedEndpoints.length; i += 1) { const requests = await mockedEndpoints[i].getSeenRequests(); @@ -157,7 +158,8 @@ describe('MetaMask onboarding @no-mmi', function () { // Wait until network is fully switched and refresh tokens before asserting to mitigate flakiness await driver.assertElementNotPresent('.loading-overlay'); - await driver.clickElement('[data-testid="refresh-list-button"]'); + await driver.clickElement('[data-testid="import-token-button"]'); + await driver.clickElement('[data-testid="refreshList"]'); // intended delay to allow for network requests to complete await driver.delay(1000); for (let i = 0; i < mockedEndpoints.length; i += 1) { diff --git a/test/e2e/tests/tokens/add-hide-token.spec.js b/test/e2e/tests/tokens/add-hide-token.spec.js index 6bd0c8744fba..0d451e5ed986 100644 --- a/test/e2e/tests/tokens/add-hide-token.spec.js +++ b/test/e2e/tests/tokens/add-hide-token.spec.js @@ -130,6 +130,7 @@ describe('Add existing token using search', function () { await unlockWallet(driver); await driver.clickElement(`[data-testid="import-token-button"]`); + await driver.clickElement('[data-testid="importTokens"]'); await driver.fill('input[placeholder="Search tokens"]', 'BAT'); await driver.clickElement({ text: 'BAT', diff --git a/test/e2e/tests/tokens/custom-token-add-approve.spec.js b/test/e2e/tests/tokens/custom-token-add-approve.spec.js index 8fa765a36164..f5da57324c95 100644 --- a/test/e2e/tests/tokens/custom-token-add-approve.spec.js +++ b/test/e2e/tests/tokens/custom-token-add-approve.spec.js @@ -36,6 +36,7 @@ describe('Create token, approve token and approve token without gas', function ( await clickNestedButton(driver, 'Tokens'); await driver.clickElement(`[data-testid="import-token-button"]`); + await driver.clickElement('[data-testid="importTokens"]'); await clickNestedButton(driver, 'Custom token'); await driver.fill( '[data-testid="import-tokens-modal-custom-address"]', diff --git a/test/e2e/tests/tokens/import-tokens.spec.js b/test/e2e/tests/tokens/import-tokens.spec.js index 3055f7109551..7b1bf60964ab 100644 --- a/test/e2e/tests/tokens/import-tokens.spec.js +++ b/test/e2e/tests/tokens/import-tokens.spec.js @@ -69,6 +69,7 @@ describe('Import flow', function () { await driver.assertElementNotPresent('.loading-overlay'); await driver.clickElement('[data-testid="import-token-button"]'); + await driver.clickElement('[data-testid="importTokens"]'); await driver.fill('input[placeholder="Search tokens"]', 'cha'); diff --git a/test/e2e/tests/tokens/token-details.spec.ts b/test/e2e/tests/tokens/token-details.spec.ts index 56d9515e727d..32830bca5d3b 100644 --- a/test/e2e/tests/tokens/token-details.spec.ts +++ b/test/e2e/tests/tokens/token-details.spec.ts @@ -28,6 +28,7 @@ describe('Token Details', function () { const importToken = async (driver: Driver) => { await driver.clickElement(`[data-testid="import-token-button"]`); + await driver.clickElement('[data-testid="importTokens"]'); await clickNestedButton(driver, 'Custom token'); await driver.fill( '[data-testid="import-tokens-modal-custom-address"]', diff --git a/test/e2e/tests/tokens/token-list.spec.ts b/test/e2e/tests/tokens/token-list.spec.ts index c20a9f13b0e3..d70e6d187cf4 100644 --- a/test/e2e/tests/tokens/token-list.spec.ts +++ b/test/e2e/tests/tokens/token-list.spec.ts @@ -28,6 +28,7 @@ describe('Token List', function () { const importToken = async (driver: Driver) => { await driver.clickElement(`[data-testid="import-token-button"]`); + await driver.clickElement('[data-testid="importTokens"]'); await clickNestedButton(driver, 'Custom token'); await driver.fill( '[data-testid="import-tokens-modal-custom-address"]', diff --git a/test/e2e/tests/tokens/token-sort.spec.ts b/test/e2e/tests/tokens/token-sort.spec.ts index 1fc1df7efd2c..1ab3b801d41a 100644 --- a/test/e2e/tests/tokens/token-sort.spec.ts +++ b/test/e2e/tests/tokens/token-sort.spec.ts @@ -26,6 +26,7 @@ describe('Token List', function () { const importToken = async (driver: Driver) => { await driver.clickElement(`[data-testid="import-token-button"]`); + await driver.clickElement('[data-testid="importTokens"]'); await clickNestedButton(driver, 'Custom token'); await driver.fill( '[data-testid="import-tokens-modal-custom-address"]', @@ -65,10 +66,8 @@ describe('Token List', function () { assert.ok(tokenSymbolsBeforeSorting[0].includes('Ethereum')); - await await driver.clickElement( - '[data-testid="sort-by-popover-toggle"]', - ); - await await driver.clickElement('[data-testid="sortByAlphabetically"]'); + await driver.clickElement('[data-testid="sort-by-popover-toggle"]'); + await driver.clickElement('[data-testid="sortByAlphabetically"]'); await driver.delay(regularDelayMs); const tokenListAfterSortingAlphabetically = await driver.findElements( @@ -84,12 +83,8 @@ describe('Token List', function () { tokenListSymbolsAfterSortingAlphabetically[0].includes('ABC'), ); - await await driver.clickElement( - '[data-testid="sort-by-popover-toggle"]', - ); - await await driver.clickElement( - '[data-testid="sortByDecliningBalance"]', - ); + await driver.clickElement('[data-testid="sort-by-popover-toggle"]'); + await driver.clickElement('[data-testid="sortByDecliningBalance"]'); await driver.delay(regularDelayMs); const tokenListBeforeSortingByDecliningBalance = diff --git a/test/jest/mock-store.js b/test/jest/mock-store.js index 3fe524634075..4720bf427372 100644 --- a/test/jest/mock-store.js +++ b/test/jest/mock-store.js @@ -139,6 +139,7 @@ export const createSwapsMockStore = () => { preferences: { showFiatInTestnets: true, smartTransactionsOptInStatus: true, + tokenNetworkFilter: {}, showMultiRpcModal: false, }, transactions: [ diff --git a/ui/components/app/assets/asset-list/asset-list-control-bar/asset-list-control-bar.tsx b/ui/components/app/assets/asset-list/asset-list-control-bar/asset-list-control-bar.tsx index 2925277c14bd..1fdc7069ab54 100644 --- a/ui/components/app/assets/asset-list/asset-list-control-bar/asset-list-control-bar.tsx +++ b/ui/components/app/assets/asset-list/asset-list-control-bar/asset-list-control-bar.tsx @@ -68,12 +68,13 @@ const AssetListControlBar = ({ showTokensLinks }: AssetListControlBarProps) => { }, [currentNetwork.chainId, TEST_CHAINS]); const allOpts: Record = {}; - Object.keys(allNetworks).forEach((chainId) => { + Object.keys(allNetworks || {}).forEach((chainId) => { allOpts[chainId] = true; }); const allNetworksFilterShown = - Object.keys(tokenNetworkFilter).length !== Object.keys(allOpts).length; + Object.keys(tokenNetworkFilter || {}).length !== + Object.keys(allOpts || {}).length; useEffect(() => { if (isTestNetwork) { @@ -86,7 +87,7 @@ const AssetListControlBar = ({ showTokensLinks }: AssetListControlBarProps) => { // We need to set the default filter for all users to be all included networks, rather than defaulting to empty object // This effect is to unblock and derisk in the short-term useEffect(() => { - if (Object.keys(tokenNetworkFilter).length === 0) { + if (Object.keys(tokenNetworkFilter || {}).length === 0) { dispatch(setTokenNetworkFilter(allOpts)); } }, []); @@ -152,37 +153,27 @@ const AssetListControlBar = ({ showTokensLinks }: AssetListControlBarProps) => { marginRight={2} ref={popoverRef} > - - {process.env.PORTFOLIO_VIEW && ( - - {allNetworksFilterShown - ? currentNetwork?.nickname ?? t('currentNetwork') - : t('allNetworks')} - - )} + + + {allNetworksFilterShown + ? currentNetwork?.nickname ?? t('currentNetwork') + : t('allNetworks')} + { useEffect(() => { const testnetChains: string[] = TEST_CHAINS; - const mainnetChainIds = Object.keys(allNetworks).filter( + const mainnetChainIds = Object.keys(allNetworks || {}).filter( (chain) => !testnetChains.includes(chain), ); setChainsToShow(mainnetChainIds); }, []); const allOpts: Record = {}; - Object.keys(allNetworks).forEach((chain) => { + Object.keys(allNetworks || {}).forEach((chain) => { allOpts[chain] = true; }); @@ -71,8 +71,8 @@ const NetworkFilter = ({ handleClose }: SortControlProps) => { <> handleFilter(allOpts)} > @@ -123,7 +123,7 @@ const NetworkFilter = ({ handleClose }: SortControlProps) => { handleFilter({ [chainId]: true })} > diff --git a/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.component.js b/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.component.js index de43b6891e3e..b0e4cdf66a3e 100644 --- a/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.component.js +++ b/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.component.js @@ -83,7 +83,7 @@ export default function UserPreferencedCurrencyDisplay({ data-testid={dataTestId} numberOfDecimals={numberOfDecimals} prefixComponent={prefixComponent} - hideLabel={!showCurrencySuffix} + //hideLabel={!showCurrencySuffix} suffix={showCurrencySuffix && !showEthLogo && currency} privacyMode={privacyMode} /> diff --git a/ui/components/multichain/network-list-menu/network-list-menu.tsx b/ui/components/multichain/network-list-menu/network-list-menu.tsx index 4dcecbf696e7..934b2912e034 100644 --- a/ui/components/multichain/network-list-menu/network-list-menu.tsx +++ b/ui/components/multichain/network-list-menu/network-list-menu.tsx @@ -287,14 +287,18 @@ export const NetworkListMenu = ({ onClose }: { onClose: () => void }) => { dispatch(toggleNetworkMenu()); dispatch(updateCustomNonce('')); dispatch(setNextNonce('')); + console.log('Nidhi', tokenNetworkFilter, allOpts); // as a user, I don't want my network selection to force update my filter when I have "All Networks" toggled on // however, if I am already filtered on "Current Network", we'll want to filter by the selected network when the network changes if (Object.keys(tokenNetworkFilter).length <= 1) { + console.log('test 1'); dispatch(setTokenNetworkFilter({ [network.chainId]: true })); } else { + console.log('test 2'); dispatch(setTokenNetworkFilter(allOpts)); } + console.log('nick'); if (permittedAccountAddresses.length > 0) { grantPermittedChain(selectedTabOrigin, network.chainId); diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index 93cc4dae7771..8d965e90cbfc 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -2327,13 +2327,9 @@ export const getChainIdsToPoll = createDeepEqualSelector( getPreferences, getNetworkConfigurationsByChainId, getCurrentChainId, - (preferences, networkConfigurations, currentChainId) => { + (preferences, networkConfigurations) => { const { pausedChainIds = [] } = preferences; - if (!process.env.PORTFOLIO_VIEW) { - return [currentChainId]; - } - return Object.keys(networkConfigurations).filter( (chainId) => !TEST_CHAINS.includes(chainId) && !pausedChainIds.includes(chainId), @@ -2345,18 +2341,9 @@ export const getNetworkClientIdsToPoll = createDeepEqualSelector( getPreferences, getNetworkConfigurationsByChainId, getCurrentChainId, - (preferences, networkConfigurations, currentChainId) => { + (preferences, networkConfigurations) => { const { pausedChainIds = [] } = preferences; - if (!process.env.PORTFOLIO_VIEW) { - const networkConfiguration = networkConfigurations[currentChainId]; - return [ - networkConfiguration.rpcEndpoints[ - networkConfiguration.defaultRpcEndpointIndex - ].networkClientId, - ]; - } - return Object.entries(networkConfigurations).reduce( (acc, [chainId, network]) => { if ( diff --git a/ui/selectors/selectors.test.js b/ui/selectors/selectors.test.js index 85180dec45f4..ffc98b535ca0 100644 --- a/ui/selectors/selectors.test.js +++ b/ui/selectors/selectors.test.js @@ -862,14 +862,6 @@ describe('Selectors', () => { }, }; - beforeEach(() => { - process.env.PORTFOLIO_VIEW = 'true'; - }); - - afterEach(() => { - process.env.PORTFOLIO_VIEW = undefined; - }); - it('returns only non-test chain IDs', () => { const chainIds = selectors.getChainIdsToPoll({ metamask: { @@ -922,14 +914,6 @@ describe('Selectors', () => { }, }; - beforeEach(() => { - process.env.PORTFOLIO_VIEW = 'true'; - }); - - afterEach(() => { - process.env.PORTFOLIO_VIEW = undefined; - }); - it('returns only non-test chain IDs', () => { const chainIds = selectors.getNetworkClientIdsToPoll({ metamask: {