snap_getPreferences
Description
Gets the user's preferences.
Parameters
This method does not have any parameters.
Returns
An object containing the user's MetaMask preferences.
locale
stringThe user's locale setting as a language code.
currency
stringThe user's preferred fiat currency code (e.g., "usd", "eur").
hideBalances
booleanWhether the user has chosen to hide balances in the MetaMask UI.
useSecurityAlerts
booleanWhether to run transactions and signatures through security alert providers before submitting.
simulateOnChainActions
booleanWhether to simulate transactions and signatures to preview their effects before the user confirms.
useTokenDetection
booleanWhether to automatically detect and add ERC-20 tokens to the user's wallet.
batchCheckBalances
booleanWhether to fetch token balances in an aggregated manner for improved performance.
displayNftMedia
booleanWhether to display NFT media (images, videos) in the MetaMask UI.
useNftDetection
booleanWhether to automatically detect and add NFTs to the user's wallet.
useExternalPricingData
booleanWhether to fetch token price data from an external pricing source.
showTestnets
booleanWhether to show testnet networks in the MetaMask UI.
Example
- Manifest
- Usage
{
"initialPermissions": {
"snap_getPreferences": {}
}
}
const preferences = await snap.request({
method: "snap_getPreferences",
});
console.log(preferences);
// {
// locale: 'en',
// currency: 'usd',
// ...
// }