@metamask-previews/preferences-controller 23.0.0-preview-e0ce55a8c → 23.0.0-preview-1f5463f7b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Added
11
+
12
+ - Expose missing public `PreferencesController` methods through its messenger ([#8193](https://github.com/MetaMask/core/pull/8193))
13
+ - The following actions are now available:
14
+ - `PreferencesController:setFeatureFlag`
15
+ - `PreferencesController:setIpfsGateway`
16
+ - `PreferencesController:setUseTokenDetection`
17
+ - `PreferencesController:setUseNftDetection`
18
+ - `PreferencesController:setDisplayNftMedia`
19
+ - `PreferencesController:setSecurityAlertsEnabled`
20
+ - `PreferencesController:setIsMultiAccountBalancesEnabled`
21
+ - `PreferencesController:setShowTestNetworks`
22
+ - `PreferencesController:setIsIpfsGatewayEnabled`
23
+ - `PreferencesController:setEnableNetworkIncomingTransactions`
24
+ - `PreferencesController:setShowMultiRpcModal`
25
+ - `PreferencesController:setSmartTransactionsOptInStatus`
26
+ - `PreferencesController:setUseTransactionSimulations`
27
+ - `PreferencesController:setTokenSortConfig`
28
+ - `PreferencesController:setUseSafeChainsListValidation`
29
+ - `PreferencesController:setPrivacyMode`
30
+ - `PreferencesController:setDismissSmartAccountSuggestionEnabled`
31
+ - `PreferencesController:setSmartAccountOptIn`
32
+ - `PreferencesController:setTokenNetworkFilter`
33
+ - Corresponding action types (e.g. `PreferencesControllerSetFeatureFlagAction`) are available as well.
34
+
10
35
  ## [23.0.0]
11
36
 
12
37
  ### Removed
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
4
+ * Do not edit manually.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=PreferencesController-method-action-types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreferencesController-method-action-types.cjs","sourceRoot":"","sources":["../src/PreferencesController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { PreferencesController } from './PreferencesController';\n\n/**\n * Enable or disable a specific feature flag.\n *\n * @param feature - Feature to toggle.\n * @param activated - Value to assign.\n */\nexport type PreferencesControllerSetFeatureFlagAction = {\n type: `PreferencesController:setFeatureFlag`;\n handler: PreferencesController['setFeatureFlag'];\n};\n\n/**\n * Sets new IPFS gateway.\n *\n * @param ipfsGateway - IPFS gateway string.\n */\nexport type PreferencesControllerSetIpfsGatewayAction = {\n type: `PreferencesController:setIpfsGateway`;\n handler: PreferencesController['setIpfsGateway'];\n};\n\n/**\n * Toggle the token detection setting.\n *\n * @param useTokenDetection - Boolean indicating user preference on token detection.\n */\nexport type PreferencesControllerSetUseTokenDetectionAction = {\n type: `PreferencesController:setUseTokenDetection`;\n handler: PreferencesController['setUseTokenDetection'];\n};\n\n/**\n * Toggle the NFT detection setting.\n *\n * @param useNftDetection - Boolean indicating user preference on NFT detection.\n */\nexport type PreferencesControllerSetUseNftDetectionAction = {\n type: `PreferencesController:setUseNftDetection`;\n handler: PreferencesController['setUseNftDetection'];\n};\n\n/**\n * Toggle the display nft media enabled setting.\n *\n * @param displayNftMedia - Boolean indicating user preference on using OpenSea's API.\n */\nexport type PreferencesControllerSetDisplayNftMediaAction = {\n type: `PreferencesController:setDisplayNftMedia`;\n handler: PreferencesController['setDisplayNftMedia'];\n};\n\n/**\n * Toggle the security alert enabled setting.\n *\n * @param securityAlertsEnabled - Boolean indicating user preference on using security alerts.\n */\nexport type PreferencesControllerSetSecurityAlertsEnabledAction = {\n type: `PreferencesController:setSecurityAlertsEnabled`;\n handler: PreferencesController['setSecurityAlertsEnabled'];\n};\n\n/**\n * A setter for the user preferences to enable/disable fetch of multiple accounts balance.\n *\n * @param isMultiAccountBalancesEnabled - true to enable multiple accounts balance fetch, false to fetch only selectedAddress.\n */\nexport type PreferencesControllerSetIsMultiAccountBalancesEnabledAction = {\n type: `PreferencesController:setIsMultiAccountBalancesEnabled`;\n handler: PreferencesController['setIsMultiAccountBalancesEnabled'];\n};\n\n/**\n * A setter for the user have the test networks visible/hidden.\n *\n * @param showTestNetworks - true to show test networks, false to hidden.\n */\nexport type PreferencesControllerSetShowTestNetworksAction = {\n type: `PreferencesController:setShowTestNetworks`;\n handler: PreferencesController['setShowTestNetworks'];\n};\n\n/**\n * A setter for the user allow to be fetched IPFS content\n *\n * @param isIpfsGatewayEnabled - true to enable ipfs source\n */\nexport type PreferencesControllerSetIsIpfsGatewayEnabledAction = {\n type: `PreferencesController:setIsIpfsGatewayEnabled`;\n handler: PreferencesController['setIsIpfsGatewayEnabled'];\n};\n\n/**\n * A setter for the user allow to be fetched IPFS content\n *\n * @param chainId - On hexadecimal format to enable the incoming transaction network\n * @param isIncomingTransactionNetworkEnable - true to enable incoming transactions\n */\nexport type PreferencesControllerSetEnableNetworkIncomingTransactionsAction = {\n type: `PreferencesController:setEnableNetworkIncomingTransactions`;\n handler: PreferencesController['setEnableNetworkIncomingTransactions'];\n};\n\n/**\n * Toggle multi rpc migration modal.\n *\n * @param showMultiRpcModal - Boolean indicating if the multi rpc modal will be displayed or not.\n */\nexport type PreferencesControllerSetShowMultiRpcModalAction = {\n type: `PreferencesController:setShowMultiRpcModal`;\n handler: PreferencesController['setShowMultiRpcModal'];\n};\n\n/**\n * A setter for the user to opt into smart transactions\n *\n * @param smartTransactionsOptInStatus - true to opt into smart transactions\n */\nexport type PreferencesControllerSetSmartTransactionsOptInStatusAction = {\n type: `PreferencesController:setSmartTransactionsOptInStatus`;\n handler: PreferencesController['setSmartTransactionsOptInStatus'];\n};\n\n/**\n * A setter for the user preferences to enable/disable transaction simulations.\n *\n * @param useTransactionSimulations - true to enable transaction simulations, false to disable it.\n */\nexport type PreferencesControllerSetUseTransactionSimulationsAction = {\n type: `PreferencesController:setUseTransactionSimulations`;\n handler: PreferencesController['setUseTransactionSimulations'];\n};\n\n/**\n * A setter to update the user's preferred token sorting order.\n *\n * @param tokenSortConfig - a configuration representing the sort order of tokens.\n */\nexport type PreferencesControllerSetTokenSortConfigAction = {\n type: `PreferencesController:setTokenSortConfig`;\n handler: PreferencesController['setTokenSortConfig'];\n};\n\n/**\n * A setter for the user preferences to enable/disable safe chains list validation.\n *\n * @param useSafeChainsListValidation - true to enable safe chains list validation, false to disable it.\n */\nexport type PreferencesControllerSetUseSafeChainsListValidationAction = {\n type: `PreferencesController:setUseSafeChainsListValidation`;\n handler: PreferencesController['setUseSafeChainsListValidation'];\n};\n\n/**\n * A setter for the user preferences to enable/disable privacy mode.\n *\n * @param privacyMode - true to enable privacy mode, false to disable it.\n */\nexport type PreferencesControllerSetPrivacyModeAction = {\n type: `PreferencesController:setPrivacyMode`;\n handler: PreferencesController['setPrivacyMode'];\n};\n\n/**\n * A setter for the user preferences dismiss smart account upgrade prompt.\n *\n * @param dismissSmartAccountSuggestionEnabled - true to dismiss smart account upgrade prompt, false to enable it.\n */\nexport type PreferencesControllerSetDismissSmartAccountSuggestionEnabledAction =\n {\n type: `PreferencesController:setDismissSmartAccountSuggestionEnabled`;\n handler: PreferencesController['setDismissSmartAccountSuggestionEnabled'];\n };\n\n/**\n * A setter for the user preferences smart account OptIn.\n *\n * @param smartAccountOptIn - true if user opts in for smart account update, false otherwise.\n */\nexport type PreferencesControllerSetSmartAccountOptInAction = {\n type: `PreferencesController:setSmartAccountOptIn`;\n handler: PreferencesController['setSmartAccountOptIn'];\n};\n\n/**\n * Set the token network filter configuration setting.\n *\n * @param tokenNetworkFilter - Object describing token network filter configuration.\n */\nexport type PreferencesControllerSetTokenNetworkFilterAction = {\n type: `PreferencesController:setTokenNetworkFilter`;\n handler: PreferencesController['setTokenNetworkFilter'];\n};\n\n/**\n * Union of all PreferencesController action types.\n */\nexport type PreferencesControllerMethodActions =\n | PreferencesControllerSetFeatureFlagAction\n | PreferencesControllerSetIpfsGatewayAction\n | PreferencesControllerSetUseTokenDetectionAction\n | PreferencesControllerSetUseNftDetectionAction\n | PreferencesControllerSetDisplayNftMediaAction\n | PreferencesControllerSetSecurityAlertsEnabledAction\n | PreferencesControllerSetIsMultiAccountBalancesEnabledAction\n | PreferencesControllerSetShowTestNetworksAction\n | PreferencesControllerSetIsIpfsGatewayEnabledAction\n | PreferencesControllerSetEnableNetworkIncomingTransactionsAction\n | PreferencesControllerSetShowMultiRpcModalAction\n | PreferencesControllerSetSmartTransactionsOptInStatusAction\n | PreferencesControllerSetUseTransactionSimulationsAction\n | PreferencesControllerSetTokenSortConfigAction\n | PreferencesControllerSetUseSafeChainsListValidationAction\n | PreferencesControllerSetPrivacyModeAction\n | PreferencesControllerSetDismissSmartAccountSuggestionEnabledAction\n | PreferencesControllerSetSmartAccountOptInAction\n | PreferencesControllerSetTokenNetworkFilterAction;\n"]}
@@ -0,0 +1,183 @@
1
+ /**
2
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
3
+ * Do not edit manually.
4
+ */
5
+ import type { PreferencesController } from "./PreferencesController.cjs";
6
+ /**
7
+ * Enable or disable a specific feature flag.
8
+ *
9
+ * @param feature - Feature to toggle.
10
+ * @param activated - Value to assign.
11
+ */
12
+ export type PreferencesControllerSetFeatureFlagAction = {
13
+ type: `PreferencesController:setFeatureFlag`;
14
+ handler: PreferencesController['setFeatureFlag'];
15
+ };
16
+ /**
17
+ * Sets new IPFS gateway.
18
+ *
19
+ * @param ipfsGateway - IPFS gateway string.
20
+ */
21
+ export type PreferencesControllerSetIpfsGatewayAction = {
22
+ type: `PreferencesController:setIpfsGateway`;
23
+ handler: PreferencesController['setIpfsGateway'];
24
+ };
25
+ /**
26
+ * Toggle the token detection setting.
27
+ *
28
+ * @param useTokenDetection - Boolean indicating user preference on token detection.
29
+ */
30
+ export type PreferencesControllerSetUseTokenDetectionAction = {
31
+ type: `PreferencesController:setUseTokenDetection`;
32
+ handler: PreferencesController['setUseTokenDetection'];
33
+ };
34
+ /**
35
+ * Toggle the NFT detection setting.
36
+ *
37
+ * @param useNftDetection - Boolean indicating user preference on NFT detection.
38
+ */
39
+ export type PreferencesControllerSetUseNftDetectionAction = {
40
+ type: `PreferencesController:setUseNftDetection`;
41
+ handler: PreferencesController['setUseNftDetection'];
42
+ };
43
+ /**
44
+ * Toggle the display nft media enabled setting.
45
+ *
46
+ * @param displayNftMedia - Boolean indicating user preference on using OpenSea's API.
47
+ */
48
+ export type PreferencesControllerSetDisplayNftMediaAction = {
49
+ type: `PreferencesController:setDisplayNftMedia`;
50
+ handler: PreferencesController['setDisplayNftMedia'];
51
+ };
52
+ /**
53
+ * Toggle the security alert enabled setting.
54
+ *
55
+ * @param securityAlertsEnabled - Boolean indicating user preference on using security alerts.
56
+ */
57
+ export type PreferencesControllerSetSecurityAlertsEnabledAction = {
58
+ type: `PreferencesController:setSecurityAlertsEnabled`;
59
+ handler: PreferencesController['setSecurityAlertsEnabled'];
60
+ };
61
+ /**
62
+ * A setter for the user preferences to enable/disable fetch of multiple accounts balance.
63
+ *
64
+ * @param isMultiAccountBalancesEnabled - true to enable multiple accounts balance fetch, false to fetch only selectedAddress.
65
+ */
66
+ export type PreferencesControllerSetIsMultiAccountBalancesEnabledAction = {
67
+ type: `PreferencesController:setIsMultiAccountBalancesEnabled`;
68
+ handler: PreferencesController['setIsMultiAccountBalancesEnabled'];
69
+ };
70
+ /**
71
+ * A setter for the user have the test networks visible/hidden.
72
+ *
73
+ * @param showTestNetworks - true to show test networks, false to hidden.
74
+ */
75
+ export type PreferencesControllerSetShowTestNetworksAction = {
76
+ type: `PreferencesController:setShowTestNetworks`;
77
+ handler: PreferencesController['setShowTestNetworks'];
78
+ };
79
+ /**
80
+ * A setter for the user allow to be fetched IPFS content
81
+ *
82
+ * @param isIpfsGatewayEnabled - true to enable ipfs source
83
+ */
84
+ export type PreferencesControllerSetIsIpfsGatewayEnabledAction = {
85
+ type: `PreferencesController:setIsIpfsGatewayEnabled`;
86
+ handler: PreferencesController['setIsIpfsGatewayEnabled'];
87
+ };
88
+ /**
89
+ * A setter for the user allow to be fetched IPFS content
90
+ *
91
+ * @param chainId - On hexadecimal format to enable the incoming transaction network
92
+ * @param isIncomingTransactionNetworkEnable - true to enable incoming transactions
93
+ */
94
+ export type PreferencesControllerSetEnableNetworkIncomingTransactionsAction = {
95
+ type: `PreferencesController:setEnableNetworkIncomingTransactions`;
96
+ handler: PreferencesController['setEnableNetworkIncomingTransactions'];
97
+ };
98
+ /**
99
+ * Toggle multi rpc migration modal.
100
+ *
101
+ * @param showMultiRpcModal - Boolean indicating if the multi rpc modal will be displayed or not.
102
+ */
103
+ export type PreferencesControllerSetShowMultiRpcModalAction = {
104
+ type: `PreferencesController:setShowMultiRpcModal`;
105
+ handler: PreferencesController['setShowMultiRpcModal'];
106
+ };
107
+ /**
108
+ * A setter for the user to opt into smart transactions
109
+ *
110
+ * @param smartTransactionsOptInStatus - true to opt into smart transactions
111
+ */
112
+ export type PreferencesControllerSetSmartTransactionsOptInStatusAction = {
113
+ type: `PreferencesController:setSmartTransactionsOptInStatus`;
114
+ handler: PreferencesController['setSmartTransactionsOptInStatus'];
115
+ };
116
+ /**
117
+ * A setter for the user preferences to enable/disable transaction simulations.
118
+ *
119
+ * @param useTransactionSimulations - true to enable transaction simulations, false to disable it.
120
+ */
121
+ export type PreferencesControllerSetUseTransactionSimulationsAction = {
122
+ type: `PreferencesController:setUseTransactionSimulations`;
123
+ handler: PreferencesController['setUseTransactionSimulations'];
124
+ };
125
+ /**
126
+ * A setter to update the user's preferred token sorting order.
127
+ *
128
+ * @param tokenSortConfig - a configuration representing the sort order of tokens.
129
+ */
130
+ export type PreferencesControllerSetTokenSortConfigAction = {
131
+ type: `PreferencesController:setTokenSortConfig`;
132
+ handler: PreferencesController['setTokenSortConfig'];
133
+ };
134
+ /**
135
+ * A setter for the user preferences to enable/disable safe chains list validation.
136
+ *
137
+ * @param useSafeChainsListValidation - true to enable safe chains list validation, false to disable it.
138
+ */
139
+ export type PreferencesControllerSetUseSafeChainsListValidationAction = {
140
+ type: `PreferencesController:setUseSafeChainsListValidation`;
141
+ handler: PreferencesController['setUseSafeChainsListValidation'];
142
+ };
143
+ /**
144
+ * A setter for the user preferences to enable/disable privacy mode.
145
+ *
146
+ * @param privacyMode - true to enable privacy mode, false to disable it.
147
+ */
148
+ export type PreferencesControllerSetPrivacyModeAction = {
149
+ type: `PreferencesController:setPrivacyMode`;
150
+ handler: PreferencesController['setPrivacyMode'];
151
+ };
152
+ /**
153
+ * A setter for the user preferences dismiss smart account upgrade prompt.
154
+ *
155
+ * @param dismissSmartAccountSuggestionEnabled - true to dismiss smart account upgrade prompt, false to enable it.
156
+ */
157
+ export type PreferencesControllerSetDismissSmartAccountSuggestionEnabledAction = {
158
+ type: `PreferencesController:setDismissSmartAccountSuggestionEnabled`;
159
+ handler: PreferencesController['setDismissSmartAccountSuggestionEnabled'];
160
+ };
161
+ /**
162
+ * A setter for the user preferences smart account OptIn.
163
+ *
164
+ * @param smartAccountOptIn - true if user opts in for smart account update, false otherwise.
165
+ */
166
+ export type PreferencesControllerSetSmartAccountOptInAction = {
167
+ type: `PreferencesController:setSmartAccountOptIn`;
168
+ handler: PreferencesController['setSmartAccountOptIn'];
169
+ };
170
+ /**
171
+ * Set the token network filter configuration setting.
172
+ *
173
+ * @param tokenNetworkFilter - Object describing token network filter configuration.
174
+ */
175
+ export type PreferencesControllerSetTokenNetworkFilterAction = {
176
+ type: `PreferencesController:setTokenNetworkFilter`;
177
+ handler: PreferencesController['setTokenNetworkFilter'];
178
+ };
179
+ /**
180
+ * Union of all PreferencesController action types.
181
+ */
182
+ export type PreferencesControllerMethodActions = PreferencesControllerSetFeatureFlagAction | PreferencesControllerSetIpfsGatewayAction | PreferencesControllerSetUseTokenDetectionAction | PreferencesControllerSetUseNftDetectionAction | PreferencesControllerSetDisplayNftMediaAction | PreferencesControllerSetSecurityAlertsEnabledAction | PreferencesControllerSetIsMultiAccountBalancesEnabledAction | PreferencesControllerSetShowTestNetworksAction | PreferencesControllerSetIsIpfsGatewayEnabledAction | PreferencesControllerSetEnableNetworkIncomingTransactionsAction | PreferencesControllerSetShowMultiRpcModalAction | PreferencesControllerSetSmartTransactionsOptInStatusAction | PreferencesControllerSetUseTransactionSimulationsAction | PreferencesControllerSetTokenSortConfigAction | PreferencesControllerSetUseSafeChainsListValidationAction | PreferencesControllerSetPrivacyModeAction | PreferencesControllerSetDismissSmartAccountSuggestionEnabledAction | PreferencesControllerSetSmartAccountOptInAction | PreferencesControllerSetTokenNetworkFilterAction;
183
+ //# sourceMappingURL=PreferencesController-method-action-types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreferencesController-method-action-types.d.cts","sourceRoot":"","sources":["../src/PreferencesController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,oCAAgC;AAErE;;;;;GAKG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD,IAAI,EAAE,sCAAsC,CAAC;IAC7C,OAAO,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;CAClD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD,IAAI,EAAE,sCAAsC,CAAC;IAC7C,OAAO,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;CAClD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,qBAAqB,CAAC,sBAAsB,CAAC,CAAC;CACxD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;CACtD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,6CAA6C,GAA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AgD,CAAC"}
@@ -0,0 +1,183 @@
1
+ /**
2
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
3
+ * Do not edit manually.
4
+ */
5
+ import type { PreferencesController } from "./PreferencesController.mjs";
6
+ /**
7
+ * Enable or disable a specific feature flag.
8
+ *
9
+ * @param feature - Feature to toggle.
10
+ * @param activated - Value to assign.
11
+ */
12
+ export type PreferencesControllerSetFeatureFlagAction = {
13
+ type: `PreferencesController:setFeatureFlag`;
14
+ handler: PreferencesController['setFeatureFlag'];
15
+ };
16
+ /**
17
+ * Sets new IPFS gateway.
18
+ *
19
+ * @param ipfsGateway - IPFS gateway string.
20
+ */
21
+ export type PreferencesControllerSetIpfsGatewayAction = {
22
+ type: `PreferencesController:setIpfsGateway`;
23
+ handler: PreferencesController['setIpfsGateway'];
24
+ };
25
+ /**
26
+ * Toggle the token detection setting.
27
+ *
28
+ * @param useTokenDetection - Boolean indicating user preference on token detection.
29
+ */
30
+ export type PreferencesControllerSetUseTokenDetectionAction = {
31
+ type: `PreferencesController:setUseTokenDetection`;
32
+ handler: PreferencesController['setUseTokenDetection'];
33
+ };
34
+ /**
35
+ * Toggle the NFT detection setting.
36
+ *
37
+ * @param useNftDetection - Boolean indicating user preference on NFT detection.
38
+ */
39
+ export type PreferencesControllerSetUseNftDetectionAction = {
40
+ type: `PreferencesController:setUseNftDetection`;
41
+ handler: PreferencesController['setUseNftDetection'];
42
+ };
43
+ /**
44
+ * Toggle the display nft media enabled setting.
45
+ *
46
+ * @param displayNftMedia - Boolean indicating user preference on using OpenSea's API.
47
+ */
48
+ export type PreferencesControllerSetDisplayNftMediaAction = {
49
+ type: `PreferencesController:setDisplayNftMedia`;
50
+ handler: PreferencesController['setDisplayNftMedia'];
51
+ };
52
+ /**
53
+ * Toggle the security alert enabled setting.
54
+ *
55
+ * @param securityAlertsEnabled - Boolean indicating user preference on using security alerts.
56
+ */
57
+ export type PreferencesControllerSetSecurityAlertsEnabledAction = {
58
+ type: `PreferencesController:setSecurityAlertsEnabled`;
59
+ handler: PreferencesController['setSecurityAlertsEnabled'];
60
+ };
61
+ /**
62
+ * A setter for the user preferences to enable/disable fetch of multiple accounts balance.
63
+ *
64
+ * @param isMultiAccountBalancesEnabled - true to enable multiple accounts balance fetch, false to fetch only selectedAddress.
65
+ */
66
+ export type PreferencesControllerSetIsMultiAccountBalancesEnabledAction = {
67
+ type: `PreferencesController:setIsMultiAccountBalancesEnabled`;
68
+ handler: PreferencesController['setIsMultiAccountBalancesEnabled'];
69
+ };
70
+ /**
71
+ * A setter for the user have the test networks visible/hidden.
72
+ *
73
+ * @param showTestNetworks - true to show test networks, false to hidden.
74
+ */
75
+ export type PreferencesControllerSetShowTestNetworksAction = {
76
+ type: `PreferencesController:setShowTestNetworks`;
77
+ handler: PreferencesController['setShowTestNetworks'];
78
+ };
79
+ /**
80
+ * A setter for the user allow to be fetched IPFS content
81
+ *
82
+ * @param isIpfsGatewayEnabled - true to enable ipfs source
83
+ */
84
+ export type PreferencesControllerSetIsIpfsGatewayEnabledAction = {
85
+ type: `PreferencesController:setIsIpfsGatewayEnabled`;
86
+ handler: PreferencesController['setIsIpfsGatewayEnabled'];
87
+ };
88
+ /**
89
+ * A setter for the user allow to be fetched IPFS content
90
+ *
91
+ * @param chainId - On hexadecimal format to enable the incoming transaction network
92
+ * @param isIncomingTransactionNetworkEnable - true to enable incoming transactions
93
+ */
94
+ export type PreferencesControllerSetEnableNetworkIncomingTransactionsAction = {
95
+ type: `PreferencesController:setEnableNetworkIncomingTransactions`;
96
+ handler: PreferencesController['setEnableNetworkIncomingTransactions'];
97
+ };
98
+ /**
99
+ * Toggle multi rpc migration modal.
100
+ *
101
+ * @param showMultiRpcModal - Boolean indicating if the multi rpc modal will be displayed or not.
102
+ */
103
+ export type PreferencesControllerSetShowMultiRpcModalAction = {
104
+ type: `PreferencesController:setShowMultiRpcModal`;
105
+ handler: PreferencesController['setShowMultiRpcModal'];
106
+ };
107
+ /**
108
+ * A setter for the user to opt into smart transactions
109
+ *
110
+ * @param smartTransactionsOptInStatus - true to opt into smart transactions
111
+ */
112
+ export type PreferencesControllerSetSmartTransactionsOptInStatusAction = {
113
+ type: `PreferencesController:setSmartTransactionsOptInStatus`;
114
+ handler: PreferencesController['setSmartTransactionsOptInStatus'];
115
+ };
116
+ /**
117
+ * A setter for the user preferences to enable/disable transaction simulations.
118
+ *
119
+ * @param useTransactionSimulations - true to enable transaction simulations, false to disable it.
120
+ */
121
+ export type PreferencesControllerSetUseTransactionSimulationsAction = {
122
+ type: `PreferencesController:setUseTransactionSimulations`;
123
+ handler: PreferencesController['setUseTransactionSimulations'];
124
+ };
125
+ /**
126
+ * A setter to update the user's preferred token sorting order.
127
+ *
128
+ * @param tokenSortConfig - a configuration representing the sort order of tokens.
129
+ */
130
+ export type PreferencesControllerSetTokenSortConfigAction = {
131
+ type: `PreferencesController:setTokenSortConfig`;
132
+ handler: PreferencesController['setTokenSortConfig'];
133
+ };
134
+ /**
135
+ * A setter for the user preferences to enable/disable safe chains list validation.
136
+ *
137
+ * @param useSafeChainsListValidation - true to enable safe chains list validation, false to disable it.
138
+ */
139
+ export type PreferencesControllerSetUseSafeChainsListValidationAction = {
140
+ type: `PreferencesController:setUseSafeChainsListValidation`;
141
+ handler: PreferencesController['setUseSafeChainsListValidation'];
142
+ };
143
+ /**
144
+ * A setter for the user preferences to enable/disable privacy mode.
145
+ *
146
+ * @param privacyMode - true to enable privacy mode, false to disable it.
147
+ */
148
+ export type PreferencesControllerSetPrivacyModeAction = {
149
+ type: `PreferencesController:setPrivacyMode`;
150
+ handler: PreferencesController['setPrivacyMode'];
151
+ };
152
+ /**
153
+ * A setter for the user preferences dismiss smart account upgrade prompt.
154
+ *
155
+ * @param dismissSmartAccountSuggestionEnabled - true to dismiss smart account upgrade prompt, false to enable it.
156
+ */
157
+ export type PreferencesControllerSetDismissSmartAccountSuggestionEnabledAction = {
158
+ type: `PreferencesController:setDismissSmartAccountSuggestionEnabled`;
159
+ handler: PreferencesController['setDismissSmartAccountSuggestionEnabled'];
160
+ };
161
+ /**
162
+ * A setter for the user preferences smart account OptIn.
163
+ *
164
+ * @param smartAccountOptIn - true if user opts in for smart account update, false otherwise.
165
+ */
166
+ export type PreferencesControllerSetSmartAccountOptInAction = {
167
+ type: `PreferencesController:setSmartAccountOptIn`;
168
+ handler: PreferencesController['setSmartAccountOptIn'];
169
+ };
170
+ /**
171
+ * Set the token network filter configuration setting.
172
+ *
173
+ * @param tokenNetworkFilter - Object describing token network filter configuration.
174
+ */
175
+ export type PreferencesControllerSetTokenNetworkFilterAction = {
176
+ type: `PreferencesController:setTokenNetworkFilter`;
177
+ handler: PreferencesController['setTokenNetworkFilter'];
178
+ };
179
+ /**
180
+ * Union of all PreferencesController action types.
181
+ */
182
+ export type PreferencesControllerMethodActions = PreferencesControllerSetFeatureFlagAction | PreferencesControllerSetIpfsGatewayAction | PreferencesControllerSetUseTokenDetectionAction | PreferencesControllerSetUseNftDetectionAction | PreferencesControllerSetDisplayNftMediaAction | PreferencesControllerSetSecurityAlertsEnabledAction | PreferencesControllerSetIsMultiAccountBalancesEnabledAction | PreferencesControllerSetShowTestNetworksAction | PreferencesControllerSetIsIpfsGatewayEnabledAction | PreferencesControllerSetEnableNetworkIncomingTransactionsAction | PreferencesControllerSetShowMultiRpcModalAction | PreferencesControllerSetSmartTransactionsOptInStatusAction | PreferencesControllerSetUseTransactionSimulationsAction | PreferencesControllerSetTokenSortConfigAction | PreferencesControllerSetUseSafeChainsListValidationAction | PreferencesControllerSetPrivacyModeAction | PreferencesControllerSetDismissSmartAccountSuggestionEnabledAction | PreferencesControllerSetSmartAccountOptInAction | PreferencesControllerSetTokenNetworkFilterAction;
183
+ //# sourceMappingURL=PreferencesController-method-action-types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreferencesController-method-action-types.d.mts","sourceRoot":"","sources":["../src/PreferencesController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,qBAAqB,E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C,CAAC,CAAC;CAC3E,CAAC;AAEJ;;;;GAIG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,qBAAqB,CAAC,sBAAsB,CAAC,CAAC;CACxD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gDAAgD,GAAG;IAC7D,IAAI,EAAE,6CAA6C,CAAC;IACpD,OAAO,EAAE,qBAAqB,CAAC,uBAAuB,CAAC,CAAC;CACzD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAC1C,yCAAyC,GACzC,yCAAyC,GACzC,+CAA+C,GAC/C,6CAA6C,GAC7C,6CAA6C,GAC7C,mDAAmD,GACnD,2DAA2D,GAC3D,8CAA8C,GAC9C,kDAAkD,GAClD,+DAA+D,GAC/D,+CAA+C,GAC/C,0DAA0D,GAC1D,uDAAuD,GACvD,6CAA6C,GAC7C,yDAAyD,GACzD,yCAAyC,GACzC,kEAAkE,GAClE,+CAA+C,GAC/C,gDAAgD,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
3
+ * Do not edit manually.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=PreferencesController-method-action-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreferencesController-method-action-types.mjs","sourceRoot":"","sources":["../src/PreferencesController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { PreferencesController } from './PreferencesController';\n\n/**\n * Enable or disable a specific feature flag.\n *\n * @param feature - Feature to toggle.\n * @param activated - Value to assign.\n */\nexport type PreferencesControllerSetFeatureFlagAction = {\n type: `PreferencesController:setFeatureFlag`;\n handler: PreferencesController['setFeatureFlag'];\n};\n\n/**\n * Sets new IPFS gateway.\n *\n * @param ipfsGateway - IPFS gateway string.\n */\nexport type PreferencesControllerSetIpfsGatewayAction = {\n type: `PreferencesController:setIpfsGateway`;\n handler: PreferencesController['setIpfsGateway'];\n};\n\n/**\n * Toggle the token detection setting.\n *\n * @param useTokenDetection - Boolean indicating user preference on token detection.\n */\nexport type PreferencesControllerSetUseTokenDetectionAction = {\n type: `PreferencesController:setUseTokenDetection`;\n handler: PreferencesController['setUseTokenDetection'];\n};\n\n/**\n * Toggle the NFT detection setting.\n *\n * @param useNftDetection - Boolean indicating user preference on NFT detection.\n */\nexport type PreferencesControllerSetUseNftDetectionAction = {\n type: `PreferencesController:setUseNftDetection`;\n handler: PreferencesController['setUseNftDetection'];\n};\n\n/**\n * Toggle the display nft media enabled setting.\n *\n * @param displayNftMedia - Boolean indicating user preference on using OpenSea's API.\n */\nexport type PreferencesControllerSetDisplayNftMediaAction = {\n type: `PreferencesController:setDisplayNftMedia`;\n handler: PreferencesController['setDisplayNftMedia'];\n};\n\n/**\n * Toggle the security alert enabled setting.\n *\n * @param securityAlertsEnabled - Boolean indicating user preference on using security alerts.\n */\nexport type PreferencesControllerSetSecurityAlertsEnabledAction = {\n type: `PreferencesController:setSecurityAlertsEnabled`;\n handler: PreferencesController['setSecurityAlertsEnabled'];\n};\n\n/**\n * A setter for the user preferences to enable/disable fetch of multiple accounts balance.\n *\n * @param isMultiAccountBalancesEnabled - true to enable multiple accounts balance fetch, false to fetch only selectedAddress.\n */\nexport type PreferencesControllerSetIsMultiAccountBalancesEnabledAction = {\n type: `PreferencesController:setIsMultiAccountBalancesEnabled`;\n handler: PreferencesController['setIsMultiAccountBalancesEnabled'];\n};\n\n/**\n * A setter for the user have the test networks visible/hidden.\n *\n * @param showTestNetworks - true to show test networks, false to hidden.\n */\nexport type PreferencesControllerSetShowTestNetworksAction = {\n type: `PreferencesController:setShowTestNetworks`;\n handler: PreferencesController['setShowTestNetworks'];\n};\n\n/**\n * A setter for the user allow to be fetched IPFS content\n *\n * @param isIpfsGatewayEnabled - true to enable ipfs source\n */\nexport type PreferencesControllerSetIsIpfsGatewayEnabledAction = {\n type: `PreferencesController:setIsIpfsGatewayEnabled`;\n handler: PreferencesController['setIsIpfsGatewayEnabled'];\n};\n\n/**\n * A setter for the user allow to be fetched IPFS content\n *\n * @param chainId - On hexadecimal format to enable the incoming transaction network\n * @param isIncomingTransactionNetworkEnable - true to enable incoming transactions\n */\nexport type PreferencesControllerSetEnableNetworkIncomingTransactionsAction = {\n type: `PreferencesController:setEnableNetworkIncomingTransactions`;\n handler: PreferencesController['setEnableNetworkIncomingTransactions'];\n};\n\n/**\n * Toggle multi rpc migration modal.\n *\n * @param showMultiRpcModal - Boolean indicating if the multi rpc modal will be displayed or not.\n */\nexport type PreferencesControllerSetShowMultiRpcModalAction = {\n type: `PreferencesController:setShowMultiRpcModal`;\n handler: PreferencesController['setShowMultiRpcModal'];\n};\n\n/**\n * A setter for the user to opt into smart transactions\n *\n * @param smartTransactionsOptInStatus - true to opt into smart transactions\n */\nexport type PreferencesControllerSetSmartTransactionsOptInStatusAction = {\n type: `PreferencesController:setSmartTransactionsOptInStatus`;\n handler: PreferencesController['setSmartTransactionsOptInStatus'];\n};\n\n/**\n * A setter for the user preferences to enable/disable transaction simulations.\n *\n * @param useTransactionSimulations - true to enable transaction simulations, false to disable it.\n */\nexport type PreferencesControllerSetUseTransactionSimulationsAction = {\n type: `PreferencesController:setUseTransactionSimulations`;\n handler: PreferencesController['setUseTransactionSimulations'];\n};\n\n/**\n * A setter to update the user's preferred token sorting order.\n *\n * @param tokenSortConfig - a configuration representing the sort order of tokens.\n */\nexport type PreferencesControllerSetTokenSortConfigAction = {\n type: `PreferencesController:setTokenSortConfig`;\n handler: PreferencesController['setTokenSortConfig'];\n};\n\n/**\n * A setter for the user preferences to enable/disable safe chains list validation.\n *\n * @param useSafeChainsListValidation - true to enable safe chains list validation, false to disable it.\n */\nexport type PreferencesControllerSetUseSafeChainsListValidationAction = {\n type: `PreferencesController:setUseSafeChainsListValidation`;\n handler: PreferencesController['setUseSafeChainsListValidation'];\n};\n\n/**\n * A setter for the user preferences to enable/disable privacy mode.\n *\n * @param privacyMode - true to enable privacy mode, false to disable it.\n */\nexport type PreferencesControllerSetPrivacyModeAction = {\n type: `PreferencesController:setPrivacyMode`;\n handler: PreferencesController['setPrivacyMode'];\n};\n\n/**\n * A setter for the user preferences dismiss smart account upgrade prompt.\n *\n * @param dismissSmartAccountSuggestionEnabled - true to dismiss smart account upgrade prompt, false to enable it.\n */\nexport type PreferencesControllerSetDismissSmartAccountSuggestionEnabledAction =\n {\n type: `PreferencesController:setDismissSmartAccountSuggestionEnabled`;\n handler: PreferencesController['setDismissSmartAccountSuggestionEnabled'];\n };\n\n/**\n * A setter for the user preferences smart account OptIn.\n *\n * @param smartAccountOptIn - true if user opts in for smart account update, false otherwise.\n */\nexport type PreferencesControllerSetSmartAccountOptInAction = {\n type: `PreferencesController:setSmartAccountOptIn`;\n handler: PreferencesController['setSmartAccountOptIn'];\n};\n\n/**\n * Set the token network filter configuration setting.\n *\n * @param tokenNetworkFilter - Object describing token network filter configuration.\n */\nexport type PreferencesControllerSetTokenNetworkFilterAction = {\n type: `PreferencesController:setTokenNetworkFilter`;\n handler: PreferencesController['setTokenNetworkFilter'];\n};\n\n/**\n * Union of all PreferencesController action types.\n */\nexport type PreferencesControllerMethodActions =\n | PreferencesControllerSetFeatureFlagAction\n | PreferencesControllerSetIpfsGatewayAction\n | PreferencesControllerSetUseTokenDetectionAction\n | PreferencesControllerSetUseNftDetectionAction\n | PreferencesControllerSetDisplayNftMediaAction\n | PreferencesControllerSetSecurityAlertsEnabledAction\n | PreferencesControllerSetIsMultiAccountBalancesEnabledAction\n | PreferencesControllerSetShowTestNetworksAction\n | PreferencesControllerSetIsIpfsGatewayEnabledAction\n | PreferencesControllerSetEnableNetworkIncomingTransactionsAction\n | PreferencesControllerSetShowMultiRpcModalAction\n | PreferencesControllerSetSmartTransactionsOptInStatusAction\n | PreferencesControllerSetUseTransactionSimulationsAction\n | PreferencesControllerSetTokenSortConfigAction\n | PreferencesControllerSetUseSafeChainsListValidationAction\n | PreferencesControllerSetPrivacyModeAction\n | PreferencesControllerSetDismissSmartAccountSuggestionEnabledAction\n | PreferencesControllerSetSmartAccountOptInAction\n | PreferencesControllerSetTokenNetworkFilterAction;\n"]}
@@ -120,6 +120,27 @@ const metadata = {
120
120
  },
121
121
  };
122
122
  const name = 'PreferencesController';
123
+ const MESSENGER_EXPOSED_METHODS = [
124
+ 'setFeatureFlag',
125
+ 'setIpfsGateway',
126
+ 'setUseTokenDetection',
127
+ 'setUseNftDetection',
128
+ 'setDisplayNftMedia',
129
+ 'setSecurityAlertsEnabled',
130
+ 'setIsMultiAccountBalancesEnabled',
131
+ 'setShowTestNetworks',
132
+ 'setIsIpfsGatewayEnabled',
133
+ 'setEnableNetworkIncomingTransactions',
134
+ 'setShowMultiRpcModal',
135
+ 'setSmartTransactionsOptInStatus',
136
+ 'setUseTransactionSimulations',
137
+ 'setTokenSortConfig',
138
+ 'setUseSafeChainsListValidation',
139
+ 'setPrivacyMode',
140
+ 'setDismissSmartAccountSuggestionEnabled',
141
+ 'setSmartAccountOptIn',
142
+ 'setTokenNetworkFilter',
143
+ ];
123
144
  /**
124
145
  * Get the default PreferencesController state.
125
146
  *
@@ -198,6 +219,7 @@ class PreferencesController extends base_controller_1.BaseController {
198
219
  ...state,
199
220
  },
200
221
  });
222
+ this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
201
223
  }
202
224
  /**
203
225
  * Enable or disable a specific feature flag.
@@ -1 +1 @@
1
- {"version":3,"file":"PreferencesController.cjs","sourceRoot":"","sources":["../src/PreferencesController.ts"],"names":[],"mappings":";;;AAAA,+DAA2D;AAO3D,+CAA4D;AA0G5D,MAAM,QAAQ,GAAG;IACf,YAAY,EAAE;QACZ,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,IAAI;KACf;IACD,WAAW,EAAE;QACX,kBAAkB,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C;IACL,CAAC;IAED;;;;OAIG;IACH,8BAA8B,CAAC,2BAAoC;QACjE,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,2BAA2B,GAAG,2BAA2B,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,WAAoB;QACjC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,uCAAuC,CACrC,oCAA6C;QAE7C,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,oCAAoC;gBACxC,oCAAoC,CAAC;QACzC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,oBAAoB,CAAC,iBAA0B;QAC7C,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,qBAAqB,CAAC,kBAA2C;QAC/D,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAxQD,sDAwQC;AAED,kBAAe,qBAAqB,CAAC","sourcesContent":["import { BaseController } from '@metamask/base-controller';\nimport type {\n ControllerStateChangeEvent,\n ControllerGetStateAction,\n} from '@metamask/base-controller';\nimport type { Messenger } from '@metamask/messenger';\n\nimport { ETHERSCAN_SUPPORTED_CHAIN_IDS } from './constants';\n\n/**\n * A type union of the name for each chain that is supported by Etherscan or\n * an Etherscan-compatible service.\n */\nexport type EtherscanSupportedChains =\n keyof typeof ETHERSCAN_SUPPORTED_CHAIN_IDS;\n\n/**\n * A type union of the chain ID for each chain that is supported by Etherscan\n * or an Etherscan-compatible service.\n */\nexport type EtherscanSupportedHexChainId =\n (typeof ETHERSCAN_SUPPORTED_CHAIN_IDS)[EtherscanSupportedChains];\n\ntype TokenSortConfig = {\n key: string;\n order: 'asc' | 'dsc';\n sortCallback: string;\n};\n\n/**\n * Preferences controller state\n */\nexport type PreferencesState = {\n /**\n * Map of specific features to enable or disable\n */\n featureFlags: { [feature: string]: boolean };\n /**\n * The configured IPFS gateway\n */\n ipfsGateway: string;\n /**\n * Controls whether IPFS is enabled or not\n */\n isIpfsGatewayEnabled: boolean;\n /**\n * Controls whether multi-account balances are enabled or not\n */\n isMultiAccountBalancesEnabled: boolean;\n /**\n * Controls whether the OpenSea API is used\n */\n displayNftMedia: boolean;\n /**\n * Controls whether \"security alerts\" are enabled\n */\n securityAlertsEnabled: boolean;\n /**\n * Controls whether incoming transactions are enabled, per-chain (for Etherscan-supported chains)\n */\n showIncomingTransactions: {\n [chainId in EtherscanSupportedHexChainId]: boolean;\n };\n /**\n * Controls whether test networks are shown in the wallet\n */\n showTestNetworks: boolean;\n /**\n * Controls whether NFT detection is enabled\n */\n useNftDetection: boolean;\n /**\n * Controls whether token detection is enabled\n */\n useTokenDetection: boolean;\n /**\n * Controls whether smart transactions are opted into\n */\n smartTransactionsOptInStatus: boolean;\n /**\n * Controls whether transaction simulations are enabled\n */\n useTransactionSimulations: boolean;\n /**\n * Controls whether Multi rpc modal is displayed or not\n */\n showMultiRpcModal: boolean;\n /**\n * Controls whether to use the safe chains list validation\n */\n useSafeChainsListValidation: boolean;\n /**\n * Controls which order tokens are sorted in\n */\n tokenSortConfig: TokenSortConfig;\n /**\n * Controls whether balance and assets are hidden or not\n */\n privacyMode: boolean;\n /**\n * Allow user to stop being prompted for smart account upgrade\n */\n dismissSmartAccountSuggestionEnabled: boolean;\n /**\n * User to opt in for smart account upgrade for all user accounts.\n */\n smartAccountOptIn: boolean;\n /**\n * Controls token filtering controls\n */\n tokenNetworkFilter: Record<string, boolean>;\n};\n\nconst metadata = {\n featureFlags: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n ipfsGateway: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n isIpfsGatewayEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n isMultiAccountBalancesEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n displayNftMedia: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n securityAlertsEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n showTestNetworks: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n showIncomingTransactions: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n useNftDetection: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n useTokenDetection: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n smartTransactionsOptInStatus: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n useTransactionSimulations: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n showMultiRpcModal: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n useSafeChainsListValidation: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n tokenSortConfig: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n privacyMode: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n dismissSmartAccountSuggestionEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n smartAccountOptIn: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n tokenNetworkFilter: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n};\n\nconst name = 'PreferencesController';\n\nexport type PreferencesControllerGetStateAction = ControllerGetStateAction<\n typeof name,\n PreferencesState\n>;\n\nexport type PreferencesControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof name,\n PreferencesState\n>;\n\nexport type PreferencesControllerActions = PreferencesControllerGetStateAction;\n\nexport type PreferencesControllerEvents = PreferencesControllerStateChangeEvent;\n\nexport type PreferencesControllerMessenger = Messenger<\n typeof name,\n PreferencesControllerActions,\n PreferencesControllerEvents\n>;\n\n/**\n * Get the default PreferencesController state.\n *\n * @returns The default PreferencesController state.\n */\nexport function getDefaultPreferencesState(): PreferencesState {\n return {\n featureFlags: {},\n ipfsGateway: 'https://ipfs.io/ipfs/',\n isIpfsGatewayEnabled: true,\n isMultiAccountBalancesEnabled: true,\n displayNftMedia: false,\n securityAlertsEnabled: false,\n showIncomingTransactions: {\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MAINNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.GOERLI]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.BSC]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.BSC_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.OPTIMISM]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.OPTIMISM_SEPOLIA]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.POLYGON]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.POLYGON_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.AVALANCHE]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.AVALANCHE_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.FANTOM]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.FANTOM_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.SEPOLIA]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.LINEA_GOERLI]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.LINEA_SEPOLIA]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.LINEA_MAINNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MOONBEAM]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MOONBEAM_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MOONRIVER]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.GNOSIS]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.SEI]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MONAD]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.HYPEREVM]: true,\n },\n showTestNetworks: false,\n useNftDetection: false,\n useTokenDetection: true,\n showMultiRpcModal: false,\n smartTransactionsOptInStatus: true,\n useTransactionSimulations: true,\n useSafeChainsListValidation: true,\n tokenSortConfig: {\n key: 'tokenFiatAmount',\n order: 'dsc',\n sortCallback: 'stringNumeric',\n },\n privacyMode: false,\n dismissSmartAccountSuggestionEnabled: false,\n smartAccountOptIn: true,\n tokenNetworkFilter: {},\n };\n}\n\n/**\n * Controller that stores shared settings and exposes convenience methods\n */\nexport class PreferencesController extends BaseController<\n typeof name,\n PreferencesState,\n PreferencesControllerMessenger\n> {\n /**\n * Creates a PreferencesController instance.\n *\n * @param args - Arguments\n * @param args.messenger - The preferences controller messenger.\n * @param args.state - Preferences controller state.\n */\n constructor({\n messenger,\n state,\n }: {\n messenger: PreferencesControllerMessenger;\n state?: Partial<PreferencesState>;\n }) {\n super({\n name,\n metadata,\n messenger,\n state: {\n ...getDefaultPreferencesState(),\n ...state,\n },\n });\n }\n\n /**\n * Enable or disable a specific feature flag.\n *\n * @param feature - Feature to toggle.\n * @param activated - Value to assign.\n */\n setFeatureFlag(feature: string, activated: boolean): void {\n this.update((state) => {\n state.featureFlags[feature] = activated;\n });\n }\n\n /**\n * Sets new IPFS gateway.\n *\n * @param ipfsGateway - IPFS gateway string.\n */\n setIpfsGateway(ipfsGateway: string): void {\n this.update((state) => {\n state.ipfsGateway = ipfsGateway;\n });\n }\n\n /**\n * Toggle the token detection setting.\n *\n * @param useTokenDetection - Boolean indicating user preference on token detection.\n */\n setUseTokenDetection(useTokenDetection: boolean): void {\n this.update((state) => {\n state.useTokenDetection = useTokenDetection;\n });\n }\n\n /**\n * Toggle the NFT detection setting.\n *\n * @param useNftDetection - Boolean indicating user preference on NFT detection.\n */\n setUseNftDetection(useNftDetection: boolean): void {\n if (useNftDetection && !this.state.displayNftMedia) {\n throw new Error(\n 'useNftDetection cannot be enabled if displayNftMedia is false',\n );\n }\n this.update((state) => {\n state.useNftDetection = useNftDetection;\n });\n }\n\n /**\n * Toggle the display nft media enabled setting.\n *\n * @param displayNftMedia - Boolean indicating user preference on using OpenSea's API.\n */\n setDisplayNftMedia(displayNftMedia: boolean): void {\n this.update((state) => {\n state.displayNftMedia = displayNftMedia;\n if (!displayNftMedia) {\n state.useNftDetection = false;\n }\n });\n }\n\n /**\n * Toggle the security alert enabled setting.\n *\n * @param securityAlertsEnabled - Boolean indicating user preference on using security alerts.\n */\n setSecurityAlertsEnabled(securityAlertsEnabled: boolean): void {\n this.update((state) => {\n state.securityAlertsEnabled = securityAlertsEnabled;\n });\n }\n\n /**\n * A setter for the user preferences to enable/disable fetch of multiple accounts balance.\n *\n * @param isMultiAccountBalancesEnabled - true to enable multiple accounts balance fetch, false to fetch only selectedAddress.\n */\n setIsMultiAccountBalancesEnabled(\n isMultiAccountBalancesEnabled: boolean,\n ): void {\n this.update((state) => {\n state.isMultiAccountBalancesEnabled = isMultiAccountBalancesEnabled;\n });\n }\n\n /**\n * A setter for the user have the test networks visible/hidden.\n *\n * @param showTestNetworks - true to show test networks, false to hidden.\n */\n setShowTestNetworks(showTestNetworks: boolean): void {\n this.update((state) => {\n state.showTestNetworks = showTestNetworks;\n });\n }\n\n /**\n * A setter for the user allow to be fetched IPFS content\n *\n * @param isIpfsGatewayEnabled - true to enable ipfs source\n */\n setIsIpfsGatewayEnabled(isIpfsGatewayEnabled: boolean): void {\n this.update((state) => {\n state.isIpfsGatewayEnabled = isIpfsGatewayEnabled;\n });\n }\n\n /**\n * A setter for the user allow to be fetched IPFS content\n *\n * @param chainId - On hexadecimal format to enable the incoming transaction network\n * @param isIncomingTransactionNetworkEnable - true to enable incoming transactions\n */\n setEnableNetworkIncomingTransactions(\n chainId: EtherscanSupportedHexChainId,\n isIncomingTransactionNetworkEnable: boolean,\n ): void {\n if (Object.values(ETHERSCAN_SUPPORTED_CHAIN_IDS).includes(chainId)) {\n this.update((state) => {\n state.showIncomingTransactions = {\n ...this.state.showIncomingTransactions,\n [chainId]: isIncomingTransactionNetworkEnable,\n };\n });\n }\n }\n\n /**\n * Toggle multi rpc migration modal.\n *\n * @param showMultiRpcModal - Boolean indicating if the multi rpc modal will be displayed or not.\n */\n setShowMultiRpcModal(showMultiRpcModal: boolean): void {\n this.update((state) => {\n state.showMultiRpcModal = showMultiRpcModal;\n if (!showMultiRpcModal) {\n state.showMultiRpcModal = false;\n }\n });\n }\n\n /**\n * A setter for the user to opt into smart transactions\n *\n * @param smartTransactionsOptInStatus - true to opt into smart transactions\n */\n setSmartTransactionsOptInStatus(smartTransactionsOptInStatus: boolean): void {\n this.update((state) => {\n state.smartTransactionsOptInStatus = smartTransactionsOptInStatus;\n });\n }\n\n /**\n * A setter for the user preferences to enable/disable transaction simulations.\n *\n * @param useTransactionSimulations - true to enable transaction simulations, false to disable it.\n */\n setUseTransactionSimulations(useTransactionSimulations: boolean): void {\n this.update((state) => {\n state.useTransactionSimulations = useTransactionSimulations;\n });\n }\n\n /**\n * A setter to update the user's preferred token sorting order.\n *\n * @param tokenSortConfig - a configuration representing the sort order of tokens.\n */\n setTokenSortConfig(tokenSortConfig: TokenSortConfig): void {\n this.update((state) => {\n state.tokenSortConfig = tokenSortConfig;\n });\n }\n\n /**\n * A setter for the user preferences to enable/disable safe chains list validation.\n *\n * @param useSafeChainsListValidation - true to enable safe chains list validation, false to disable it.\n */\n setUseSafeChainsListValidation(useSafeChainsListValidation: boolean): void {\n this.update((state) => {\n state.useSafeChainsListValidation = useSafeChainsListValidation;\n });\n }\n\n /**\n * A setter for the user preferences to enable/disable privacy mode.\n *\n * @param privacyMode - true to enable privacy mode, false to disable it.\n */\n setPrivacyMode(privacyMode: boolean): void {\n this.update((state) => {\n state.privacyMode = privacyMode;\n });\n }\n\n /**\n * A setter for the user preferences dismiss smart account upgrade prompt.\n *\n * @param dismissSmartAccountSuggestionEnabled - true to dismiss smart account upgrade prompt, false to enable it.\n */\n setDismissSmartAccountSuggestionEnabled(\n dismissSmartAccountSuggestionEnabled: boolean,\n ): void {\n this.update((state) => {\n state.dismissSmartAccountSuggestionEnabled =\n dismissSmartAccountSuggestionEnabled;\n });\n }\n\n /**\n * A setter for the user preferences smart account OptIn.\n *\n * @param smartAccountOptIn - true if user opts in for smart account update, false otherwise.\n */\n setSmartAccountOptIn(smartAccountOptIn: boolean): void {\n this.update((state) => {\n state.smartAccountOptIn = smartAccountOptIn;\n });\n }\n\n /**\n * Set the token network filter configuration setting.\n *\n * @param tokenNetworkFilter - Object describing token network filter configuration.\n */\n setTokenNetworkFilter(tokenNetworkFilter: Record<string, boolean>): void {\n this.update((state) => {\n state.tokenNetworkFilter = tokenNetworkFilter;\n });\n }\n}\n\nexport default PreferencesController;\n"]}
1
+ {"version":3,"file":"PreferencesController.cjs","sourceRoot":"","sources":["../src/PreferencesController.ts"],"names":[],"mappings":";;;AAAA,+DAA2D;AAO3D,+CAA4D;AA2G5D,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AAG,iBAAiB,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,qBAAqB,CAAC,kBAA2C;QAC/D,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA7QD,sDA6QC;AAED,kBAAe,qBAAqB,CAAC","sourcesContent":["import { BaseController } from '@metamask/base-controller';\nimport type {\n ControllerStateChangeEvent,\n ControllerGetStateAction,\n} from '@metamask/base-controller';\nimport type { Messenger } from '@metamask/messenger';\n\nimport { ETHERSCAN_SUPPORTED_CHAIN_IDS } from './constants';\nimport type { PreferencesControllerMethodActions } from './PreferencesController-method-action-types';\n\n/**\n * A type union of the name for each chain that is supported by Etherscan or\n * an Etherscan-compatible service.\n */\nexport type EtherscanSupportedChains =\n keyof typeof ETHERSCAN_SUPPORTED_CHAIN_IDS;\n\n/**\n * A type union of the chain ID for each chain that is supported by Etherscan\n * or an Etherscan-compatible service.\n */\nexport type EtherscanSupportedHexChainId =\n (typeof ETHERSCAN_SUPPORTED_CHAIN_IDS)[EtherscanSupportedChains];\n\ntype TokenSortConfig = {\n key: string;\n order: 'asc' | 'dsc';\n sortCallback: string;\n};\n\n/**\n * Preferences controller state\n */\nexport type PreferencesState = {\n /**\n * Map of specific features to enable or disable\n */\n featureFlags: { [feature: string]: boolean };\n /**\n * The configured IPFS gateway\n */\n ipfsGateway: string;\n /**\n * Controls whether IPFS is enabled or not\n */\n isIpfsGatewayEnabled: boolean;\n /**\n * Controls whether multi-account balances are enabled or not\n */\n isMultiAccountBalancesEnabled: boolean;\n /**\n * Controls whether the OpenSea API is used\n */\n displayNftMedia: boolean;\n /**\n * Controls whether \"security alerts\" are enabled\n */\n securityAlertsEnabled: boolean;\n /**\n * Controls whether incoming transactions are enabled, per-chain (for Etherscan-supported chains)\n */\n showIncomingTransactions: {\n [chainId in EtherscanSupportedHexChainId]: boolean;\n };\n /**\n * Controls whether test networks are shown in the wallet\n */\n showTestNetworks: boolean;\n /**\n * Controls whether NFT detection is enabled\n */\n useNftDetection: boolean;\n /**\n * Controls whether token detection is enabled\n */\n useTokenDetection: boolean;\n /**\n * Controls whether smart transactions are opted into\n */\n smartTransactionsOptInStatus: boolean;\n /**\n * Controls whether transaction simulations are enabled\n */\n useTransactionSimulations: boolean;\n /**\n * Controls whether Multi rpc modal is displayed or not\n */\n showMultiRpcModal: boolean;\n /**\n * Controls whether to use the safe chains list validation\n */\n useSafeChainsListValidation: boolean;\n /**\n * Controls which order tokens are sorted in\n */\n tokenSortConfig: TokenSortConfig;\n /**\n * Controls whether balance and assets are hidden or not\n */\n privacyMode: boolean;\n /**\n * Allow user to stop being prompted for smart account upgrade\n */\n dismissSmartAccountSuggestionEnabled: boolean;\n /**\n * User to opt in for smart account upgrade for all user accounts.\n */\n smartAccountOptIn: boolean;\n /**\n * Controls token filtering controls\n */\n tokenNetworkFilter: Record<string, boolean>;\n};\n\nconst metadata = {\n featureFlags: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n ipfsGateway: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n isIpfsGatewayEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n isMultiAccountBalancesEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n displayNftMedia: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n securityAlertsEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n showTestNetworks: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n showIncomingTransactions: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n useNftDetection: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n useTokenDetection: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n smartTransactionsOptInStatus: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n useTransactionSimulations: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n showMultiRpcModal: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n useSafeChainsListValidation: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n tokenSortConfig: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n privacyMode: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n dismissSmartAccountSuggestionEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n smartAccountOptIn: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n tokenNetworkFilter: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n};\n\nconst name = 'PreferencesController';\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'setFeatureFlag',\n 'setIpfsGateway',\n 'setUseTokenDetection',\n 'setUseNftDetection',\n 'setDisplayNftMedia',\n 'setSecurityAlertsEnabled',\n 'setIsMultiAccountBalancesEnabled',\n 'setShowTestNetworks',\n 'setIsIpfsGatewayEnabled',\n 'setEnableNetworkIncomingTransactions',\n 'setShowMultiRpcModal',\n 'setSmartTransactionsOptInStatus',\n 'setUseTransactionSimulations',\n 'setTokenSortConfig',\n 'setUseSafeChainsListValidation',\n 'setPrivacyMode',\n 'setDismissSmartAccountSuggestionEnabled',\n 'setSmartAccountOptIn',\n 'setTokenNetworkFilter',\n] as const;\n\nexport type PreferencesControllerGetStateAction = ControllerGetStateAction<\n typeof name,\n PreferencesState\n>;\n\nexport type PreferencesControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof name,\n PreferencesState\n>;\n\nexport type PreferencesControllerActions =\n | PreferencesControllerGetStateAction\n | PreferencesControllerMethodActions;\n\nexport type PreferencesControllerEvents = PreferencesControllerStateChangeEvent;\n\nexport type PreferencesControllerMessenger = Messenger<\n typeof name,\n PreferencesControllerActions,\n PreferencesControllerEvents\n>;\n\n/**\n * Get the default PreferencesController state.\n *\n * @returns The default PreferencesController state.\n */\nexport function getDefaultPreferencesState(): PreferencesState {\n return {\n featureFlags: {},\n ipfsGateway: 'https://ipfs.io/ipfs/',\n isIpfsGatewayEnabled: true,\n isMultiAccountBalancesEnabled: true,\n displayNftMedia: false,\n securityAlertsEnabled: false,\n showIncomingTransactions: {\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MAINNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.GOERLI]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.BSC]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.BSC_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.OPTIMISM]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.OPTIMISM_SEPOLIA]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.POLYGON]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.POLYGON_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.AVALANCHE]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.AVALANCHE_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.FANTOM]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.FANTOM_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.SEPOLIA]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.LINEA_GOERLI]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.LINEA_SEPOLIA]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.LINEA_MAINNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MOONBEAM]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MOONBEAM_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MOONRIVER]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.GNOSIS]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.SEI]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MONAD]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.HYPEREVM]: true,\n },\n showTestNetworks: false,\n useNftDetection: false,\n useTokenDetection: true,\n showMultiRpcModal: false,\n smartTransactionsOptInStatus: true,\n useTransactionSimulations: true,\n useSafeChainsListValidation: true,\n tokenSortConfig: {\n key: 'tokenFiatAmount',\n order: 'dsc',\n sortCallback: 'stringNumeric',\n },\n privacyMode: false,\n dismissSmartAccountSuggestionEnabled: false,\n smartAccountOptIn: true,\n tokenNetworkFilter: {},\n };\n}\n\n/**\n * Controller that stores shared settings and exposes convenience methods\n */\nexport class PreferencesController extends BaseController<\n typeof name,\n PreferencesState,\n PreferencesControllerMessenger\n> {\n /**\n * Creates a PreferencesController instance.\n *\n * @param args - Arguments\n * @param args.messenger - The preferences controller messenger.\n * @param args.state - Preferences controller state.\n */\n constructor({\n messenger,\n state,\n }: {\n messenger: PreferencesControllerMessenger;\n state?: Partial<PreferencesState>;\n }) {\n super({\n name,\n metadata,\n messenger,\n state: {\n ...getDefaultPreferencesState(),\n ...state,\n },\n });\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Enable or disable a specific feature flag.\n *\n * @param feature - Feature to toggle.\n * @param activated - Value to assign.\n */\n setFeatureFlag(feature: string, activated: boolean): void {\n this.update((state) => {\n state.featureFlags[feature] = activated;\n });\n }\n\n /**\n * Sets new IPFS gateway.\n *\n * @param ipfsGateway - IPFS gateway string.\n */\n setIpfsGateway(ipfsGateway: string): void {\n this.update((state) => {\n state.ipfsGateway = ipfsGateway;\n });\n }\n\n /**\n * Toggle the token detection setting.\n *\n * @param useTokenDetection - Boolean indicating user preference on token detection.\n */\n setUseTokenDetection(useTokenDetection: boolean): void {\n this.update((state) => {\n state.useTokenDetection = useTokenDetection;\n });\n }\n\n /**\n * Toggle the NFT detection setting.\n *\n * @param useNftDetection - Boolean indicating user preference on NFT detection.\n */\n setUseNftDetection(useNftDetection: boolean): void {\n if (useNftDetection && !this.state.displayNftMedia) {\n throw new Error(\n 'useNftDetection cannot be enabled if displayNftMedia is false',\n );\n }\n this.update((state) => {\n state.useNftDetection = useNftDetection;\n });\n }\n\n /**\n * Toggle the display nft media enabled setting.\n *\n * @param displayNftMedia - Boolean indicating user preference on using OpenSea's API.\n */\n setDisplayNftMedia(displayNftMedia: boolean): void {\n this.update((state) => {\n state.displayNftMedia = displayNftMedia;\n if (!displayNftMedia) {\n state.useNftDetection = false;\n }\n });\n }\n\n /**\n * Toggle the security alert enabled setting.\n *\n * @param securityAlertsEnabled - Boolean indicating user preference on using security alerts.\n */\n setSecurityAlertsEnabled(securityAlertsEnabled: boolean): void {\n this.update((state) => {\n state.securityAlertsEnabled = securityAlertsEnabled;\n });\n }\n\n /**\n * A setter for the user preferences to enable/disable fetch of multiple accounts balance.\n *\n * @param isMultiAccountBalancesEnabled - true to enable multiple accounts balance fetch, false to fetch only selectedAddress.\n */\n setIsMultiAccountBalancesEnabled(\n isMultiAccountBalancesEnabled: boolean,\n ): void {\n this.update((state) => {\n state.isMultiAccountBalancesEnabled = isMultiAccountBalancesEnabled;\n });\n }\n\n /**\n * A setter for the user have the test networks visible/hidden.\n *\n * @param showTestNetworks - true to show test networks, false to hidden.\n */\n setShowTestNetworks(showTestNetworks: boolean): void {\n this.update((state) => {\n state.showTestNetworks = showTestNetworks;\n });\n }\n\n /**\n * A setter for the user allow to be fetched IPFS content\n *\n * @param isIpfsGatewayEnabled - true to enable ipfs source\n */\n setIsIpfsGatewayEnabled(isIpfsGatewayEnabled: boolean): void {\n this.update((state) => {\n state.isIpfsGatewayEnabled = isIpfsGatewayEnabled;\n });\n }\n\n /**\n * A setter for the user allow to be fetched IPFS content\n *\n * @param chainId - On hexadecimal format to enable the incoming transaction network\n * @param isIncomingTransactionNetworkEnable - true to enable incoming transactions\n */\n setEnableNetworkIncomingTransactions(\n chainId: EtherscanSupportedHexChainId,\n isIncomingTransactionNetworkEnable: boolean,\n ): void {\n if (Object.values(ETHERSCAN_SUPPORTED_CHAIN_IDS).includes(chainId)) {\n this.update((state) => {\n state.showIncomingTransactions = {\n ...this.state.showIncomingTransactions,\n [chainId]: isIncomingTransactionNetworkEnable,\n };\n });\n }\n }\n\n /**\n * Toggle multi rpc migration modal.\n *\n * @param showMultiRpcModal - Boolean indicating if the multi rpc modal will be displayed or not.\n */\n setShowMultiRpcModal(showMultiRpcModal: boolean): void {\n this.update((state) => {\n state.showMultiRpcModal = showMultiRpcModal;\n if (!showMultiRpcModal) {\n state.showMultiRpcModal = false;\n }\n });\n }\n\n /**\n * A setter for the user to opt into smart transactions\n *\n * @param smartTransactionsOptInStatus - true to opt into smart transactions\n */\n setSmartTransactionsOptInStatus(smartTransactionsOptInStatus: boolean): void {\n this.update((state) => {\n state.smartTransactionsOptInStatus = smartTransactionsOptInStatus;\n });\n }\n\n /**\n * A setter for the user preferences to enable/disable transaction simulations.\n *\n * @param useTransactionSimulations - true to enable transaction simulations, false to disable it.\n */\n setUseTransactionSimulations(useTransactionSimulations: boolean): void {\n this.update((state) => {\n state.useTransactionSimulations = useTransactionSimulations;\n });\n }\n\n /**\n * A setter to update the user's preferred token sorting order.\n *\n * @param tokenSortConfig - a configuration representing the sort order of tokens.\n */\n setTokenSortConfig(tokenSortConfig: TokenSortConfig): void {\n this.update((state) => {\n state.tokenSortConfig = tokenSortConfig;\n });\n }\n\n /**\n * A setter for the user preferences to enable/disable safe chains list validation.\n *\n * @param useSafeChainsListValidation - true to enable safe chains list validation, false to disable it.\n */\n setUseSafeChainsListValidation(useSafeChainsListValidation: boolean): void {\n this.update((state) => {\n state.useSafeChainsListValidation = useSafeChainsListValidation;\n });\n }\n\n /**\n * A setter for the user preferences to enable/disable privacy mode.\n *\n * @param privacyMode - true to enable privacy mode, false to disable it.\n */\n setPrivacyMode(privacyMode: boolean): void {\n this.update((state) => {\n state.privacyMode = privacyMode;\n });\n }\n\n /**\n * A setter for the user preferences dismiss smart account upgrade prompt.\n *\n * @param dismissSmartAccountSuggestionEnabled - true to dismiss smart account upgrade prompt, false to enable it.\n */\n setDismissSmartAccountSuggestionEnabled(\n dismissSmartAccountSuggestionEnabled: boolean,\n ): void {\n this.update((state) => {\n state.dismissSmartAccountSuggestionEnabled =\n dismissSmartAccountSuggestionEnabled;\n });\n }\n\n /**\n * A setter for the user preferences smart account OptIn.\n *\n * @param smartAccountOptIn - true if user opts in for smart account update, false otherwise.\n */\n setSmartAccountOptIn(smartAccountOptIn: boolean): void {\n this.update((state) => {\n state.smartAccountOptIn = smartAccountOptIn;\n });\n }\n\n /**\n * Set the token network filter configuration setting.\n *\n * @param tokenNetworkFilter - Object describing token network filter configuration.\n */\n setTokenNetworkFilter(tokenNetworkFilter: Record<string, boolean>): void {\n this.update((state) => {\n state.tokenNetworkFilter = tokenNetworkFilter;\n });\n }\n}\n\nexport default PreferencesController;\n"]}
@@ -2,6 +2,7 @@ import { BaseController } from "@metamask/base-controller";
2
2
  import type { ControllerStateChangeEvent, ControllerGetStateAction } from "@metamask/base-controller";
3
3
  import type { Messenger } from "@metamask/messenger";
4
4
  import { ETHERSCAN_SUPPORTED_CHAIN_IDS } from "./constants.cjs";
5
+ import type { PreferencesControllerMethodActions } from "./PreferencesController-method-action-types.cjs";
5
6
  /**
6
7
  * A type union of the name for each chain that is supported by Etherscan or
7
8
  * an Etherscan-compatible service.
@@ -105,7 +106,7 @@ export type PreferencesState = {
105
106
  declare const name = "PreferencesController";
106
107
  export type PreferencesControllerGetStateAction = ControllerGetStateAction<typeof name, PreferencesState>;
107
108
  export type PreferencesControllerStateChangeEvent = ControllerStateChangeEvent<typeof name, PreferencesState>;
108
- export type PreferencesControllerActions = PreferencesControllerGetStateAction;
109
+ export type PreferencesControllerActions = PreferencesControllerGetStateAction | PreferencesControllerMethodActions;
109
110
  export type PreferencesControllerEvents = PreferencesControllerStateChangeEvent;
110
111
  export type PreferencesControllerMessenger = Messenger<typeof name, PreferencesControllerActions, PreferencesControllerEvents>;
111
112
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"PreferencesController.d.cts","sourceRoot":"","sources":["../src/PreferencesController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EACV,0BAA0B,EAC1B,wBAAwB,EACzB,kCAAkC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AAErD,OAAO,EAAE,6BAA6B,EAAE,wBAAoB;AAE5D;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAClC,MAAM,OAAO,6BAA6B,CAAC;AAE7C;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GACtC,CAAC,OAAO,6BAA6B,CAAC,CAAC,wBAAwB,CAAC,CAAC;AAEnE,KAAK,eAAe,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,YAAY,EAAE;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC7C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IAC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AM5E;;;;OAIG;IACH,4BAA4B,CAAC,yBAAyB,EAAE,OAAO,GAAG,IAAI;IAMtE;;;;OAIG;IACH,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI;IAM1D;;;;OAIG;IACH,8BAA8B,CAAC,2BAA2B,EAAE,OAAO,GAAG,IAAI;IAM1E;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI;IAM1C;;;;OAIG;IACH,uCAAuC,CACrC,oCAAoC,EAAE,OAAO,GAC5C,IAAI;IAOP;;;;OAIG;IACH,oBAAoB,CAAC,iBAAiB,EAAE,OAAO,GAAG,IAAI;IAMtD;;;;OAIG;IACH,qBAAqB,CAAC,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAKzE;AAED,eAAe,qBAAqB,CAAC"}
@@ -2,6 +2,7 @@ import { BaseController } from "@metamask/base-controller";
2
2
  import type { ControllerStateChangeEvent, ControllerGetStateAction } from "@metamask/base-controller";
3
3
  import type { Messenger } from "@metamask/messenger";
4
4
  import { ETHERSCAN_SUPPORTED_CHAIN_IDS } from "./constants.mjs";
5
+ import type { PreferencesControllerMethodActions } from "./PreferencesController-method-action-types.mjs";
5
6
  /**
6
7
  * A type union of the name for each chain that is supported by Etherscan or
7
8
  * an Etherscan-compatible service.
@@ -105,7 +106,7 @@ export type PreferencesState = {
105
106
  declare const name = "PreferencesController";
106
107
  export type PreferencesControllerGetStateAction = ControllerGetStateAction<typeof name, PreferencesState>;
107
108
  export type PreferencesControllerStateChangeEvent = ControllerStateChangeEvent<typeof name, PreferencesState>;
108
- export type PreferencesControllerActions = PreferencesControllerGetStateAction;
109
+ export type PreferencesControllerActions = PreferencesControllerGetStateAction | PreferencesControllerMethodActions;
109
110
  export type PreferencesControllerEvents = PreferencesControllerStateChangeEvent;
110
111
  export type PreferencesControllerMessenger = Messenger<typeof name, PreferencesControllerActions, PreferencesControllerEvents>;
111
112
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"PreferencesController.d.mts","sourceRoot":"","sources":["../src/PreferencesController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EACV,0BAA0B,EAC1B,wBAAwB,EACzB,kCAAkC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AAErD,OAAO,EAAE,6BAA6B,EAAE,wBAAoB;AAE5D;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAClC,MAAM,OAAO,6BAA6B,CAAC;AAE7C;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GACtC,CAAC,OAAO,6BAA6B,CAAC,CAAC,wBAAwB,CAAC,CAAC;AAEnE,KAAK,eAAe,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,YAAY,EAAE;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC7C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,oBAAoB,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,6BAA6B,EAAE,OAAO,CAAC;IACvC;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,qBAAqB,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,wBAAwB,EAAE;SACvB,OAAO,IAAI,4BAA4B,GAAG,OAAO;KACnD,CAAC;IACF;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,4BAA4B,EAAE,OAAO,CAAC;IACtC;;OAEG;IACH,yBAAyB,EAAE,O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,CAAC"}
1
+ {"version":3,"file":"PreferencesController.d.mts","sourceRoot":"","sources":["../src/PreferencesController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EACV,0BAA0B,EAC1B,wBAAwB,EACzB,kCAAkC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AAErD,OAAO,EAAE,6BAA6B,EAAE,wBAAoB;AAC5D,OAAO,KAAK,EAAE,kCAAkC,EAAE,wDAAoD;AAEtG;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAClC,MAAM,OAAO,6BAA6B,CAAC;AAE7C;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GACtC,CAAC,OAAO,6BAA6B,CAAC,CAAC,wBAAwB,CAAC,CAAC;AAEnE,KAAK,eAAe,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,YAAY,EAAE;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC7C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,oBAAoB,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,6BAA6B,EAAE,OAAO,CAAC;IACvC;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,qBAAqB,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,wBAAwB,EAAE;SACvB,OAAO,IAAI,4BAA4B,GAAG,OAAO;KACnD,CAAC;IACF;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,4BAA4B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AM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAKzE;AAED,eAAe,qBAAqB,CAAC"}
@@ -117,6 +117,27 @@ const metadata = {
117
117
  },
118
118
  };
119
119
  const name = 'PreferencesController';
120
+ const MESSENGER_EXPOSED_METHODS = [
121
+ 'setFeatureFlag',
122
+ 'setIpfsGateway',
123
+ 'setUseTokenDetection',
124
+ 'setUseNftDetection',
125
+ 'setDisplayNftMedia',
126
+ 'setSecurityAlertsEnabled',
127
+ 'setIsMultiAccountBalancesEnabled',
128
+ 'setShowTestNetworks',
129
+ 'setIsIpfsGatewayEnabled',
130
+ 'setEnableNetworkIncomingTransactions',
131
+ 'setShowMultiRpcModal',
132
+ 'setSmartTransactionsOptInStatus',
133
+ 'setUseTransactionSimulations',
134
+ 'setTokenSortConfig',
135
+ 'setUseSafeChainsListValidation',
136
+ 'setPrivacyMode',
137
+ 'setDismissSmartAccountSuggestionEnabled',
138
+ 'setSmartAccountOptIn',
139
+ 'setTokenNetworkFilter',
140
+ ];
120
141
  /**
121
142
  * Get the default PreferencesController state.
122
143
  *
@@ -194,6 +215,7 @@ export class PreferencesController extends BaseController {
194
215
  ...state,
195
216
  },
196
217
  });
218
+ this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
197
219
  }
198
220
  /**
199
221
  * Enable or disable a specific feature flag.
@@ -1 +1 @@
1
- {"version":3,"file":"PreferencesController.mjs","sourceRoot":"","sources":["../src/PreferencesController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAO3D,OAAO,EAAE,6BAA6B,EAAE,wBAAoB;AA0G5D,MAAM,QAAQ,GAAG;IACf,YAAY,EAAE;QACZ,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,IAAI;KACf;IACD,WAAW,EAAE;QACX,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,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2BAAoC;QACjE,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,2BAA2B,GAAG,2BAA2B,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,WAAoB;QACjC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,uCAAuC,CACrC,oCAA6C;QAE7C,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,oCAAoC;gBACxC,oCAAoC,CAAC;QACzC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,oBAAoB,CAAC,iBAA0B;QAC7C,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,qBAAqB,CAAC,kBAA2C;QAC/D,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,eAAe,qBAAqB,CAAC","sourcesContent":["import { BaseController } from '@metamask/base-controller';\nimport type {\n ControllerStateChangeEvent,\n ControllerGetStateAction,\n} from '@metamask/base-controller';\nimport type { Messenger } from '@metamask/messenger';\n\nimport { ETHERSCAN_SUPPORTED_CHAIN_IDS } from './constants';\n\n/**\n * A type union of the name for each chain that is supported by Etherscan or\n * an Etherscan-compatible service.\n */\nexport type EtherscanSupportedChains =\n keyof typeof ETHERSCAN_SUPPORTED_CHAIN_IDS;\n\n/**\n * A type union of the chain ID for each chain that is supported by Etherscan\n * or an Etherscan-compatible service.\n */\nexport type EtherscanSupportedHexChainId =\n (typeof ETHERSCAN_SUPPORTED_CHAIN_IDS)[EtherscanSupportedChains];\n\ntype TokenSortConfig = {\n key: string;\n order: 'asc' | 'dsc';\n sortCallback: string;\n};\n\n/**\n * Preferences controller state\n */\nexport type PreferencesState = {\n /**\n * Map of specific features to enable or disable\n */\n featureFlags: { [feature: string]: boolean };\n /**\n * The configured IPFS gateway\n */\n ipfsGateway: string;\n /**\n * Controls whether IPFS is enabled or not\n */\n isIpfsGatewayEnabled: boolean;\n /**\n * Controls whether multi-account balances are enabled or not\n */\n isMultiAccountBalancesEnabled: boolean;\n /**\n * Controls whether the OpenSea API is used\n */\n displayNftMedia: boolean;\n /**\n * Controls whether \"security alerts\" are enabled\n */\n securityAlertsEnabled: boolean;\n /**\n * Controls whether incoming transactions are enabled, per-chain (for Etherscan-supported chains)\n */\n showIncomingTransactions: {\n [chainId in EtherscanSupportedHexChainId]: boolean;\n };\n /**\n * Controls whether test networks are shown in the wallet\n */\n showTestNetworks: boolean;\n /**\n * Controls whether NFT detection is enabled\n */\n useNftDetection: boolean;\n /**\n * Controls whether token detection is enabled\n */\n useTokenDetection: boolean;\n /**\n * Controls whether smart transactions are opted into\n */\n smartTransactionsOptInStatus: boolean;\n /**\n * Controls whether transaction simulations are enabled\n */\n useTransactionSimulations: boolean;\n /**\n * Controls whether Multi rpc modal is displayed or not\n */\n showMultiRpcModal: boolean;\n /**\n * Controls whether to use the safe chains list validation\n */\n useSafeChainsListValidation: boolean;\n /**\n * Controls which order tokens are sorted in\n */\n tokenSortConfig: TokenSortConfig;\n /**\n * Controls whether balance and assets are hidden or not\n */\n privacyMode: boolean;\n /**\n * Allow user to stop being prompted for smart account upgrade\n */\n dismissSmartAccountSuggestionEnabled: boolean;\n /**\n * User to opt in for smart account upgrade for all user accounts.\n */\n smartAccountOptIn: boolean;\n /**\n * Controls token filtering controls\n */\n tokenNetworkFilter: Record<string, boolean>;\n};\n\nconst metadata = {\n featureFlags: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n ipfsGateway: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n isIpfsGatewayEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n isMultiAccountBalancesEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n displayNftMedia: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n securityAlertsEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n showTestNetworks: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n showIncomingTransactions: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n useNftDetection: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n useTokenDetection: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n smartTransactionsOptInStatus: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n useTransactionSimulations: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n showMultiRpcModal: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n useSafeChainsListValidation: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n tokenSortConfig: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n privacyMode: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n dismissSmartAccountSuggestionEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n smartAccountOptIn: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n tokenNetworkFilter: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n};\n\nconst name = 'PreferencesController';\n\nexport type PreferencesControllerGetStateAction = ControllerGetStateAction<\n typeof name,\n PreferencesState\n>;\n\nexport type PreferencesControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof name,\n PreferencesState\n>;\n\nexport type PreferencesControllerActions = PreferencesControllerGetStateAction;\n\nexport type PreferencesControllerEvents = PreferencesControllerStateChangeEvent;\n\nexport type PreferencesControllerMessenger = Messenger<\n typeof name,\n PreferencesControllerActions,\n PreferencesControllerEvents\n>;\n\n/**\n * Get the default PreferencesController state.\n *\n * @returns The default PreferencesController state.\n */\nexport function getDefaultPreferencesState(): PreferencesState {\n return {\n featureFlags: {},\n ipfsGateway: 'https://ipfs.io/ipfs/',\n isIpfsGatewayEnabled: true,\n isMultiAccountBalancesEnabled: true,\n displayNftMedia: false,\n securityAlertsEnabled: false,\n showIncomingTransactions: {\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MAINNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.GOERLI]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.BSC]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.BSC_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.OPTIMISM]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.OPTIMISM_SEPOLIA]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.POLYGON]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.POLYGON_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.AVALANCHE]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.AVALANCHE_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.FANTOM]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.FANTOM_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.SEPOLIA]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.LINEA_GOERLI]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.LINEA_SEPOLIA]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.LINEA_MAINNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MOONBEAM]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MOONBEAM_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MOONRIVER]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.GNOSIS]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.SEI]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MONAD]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.HYPEREVM]: true,\n },\n showTestNetworks: false,\n useNftDetection: false,\n useTokenDetection: true,\n showMultiRpcModal: false,\n smartTransactionsOptInStatus: true,\n useTransactionSimulations: true,\n useSafeChainsListValidation: true,\n tokenSortConfig: {\n key: 'tokenFiatAmount',\n order: 'dsc',\n sortCallback: 'stringNumeric',\n },\n privacyMode: false,\n dismissSmartAccountSuggestionEnabled: false,\n smartAccountOptIn: true,\n tokenNetworkFilter: {},\n };\n}\n\n/**\n * Controller that stores shared settings and exposes convenience methods\n */\nexport class PreferencesController extends BaseController<\n typeof name,\n PreferencesState,\n PreferencesControllerMessenger\n> {\n /**\n * Creates a PreferencesController instance.\n *\n * @param args - Arguments\n * @param args.messenger - The preferences controller messenger.\n * @param args.state - Preferences controller state.\n */\n constructor({\n messenger,\n state,\n }: {\n messenger: PreferencesControllerMessenger;\n state?: Partial<PreferencesState>;\n }) {\n super({\n name,\n metadata,\n messenger,\n state: {\n ...getDefaultPreferencesState(),\n ...state,\n },\n });\n }\n\n /**\n * Enable or disable a specific feature flag.\n *\n * @param feature - Feature to toggle.\n * @param activated - Value to assign.\n */\n setFeatureFlag(feature: string, activated: boolean): void {\n this.update((state) => {\n state.featureFlags[feature] = activated;\n });\n }\n\n /**\n * Sets new IPFS gateway.\n *\n * @param ipfsGateway - IPFS gateway string.\n */\n setIpfsGateway(ipfsGateway: string): void {\n this.update((state) => {\n state.ipfsGateway = ipfsGateway;\n });\n }\n\n /**\n * Toggle the token detection setting.\n *\n * @param useTokenDetection - Boolean indicating user preference on token detection.\n */\n setUseTokenDetection(useTokenDetection: boolean): void {\n this.update((state) => {\n state.useTokenDetection = useTokenDetection;\n });\n }\n\n /**\n * Toggle the NFT detection setting.\n *\n * @param useNftDetection - Boolean indicating user preference on NFT detection.\n */\n setUseNftDetection(useNftDetection: boolean): void {\n if (useNftDetection && !this.state.displayNftMedia) {\n throw new Error(\n 'useNftDetection cannot be enabled if displayNftMedia is false',\n );\n }\n this.update((state) => {\n state.useNftDetection = useNftDetection;\n });\n }\n\n /**\n * Toggle the display nft media enabled setting.\n *\n * @param displayNftMedia - Boolean indicating user preference on using OpenSea's API.\n */\n setDisplayNftMedia(displayNftMedia: boolean): void {\n this.update((state) => {\n state.displayNftMedia = displayNftMedia;\n if (!displayNftMedia) {\n state.useNftDetection = false;\n }\n });\n }\n\n /**\n * Toggle the security alert enabled setting.\n *\n * @param securityAlertsEnabled - Boolean indicating user preference on using security alerts.\n */\n setSecurityAlertsEnabled(securityAlertsEnabled: boolean): void {\n this.update((state) => {\n state.securityAlertsEnabled = securityAlertsEnabled;\n });\n }\n\n /**\n * A setter for the user preferences to enable/disable fetch of multiple accounts balance.\n *\n * @param isMultiAccountBalancesEnabled - true to enable multiple accounts balance fetch, false to fetch only selectedAddress.\n */\n setIsMultiAccountBalancesEnabled(\n isMultiAccountBalancesEnabled: boolean,\n ): void {\n this.update((state) => {\n state.isMultiAccountBalancesEnabled = isMultiAccountBalancesEnabled;\n });\n }\n\n /**\n * A setter for the user have the test networks visible/hidden.\n *\n * @param showTestNetworks - true to show test networks, false to hidden.\n */\n setShowTestNetworks(showTestNetworks: boolean): void {\n this.update((state) => {\n state.showTestNetworks = showTestNetworks;\n });\n }\n\n /**\n * A setter for the user allow to be fetched IPFS content\n *\n * @param isIpfsGatewayEnabled - true to enable ipfs source\n */\n setIsIpfsGatewayEnabled(isIpfsGatewayEnabled: boolean): void {\n this.update((state) => {\n state.isIpfsGatewayEnabled = isIpfsGatewayEnabled;\n });\n }\n\n /**\n * A setter for the user allow to be fetched IPFS content\n *\n * @param chainId - On hexadecimal format to enable the incoming transaction network\n * @param isIncomingTransactionNetworkEnable - true to enable incoming transactions\n */\n setEnableNetworkIncomingTransactions(\n chainId: EtherscanSupportedHexChainId,\n isIncomingTransactionNetworkEnable: boolean,\n ): void {\n if (Object.values(ETHERSCAN_SUPPORTED_CHAIN_IDS).includes(chainId)) {\n this.update((state) => {\n state.showIncomingTransactions = {\n ...this.state.showIncomingTransactions,\n [chainId]: isIncomingTransactionNetworkEnable,\n };\n });\n }\n }\n\n /**\n * Toggle multi rpc migration modal.\n *\n * @param showMultiRpcModal - Boolean indicating if the multi rpc modal will be displayed or not.\n */\n setShowMultiRpcModal(showMultiRpcModal: boolean): void {\n this.update((state) => {\n state.showMultiRpcModal = showMultiRpcModal;\n if (!showMultiRpcModal) {\n state.showMultiRpcModal = false;\n }\n });\n }\n\n /**\n * A setter for the user to opt into smart transactions\n *\n * @param smartTransactionsOptInStatus - true to opt into smart transactions\n */\n setSmartTransactionsOptInStatus(smartTransactionsOptInStatus: boolean): void {\n this.update((state) => {\n state.smartTransactionsOptInStatus = smartTransactionsOptInStatus;\n });\n }\n\n /**\n * A setter for the user preferences to enable/disable transaction simulations.\n *\n * @param useTransactionSimulations - true to enable transaction simulations, false to disable it.\n */\n setUseTransactionSimulations(useTransactionSimulations: boolean): void {\n this.update((state) => {\n state.useTransactionSimulations = useTransactionSimulations;\n });\n }\n\n /**\n * A setter to update the user's preferred token sorting order.\n *\n * @param tokenSortConfig - a configuration representing the sort order of tokens.\n */\n setTokenSortConfig(tokenSortConfig: TokenSortConfig): void {\n this.update((state) => {\n state.tokenSortConfig = tokenSortConfig;\n });\n }\n\n /**\n * A setter for the user preferences to enable/disable safe chains list validation.\n *\n * @param useSafeChainsListValidation - true to enable safe chains list validation, false to disable it.\n */\n setUseSafeChainsListValidation(useSafeChainsListValidation: boolean): void {\n this.update((state) => {\n state.useSafeChainsListValidation = useSafeChainsListValidation;\n });\n }\n\n /**\n * A setter for the user preferences to enable/disable privacy mode.\n *\n * @param privacyMode - true to enable privacy mode, false to disable it.\n */\n setPrivacyMode(privacyMode: boolean): void {\n this.update((state) => {\n state.privacyMode = privacyMode;\n });\n }\n\n /**\n * A setter for the user preferences dismiss smart account upgrade prompt.\n *\n * @param dismissSmartAccountSuggestionEnabled - true to dismiss smart account upgrade prompt, false to enable it.\n */\n setDismissSmartAccountSuggestionEnabled(\n dismissSmartAccountSuggestionEnabled: boolean,\n ): void {\n this.update((state) => {\n state.dismissSmartAccountSuggestionEnabled =\n dismissSmartAccountSuggestionEnabled;\n });\n }\n\n /**\n * A setter for the user preferences smart account OptIn.\n *\n * @param smartAccountOptIn - true if user opts in for smart account update, false otherwise.\n */\n setSmartAccountOptIn(smartAccountOptIn: boolean): void {\n this.update((state) => {\n state.smartAccountOptIn = smartAccountOptIn;\n });\n }\n\n /**\n * Set the token network filter configuration setting.\n *\n * @param tokenNetworkFilter - Object describing token network filter configuration.\n */\n setTokenNetworkFilter(tokenNetworkFilter: Record<string, boolean>): void {\n this.update((state) => {\n state.tokenNetworkFilter = tokenNetworkFilter;\n });\n }\n}\n\nexport default PreferencesController;\n"]}
1
+ {"version":3,"file":"PreferencesController.mjs","sourceRoot":"","sources":["../src/PreferencesController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAO3D,OAAO,EAAE,6BAA6B,EAAE,wBAAoB;AA2G5D,MAAM,QAAQ,GA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C9C,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,qBAAqB,CAAC,kBAA2C;QAC/D,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,eAAe,qBAAqB,CAAC","sourcesContent":["import { BaseController } from '@metamask/base-controller';\nimport type {\n ControllerStateChangeEvent,\n ControllerGetStateAction,\n} from '@metamask/base-controller';\nimport type { Messenger } from '@metamask/messenger';\n\nimport { ETHERSCAN_SUPPORTED_CHAIN_IDS } from './constants';\nimport type { PreferencesControllerMethodActions } from './PreferencesController-method-action-types';\n\n/**\n * A type union of the name for each chain that is supported by Etherscan or\n * an Etherscan-compatible service.\n */\nexport type EtherscanSupportedChains =\n keyof typeof ETHERSCAN_SUPPORTED_CHAIN_IDS;\n\n/**\n * A type union of the chain ID for each chain that is supported by Etherscan\n * or an Etherscan-compatible service.\n */\nexport type EtherscanSupportedHexChainId =\n (typeof ETHERSCAN_SUPPORTED_CHAIN_IDS)[EtherscanSupportedChains];\n\ntype TokenSortConfig = {\n key: string;\n order: 'asc' | 'dsc';\n sortCallback: string;\n};\n\n/**\n * Preferences controller state\n */\nexport type PreferencesState = {\n /**\n * Map of specific features to enable or disable\n */\n featureFlags: { [feature: string]: boolean };\n /**\n * The configured IPFS gateway\n */\n ipfsGateway: string;\n /**\n * Controls whether IPFS is enabled or not\n */\n isIpfsGatewayEnabled: boolean;\n /**\n * Controls whether multi-account balances are enabled or not\n */\n isMultiAccountBalancesEnabled: boolean;\n /**\n * Controls whether the OpenSea API is used\n */\n displayNftMedia: boolean;\n /**\n * Controls whether \"security alerts\" are enabled\n */\n securityAlertsEnabled: boolean;\n /**\n * Controls whether incoming transactions are enabled, per-chain (for Etherscan-supported chains)\n */\n showIncomingTransactions: {\n [chainId in EtherscanSupportedHexChainId]: boolean;\n };\n /**\n * Controls whether test networks are shown in the wallet\n */\n showTestNetworks: boolean;\n /**\n * Controls whether NFT detection is enabled\n */\n useNftDetection: boolean;\n /**\n * Controls whether token detection is enabled\n */\n useTokenDetection: boolean;\n /**\n * Controls whether smart transactions are opted into\n */\n smartTransactionsOptInStatus: boolean;\n /**\n * Controls whether transaction simulations are enabled\n */\n useTransactionSimulations: boolean;\n /**\n * Controls whether Multi rpc modal is displayed or not\n */\n showMultiRpcModal: boolean;\n /**\n * Controls whether to use the safe chains list validation\n */\n useSafeChainsListValidation: boolean;\n /**\n * Controls which order tokens are sorted in\n */\n tokenSortConfig: TokenSortConfig;\n /**\n * Controls whether balance and assets are hidden or not\n */\n privacyMode: boolean;\n /**\n * Allow user to stop being prompted for smart account upgrade\n */\n dismissSmartAccountSuggestionEnabled: boolean;\n /**\n * User to opt in for smart account upgrade for all user accounts.\n */\n smartAccountOptIn: boolean;\n /**\n * Controls token filtering controls\n */\n tokenNetworkFilter: Record<string, boolean>;\n};\n\nconst metadata = {\n featureFlags: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n ipfsGateway: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n isIpfsGatewayEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n isMultiAccountBalancesEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n displayNftMedia: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n securityAlertsEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n showTestNetworks: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n showIncomingTransactions: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n useNftDetection: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n useTokenDetection: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n smartTransactionsOptInStatus: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n useTransactionSimulations: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n showMultiRpcModal: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n useSafeChainsListValidation: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n tokenSortConfig: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n privacyMode: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n dismissSmartAccountSuggestionEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n smartAccountOptIn: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n tokenNetworkFilter: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n};\n\nconst name = 'PreferencesController';\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'setFeatureFlag',\n 'setIpfsGateway',\n 'setUseTokenDetection',\n 'setUseNftDetection',\n 'setDisplayNftMedia',\n 'setSecurityAlertsEnabled',\n 'setIsMultiAccountBalancesEnabled',\n 'setShowTestNetworks',\n 'setIsIpfsGatewayEnabled',\n 'setEnableNetworkIncomingTransactions',\n 'setShowMultiRpcModal',\n 'setSmartTransactionsOptInStatus',\n 'setUseTransactionSimulations',\n 'setTokenSortConfig',\n 'setUseSafeChainsListValidation',\n 'setPrivacyMode',\n 'setDismissSmartAccountSuggestionEnabled',\n 'setSmartAccountOptIn',\n 'setTokenNetworkFilter',\n] as const;\n\nexport type PreferencesControllerGetStateAction = ControllerGetStateAction<\n typeof name,\n PreferencesState\n>;\n\nexport type PreferencesControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof name,\n PreferencesState\n>;\n\nexport type PreferencesControllerActions =\n | PreferencesControllerGetStateAction\n | PreferencesControllerMethodActions;\n\nexport type PreferencesControllerEvents = PreferencesControllerStateChangeEvent;\n\nexport type PreferencesControllerMessenger = Messenger<\n typeof name,\n PreferencesControllerActions,\n PreferencesControllerEvents\n>;\n\n/**\n * Get the default PreferencesController state.\n *\n * @returns The default PreferencesController state.\n */\nexport function getDefaultPreferencesState(): PreferencesState {\n return {\n featureFlags: {},\n ipfsGateway: 'https://ipfs.io/ipfs/',\n isIpfsGatewayEnabled: true,\n isMultiAccountBalancesEnabled: true,\n displayNftMedia: false,\n securityAlertsEnabled: false,\n showIncomingTransactions: {\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MAINNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.GOERLI]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.BSC]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.BSC_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.OPTIMISM]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.OPTIMISM_SEPOLIA]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.POLYGON]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.POLYGON_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.AVALANCHE]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.AVALANCHE_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.FANTOM]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.FANTOM_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.SEPOLIA]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.LINEA_GOERLI]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.LINEA_SEPOLIA]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.LINEA_MAINNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MOONBEAM]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MOONBEAM_TESTNET]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MOONRIVER]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.GNOSIS]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.SEI]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.MONAD]: true,\n [ETHERSCAN_SUPPORTED_CHAIN_IDS.HYPEREVM]: true,\n },\n showTestNetworks: false,\n useNftDetection: false,\n useTokenDetection: true,\n showMultiRpcModal: false,\n smartTransactionsOptInStatus: true,\n useTransactionSimulations: true,\n useSafeChainsListValidation: true,\n tokenSortConfig: {\n key: 'tokenFiatAmount',\n order: 'dsc',\n sortCallback: 'stringNumeric',\n },\n privacyMode: false,\n dismissSmartAccountSuggestionEnabled: false,\n smartAccountOptIn: true,\n tokenNetworkFilter: {},\n };\n}\n\n/**\n * Controller that stores shared settings and exposes convenience methods\n */\nexport class PreferencesController extends BaseController<\n typeof name,\n PreferencesState,\n PreferencesControllerMessenger\n> {\n /**\n * Creates a PreferencesController instance.\n *\n * @param args - Arguments\n * @param args.messenger - The preferences controller messenger.\n * @param args.state - Preferences controller state.\n */\n constructor({\n messenger,\n state,\n }: {\n messenger: PreferencesControllerMessenger;\n state?: Partial<PreferencesState>;\n }) {\n super({\n name,\n metadata,\n messenger,\n state: {\n ...getDefaultPreferencesState(),\n ...state,\n },\n });\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Enable or disable a specific feature flag.\n *\n * @param feature - Feature to toggle.\n * @param activated - Value to assign.\n */\n setFeatureFlag(feature: string, activated: boolean): void {\n this.update((state) => {\n state.featureFlags[feature] = activated;\n });\n }\n\n /**\n * Sets new IPFS gateway.\n *\n * @param ipfsGateway - IPFS gateway string.\n */\n setIpfsGateway(ipfsGateway: string): void {\n this.update((state) => {\n state.ipfsGateway = ipfsGateway;\n });\n }\n\n /**\n * Toggle the token detection setting.\n *\n * @param useTokenDetection - Boolean indicating user preference on token detection.\n */\n setUseTokenDetection(useTokenDetection: boolean): void {\n this.update((state) => {\n state.useTokenDetection = useTokenDetection;\n });\n }\n\n /**\n * Toggle the NFT detection setting.\n *\n * @param useNftDetection - Boolean indicating user preference on NFT detection.\n */\n setUseNftDetection(useNftDetection: boolean): void {\n if (useNftDetection && !this.state.displayNftMedia) {\n throw new Error(\n 'useNftDetection cannot be enabled if displayNftMedia is false',\n );\n }\n this.update((state) => {\n state.useNftDetection = useNftDetection;\n });\n }\n\n /**\n * Toggle the display nft media enabled setting.\n *\n * @param displayNftMedia - Boolean indicating user preference on using OpenSea's API.\n */\n setDisplayNftMedia(displayNftMedia: boolean): void {\n this.update((state) => {\n state.displayNftMedia = displayNftMedia;\n if (!displayNftMedia) {\n state.useNftDetection = false;\n }\n });\n }\n\n /**\n * Toggle the security alert enabled setting.\n *\n * @param securityAlertsEnabled - Boolean indicating user preference on using security alerts.\n */\n setSecurityAlertsEnabled(securityAlertsEnabled: boolean): void {\n this.update((state) => {\n state.securityAlertsEnabled = securityAlertsEnabled;\n });\n }\n\n /**\n * A setter for the user preferences to enable/disable fetch of multiple accounts balance.\n *\n * @param isMultiAccountBalancesEnabled - true to enable multiple accounts balance fetch, false to fetch only selectedAddress.\n */\n setIsMultiAccountBalancesEnabled(\n isMultiAccountBalancesEnabled: boolean,\n ): void {\n this.update((state) => {\n state.isMultiAccountBalancesEnabled = isMultiAccountBalancesEnabled;\n });\n }\n\n /**\n * A setter for the user have the test networks visible/hidden.\n *\n * @param showTestNetworks - true to show test networks, false to hidden.\n */\n setShowTestNetworks(showTestNetworks: boolean): void {\n this.update((state) => {\n state.showTestNetworks = showTestNetworks;\n });\n }\n\n /**\n * A setter for the user allow to be fetched IPFS content\n *\n * @param isIpfsGatewayEnabled - true to enable ipfs source\n */\n setIsIpfsGatewayEnabled(isIpfsGatewayEnabled: boolean): void {\n this.update((state) => {\n state.isIpfsGatewayEnabled = isIpfsGatewayEnabled;\n });\n }\n\n /**\n * A setter for the user allow to be fetched IPFS content\n *\n * @param chainId - On hexadecimal format to enable the incoming transaction network\n * @param isIncomingTransactionNetworkEnable - true to enable incoming transactions\n */\n setEnableNetworkIncomingTransactions(\n chainId: EtherscanSupportedHexChainId,\n isIncomingTransactionNetworkEnable: boolean,\n ): void {\n if (Object.values(ETHERSCAN_SUPPORTED_CHAIN_IDS).includes(chainId)) {\n this.update((state) => {\n state.showIncomingTransactions = {\n ...this.state.showIncomingTransactions,\n [chainId]: isIncomingTransactionNetworkEnable,\n };\n });\n }\n }\n\n /**\n * Toggle multi rpc migration modal.\n *\n * @param showMultiRpcModal - Boolean indicating if the multi rpc modal will be displayed or not.\n */\n setShowMultiRpcModal(showMultiRpcModal: boolean): void {\n this.update((state) => {\n state.showMultiRpcModal = showMultiRpcModal;\n if (!showMultiRpcModal) {\n state.showMultiRpcModal = false;\n }\n });\n }\n\n /**\n * A setter for the user to opt into smart transactions\n *\n * @param smartTransactionsOptInStatus - true to opt into smart transactions\n */\n setSmartTransactionsOptInStatus(smartTransactionsOptInStatus: boolean): void {\n this.update((state) => {\n state.smartTransactionsOptInStatus = smartTransactionsOptInStatus;\n });\n }\n\n /**\n * A setter for the user preferences to enable/disable transaction simulations.\n *\n * @param useTransactionSimulations - true to enable transaction simulations, false to disable it.\n */\n setUseTransactionSimulations(useTransactionSimulations: boolean): void {\n this.update((state) => {\n state.useTransactionSimulations = useTransactionSimulations;\n });\n }\n\n /**\n * A setter to update the user's preferred token sorting order.\n *\n * @param tokenSortConfig - a configuration representing the sort order of tokens.\n */\n setTokenSortConfig(tokenSortConfig: TokenSortConfig): void {\n this.update((state) => {\n state.tokenSortConfig = tokenSortConfig;\n });\n }\n\n /**\n * A setter for the user preferences to enable/disable safe chains list validation.\n *\n * @param useSafeChainsListValidation - true to enable safe chains list validation, false to disable it.\n */\n setUseSafeChainsListValidation(useSafeChainsListValidation: boolean): void {\n this.update((state) => {\n state.useSafeChainsListValidation = useSafeChainsListValidation;\n });\n }\n\n /**\n * A setter for the user preferences to enable/disable privacy mode.\n *\n * @param privacyMode - true to enable privacy mode, false to disable it.\n */\n setPrivacyMode(privacyMode: boolean): void {\n this.update((state) => {\n state.privacyMode = privacyMode;\n });\n }\n\n /**\n * A setter for the user preferences dismiss smart account upgrade prompt.\n *\n * @param dismissSmartAccountSuggestionEnabled - true to dismiss smart account upgrade prompt, false to enable it.\n */\n setDismissSmartAccountSuggestionEnabled(\n dismissSmartAccountSuggestionEnabled: boolean,\n ): void {\n this.update((state) => {\n state.dismissSmartAccountSuggestionEnabled =\n dismissSmartAccountSuggestionEnabled;\n });\n }\n\n /**\n * A setter for the user preferences smart account OptIn.\n *\n * @param smartAccountOptIn - true if user opts in for smart account update, false otherwise.\n */\n setSmartAccountOptIn(smartAccountOptIn: boolean): void {\n this.update((state) => {\n state.smartAccountOptIn = smartAccountOptIn;\n });\n }\n\n /**\n * Set the token network filter configuration setting.\n *\n * @param tokenNetworkFilter - Object describing token network filter configuration.\n */\n setTokenNetworkFilter(tokenNetworkFilter: Record<string, boolean>): void {\n this.update((state) => {\n state.tokenNetworkFilter = tokenNetworkFilter;\n });\n }\n}\n\nexport default PreferencesController;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8DAAwC;AACxC,6CAA4D;AAAnD,0HAAA,6BAA6B,OAAA","sourcesContent":["export * from './PreferencesController';\nexport { ETHERSCAN_SUPPORTED_CHAIN_IDS } from './constants';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8DAAwC;AAExC,6CAA4D;AAAnD,0HAAA,6BAA6B,OAAA","sourcesContent":["export * from './PreferencesController';\nexport type * from './PreferencesController-method-action-types';\nexport { ETHERSCAN_SUPPORTED_CHAIN_IDS } from './constants';\n"]}
package/dist/index.d.cts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./PreferencesController.cjs";
2
+ export type * from "./PreferencesController-method-action-types.cjs";
2
3
  export { ETHERSCAN_SUPPORTED_CHAIN_IDS } from "./constants.cjs";
3
4
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAAwC;AACxC,OAAO,EAAE,6BAA6B,EAAE,wBAAoB"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAAwC;AACxC,qEAAiE;AACjE,OAAO,EAAE,6BAA6B,EAAE,wBAAoB"}
package/dist/index.d.mts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./PreferencesController.mjs";
2
+ export type * from "./PreferencesController-method-action-types.mjs";
2
3
  export { ETHERSCAN_SUPPORTED_CHAIN_IDS } from "./constants.mjs";
3
4
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAAwC;AACxC,OAAO,EAAE,6BAA6B,EAAE,wBAAoB"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAAwC;AACxC,qEAAiE;AACjE,OAAO,EAAE,6BAA6B,EAAE,wBAAoB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAAwC;AACxC,OAAO,EAAE,6BAA6B,EAAE,wBAAoB","sourcesContent":["export * from './PreferencesController';\nexport { ETHERSCAN_SUPPORTED_CHAIN_IDS } from './constants';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAAwC;AAExC,OAAO,EAAE,6BAA6B,EAAE,wBAAoB","sourcesContent":["export * from './PreferencesController';\nexport type * from './PreferencesController-method-action-types';\nexport { ETHERSCAN_SUPPORTED_CHAIN_IDS } from './constants';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/preferences-controller",
3
- "version": "23.0.0-preview-e0ce55a8c",
3
+ "version": "23.0.0-preview-1f5463f7b",
4
4
  "description": "Manages user-configurable settings for MetaMask",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -40,6 +40,7 @@
40
40
  "build:docs": "typedoc",
41
41
  "changelog:update": "../../scripts/update-changelog.sh @metamask/preferences-controller",
42
42
  "changelog:validate": "../../scripts/validate-changelog.sh @metamask/preferences-controller",
43
+ "generate-method-action-types": "tsx ../../scripts/generate-method-action-types.ts",
43
44
  "since-latest-release": "../../scripts/since-latest-release.sh",
44
45
  "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter",
45
46
  "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache",
@@ -58,6 +59,7 @@
58
59
  "deepmerge": "^4.2.2",
59
60
  "jest": "^29.7.0",
60
61
  "ts-jest": "^29.2.5",
62
+ "tsx": "^4.20.5",
61
63
  "typedoc": "^0.25.13",
62
64
  "typedoc-plugin-missing-exports": "^2.0.0",
63
65
  "typescript": "~5.3.3"