@metamask/preferences-controller
Advanced tools
Comparing version 2.1.0 to 3.0.0
@@ -9,2 +9,7 @@ # Changelog | ||
## [3.0.0] | ||
### Changed | ||
- **BREAKING:** Migrate network configurations from `PreferencesController` to `NetworkController` ([#1064](https://github.com/MetaMask/core/pull/1064)) | ||
- Consumers will need to adapt by reading network data from `NetworkConfigurations` state on `NetworkController` rather than `frequentRpcList` on `PreferencesController`. See `NetworkController` v6.0.0 changelog entry for more details. | ||
## [2.1.0] | ||
@@ -37,3 +42,4 @@ ### Added | ||
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@2.1.0...HEAD | ||
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@3.0.0...HEAD | ||
[3.0.0]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@2.1.0...@metamask/preferences-controller@3.0.0 | ||
[2.1.0]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@2.0.0...@metamask/preferences-controller@2.1.0 | ||
@@ -40,0 +46,0 @@ [2.0.0]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@1.0.2...@metamask/preferences-controller@2.0.0 |
@@ -15,26 +15,2 @@ import { BaseController, BaseConfig, BaseState } from '@metamask/base-controller'; | ||
/** | ||
* Custom RPC network information | ||
* | ||
* @property rpcUrl - RPC target URL. | ||
* @property chainId - Network ID as per EIP-155 | ||
* @property nickname - Personalized network name. | ||
* @property ticker - Currency ticker. | ||
* @property rpcPrefs - Personalized preferences. | ||
*/ | ||
export interface FrequentRpc { | ||
rpcUrl: string; | ||
chainId?: number; | ||
nickname?: string; | ||
ticker?: string; | ||
rpcPrefs?: RpcPreferences; | ||
} | ||
/** | ||
* Custom RPC network preferences | ||
* | ||
* @param blockExplorerUrl - Block explorer URL. | ||
*/ | ||
export interface RpcPreferences { | ||
blockExplorerUrl: string; | ||
} | ||
/** | ||
* @type PreferencesState | ||
@@ -44,3 +20,2 @@ * | ||
* @property featureFlags - Map of specific features to enable or disable | ||
* @property frequentRpcList - A list of custom RPCs to provide the user | ||
* @property identities - Map of addresses to ContactEntry objects | ||
@@ -54,3 +29,2 @@ * @property lostIdentities - Map of lost addresses to ContactEntry objects | ||
}; | ||
frequentRpcList: FrequentRpc[]; | ||
ipfsGateway: string; | ||
@@ -128,18 +102,2 @@ identities: { | ||
/** | ||
* Adds custom RPC URL to state. | ||
* | ||
* @param url - The custom RPC URL. | ||
* @param chainId - The chain ID of the network, as per EIP-155. | ||
* @param ticker - Currency ticker. | ||
* @param nickname - Personalized network name. | ||
* @param rpcPrefs - Personalized preferences. | ||
*/ | ||
addToFrequentRpcList(url: string, chainId?: number, ticker?: string, nickname?: string, rpcPrefs?: RpcPreferences): void; | ||
/** | ||
* Removes custom RPC URL from state. | ||
* | ||
* @param url - Custom RPC URL. | ||
*/ | ||
removeFromFrequentRpcList(url: string): void; | ||
/** | ||
* Sets selected address. | ||
@@ -146,0 +104,0 @@ * |
@@ -24,3 +24,2 @@ "use strict"; | ||
featureFlags: {}, | ||
frequentRpcList: [], | ||
identities: {}, | ||
@@ -157,44 +156,2 @@ ipfsGateway: 'https://ipfs.io/ipfs/', | ||
/** | ||
* Adds custom RPC URL to state. | ||
* | ||
* @param url - The custom RPC URL. | ||
* @param chainId - The chain ID of the network, as per EIP-155. | ||
* @param ticker - Currency ticker. | ||
* @param nickname - Personalized network name. | ||
* @param rpcPrefs - Personalized preferences. | ||
*/ | ||
addToFrequentRpcList(url, chainId, ticker, nickname, rpcPrefs) { | ||
const { frequentRpcList } = this.state; | ||
const index = frequentRpcList.findIndex(({ rpcUrl }) => { | ||
return rpcUrl === url; | ||
}); | ||
if (index !== -1) { | ||
frequentRpcList.splice(index, 1); | ||
} | ||
const newFrequestRpc = { | ||
rpcUrl: url, | ||
chainId, | ||
ticker, | ||
nickname, | ||
rpcPrefs, | ||
}; | ||
frequentRpcList.push(newFrequestRpc); | ||
this.update({ frequentRpcList: [...frequentRpcList] }); | ||
} | ||
/** | ||
* Removes custom RPC URL from state. | ||
* | ||
* @param url - Custom RPC URL. | ||
*/ | ||
removeFromFrequentRpcList(url) { | ||
const { frequentRpcList } = this.state; | ||
const index = frequentRpcList.findIndex(({ rpcUrl }) => { | ||
return rpcUrl === url; | ||
}); | ||
if (index !== -1) { | ||
frequentRpcList.splice(index, 1); | ||
} | ||
this.update({ frequentRpcList: [...frequentRpcList] }); | ||
} | ||
/** | ||
* Sets selected address. | ||
@@ -201,0 +158,0 @@ * |
{ | ||
"name": "@metamask/preferences-controller", | ||
"version": "2.1.0", | ||
"version": "3.0.0", | ||
"description": "Manages user-configurable settings for MetaMask", | ||
@@ -33,3 +33,3 @@ "keywords": [ | ||
"@metamask/base-controller": "^2.0.0", | ||
"@metamask/controller-utils": "^3.0.0" | ||
"@metamask/controller-utils": "^3.1.0" | ||
}, | ||
@@ -36,0 +36,0 @@ "devDependencies": { |
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
32959
367