1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/pages/settings/security-tab/security-tab.container.js
Danica Shen 00d155ce2f
feat(878): implement network txn toggle and new style (#20363)
* feat(878): implement new incoming transaction toggle networks for setting and onboarding

* Update state snapshots

* feat(878): change gaps, migration types based on comment

---------

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2023-08-24 11:27:42 +01:00

90 lines
2.5 KiB
JavaScript

import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import { compose } from 'redux';
import {
setIncomingTransactionsPreferences,
setIpfsGateway,
setParticipateInMetaMetrics,
setUseCurrencyRateCheck,
setUseMultiAccountBalanceChecker,
setUsePhishDetect,
setUseTokenDetection,
setUseAddressBarEnsResolution,
setOpenSeaEnabled,
setUseNftDetection,
setUse4ByteResolution,
} from '../../../store/actions';
import { getAllNetworks } from '../../../selectors';
import SecurityTab from './security-tab.component';
const mapStateToProps = (state) => {
const {
appState: { warning },
metamask,
} = state;
const {
incomingTransactionsPreferences,
participateInMetaMetrics,
usePhishDetect,
useTokenDetection,
ipfsGateway,
useMultiAccountBalanceChecker,
useCurrencyRateCheck,
useAddressBarEnsResolution,
openSeaEnabled,
useNftDetection,
use4ByteResolution,
} = metamask;
const allNetworks = getAllNetworks(state);
return {
warning,
incomingTransactionsPreferences,
allNetworks,
participateInMetaMetrics,
usePhishDetect,
useTokenDetection,
ipfsGateway,
useMultiAccountBalanceChecker,
useCurrencyRateCheck,
useAddressBarEnsResolution,
openSeaEnabled,
useNftDetection,
use4ByteResolution,
};
};
const mapDispatchToProps = (dispatch) => {
return {
setIncomingTransactionsPreferences: (chainId, value) =>
dispatch(setIncomingTransactionsPreferences(chainId, value)),
setParticipateInMetaMetrics: (val) =>
dispatch(setParticipateInMetaMetrics(val)),
setUsePhishDetect: (val) => dispatch(setUsePhishDetect(val)),
setUseCurrencyRateCheck: (val) => dispatch(setUseCurrencyRateCheck(val)),
setUseTokenDetection: (value) => {
return dispatch(setUseTokenDetection(value));
},
setIpfsGateway: (value) => {
return dispatch(setIpfsGateway(value));
},
setUseMultiAccountBalanceChecker: (value) => {
return dispatch(setUseMultiAccountBalanceChecker(value));
},
setUseAddressBarEnsResolution: (value) =>
dispatch(setUseAddressBarEnsResolution(value)),
setOpenSeaEnabled: (val) => dispatch(setOpenSeaEnabled(val)),
setUseNftDetection: (val) => dispatch(setUseNftDetection(val)),
setUse4ByteResolution: (value) => {
return dispatch(setUse4ByteResolution(value));
},
};
};
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps),
)(SecurityTab);