All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- BREAKING: Bump peer dependency
@metamask/network-controllerto^23.0.0(#5507) - Bump
@metamask/utilsto^11.2.0(#5301)
- Bump
@metamask/base-controllerfrom^7.1.1to^8.0.0(#5305) - Bump
@metamask/json-rpc-enginefrom^10.0.2to^10.0.3(#5272) - Bump
@metamask/utilsfrom^11.0.1to^11.1.0(#5223)
- BREAKING: The
SelectedNetworkControllerconstructor now expects bothuseRequestQueuePreferenceandonPreferencesStateChangeoptions (#5065)- These were previously removed in 20.0.0, but have been re-added for compatibility with Mobile.
- Bump
@metamask/base-controllerfrom^7.0.0to^7.1.1(#5079), #5135) - Bump
@metamask/json-rpc-enginefrom^10.0.1to^10.0.2(#5082) - Bump
@metamask/utilsfrom^10.0.0to^11.0.1(#5080)- This upgrade is not a breaking change because this package does not use
generateRandomMnemonic.
- This upgrade is not a breaking change because this package does not use
- Bump
swappable-obj-proxyfrom^2.2.0to^2.3.0(#5036)
- Correct ESM-compatible build so that imports of the following packages that re-export other modules via
export *are no longer corrupted: (#5011)@metamask/swappable-obj-proxy
- Bump
@metamask/base-controllerfrom^7.0.1to^7.0.2(#4862) - Bump
@metamask/json-rpc-enginefrom^10.0.0to^10.0.1(#4862)
- BREAKING: The
SelectedNetworkControllerconstructor no longer expects auseRequestPreferenceboolean nor anonPreferencesStateChangelistener. Removal of these parameters means thatdomainsstate will always be added for sites that are granted permissions. (#4941)
- BREAKING: Bump
@metamask/network-controllerpeer dependency from^21.0.0to^22.0.0(#4841) - Bump
@metamask/utilsto^10.0.0(#4831)
- Ensure that the
networkClientIDis updated indomainsstate before fetching the network proxy for a given domain. This ensures that the network proxy being fetched has not already been garbage collected. (#4801)
- Redirect domains to default endpoint (#4679)
- When the default RPC endpoint changes for a network, domains that were referencing a network client id on that network are redirected to the new default RPC endpoint.
- Produce and export ESM-compatible TypeScript type declaration files in addition to CommonJS-compatible declaration files (#4648)
- Previously, this package shipped with only one variant of type declaration
files, and these files were only CommonJS-compatible, and the
exportsfield inpackage.jsonlinked to these files. This is an anti-pattern and was rightfully flagged by the "Are the Types Wrong?" tool as "masquerading as CJS". All of the ATTW checks now pass.
- Previously, this package shipped with only one variant of type declaration
files, and these files were only CommonJS-compatible, and the
- Remove chunk files (#4648).
- Previously, the build tool we used to generate JavaScript files extracted common code to "chunk" files. While this was intended to make this package more tree-shakeable, it also made debugging more difficult for our development teams. These chunk files are no longer present.
- BREAKING: Bump devDependency and peerDependency
@metamask/network-controllerfrom^20.0.0to^21.0.0(#4618, #4651) - Bump
@metamask/base-controllerfrom^6.0.2to^7.0.0(#4625, #4643) - Bump
typescriptfrom~5.0.4to~5.2.2(#4576, #4584)
- BREAKING: Bump dependency and peerDependency
@metamask/permission-controllerfrom^10.0.0to^11.0.0(#4544) - Remove
@metamask/network-controllerand@metamask/permission-controllerdependencies #4556- These were listed under
peerDependenciesalready, so they were redundant as dependencies.
- These were listed under
- Upgrade TypeScript version to
~5.0.4and setmoduleResolutionoption toNode16(#3645) - Bump
@metamask/base-controllerfrom^6.0.0to^6.0.2(#4517, #4544) - Bump
@metamask/json-rpc-enginefrom^9.0.0to^9.0.2(#4517, #4544) - Bump
@metamask/utilsfrom^8.3.0to^9.1.0(#4516, #4529)
- BREAKING: Bump peerDependency
@metamask/network-controllerto^20.0.0(#4508)
setNetworkClientId()no longer modifies state nor creates/updates proxies when theuseRequestQueuePreferenceflag is false (#4388)
- No longer add domains that have been granted permissions to
domainsstate (nor create a selected network proxy for it) unless theuseRequestQueuePreferenceflag is true (#4368)
- BREAKING: Bump minimum Node version to 18.18 (#3611)
- BREAKING: Bump dependency and peer dependency
@metamask/network-controllerto^19.0.0(#4352) - BREAKING: Bump dependency and peer dependency
@metamask/permission-controllerto^10.0.0(#4352) - Bump
@metamask/base-controllerto^6.0.0(#4352) - Bump
@metamask/json-rpc-engineto^9.0.0(#4352)
- BREAKING: Bump dependency and peer dependency
@metamask/network-controllerto^18.1.3(#4342) - BREAKING: Bump dependency and peer dependency
@metamask/permission-controllerto^9.1.1(#4342)
getProviderAndBlockTrackernow returns theNetworkController's globally selected network client proxy if thedomainarg is eithermetamaskor a snap (identified as starting withnpm:orlocal:) (#4259)- BREAKING: Now when
setNetworkClientIdForDomainis called with a snap's domain (identified as starting withnpm:orlocal:), thedomainwill not be added to state and no proxy will be created for this domain in thedomainProxyMap(#4258)- In order to remove snaps that made it into
domainsstate prior to this change, consumers will need to run a migration.
- In order to remove snaps that made it into
- Bump
@metamask/json-rpc-engineto^8.0.2(#4234) - Bump
@metamask/base-controllerto^5.0.2(#4232)
- When
getProviderAndBlockTrackeris called with adomainfor which there is no cachednetworkProxyin thedomainProxyMap, if theuseRequestQueuepreference is off and thedomaindoes not have permissions the newly creatednetworkProxyfor thisdomainwill be pointed at theNetworkController's own proxy of the globally selectednetworkClient. (#4187)
- These changes keep the per domain proxies (stored in domainProxyMap) pointing to the correct network client instance when the "Select networks for each site" toggle is turned on and off.
- BREAKING: A parameter
useRequestQueuePreferencewhich should point to the current preferences state foruseRequestQueueis now required by the constructor (#4130) -
- BREAKING: An
onPreferencesStateChangeargument that should subscribe toPreferencesControllerstate changes and call a callback with the updated state is now a required parameter in the constructor options object. (#4130)
- BREAKING: An
- BREAKING: A parameter
- The
getUseRequestQueueparameter is no longer expected by the constructor. (#4130)
- Now exports the
Domaintype (#4104)
- Previously the
SelectedNetworkControlleronly constructed proxies for domains that had permissions. Other domains have no associated proxy and thegetProviderAndBlockTrackermethod would throw an error. This was problematic because we grab the network client for an origin a single time when constructing an RPC pipeline for that origin in the MetaMask extension. We don't re-create the RPC pipeline when permissions change. That means that the pipeline is setup with the wrong network client and cannot be updated. The following changes ensure seamlessly proxying calls during sessions where a dapp connects/disconnects and provides a path for clients to prune inactive proxies:- BREAKING:
SelectedNetworkControllernow expects adomainProxyMapparam - which is a Map of Domain to NetworkProxy - in its constructor (#4104)- This
domainProxyMapis expected to automatically delete entries for domains that are no longer connected to the wallet. TheSelectedNetworkControllerhandles adding entries, but it can't handle removal, as it doesn't know which connections are active. - You can pass in a plain
Maphere and it will work, but during longer sessions this might grow unbounded, resulting in a memory leak.
- This
- BREAKING:
SelectedNetworkControllernow requiresNetworkController:getSelectedNetworkClientas an allowed action (#4063) getProviderAndBlockTrackermethod no longer throws an error if theuseRequestQueueflag is false (#4063)getProviderAndBlockTrackermethod no longer throws an error if there is nonetworkClientIdset for the passed domain. Now it returns a proxy pointed at the globally selected network instead. (#4063)
- BREAKING:
- Bump dependency
@metamask/network-controllerto^18.1.0(#4121)
- Previously when a domain's permission was removed from
PermissionsController, it's network client proxy would continue to point at thenetworkClientIdit was last set to. Now it is set to follow the globally selected network (#4063)
- Fix
typesfield inpackage.json(#4047)
- BREAKING: Add ESM build (#3998)
- It's no longer possible to import files from
./distdirectly.
- It's no longer possible to import files from
- BREAKING: Bump
@metamask/base-controllerto^5.0.0(#4039)- This version has a number of breaking changes. See the changelog for more.
- BREAKING: Bump dependency and peer dependency on
@metamask/network-controllerto^18.0.0(#4007) - BREAKING: Bump dependency and peer dependency on
@metamask/permission-controllerto^9.0.0(#4007) - Bump
@metamask/json-rpc-engineto^8.0.0(#4007)
- Listen to permissions changes and add/remove
domains(#3969)
- BREAKING remove
perDomainNetworkfrom state (#3989) - BREAKING Add dependency and peer dependency on
@metamask/permission-controller^8.0.1 (#4000)
- BREAKING:
setNetworkClientIdForDomainnow throws an error if passedmetamaskfor the domain param (#3908). - BREAKING:
setNetworkClientIdForDomainnow fails and throws an error if the passed indomainis not currently permissioned in thePermissionsController(#3908). - BREAKING: the
domainsstate now no longer contains ametamaskdomain key. Consumers should instead use theselectedNetworkClientIdfrom theNetworkControllerto get the selected network for themetamaskdomain (#3908). - BREAKING:
getProviderAndBlockTrackernow throws an error if called with any domain while theperDomainNetworkflag is false. Consumers should instead use theproviderandblockTrackerfrom theNetworkControllerwhen theperDomainNetworkflag is false (#3908). - BREAKING:
getProviderAndBlockTrackernow throws an error if called with a domain that does not have a networkClientId set (#3908). - BREAKING:
getNetworkClientIdForDomainnow returns theselectedNetworkClientIdfor the globally selected network if theperDomainNetworkflag is false or if the domain is not in thedomainsstate (#3908).
- BREAKING: Remove logic in
selectedNetworkMiddlewareto set a defaultnetworkClientIdfor the requesting origin in theSelectedNetworkControllerwhen not already set. Now ifnetworkClientIdis not already set for the requesting origin, the middleware will not set a defaultnetworkClientIdfor that origin in theSelectedNetworkControllerbut will continue to add theselectedNetworkClientIdfrom theNetworkControllerto thenetworkClientIdproperty on the request object (#3908).
- The
SelectedNetworkControllernow listens fornetworkConfigurationremoval events on theNetworkControllerand updates domains pointed at a removednetworkClientIdto theselectedNetworkClientId(#3926).
- Selected network controller should update all domains when perDomainNetwork feature flag is off (#3834)
- BREAKING: Bump
@metamask/network-controllerpeer dependency to^17.2.0(#3821) - Bump
@metamask/swappable-obj-proxyto^2.2.0(#3784) - Bump
@metamask/utilsto^8.3.0(#3769) - Bump
@metamask/base-controllerto^4.1.1(#3760, #3821) - Bump
@metamask/json-rpc-engineto^7.3.2(#3821)
- BREAKING: Bump
@metamask/network-controllerdependency and peer dependency from^17.0.0to^17.1.0(#3695) - Bump
@metamask/base-controllerto^4.0.1(#3695) - Bump
@metamask/json-rpc-engineto^7.3.1(#3695)
- Add
SelectedNetworkMiddlewareJsonRpcRequesttype (#1970). - Add
setPerDomainNetworkmethod to reset proxies when flag toggled (#3593). - Add
stateas a constructor argument (#3585).
- BREAKING: Rename
SelectedNetworkControllerActiontoSelectedNetworkControllerActionsandSelectedNetworkControllerEventtoSelectedNetworkControllerEventsfor consistency with corresponding type exports from other controllers (#1970). - BREAKING:
createSelectedNetworkMiddlewarereturn type is constrained to satisfyJsonRpcMiddleware<JsonRpcParams, Json>, and itsreqparameter is constrained to satisfySelectedNetworkMiddlewareJsonRpcRequest(#1970).
- BREAKING: Bump
@metamask/base-controllerto ^4.0.0 (#2063)- This is breaking because the type of the
messengerhas backward-incompatible changes. See the changelog for this package for more.
- This is breaking because the type of the
- Bump
@metamask/network-controllerto ^17.0.0 (#2063)
- BREAKING: Bump dependency and peer dependency on
@metamask/network-controllerto ^16.0.0
- Bump
@metamask/json-rpc-enginefrom^7.1.0to^7.2.0(#1895)
- Add
getProviderAndBlockTrackermethod to get a proxy provider fromNetworkControllerfor a given origin/domain. (#1806)
- No longer update
selectedNetworkClientIdwhen theNetworkControllerprovider changes. (#1806) - Bump dependency and peer dependency on
@metamask/network-controllerto ^15.1.0
- BREAKING: Bump dependency and peer dependency on
@metamask/network-controllerto ^14.0.0 (#1747) - BREAKING: Move from
json-rpc-engine^7.1.1 to@metamask/json-rpc-engine^8.0.0 (#1653) - BREAKING: Bump dependency and peer dependency on
@metamask/network-controllerto ^15.0.0 - Bump dependency on
@metamask/base-controllerto ^3.2.3 (#1747)
setNetworkClientIdForDomain()will now ignore the passed in domain value and set thenetworkClientIdfor the metamask domain instead when thestate.perDomainNetworkflag is false (default) (#1757)
- Update TypeScript to v4.8.x (#1718)
- BREAKING: Bump peer dependency on
@metamask/network-controllerto ^13.0.0 (#1633)
- Initial Release (#1643)