mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-29 15:50:28 +01:00
5bc0ba7f3a
* 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
69 lines
2.1 KiB
JavaScript
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);
|