@metamask/preferences-controller
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -9,2 +9,6 @@ # Changelog | ||
## [2.1.0] | ||
### Added | ||
- `disabledRpcMethodPreferences` state to PreferencesController ([#1109](https://github.com/MetaMask/core/pull/1109)). See [this PR on extension](https://github.com/MetaMask/metamask-extension/pull/17308) and [this ticket](https://github.com/MetaMask/metamask-mobile/issues/5676) | ||
## [2.0.0] | ||
@@ -33,3 +37,4 @@ ### Removed | ||
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@2.0.0...HEAD | ||
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@2.1.0...HEAD | ||
[2.1.0]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@2.0.0...@metamask/preferences-controller@2.1.0 | ||
[2.0.0]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@1.0.2...@metamask/preferences-controller@2.0.0 | ||
@@ -36,0 +41,0 @@ [1.0.2]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@1.0.1...@metamask/preferences-controller@1.0.2 |
@@ -64,2 +64,5 @@ import { BaseController, BaseConfig, BaseState } from '@metamask/base-controller'; | ||
openSeaEnabled: boolean; | ||
disabledRpcMethodPreferences: { | ||
[methodName: string]: boolean; | ||
}; | ||
} | ||
@@ -168,3 +171,10 @@ /** | ||
setOpenSeaEnabled(openSeaEnabled: boolean): void; | ||
/** | ||
* A setter for the user preferences to enable/disable rpc methods. | ||
* | ||
* @param methodName - The RPC method name to change the setting of. | ||
* @param isEnabled - true to enable the rpc method, false to disable it. | ||
*/ | ||
setDisabledRpcMethodPreference(methodName: string, isEnabled: boolean): void; | ||
} | ||
export default PreferencesController; |
@@ -32,2 +32,5 @@ "use strict"; | ||
openSeaEnabled: false, | ||
disabledRpcMethodPreferences: { | ||
eth_sign: false, | ||
}, | ||
}; | ||
@@ -241,2 +244,13 @@ this.initialize(); | ||
} | ||
/** | ||
* A setter for the user preferences to enable/disable rpc methods. | ||
* | ||
* @param methodName - The RPC method name to change the setting of. | ||
* @param isEnabled - true to enable the rpc method, false to disable it. | ||
*/ | ||
setDisabledRpcMethodPreference(methodName, isEnabled) { | ||
const { disabledRpcMethodPreferences } = this.state; | ||
const newDisabledRpcMethods = Object.assign(Object.assign({}, disabledRpcMethodPreferences), { [methodName]: isEnabled }); | ||
this.update({ disabledRpcMethodPreferences: newDisabledRpcMethods }); | ||
} | ||
} | ||
@@ -243,0 +257,0 @@ exports.PreferencesController = PreferencesController; |
{ | ||
"name": "@metamask/preferences-controller", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Manages user-configurable settings for MetaMask", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38138
452