diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 078fda863..04d4bbfe2 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -4140,6 +4140,12 @@ "transactionResubmitted": { "message": "Transaction resubmitted with estimated gas fee increased to $1 at $2" }, + "transactionSecurityCheck": { + "message": "Transaction security check" + }, + "transactionSecurityCheckDescription": { + "message": "Turn this on to enable a third party (OpenSea) to review all your transactions and signature requests and warn you about known malicious requests." + }, "transactionSubmitted": { "message": "Transaction submitted with estimated gas fee of $1 at $2." }, diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js index 569d09750..b99d304ee 100644 --- a/app/scripts/controllers/preferences.js +++ b/app/scripts/controllers/preferences.js @@ -70,6 +70,7 @@ export default class PreferencesController { : LEDGER_TRANSPORT_TYPES.U2F, theme: 'light', improvedTokenAllowanceEnabled: false, + transactionSecurityCheckEnabled: false, ...opts.initState, }; @@ -199,6 +200,17 @@ export default class PreferencesController { }); } + /** + * Setter for the `transactionSecurityCheckEnabled` property + * + * @param transactionSecurityCheckEnabled + */ + setTransactionSecurityCheckEnabled(transactionSecurityCheckEnabled) { + this.store.updateState({ + transactionSecurityCheckEnabled, + }); + } + /** * Add new methodData to state, to avoid requesting this information again through Infura * diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index b56b17f2e..02d2dd530 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -1648,6 +1648,10 @@ export default class MetamaskController extends EventEmitter { preferencesController.setImprovedTokenAllowanceEnabled.bind( preferencesController, ), + setTransactionSecurityCheckEnabled: + preferencesController.setTransactionSecurityCheckEnabled.bind( + preferencesController, + ), // AssetsContractController getTokenStandardAndDetails: this.getTokenStandardAndDetails.bind(this), diff --git a/ui/helpers/constants/settings.js b/ui/helpers/constants/settings.js index 9072b48d3..f53fed4a0 100644 --- a/ui/helpers/constants/settings.js +++ b/ui/helpers/constants/settings.js @@ -343,4 +343,11 @@ export const SETTINGS_CONSTANTS = [ route: `${EXPERIMENTAL_ROUTE}#improved-token-allowance`, icon: 'fa fa-flask', }, + { + tabMessage: (t) => t('experimental'), + sectionMessage: (t) => t('transactionSecurityCheck'), + descriptionMessage: (t) => t('transactionSecurityCheckDescription'), + route: `${EXPERIMENTAL_ROUTE}#transaction-security-check`, + icon: 'fa fa-flask', + }, ]; diff --git a/ui/helpers/utils/settings-search.test.js b/ui/helpers/utils/settings-search.test.js index 96210eae1..9efe18bc5 100644 --- a/ui/helpers/utils/settings-search.test.js +++ b/ui/helpers/utils/settings-search.test.js @@ -182,7 +182,7 @@ describe('Settings Search Utils', () => { it('should get good experimental section number', () => { expect(getNumberOfSettingsInSection(t, t('experimental'))).toStrictEqual( - 2, + 3, ); }); diff --git a/ui/pages/settings/experimental-tab/experimental-tab.component.js b/ui/pages/settings/experimental-tab/experimental-tab.component.js index fc05a8620..d4c362b4b 100644 --- a/ui/pages/settings/experimental-tab/experimental-tab.component.js +++ b/ui/pages/settings/experimental-tab/experimental-tab.component.js @@ -22,6 +22,8 @@ export default class ExperimentalTab extends PureComponent { setEIP1559V2Enabled: PropTypes.func, improvedTokenAllowanceEnabled: PropTypes.bool, setImprovedTokenAllowanceEnabled: PropTypes.func, + transactionSecurityCheckEnabled: PropTypes.bool, + setTransactionSecurityCheckEnabled: PropTypes.func, }; settingsRefs = Array( @@ -198,7 +200,7 @@ export default class ExperimentalTab extends PureComponent { this.props; return ( -