Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@metamask/preferences-controller

Package Overview
Dependencies
Maintainers
8
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/preferences-controller - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0

8

CHANGELOG.md

@@ -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

42

dist/PreferencesController.d.ts

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc