@metamask-previews/preferences-controller 23.1.0-preview-ec4680201 → 23.1.0-preview-40d5fb1e2
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/dist/PreferencesController-method-action-types.cjs.map +1 -1
- package/dist/PreferencesController-method-action-types.d.cts.map +1 -1
- package/dist/PreferencesController-method-action-types.d.mts.map +1 -1
- package/dist/PreferencesController-method-action-types.mjs.map +1 -1
- package/dist/PreferencesController.cjs +25 -25
- package/dist/PreferencesController.cjs.map +1 -1
- package/dist/PreferencesController.d.cts.map +1 -1
- package/dist/PreferencesController.d.mts.map +1 -1
- package/dist/PreferencesController.mjs.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
|
@@ -1 +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.\n * Do not edit manually.\n */\n\nimport type { PreferencesController } from './PreferencesController
|
|
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.\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"]}
|
|
@@ -1 +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,
|
|
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,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;CACtD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gD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;CACtD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,sDAAsD,CAAC;IAC7D,OAAO,EAAE,qBAAqB,CAAC,gCAAgC,CAAC,CAAC;CAClE,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,kEAAkE,GAC5E;IACE,IAAI,EAAE,+DAA+D,CAAC;IACtE,OAAO,EAAE,qBAAqB,CAAC,yCAAyC,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"}
|
|
@@ -1 +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,EAAE,
|
|
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,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,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;CACtD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,qBAAqB,CAAC,0BAA0B,CAAC,CAAC;CAC5D,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,2DAA2D,GAAG;IACxE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,qBAAqB,CAAC,kCAAkC,CAAC,CAAC;CACpE,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,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,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;CAClD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,kEAAkE,GAC5E;IACE,IAAI,EAAE,+DAA+D,CAAC;IACtE,OAAO,EAAE,qBAAqB,CAAC,yCAAyC,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"}
|
|
@@ -1 +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.\n * Do not edit manually.\n */\n\nimport type { PreferencesController } from './PreferencesController
|
|
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.\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"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PreferencesController = exports.getDefaultPreferencesState = void 0;
|
|
4
4
|
const base_controller_1 = require("@metamask/base-controller");
|
|
5
|
-
const
|
|
5
|
+
const constants_1 = require("./constants.cjs");
|
|
6
6
|
const metadata = {
|
|
7
7
|
featureFlags: {
|
|
8
8
|
includeInStateLogs: true,
|
|
@@ -155,29 +155,29 @@ function getDefaultPreferencesState() {
|
|
|
155
155
|
displayNftMedia: false,
|
|
156
156
|
securityAlertsEnabled: false,
|
|
157
157
|
showIncomingTransactions: {
|
|
158
|
-
[
|
|
159
|
-
[
|
|
160
|
-
[
|
|
161
|
-
[
|
|
162
|
-
[
|
|
163
|
-
[
|
|
164
|
-
[
|
|
165
|
-
[
|
|
166
|
-
[
|
|
167
|
-
[
|
|
168
|
-
[
|
|
169
|
-
[
|
|
170
|
-
[
|
|
171
|
-
[
|
|
172
|
-
[
|
|
173
|
-
[
|
|
174
|
-
[
|
|
175
|
-
[
|
|
176
|
-
[
|
|
177
|
-
[
|
|
178
|
-
[
|
|
179
|
-
[
|
|
180
|
-
[
|
|
158
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.MAINNET]: true,
|
|
159
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.GOERLI]: true,
|
|
160
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.BSC]: true,
|
|
161
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.BSC_TESTNET]: true,
|
|
162
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.OPTIMISM]: true,
|
|
163
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.OPTIMISM_SEPOLIA]: true,
|
|
164
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.POLYGON]: true,
|
|
165
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.POLYGON_TESTNET]: true,
|
|
166
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.AVALANCHE]: true,
|
|
167
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.AVALANCHE_TESTNET]: true,
|
|
168
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.FANTOM]: true,
|
|
169
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.FANTOM_TESTNET]: true,
|
|
170
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.SEPOLIA]: true,
|
|
171
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.LINEA_GOERLI]: true,
|
|
172
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.LINEA_SEPOLIA]: true,
|
|
173
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.LINEA_MAINNET]: true,
|
|
174
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.MOONBEAM]: true,
|
|
175
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.MOONBEAM_TESTNET]: true,
|
|
176
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.MOONRIVER]: true,
|
|
177
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.GNOSIS]: true,
|
|
178
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.SEI]: true,
|
|
179
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.MONAD]: true,
|
|
180
|
+
[constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS.HYPEREVM]: true,
|
|
181
181
|
},
|
|
182
182
|
showTestNetworks: false,
|
|
183
183
|
useNftDetection: false,
|
|
@@ -325,7 +325,7 @@ class PreferencesController extends base_controller_1.BaseController {
|
|
|
325
325
|
* @param isIncomingTransactionNetworkEnable - true to enable incoming transactions
|
|
326
326
|
*/
|
|
327
327
|
setEnableNetworkIncomingTransactions(chainId, isIncomingTransactionNetworkEnable) {
|
|
328
|
-
if (Object.values(
|
|
328
|
+
if (Object.values(constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS).includes(chainId)) {
|
|
329
329
|
this.update((state) => {
|
|
330
330
|
state.showIncomingTransactions = {
|
|
331
331
|
...this.state.showIncomingTransactions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferencesController.cjs","sourceRoot":"","sources":["../src/PreferencesController.ts"],"names":[],"mappings":";;;AAAA,+DAA2D;AAO3D,kDAA+D;AA2G/D,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,sBAAsB,EAAE,KAAK;QAC7B,QAAQ,EAAE,IAAI;KACf;IACD,oBAAoB,EAAE;QACpB,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,IAAI;KACf;IACD,6BAA6B,EAAE;QAC7B,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,Q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AE;YACpB,KAAK,CAAC,eAAe,GAAG,eAAe,CAAC;QAC1C,CAAC,CAAC,CAAC;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;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.js';\nimport type { PreferencesControllerMethodActions } from './PreferencesController-method-action-types.js';\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
|
+
{"version":3,"file":"PreferencesController.cjs","sourceRoot":"","sources":["../src/PreferencesController.ts"],"names":[],"mappings":";;;AAAA,+DAA2D;AAO3D,+CAA4D;AA2G5D,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,sBAAsB,EAAE,KAAK;QAC7B,QAAQ,EAAE,IAAI;KACf;IACD,oBAAoB,EAAE;QACpB,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,IAAI;KACf;IACD,6BAA6B,EAAE;QAC7B,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,IAAI;KACf;IACD,eAAe,EAAE;QACf,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IA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AAC,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;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"]}
|
|
@@ -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,
|
|
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;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,EA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,oCAAoC,CAClC,OAAO,EAAE,4BAA4B,EACrC,kCAAkC,EAAE,OAAO,GAC1C,IAAI;IAWP;;;;OAIG;IACH,oBAAoB,CAAC,iBAAiB,EAAE,OAAO,GAAG,IAAI;IAStD;;;;OAIG;IACH,+BAA+B,CAAC,4BAA4B,EAAE,OAAO,GAAG,IAAI;IAM5E;;;;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"}
|
|
@@ -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,
|
|
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,K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AC,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.js';\nimport type { PreferencesControllerMethodActions } from './PreferencesController-method-action-types.js';\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
|
+
{"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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;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';\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"]}
|
package/dist/index.cjs
CHANGED
|
@@ -16,6 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.ETHERSCAN_SUPPORTED_CHAIN_IDS = void 0;
|
|
18
18
|
__exportStar(require("./PreferencesController.cjs"), exports);
|
|
19
|
-
var
|
|
20
|
-
Object.defineProperty(exports, "ETHERSCAN_SUPPORTED_CHAIN_IDS", { enumerable: true, get: function () { return
|
|
19
|
+
var constants_1 = require("./constants.cjs");
|
|
20
|
+
Object.defineProperty(exports, "ETHERSCAN_SUPPORTED_CHAIN_IDS", { enumerable: true, get: function () { return constants_1.ETHERSCAN_SUPPORTED_CHAIN_IDS; } });
|
|
21
21
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,
|
|
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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAAwC;AACxC,qEAAiE;AACjE,OAAO,EAAE,6BAA6B,EAAE,wBAAoB"}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
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.1.0-preview-
|
|
3
|
+
"version": "23.1.0-preview-40d5fb1e2",
|
|
4
4
|
"description": "Manages user-configurable settings for MetaMask",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ethereum",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/preferences-controller",
|
|
47
47
|
"lint:tsconfigs": "tsx ../../scripts/lint-tsconfigs/lint-tsconfigs.mts",
|
|
48
48
|
"lint:tsconfigs:fix": "tsx ../../scripts/lint-tsconfigs/lint-tsconfigs.mts --fix",
|
|
49
|
-
"messenger-action-types:check": "tsx ../../packages/messenger-cli/src/cli.ts --formatter oxfmt --
|
|
50
|
-
"messenger-action-types:generate": "tsx ../../packages/messenger-cli/src/cli.ts --formatter oxfmt --
|
|
49
|
+
"messenger-action-types:check": "tsx ../../packages/messenger-cli/src/cli.ts --formatter oxfmt --check",
|
|
50
|
+
"messenger-action-types:generate": "tsx ../../packages/messenger-cli/src/cli.ts --formatter oxfmt --generate",
|
|
51
51
|
"since-latest-release": "../../scripts/since-latest-release.sh",
|
|
52
52
|
"test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter",
|
|
53
53
|
"test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache",
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"@metamask/auto-changelog": "^6.1.0",
|
|
63
63
|
"@metamask/utils": "^11.11.0",
|
|
64
64
|
"@ts-bridge/cli": "^0.6.4",
|
|
65
|
-
"@types/jest": "^
|
|
65
|
+
"@types/jest": "^29.5.14",
|
|
66
66
|
"deepmerge": "^4.2.2",
|
|
67
|
-
"jest": "^
|
|
68
|
-
"ts-jest": "^29.
|
|
67
|
+
"jest": "^29.7.0",
|
|
68
|
+
"ts-jest": "^29.2.5",
|
|
69
69
|
"tsx": "^4.20.5",
|
|
70
70
|
"typedoc": "^0.25.13",
|
|
71
71
|
"typedoc-plugin-missing-exports": "^2.0.0",
|