import { BaseController } from "@metamask/base-controller"; import type { ControllerStateChangeEvent, ControllerGetStateAction } from "@metamask/base-controller"; import type { Messenger } from "@metamask/messenger"; import { ETHERSCAN_SUPPORTED_CHAIN_IDS } from "./constants.cjs"; import type { PreferencesControllerMethodActions } from "./PreferencesController-method-action-types.cjs"; /** * A type union of the name for each chain that is supported by Etherscan or * an Etherscan-compatible service. */ export type EtherscanSupportedChains = keyof typeof ETHERSCAN_SUPPORTED_CHAIN_IDS; /** * A type union of the chain ID for each chain that is supported by Etherscan * or an Etherscan-compatible service. */ export type EtherscanSupportedHexChainId = (typeof ETHERSCAN_SUPPORTED_CHAIN_IDS)[EtherscanSupportedChains]; type TokenSortConfig = { key: string; order: 'asc' | 'dsc'; sortCallback: string; }; /** * Preferences controller state */ export type PreferencesState = { /** * Map of specific features to enable or disable */ featureFlags: { [feature: string]: boolean; }; /** * The configured IPFS gateway */ ipfsGateway: string; /** * Controls whether IPFS is enabled or not */ isIpfsGatewayEnabled: boolean; /** * Controls whether multi-account balances are enabled or not */ isMultiAccountBalancesEnabled: boolean; /** * Controls whether the OpenSea API is used */ displayNftMedia: boolean; /** * Controls whether "security alerts" are enabled */ securityAlertsEnabled: boolean; /** * Controls whether incoming transactions are enabled, per-chain (for Etherscan-supported chains) */ showIncomingTransactions: { [chainId in EtherscanSupportedHexChainId]: boolean; }; /** * Controls whether test networks are shown in the wallet */ showTestNetworks: boolean; /** * Controls whether NFT detection is enabled */ useNftDetection: boolean; /** * Controls whether token detection is enabled */ useTokenDetection: boolean; /** * Controls whether smart transactions are opted into */ smartTransactionsOptInStatus: boolean; /** * Controls whether transaction simulations are enabled */ useTransactionSimulations: boolean; /** * Controls whether Multi rpc modal is displayed or not */ showMultiRpcModal: boolean; /** * Controls whether to use the safe chains list validation */ useSafeChainsListValidation: boolean; /** * Controls which order tokens are sorted in */ tokenSortConfig: TokenSortConfig; /** * Controls whether balance and assets are hidden or not */ privacyMode: boolean; /** * Allow user to stop being prompted for smart account upgrade */ dismissSmartAccountSuggestionEnabled: boolean; /** * User to opt in for smart account upgrade for all user accounts. */ smartAccountOptIn: boolean; /** * Controls token filtering controls */ tokenNetworkFilter: Record; }; declare const name = "PreferencesController"; export type PreferencesControllerGetStateAction = ControllerGetStateAction; export type PreferencesControllerStateChangeEvent = ControllerStateChangeEvent; export type PreferencesControllerActions = PreferencesControllerGetStateAction | PreferencesControllerMethodActions; export type PreferencesControllerEvents = PreferencesControllerStateChangeEvent; export type PreferencesControllerMessenger = Messenger; /** * Get the default PreferencesController state. * * @returns The default PreferencesController state. */ export declare function getDefaultPreferencesState(): PreferencesState; /** * Controller that stores shared settings and exposes convenience methods */ export declare class PreferencesController extends BaseController { /** * Creates a PreferencesController instance. * * @param args - Arguments * @param args.messenger - The preferences controller messenger. * @param args.state - Preferences controller state. */ constructor({ messenger, state, }: { messenger: PreferencesControllerMessenger; state?: Partial; }); /** * Enable or disable a specific feature flag. * * @param feature - Feature to toggle. * @param activated - Value to assign. */ setFeatureFlag(feature: string, activated: boolean): void; /** * Sets new IPFS gateway. * * @param ipfsGateway - IPFS gateway string. */ setIpfsGateway(ipfsGateway: string): void; /** * Toggle the token detection setting. * * @param useTokenDetection - Boolean indicating user preference on token detection. */ setUseTokenDetection(useTokenDetection: boolean): void; /** * Toggle the NFT detection setting. * * @param useNftDetection - Boolean indicating user preference on NFT detection. */ setUseNftDetection(useNftDetection: boolean): void; /** * Toggle the display nft media enabled setting. * * @param displayNftMedia - Boolean indicating user preference on using OpenSea's API. */ setDisplayNftMedia(displayNftMedia: boolean): void; /** * Toggle the security alert enabled setting. * * @param securityAlertsEnabled - Boolean indicating user preference on using security alerts. */ setSecurityAlertsEnabled(securityAlertsEnabled: boolean): void; /** * A setter for the user preferences to enable/disable fetch of multiple accounts balance. * * @param isMultiAccountBalancesEnabled - true to enable multiple accounts balance fetch, false to fetch only selectedAddress. */ setIsMultiAccountBalancesEnabled(isMultiAccountBalancesEnabled: boolean): void; /** * A setter for the user have the test networks visible/hidden. * * @param showTestNetworks - true to show test networks, false to hidden. */ setShowTestNetworks(showTestNetworks: boolean): void; /** * A setter for the user allow to be fetched IPFS content * * @param isIpfsGatewayEnabled - true to enable ipfs source */ setIsIpfsGatewayEnabled(isIpfsGatewayEnabled: boolean): void; /** * A setter for the user allow to be fetched IPFS content * * @param chainId - On hexadecimal format to enable the incoming transaction network * @param isIncomingTransactionNetworkEnable - true to enable incoming transactions */ setEnableNetworkIncomingTransactions(chainId: EtherscanSupportedHexChainId, isIncomingTransactionNetworkEnable: boolean): void; /** * Toggle multi rpc migration modal. * * @param showMultiRpcModal - Boolean indicating if the multi rpc modal will be displayed or not. */ setShowMultiRpcModal(showMultiRpcModal: boolean): void; /** * A setter for the user to opt into smart transactions * * @param smartTransactionsOptInStatus - true to opt into smart transactions */ setSmartTransactionsOptInStatus(smartTransactionsOptInStatus: boolean): void; /** * A setter for the user preferences to enable/disable transaction simulations. * * @param useTransactionSimulations - true to enable transaction simulations, false to disable it. */ setUseTransactionSimulations(useTransactionSimulations: boolean): void; /** * A setter to update the user's preferred token sorting order. * * @param tokenSortConfig - a configuration representing the sort order of tokens. */ setTokenSortConfig(tokenSortConfig: TokenSortConfig): void; /** * A setter for the user preferences to enable/disable safe chains list validation. * * @param useSafeChainsListValidation - true to enable safe chains list validation, false to disable it. */ setUseSafeChainsListValidation(useSafeChainsListValidation: boolean): void; /** * A setter for the user preferences to enable/disable privacy mode. * * @param privacyMode - true to enable privacy mode, false to disable it. */ setPrivacyMode(privacyMode: boolean): void; /** * A setter for the user preferences dismiss smart account upgrade prompt. * * @param dismissSmartAccountSuggestionEnabled - true to dismiss smart account upgrade prompt, false to enable it. */ setDismissSmartAccountSuggestionEnabled(dismissSmartAccountSuggestionEnabled: boolean): void; /** * A setter for the user preferences smart account OptIn. * * @param smartAccountOptIn - true if user opts in for smart account update, false otherwise. */ setSmartAccountOptIn(smartAccountOptIn: boolean): void; /** * Set the token network filter configuration setting. * * @param tokenNetworkFilter - Object describing token network filter configuration. */ setTokenNetworkFilter(tokenNetworkFilter: Record): void; } export default PreferencesController; //# sourceMappingURL=PreferencesController.d.cts.map