Skip to content

Commit 0492f59

Browse files
chore(batch-sell): remove unused batch sell imports and locals (#47635)
## **Description** Removes unused imports and locals in the batch-sell review flow and the batch-sell selector tests, as reported by `tsc --noUnusedLocals`. The helpers `hasAnyEnabledAsset` and `hasAtLeastOneQuoteAvailable` stay; only an unused import of them in `total-received-modal.tsx` is removed. The modal still receives `anyEnabledAsset` and `atLeastOneQuoteAvailable` as props. Owner set: none (no CODEOWNERS match for any touched file). | path | removed (file / symbol / class) | why dead | | --- | --- | --- | | `ui/pages/batch-sell/pages/review/components/total-received-modal.tsx` | `useMemo`, `hasAnyEnabledAsset`, `hasAtLeastOneQuoteAvailable` imports | unused local | | `ui/pages/batch-sell/pages/review/hooks/useBatchSellAggregateValidation.ts` | `BigNumber`, `getNativeAssetForChainId` imports | unused local | | `ui/pages/batch-sell/pages/review/hooks/useBatchSellQuotesFetching.ts` | `CaipAssetType` import | unused local | | `ui/pages/batch-sell/pages/review/utils/buildQuoteRequest.test.ts` | `ASSET_ID` | unused local | | `ui/ducks/batch-sell/selectors.test.ts` | `MOCK_SOLANA_ACCOUNT`, `ALL_NETWORKS`, `MOCK_SOLANA_NETWORK` | unused local (`MOCK_SOLANA_NETWORK` is a cascade: its only reader was `ALL_NETWORKS`) | Every removed item was proven with a whole-repo whole-word search. Other `MOCK_SOLANA_ACCOUNT` hits are a different export in `test/data/bridge/mock-bridge-store.ts`. Other `*_ASSET_ID` names in the selector test are different locals. `hasAnyEnabledAsset` and `hasAtLeastOneQuoteAvailable` remain used by the review page. Checked against the diffs of all 562 open PRs: none edit these files. Declaration blame is June–July 2026, outside the 60-day window, and these files last changed before the 30-day window. No user-facing behavior change. Checks passed: `yarn lint:tsc`, eslint on the touched files, and `yarn test:unit --coverage=false` for `ui/ducks/batch-sell` plus the touched review tests (96 tests, no snapshot updates). Docs/comments updated: none ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Refs: proactive dead-code cleanup (extension counterpart of metamask-mobile#37948) ## **Manual testing steps** N/A — deletes unreachable code. There is no user-facing behavior to click through. ## **Screenshots/Recordings** N/A — no UI change ### **Before** N/A ### **After** N/A ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Import and test-fixture deletions only; batch-sell logic and UI props are unchanged. > > **Overview** > Dead-code cleanup in the batch-sell review flow and selector tests so **`tsc --noUnusedLocals`** stays clean. No runtime or UI behavior changes. > > **Review flow:** Drops unused imports from **`total-received-modal.tsx`** (`useMemo`, `hasAnyEnabledAsset`, `hasAtLeastOneQuoteAvailable`); the modal still uses **`anyEnabledAsset`** and **`atLeastOneQuoteAvailable`** from props. **`useBatchSellAggregateValidation`** and **`useBatchSellQuotesFetching`** lose unused **`BigNumber`**, **`getNativeAssetForChainId`**, and **`CaipAssetType`** imports. **`buildQuoteRequest.test.ts`** removes an unused **`ASSET_ID`** constant. > > **Tests:** **`selectors.test.ts`** removes unused Solana fixtures (**`MOCK_SOLANA_ACCOUNT`**, **`MOCK_SOLANA_NETWORK`**, **`ALL_NETWORKS`**) that nothing referenced after other test setup. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0fe01f8. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: George Marshall <georgewrmarshall@users.noreply.github.com>
1 parent 79ab2fd commit 0492f59

5 files changed

Lines changed: 1 addition & 35 deletions

File tree

‎ui/ducks/batch-sell/selectors.test.ts‎

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,6 @@ const MOCK_EVM_ACCOUNT = {
8282
methods: [],
8383
};
8484

85-
// Minimal Solana (non-EVM) account
86-
const MOCK_SOLANA_ACCOUNT = {
87-
id: 'sol-account-1',
88-
address: 'SolanaAddress',
89-
type: 'solana:data-account' as const,
90-
scopes: ['solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'] as CaipChainId[],
91-
options: {},
92-
metadata: { name: 'Solana', keyring: { type: 'Snap Keyring' } },
93-
methods: [],
94-
};
95-
9685
// Minimal network configuration – cast to unknown to avoid satisfying the full
9786
// MultichainNetworkConfiguration type in test fixtures (isEvm, etc.)
9887
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -128,23 +117,6 @@ const MOCK_OPTIMISM_NETWORK: AnyNetwork = {
128117
defaultBlockExplorerUrlIndex: 0,
129118
};
130119

131-
const MOCK_SOLANA_NETWORK: AnyNetwork = {
132-
chainId: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' as CaipChainId,
133-
name: 'Solana',
134-
nativeCurrency: 'SOL',
135-
rpcEndpoints: [],
136-
defaultRpcEndpointIndex: 0,
137-
blockExplorerUrls: [],
138-
defaultBlockExplorerUrlIndex: 0,
139-
};
140-
141-
const ALL_NETWORKS: AnyNetwork = {
142-
[CAIP_MAINNET]: MOCK_MAINNET_NETWORK,
143-
[CAIP_BASE]: MOCK_BASE_NETWORK,
144-
[CAIP_OPTIMISM]: MOCK_OPTIMISM_NETWORK,
145-
[MOCK_SOLANA_NETWORK.chainId]: MOCK_SOLANA_NETWORK,
146-
};
147-
148120
/** Return a fresh state object each call so reselect never returns a cached value. */
149121
// eslint-disable-next-line @typescript-eslint/no-explicit-any
150122
const buildState = (): any => ({});

‎ui/pages/batch-sell/pages/review/components/total-received-modal.tsx‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useMemo } from 'react';
1+
import React from 'react';
22
import {
33
ModalFooter,
44
Text,
@@ -14,8 +14,6 @@ import {
1414
} from '../../../../../components/component-library';
1515
import { useI18nContext } from '../../../../../hooks/useI18nContext';
1616
import { BatchSellQuotesConfig, BatchSellQuotesResults } from '../types';
17-
import { hasAnyEnabledAsset } from '../utils/hasAnyEnabledAsset';
18-
import { hasAtLeastOneQuoteAvailable } from '../utils/hasAtLeastOneQuoteAvailable';
1917
import { AssetsReceivedSummaryList } from './assets-received-summary-list';
2018
import { AssetsReceivedTotalAmountsSummary } from './assets-received-total-amounts-summary';
2119

‎ui/pages/batch-sell/pages/review/hooks/useBatchSellAggregateValidation.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { useMemo } from 'react';
22
import { useSelector } from 'react-redux';
3-
import BigNumber from 'bignumber.js';
43
import { CaipChainId } from '@metamask/utils';
5-
import { getNativeAssetForChainId } from '@metamask/bridge-controller';
64
import { getNativeAssetForChain } from '../../../../../ducks/batch-sell/selectors';
75
import { type BridgeAppState } from '../../../../../ducks/bridge/selectors';
86
import {

‎ui/pages/batch-sell/pages/review/hooks/useBatchSellQuotesFetching.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { useCallback, useEffect, useMemo, useRef } from 'react';
22
import { useSelector } from 'react-redux';
33
import { debounce } from 'lodash';
4-
import { CaipAssetType } from '@metamask/utils';
54
import { formatChainIdToCaip } from '@metamask/bridge-controller';
65
import {
76
resetBridgeController,

‎ui/pages/batch-sell/pages/review/utils/buildQuoteRequest.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
} from './buildQuoteRequest';
1212

1313
const CHAIN_ID = BATCH_SELL_CHAIN_ID as unknown as CaipChainId;
14-
const ASSET_ID = BATCH_SELL_ASSET_IDS.USDC;
1514
const DEST_ASSET_ID = BATCH_SELL_ASSET_IDS.ETH_NATIVE;
1615
const WALLET_ADDRESS = '0xWalletAddress';
1716

0 commit comments

Comments
 (0)