Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const utilNumberImportBurndownFiles = [
'app/components/UI/TransactionElement/utils.js',
'app/components/UI/UrlAutocomplete/Result.tsx',
'app/components/Views/AssetDetails/index.tsx',
'app/components/Views/DetectedTokens/components/Token.tsx',
'app/components/Views/GasEducationCarousel/index.js',
'app/components/Views/NetworksManagement/NetworkDetailsView/hooks/useNetworkValidation.ts',
'app/components/Views/SocialLeaderboard/TraderPositionView/components/QuickBuyBottomSheet/useQuickBuyBottomSheet.ts',
Expand Down
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ app/components/Views/AssetHideConfirmation @MetaMask/metamask-assets
app/components/Views/AssetOptions @MetaMask/metamask-assets
app/components/Views/Collectible @MetaMask/metamask-assets
app/components/Views/CollectibleView @MetaMask/metamask-assets
app/components/Views/DetectedTokens @MetaMask/metamask-assets
app/components/Views/NFTAutoDetectionModal @MetaMask/metamask-assets
app/components/Views/NftDetails @MetaMask/metamask-assets
app/reducers/collectibles @MetaMask/metamask-assets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ const mockStore = configureStore({
TokensController: {
allTokens: {},
allIgnoredTokens: {},
allDetectedTokens: {},
},
CurrencyRateController: {
currentCurrency: 'usd',
Expand Down
14 changes: 0 additions & 14 deletions app/components/Nav/App/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,6 @@ jest.mock('../../Views/LedgerSelectAccount', () => () => (
jest.mock('../../Views/ConnectHardware/SelectHardware', () => () => (
<MockView testID="mock-select-hw" />
));
jest.mock('../../Views/DetectedTokens', () => () => (
<MockView testID="mock-detected-tokens" />
));
jest.mock('../../Views/DetectedTokensConfirmation', () => () => (
<MockView testID="mock-detected-confirm" />
));
jest.mock('../../Views/WalletActions', () => () => (
<MockView testID="mock-wallet-actions" />
));
Expand Down Expand Up @@ -2236,13 +2230,5 @@ describe('App', () => {
expect(getByTestId('mock-trade-actions')).toBeTruthy();
});
});

it('renders DetectedTokens flow', async () => {
const { getByTestId } = renderAppWithModal('DetectedTokens');

await waitFor(() => {
expect(getByTestId('mock-detected-tokens')).toBeTruthy();
});
});
});
});
17 changes: 0 additions & 17 deletions app/components/Nav/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ import ConnectionDetails from '../../../components/Views/AccountPermissions/Conn
import { SRPQuiz } from '../../Views/Quiz';
import { TurnOffRememberMeModal } from '../../../components/UI/TurnOffRememberMeModal';
import AssetHideConfirmation from '../../Views/AssetHideConfirmation';
import DetectedTokens from '../../Views/DetectedTokens';
import DetectedTokensConfirmation from '../../Views/DetectedTokensConfirmation';
import AssetOptions from '../../Views/AssetOptions';
import ImportPrivateKey from '../../Views/ImportPrivateKey';
import ImportPrivateKeySuccess from '../../Views/ImportPrivateKeySuccess';
Expand Down Expand Up @@ -413,20 +411,6 @@ const AddNetworkFlow = () => {
);
};

const DetectedTokensFlow = () => (
<Stack.Navigator
screenOptions={clearStackNavigatorOptions}
initialRouteName={'DetectedTokens'}
>
<Stack.Screen name={'DetectedTokens'} component={DetectedTokens} />
<Stack.Screen
name={'DetectedTokensConfirmation'}
component={DetectedTokensConfirmation}
options={{ presentation: 'modal' }}
/>
</Stack.Navigator>
);

interface RootModalFlowProps {
route: {
params: Record<string, unknown>;
Expand Down Expand Up @@ -590,7 +574,6 @@ const RootModalFlow = (props: RootModalFlowProps) => (
name={'AssetHideConfirmation'}
component={AssetHideConfirmation}
/>
<Stack.Screen name={'DetectedTokens'} component={DetectedTokensFlow} />
<Stack.Screen name={'AssetOptions'} component={AssetOptions} />
<Stack.Screen name={'NftOptions'} component={NftOptions} />
<Stack.Screen name={Routes.MODAL.UPDATE_NEEDED} component={UpdateNeeded} />
Expand Down
20 changes: 0 additions & 20 deletions app/components/UI/Card/hooks/useAssetBalances.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ describe('useAssetBalances', () => {
backgroundState: {
TokensController: {
allTokens: {},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -218,7 +217,6 @@ describe('useAssetBalances', () => {
backgroundState: {
TokensController: {
allTokens: {},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -449,7 +447,6 @@ describe('useAssetBalances', () => {
'mock-account': [walletAsset],
},
},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -546,7 +543,6 @@ describe('useAssetBalances', () => {
'mock-account': [walletAsset],
},
},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -694,7 +690,6 @@ describe('useAssetBalances', () => {
'mock-account': [walletAsset],
},
},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -754,7 +749,6 @@ describe('useAssetBalances', () => {
backgroundState: {
TokensController: {
allTokens: {},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -804,7 +798,6 @@ describe('useAssetBalances', () => {
backgroundState: {
TokensController: {
allTokens: {},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -870,7 +863,6 @@ describe('useAssetBalances', () => {
backgroundState: {
TokensController: {
allTokens: {},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {},
Expand Down Expand Up @@ -1017,7 +1009,6 @@ describe('useAssetBalances', () => {
'mock-account': [walletAsset],
},
},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -1089,7 +1080,6 @@ describe('useAssetBalances', () => {
'mock-account': [walletAsset],
},
},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -1161,7 +1151,6 @@ describe('useAssetBalances', () => {
'mock-account': [walletAsset],
},
},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -1233,7 +1222,6 @@ describe('useAssetBalances', () => {
'mock-account': [walletAsset],
},
},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -1291,7 +1279,6 @@ describe('useAssetBalances', () => {
backgroundState: {
TokensController: {
allTokens: {},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -1356,7 +1343,6 @@ describe('useAssetBalances', () => {
backgroundState: {
TokensController: {
allTokens: {},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -1426,7 +1412,6 @@ describe('useAssetBalances', () => {
'mock-account': [walletAsset],
},
},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -1496,7 +1481,6 @@ describe('useAssetBalances', () => {
'mock-account': [walletAsset],
},
},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -1877,7 +1861,6 @@ describe('useAssetBalances', () => {
'mock-account': [walletAsset],
},
},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -1944,7 +1927,6 @@ describe('useAssetBalances', () => {
'mock-account': [walletAsset],
},
},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -2012,7 +1994,6 @@ describe('useAssetBalances', () => {
'mock-account': [walletAsset],
},
},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down Expand Up @@ -2079,7 +2060,6 @@ describe('useAssetBalances', () => {
'mock-account': [walletAsset],
},
},
allDetectedTokens: {},
},
NetworkController: {
networkConfigurationsByChainId: {
Expand Down
19 changes: 1 addition & 18 deletions app/components/UI/Card/hooks/useAssetBalances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ export const useAssetBalances = (

// Get raw state needed for asset lookups - these are stable references from Redux
const allAssets = useSelector(getTokensControllerAllTokens);
const allDetectedTokens = useSelector(
(state: RootState) =>
state.engine.backgroundState.TokensController.allDetectedTokens,
);
const networkConfigs = useSelector(
(state: RootState) =>
state.engine.backgroundState.NetworkController
Expand All @@ -124,7 +120,6 @@ export const useAssetBalances = (

// Manually lookup asset from raw state (similar to selectAsset)
const allTokensForChain = allAssets?.[chainId as Hex];
const detectedTokensForChain = allDetectedTokens?.[chainId as Hex];

let asset: TokenI | undefined;
if (allTokensForChain) {
Expand All @@ -139,18 +134,6 @@ export const useAssetBalances = (
}
}
}
if (!asset && detectedTokensForChain) {
for (const accountTokens of Object.values(detectedTokensForChain)) {
const found = (accountTokens as TokenI[])?.find(
(t) =>
t.address?.toLowerCase() === token.address?.toLowerCase(),
);
if (found) {
asset = found;
break;
}
}
}

if (asset) {
const key = `${token.address.toLowerCase()}-${token.caipChainId}`;
Expand All @@ -159,7 +142,7 @@ export const useAssetBalances = (
}
});
return map;
}, [tokens, allAssets, allDetectedTokens]);
}, [tokens, allAssets]);

// Build the exchangeRatesMap in useMemo using raw state
const exchangeRatesMap = useMemo(() => {
Expand Down
Loading
Loading