Skip to main content

PreferencesController Actions

20 actions registered.

NameDeprecated
getState
setDismissSmartAccountSuggestionEnabled
setDisplayNftMedia
setEnableNetworkIncomingTransactions
setFeatureFlag
setIpfsGateway
setIsIpfsGatewayEnabled
setIsMultiAccountBalancesEnabled
setPrivacyMode
setSecurityAlertsEnabled
setShowMultiRpcModal
setShowTestNetworks
setSmartAccountOptIn
setSmartTransactionsOptInStatus
setTokenNetworkFilter
setTokenSortConfig
setUseNftDetection
setUseSafeChainsListValidation
setUseTokenDetection
setUseTransactionSimulations

PreferencesController:getState​

Package: @metamask/preferences-controller

Handler signature:

() => PreferencesState

PreferencesController:setDismissSmartAccountSuggestionEnabled​

Package: @metamask/preferences-controller

A setter for the user preferences dismiss smart account upgrade prompt.

Parameters:

NameDescription
dismissSmartAccountSuggestionEnabledtrue to dismiss smart account upgrade prompt, false to enable it.

Handler signature:

(dismissSmartAccountSuggestionEnabled: boolean) => void

PreferencesController:setDisplayNftMedia​

Package: @metamask/preferences-controller

Toggle the display nft media enabled setting.

Parameters:

NameDescription
displayNftMediaBoolean indicating user preference on using OpenSea's API.

Handler signature:

(displayNftMedia: boolean) => void

PreferencesController:setEnableNetworkIncomingTransactions​

Package: @metamask/preferences-controller

A setter for the user allow to be fetched IPFS content

Parameters:

NameDescription
chainIdOn hexadecimal format to enable the incoming transaction network
isIncomingTransactionNetworkEnabletrue to enable incoming transactions

Handler signature:

(chainId: EtherscanSupportedHexChainId, isIncomingTransactionNetworkEnable: boolean) => void

PreferencesController:setFeatureFlag​

Package: @metamask/preferences-controller

Enable or disable a specific feature flag.

Parameters:

NameDescription
featureFeature to toggle.
activatedValue to assign.

Handler signature:

(feature: string, activated: boolean) => void

PreferencesController:setIpfsGateway​

Package: @metamask/preferences-controller

Sets new IPFS gateway.

Parameters:

NameDescription
ipfsGatewayIPFS gateway string.

Handler signature:

(ipfsGateway: string) => void

PreferencesController:setIsIpfsGatewayEnabled​

Package: @metamask/preferences-controller

A setter for the user allow to be fetched IPFS content

Parameters:

NameDescription
isIpfsGatewayEnabledtrue to enable ipfs source

Handler signature:

(isIpfsGatewayEnabled: boolean) => void

PreferencesController:setIsMultiAccountBalancesEnabled​

Package: @metamask/preferences-controller

A setter for the user preferences to enable/disable fetch of multiple accounts balance.

Parameters:

NameDescription
isMultiAccountBalancesEnabledtrue to enable multiple accounts balance fetch, false to fetch only selectedAddress.

Handler signature:

(isMultiAccountBalancesEnabled: boolean) => void

PreferencesController:setPrivacyMode​

Package: @metamask/preferences-controller

A setter for the user preferences to enable/disable privacy mode.

Parameters:

NameDescription
privacyModetrue to enable privacy mode, false to disable it.

Handler signature:

(privacyMode: boolean) => void

PreferencesController:setSecurityAlertsEnabled​

Package: @metamask/preferences-controller

Toggle the security alert enabled setting.

Parameters:

NameDescription
securityAlertsEnabledBoolean indicating user preference on using security alerts.

Handler signature:

(securityAlertsEnabled: boolean) => void

PreferencesController:setShowMultiRpcModal​

Package: @metamask/preferences-controller

Toggle multi rpc migration modal.

Parameters:

NameDescription
showMultiRpcModalBoolean indicating if the multi rpc modal will be displayed or not.

Handler signature:

(showMultiRpcModal: boolean) => void

PreferencesController:setShowTestNetworks​

Package: @metamask/preferences-controller

A setter for the user have the test networks visible/hidden.

Parameters:

NameDescription
showTestNetworkstrue to show test networks, false to hidden.

Handler signature:

(showTestNetworks: boolean) => void

PreferencesController:setSmartAccountOptIn​

Package: @metamask/preferences-controller

A setter for the user preferences smart account OptIn.

Parameters:

NameDescription
smartAccountOptIntrue if user opts in for smart account update, false otherwise.

Handler signature:

(smartAccountOptIn: boolean) => void

PreferencesController:setSmartTransactionsOptInStatus​

Package: @metamask/preferences-controller

A setter for the user to opt into smart transactions

Parameters:

NameDescription
smartTransactionsOptInStatustrue to opt into smart transactions

Handler signature:

(smartTransactionsOptInStatus: boolean) => void

PreferencesController:setTokenNetworkFilter​

Package: @metamask/preferences-controller

Set the token network filter configuration setting.

Parameters:

NameDescription
tokenNetworkFilterObject describing token network filter configuration.

Handler signature:

(tokenNetworkFilter: Record<string, boolean>) => void

PreferencesController:setTokenSortConfig​

Package: @metamask/preferences-controller

A setter to update the user's preferred token sorting order.

Parameters:

NameDescription
tokenSortConfiga configuration representing the sort order of tokens.

Handler signature:

(tokenSortConfig: TokenSortConfig) => void

PreferencesController:setUseNftDetection​

Package: @metamask/preferences-controller

Toggle the NFT detection setting.

Parameters:

NameDescription
useNftDetectionBoolean indicating user preference on NFT detection.

Handler signature:

(useNftDetection: boolean) => void

PreferencesController:setUseSafeChainsListValidation​

Package: @metamask/preferences-controller

A setter for the user preferences to enable/disable safe chains list validation.

Parameters:

NameDescription
useSafeChainsListValidationtrue to enable safe chains list validation, false to disable it.

Handler signature:

(useSafeChainsListValidation: boolean) => void

PreferencesController:setUseTokenDetection​

Package: @metamask/preferences-controller

Toggle the token detection setting.

Parameters:

NameDescription
useTokenDetectionBoolean indicating user preference on token detection.

Handler signature:

(useTokenDetection: boolean) => void

PreferencesController:setUseTransactionSimulations​

Package: @metamask/preferences-controller

A setter for the user preferences to enable/disable transaction simulations.

Parameters:

NameDescription
useTransactionSimulationstrue to enable transaction simulations, false to disable it.

Handler signature:

(useTransactionSimulations: boolean) => void