1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00
metamask-extension/ui/pages/import-token/import-token.container.js
Nidhi Kumari 5bc0ba7f3a
Move "Import NFTs" to Modal (#19806)
* moved import nft to modal

* fixed modal state

* updated port-nft-popup

* updated onChange for import nft modal

* updated tests

* updated tests

* updated tests

* added story and updated spec file

* updated spec file

* updated spec file

* updated spec file for import-nft

* added focus to form field

* added autofocus to tokenId
2023-07-14 21:48:41 +05:30

69 lines
2.1 KiB
JavaScript

import { connect } from 'react-redux';
import {
setPendingTokens,
clearPendingTokens,
getTokenStandardAndDetails,
showImportNftsModal,
} from '../../store/actions';
import { getMostRecentOverviewPage } from '../../ducks/history/history';
import { getProviderConfig } from '../../ducks/metamask/metamask';
import {
getRpcPrefsForCurrentProvider,
getIsTokenDetectionSupported,
getTokenDetectionSupportNetworkByChainId,
getIsTokenDetectionInactiveOnMainnet,
getIsDynamicTokenListAvailable,
getIstokenDetectionInactiveOnNonMainnetSupportedNetwork,
getTokenList,
} from '../../selectors/selectors';
import ImportToken from './import-token.component';
const mapStateToProps = (state) => {
const {
metamask: {
identities,
tokens,
pendingTokens,
useTokenDetection,
selectedAddress,
},
} = state;
const { chainId } = getProviderConfig(state);
const isTokenDetectionInactiveOnMainnet =
getIsTokenDetectionInactiveOnMainnet(state);
const showSearchTab =
getIsTokenDetectionSupported(state) ||
isTokenDetectionInactiveOnMainnet ||
Boolean(process.env.IN_TEST);
return {
identities,
mostRecentOverviewPage: getMostRecentOverviewPage(state),
tokens,
pendingTokens,
showSearchTab,
chainId,
rpcPrefs: getRpcPrefsForCurrentProvider(state),
tokenList: getTokenList(state),
useTokenDetection,
selectedAddress,
isDynamicTokenListAvailable: getIsDynamicTokenListAvailable(state),
networkName: getTokenDetectionSupportNetworkByChainId(state),
tokenDetectionInactiveOnNonMainnetSupportedNetwork:
getIstokenDetectionInactiveOnNonMainnetSupportedNetwork(state),
};
};
const mapDispatchToProps = (dispatch) => {
return {
setPendingTokens: (tokens) => dispatch(setPendingTokens(tokens)),
clearPendingTokens: () => dispatch(clearPendingTokens()),
showImportNftsModal: () => dispatch(showImportNftsModal()),
getTokenStandardAndDetails: (address, selectedAddress) =>
getTokenStandardAndDetails(address, selectedAddress, null),
};
};
export default connect(mapStateToProps, mapDispatchToProps)(ImportToken);