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
@metamask/network-controller
peer dependency from^21.0.0
to^22.0.0
(#4841) - Bump
@metamask/utils
to^10.0.0
(#4831)
- Ensure that the
networkClientID
is updated indomains
state 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
exports
field inpackage.json
linked 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-controller
from^20.0.0
to^21.0.0
(#4618, #4651) - Bump
@metamask/base-controller
from^6.0.2
to^7.0.0
(#4625, #4643) - Bump
typescript
from~5.0.4
to~5.2.2
(#4576, #4584)
- BREAKING: Bump dependency and peerDependency
@metamask/permission-controller
from^10.0.0
to^11.0.0
(#4544) - Remove
@metamask/network-controller
and@metamask/permission-controller
dependencies #4556- These were listed under
peerDependencies
already, so they were redundant as dependencies.
- These were listed under
- Upgrade TypeScript version to
~5.0.4
and setmoduleResolution
option toNode16
(#3645) - Bump
@metamask/base-controller
from^6.0.0
to^6.0.2
(#4517, #4544) - Bump
@metamask/json-rpc-engine
from^9.0.0
to^9.0.2
(#4517, #4544) - Bump
@metamask/utils
from^8.3.0
to^9.1.0
(#4516, #4529)
- BREAKING: Bump peerDependency
@metamask/network-controller
to^20.0.0
(#4508)
setNetworkClientId()
no longer modifies state nor creates/updates proxies when theuseRequestQueuePreference
flag is false (#4388)
- No longer add domains that have been granted permissions to
domains
state (nor create a selected network proxy for it) unless theuseRequestQueuePreference
flag is true (#4368)
- BREAKING: Bump minimum Node version to 18.18 (#3611)
- BREAKING: Bump dependency and peer dependency
@metamask/network-controller
to^19.0.0
(#4352) - BREAKING: Bump dependency and peer dependency
@metamask/permission-controller
to^10.0.0
(#4352) - Bump
@metamask/base-controller
to^6.0.0
(#4352) - Bump
@metamask/json-rpc-engine
to^9.0.0
(#4352)
- BREAKING: Bump dependency and peer dependency
@metamask/network-controller
to^18.1.3
(#4342) - BREAKING: Bump dependency and peer dependency
@metamask/permission-controller
to^9.1.1
(#4342)
getProviderAndBlockTracker
now returns theNetworkController
's globally selected network client proxy if thedomain
arg is eithermetamask
or a snap (identified as starting withnpm:
orlocal:
) (#4259)- BREAKING: Now when
setNetworkClientIdForDomain
is called with a snap's domain (identified as starting withnpm:
orlocal:
), thedomain
will 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
domains
state prior to this change, consumers will need to run a migration.
- In order to remove snaps that made it into
- Bump
@metamask/json-rpc-engine
to^8.0.2
(#4234) - Bump
@metamask/base-controller
to^5.0.2
(#4232)
- When
getProviderAndBlockTracker
is called with adomain
for which there is no cachednetworkProxy
in thedomainProxyMap
, if theuseRequestQueue
preference is off and thedomain
does not have permissions the newly creatednetworkProxy
for thisdomain
will 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
useRequestQueuePreference
which should point to the current preferences state foruseRequestQueue
is now required by the constructor (#4130) -
- BREAKING: An
onPreferencesStateChange
argument that should subscribe toPreferencesController
state 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
getUseRequestQueue
parameter is no longer expected by the constructor. (#4130)
- Now exports the
Domain
type (#4104)
- Previously the
SelectedNetworkController
only constructed proxies for domains that had permissions. Other domains have no associated proxy and thegetProviderAndBlockTracker
method 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:
SelectedNetworkController
now expects adomainProxyMap
param - which is a Map of Domain to NetworkProxy - in its constructor (#4104)- This
domainProxyMap
is expected to automatically delete entries for domains that are no longer connected to the wallet. TheSelectedNetworkController
handles adding entries, but it can't handle removal, as it doesn't know which connections are active. - You can pass in a plain
Map
here and it will work, but during longer sessions this might grow unbounded, resulting in a memory leak.
- This
- BREAKING:
SelectedNetworkController
now requiresNetworkController:getSelectedNetworkClient
as an allowed action (#4063) getProviderAndBlockTracker
method no longer throws an error if theuseRequestQueue
flag is false (#4063)getProviderAndBlockTracker
method no longer throws an error if there is nonetworkClientId
set for the passed domain. Now it returns a proxy pointed at the globally selected network instead. (#4063)
- BREAKING:
- Bump dependency
@metamask/network-controller
to^18.1.0
(#4121)
- Previously when a domain's permission was removed from
PermissionsController
, it's network client proxy would continue to point at thenetworkClientId
it was last set to. Now it is set to follow the globally selected network (#4063)
- Fix
types
field inpackage.json
(#4047)
- BREAKING: Add ESM build (#3998)
- It's no longer possible to import files from
./dist
directly.
- It's no longer possible to import files from
- BREAKING: Bump
@metamask/base-controller
to^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-controller
to^18.0.0
(#4007) - BREAKING: Bump dependency and peer dependency on
@metamask/permission-controller
to^9.0.0
(#4007) - Bump
@metamask/json-rpc-engine
to^8.0.0
(#4007)
- Listen to permissions changes and add/remove
domains
(#3969)
- BREAKING remove
perDomainNetwork
from state (#3989) - BREAKING Add dependency and peer dependency on
@metamask/permission-controller
^8.0.1 (#4000)
- BREAKING:
setNetworkClientIdForDomain
now throws an error if passedmetamask
for the domain param (#3908). - BREAKING:
setNetworkClientIdForDomain
now fails and throws an error if the passed indomain
is not currently permissioned in thePermissionsController
(#3908). - BREAKING: the
domains
state now no longer contains ametamask
domain key. Consumers should instead use theselectedNetworkClientId
from theNetworkController
to get the selected network for themetamask
domain (#3908). - BREAKING:
getProviderAndBlockTracker
now throws an error if called with any domain while theperDomainNetwork
flag is false. Consumers should instead use theprovider
andblockTracker
from theNetworkController
when theperDomainNetwork
flag is false (#3908). - BREAKING:
getProviderAndBlockTracker
now throws an error if called with a domain that does not have a networkClientId set (#3908). - BREAKING:
getNetworkClientIdForDomain
now returns theselectedNetworkClientId
for the globally selected network if theperDomainNetwork
flag is false or if the domain is not in thedomains
state (#3908).
- BREAKING: Remove logic in
selectedNetworkMiddleware
to set a defaultnetworkClientId
for the requesting origin in theSelectedNetworkController
when not already set. Now ifnetworkClientId
is not already set for the requesting origin, the middleware will not set a defaultnetworkClientId
for that origin in theSelectedNetworkController
but will continue to add theselectedNetworkClientId
from theNetworkController
to thenetworkClientId
property on the request object (#3908).
- The
SelectedNetworkController
now listens fornetworkConfiguration
removal events on theNetworkController
and updates domains pointed at a removednetworkClientId
to theselectedNetworkClientId
(#3926).
- Selected network controller should update all domains when perDomainNetwork feature flag is off (#3834)
- BREAKING: Bump
@metamask/network-controller
peer dependency to^17.2.0
(#3821) - Bump
@metamask/swappable-obj-proxy
to^2.2.0
(#3784) - Bump
@metamask/utils
to^8.3.0
(#3769) - Bump
@metamask/base-controller
to^4.1.1
(#3760, #3821) - Bump
@metamask/json-rpc-engine
to^7.3.2
(#3821)
- BREAKING: Bump
@metamask/network-controller
dependency and peer dependency from^17.0.0
to^17.1.0
(#3695) - Bump
@metamask/base-controller
to^4.0.1
(#3695) - Bump
@metamask/json-rpc-engine
to^7.3.1
(#3695)
- Add
SelectedNetworkMiddlewareJsonRpcRequest
type (#1970). - Add
setPerDomainNetwork
method to reset proxies when flag toggled (#3593). - Add
state
as a constructor argument (#3585).
- BREAKING: Rename
SelectedNetworkControllerAction
toSelectedNetworkControllerActions
andSelectedNetworkControllerEvent
toSelectedNetworkControllerEvents
for consistency with corresponding type exports from other controllers (#1970). - BREAKING:
createSelectedNetworkMiddleware
return type is constrained to satisfyJsonRpcMiddleware<JsonRpcParams, Json>
, and itsreq
parameter is constrained to satisfySelectedNetworkMiddlewareJsonRpcRequest
(#1970).
- BREAKING: Bump
@metamask/base-controller
to ^4.0.0 (#2063)- This is breaking because the type of the
messenger
has backward-incompatible changes. See the changelog for this package for more.
- This is breaking because the type of the
- Bump
@metamask/network-controller
to ^17.0.0 (#2063)
- BREAKING: Bump dependency and peer dependency on
@metamask/network-controller
to ^16.0.0
- Bump
@metamask/json-rpc-engine
from^7.1.0
to^7.2.0
(#1895)
- Add
getProviderAndBlockTracker
method to get a proxy provider fromNetworkController
for a given origin/domain. (#1806)
- No longer update
selectedNetworkClientId
when theNetworkController
provider changes. (#1806) - Bump dependency and peer dependency on
@metamask/network-controller
to ^15.1.0
- BREAKING: Bump dependency and peer dependency on
@metamask/network-controller
to ^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-controller
to ^15.0.0 - Bump dependency on
@metamask/base-controller
to ^3.2.3 (#1747)
setNetworkClientIdForDomain()
will now ignore the passed in domain value and set thenetworkClientId
for the metamask domain instead when thestate.perDomainNetwork
flag is false (default) (#1757)
- Update TypeScript to v4.8.x (#1718)
- BREAKING: Bump peer dependency on
@metamask/network-controller
to ^13.0.0 (#1633)
- Initial Release (#1643)