Skip to content

Latest commit

 

History

History
327 lines (226 loc) · 23.5 KB

CHANGELOG.md

File metadata and controls

327 lines (226 loc) · 23.5 KB

Changelog

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.

Fixed

  • Fix issue where queuedRequestCount state is not updated after flushing requests for an origin (#4898)

Added

  • BREAKING: The QueuedRequestController now requires the canRequestSwitchNetworkWithoutApproval callback in its constructor params. (#4846)

Changed

  • The QueuedRequestController now ensures that a request that can switch the globally selected network without approval is queued behind any existing pending requests. (#4846)

Fixed

  • The QueuedRequestController now ensures that any queued requests for a origin are failed if a request that can switch the globally selected network without approval actually does change the globally selected network for that origin. (#4846)

Changed

  • BREAKING: Bump @metamask/network-controller peer dependency from ^21.0.0 to ^22.0.0 (#4841)
  • Bump @metamask/controller-utils to ^11.4.0 (#4834)
  • Bump @metamask/rpc-errors to ^7.0.1 (#4831)
  • Bump @metamask/utils to ^10.0.0 (#4831)

Changed

  • Batch processing now considers both origin and networkClientId, ensuring requests targeting different networks are processed separately. (#4718)
  • Incoming requests to enqueueRequest now must include a networkClientId; an error is thrown if it's missing. This was previously a required part of the type but since consumers like the extension do not have extensive typescript coverage this wasn't definitively enforced. (#4718)

Fixed

  • 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 in package.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.
  • 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.
  • Remove extra slash when constructing user storage url (#4702)

Changed

  • BREAKING: Bump devDependency and peerDependency @metamask/network-controller from ^20.0.0 to ^21.0.0 (#4618, #4651)
  • BREAKING: Bump devDependency and peerDependency @metamask/selected-network-controller from ^17.0.0 to ^18.0.0 (#4651)
  • Bump @metamask/base-controller from ^6.0.2 to ^7.0.0 (#4625, #4643)
  • Bump @metamask/controller-utils from ^11.0.2 to ^11.2.0 (#4639, #4651)
  • Bump typescript from ~5.0.4 to ~5.2.2 (#4576, #4584)

Changed

  • BREAKING: Bump peerDependency @metamask/selected-network-controller from ^16.0.0 to ^17.0.0 (#4548)
  • Upgrade TypeScript version to ~5.0.4 and set moduleResolution option to Node16 (#3645)
  • Bump @metamask/base-controller from ^6.0.0 to ^6.0.2 (#4517, #4544)
  • Bump @metamask/controller-utils from ^11.0.0 to ^11.0.2 (#4517, #4544)
  • Bump @metamask/json-rpc-engine from ^9.0.0 to ^9.0.2 (#4517, #4544)
  • Bump @metamask/rpc-errors from ^6.2.1 to ^6.3.1 (#4516)
  • Bump @metamask/utils from ^8.3.0 to ^9.1.0 (#4516, #4529)

Changed

  • BREAKING: Bump peerDependency @metamask/network-controller to ^20.0.0 (#4508)
  • BREAKING: Bump peerDependency @metamask/selected-network-controller to ^16.0.0 (#4508)

Added

  • BREAKING: QueuedRequestController constructor params now requires the showApprovalRequest hook that is called when the approval request UI should be opened/focused as the result of a request with confirmation being enqueued (#4456)

Changed

  • BREAKING: QueuedRequestController constructor no longer accepts the methodsRequiringNetworkSwitch array param. It's now replaced with the shouldRequestSwitchNetwork function param which should return true when a request requires the globally selected network to match that of the dapp from which the request originated. (#4423)
  • BREAKING: createQueuedRequestMiddleware no longer accepts the methodsWithConfirmation array typed param. It's now replaced with the shouldEnqueueRequest function typed param which should return true when a request should be handled by the QueuedRequestController. (#4423)

Changed

  • BREAKING: Bump minimum Node version to 18.18 (#3611)
  • BREAKING: Bump peer dependency @metamask/network-controller to ^19.0.0 (#4352)
  • BREAKING: Bump peer dependency @metamask/selected-network-controller to ^15.0.0 (#4352)
  • Bump @metamask/base-controller to ^6.0.0 (#4352)
  • Bump @metamask/controller-utils to ^11.0.0 (#4352)
  • Bump @metamask/json-rpc-engine to ^9.0.0 (#4352)

Changed

  • BREAKING: Bump peer dependency @metamask/network-controller to ^18.1.3 (#4342)
  • BREAKING: Bump dependency and peer dependency @metamask/selected-network-controller to ^14.0.0 (#4342)
  • Bump @metamask/controller-utils to ^10.0.0 (#4342)

Changed

  • BREAKING: Bump peer dependency @metamask/selected-network-controller to ^13.0.0 (#4260)
  • Bump @metamask/json-rpc-engine to ^8.0.2 (#4234)
  • Bump @metamask/base-controller to ^5.0.2 (#4232)

Changed

  • BREAKING: Bump peer dependency @metamask/selected-network-controller to ^12.0.0 (#4173)

Added

  • BREAKING: The QueuedRequestMiddleware constructor now requires the methodsWithConfirmation param which should be a list of methods that can trigger confirmations (#4066)
  • BREAKING: The QueuedRequestController constructor now requires the methodsRequiringNetworkSwitch param which should be a list of methods that need the globally selected network to switched to the dapp selected network before being processed (#4066)
  • BREAKING: Clear pending confirmations (for both queued and non-queued requests) after processing revokePermissions. We now require a function to be passed into the constructor (clearPendingConfirmations) which will be called when permissions are revoked for a domain who currently has pending confirmations that are not queued. This is done by piggybacking on SelectedNetworkController:stateChange in order to serve as a proxy for permissions being revoked. (#4165)
  • BREAKING: The QueuedRequestController will now flush the RequestQueue after a dapp switches networks. QueuedRequestController now requires a subscription on SelectedNetworkController:stateChange, and upon receiving stateChanges for adding or replacing selectedNetworkController.state.domains, we flush the queue for the domain in question. (#4139)

Changed

  • BREAKING: QueuedRequestController.enqueueRequest() now ensures the globally selected network matches the dapp selected network before processing methods listed in the methodsRequiringNetworkSwitch constructor param. This replaces the previous behavior of switching for all methods except eth_requestAccounts. (#4066)

Changed

  • BREAKING: Bump peer dependency @metamask/selected-network-controller to ^11.0.0 (#4121)
  • Bump @metamask/controller-utils to ^9.0.2 (#4065)

Fixed

  • Fix types field in package.json (#4047)

Added

  • BREAKING: Add ESM build (#3998)
    • It's no longer possible to import files from ./dist directly.
  • Export QueuedRequestControllerGetStateAction and QueuedRequestControllerStateChangeEvent (#3984)

Changed

  • BREAKING: The QueuedRequestController will now batch queued requests by origin (#3781, #4038)
    • All of the requests in a single batch will be processed in parallel.
    • Requests get processed in order of insertion, even across origins/batches.
    • All requests get processed even in the event of preceding requests failing.
  • BREAKING: The queuedRequestCount state no longer includes requests that are currently being processed; it just counts requests that are queued (#3781)
  • BREAKING: The QueuedRequestController no longer triggers a confirmation when a network switch is needed (#3781)
    • The network switch now happens automatically, with no confirmation.
    • A new QueuedRequestController:networkSwitched event has been added to communicate when this has happened.
    • The QueuedRequestController messenger no longer needs access to the actions NetworkController:getNetworkConfigurationByNetworkClientId and ApprovalController:addRequest.
    • The package @metamask/approval-controller has been completely removed as a dependency
  • BREAKING: The QueuedRequestController method enqueueRequest is now responsible for switching the network before processing a request, rather than the QueuedRequestMiddleware (#3968)
    • Functionally the behavior is the same: before processing each request, we compare the request network client with the current selected network client, and we switch the current selected network client if necessary.
    • The QueuedRequestController messenger now requires four additional allowed actions:
      • NetworkController:getState
      • NetworkController:setActiveNetwork
      • NetworkController:getNetworkConfigurationByNetworkClientId
      • ApprovalController:addRequest
    • The QueuedRequestController method enqueueRequest now takes one additional parameter, the request object.
    • createQueuedRequestMiddleware no longer takes a controller messenger; instead it takes the enqueueRequest method from QueuedRequestController as a parameter.
  • BREAKING: Remove the QueuedRequestController:countChanged event (#3985)
    • The number of queued requests is now tracked in controller state, as the queuedRequestCount property. Use the QueuedRequestController:stateChange event to be notified of count changes instead.
  • BREAKING: Remove the length method (#3985)
    • The number of queued requests is now tracked in controller state, as the queuedRequestCount property.
  • 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 peer dependency on @metamask/network-controller to ^18.0.0 (#4039)
  • BREAKING: Bump peer dependency on @metamask/selected-network-controller to ^10.0.0 (#3996)
  • Bump @metamask/controller-utils to ^9.0.0 (#4007)
  • Bump @metamask/json-rpc-engine to ^8.0.0 (#4007)
  • Bump @metamask/rpc-errors to ^6.2.1 (#3970)

Added

  • Add queuedRequestCount state (#3919)

Changed

  • BREAKING: Bump @metamask/selected-network-controller peer dependency to ^8.0.0 (#3958)
  • Deprecate the length method in favor of the queuedRequestCount state (#3919)
  • Deprecate the countChanged event in favor of the stateChange event (#3919)

Changed

  • BREAKING: Bump @metamask/approval-controller peer dependency to ^5.1.2 (#3821)
  • BREAKING: Bump @metamask/network-controller peer dependency to ^17.2.0 (#3821)
  • BREAKING: Bump @metamask/selected-network-controller peer dependency to ^7.0.0 (#3821)
  • The action NetworkController:setProviderType is no longer used, so it's no longer required by the QueuedRequestController messenger (#3807)
  • 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/controller-utils to ^8.0.2 (#3821)
  • Bump @metamask/json-rpc-engine to ^7.3.2 (#3821)

Added

  • Add QueuedRequestMiddlewareJsonRpcRequest type (#1970).

Changed

  • BREAKING: QueuedRequestControllerMessenger can no longer be defined with any allowed actions or events (#1970).
  • BREAKING: Add @metamask/approval-controller as dependency and peer dependency (#1970, #3695, #3680)
  • BREAKING: Bump @metamask/network-controller dependency and peer dependency from ^17.0.0 to ^17.1.0 (#3695)
  • BREAKING: Bump @metamask/selected-network-controller dependency and peer dependency from ^4.0.0 to ^6.1.0 (#3695, #3603)
  • Bump @metamask/base-controller to ^4.0.1 (#3695)
  • Bump @metamask/controller-utils to ^8.0.1 (#3695, #3678, #3667, #3580)
  • Bump @metamask/base-controller to ^4.0.1 (#3695)

Fixed

  • Remove @metamask/approval-controller, @metamask/network-controller, and @metamask/selected-network-controller dependencies (#3607)

Changed

  • 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.
  • Bump @metamask/controller-utils to ^6.0.0 (#2063)
  • Bump @metamask/network-controller to ^17.0.0 (#2063)
  • Bump @metamask/selected-network-controller to ^4.0.0 (#2063)

Changed

  • BREAKING: Bump dependency and peer dependency on @metamask/network-controller to ^16.0.0
  • Bump dependency and peer dependency on @metamask/selected-network-controller to ^3.1.2

Changed

  • Bump dependency on @metamask/json-rpc-engine to ^7.2.0 (#1895)
  • Bump @metamask/utils from 8.1.0 to 8.2.0 (#1957)

Fixed

  • Fixes an issue in the extension when 'useRequestQueue' is enabled. The problem occurred when a DApp's selected network differed from the globally selected network, and when the DApp's chosen network was not a built-in network. Under these conditions, the nickname would not be displayed in the 'toNetworkConfiguration' parameter passed to the addApproval function (#2000).
  • Fixes an issue in the extension when 'useRequestQueue' is activated. Previously, when invoking 'wallet_addEthereumChain', if the DApp's selected network was different from the globally selected network, the user was incorrectly prompted to switch the Ethereum chain prior to the 'addEthereumChain' request. With this update, 'addEthereumChain' will still be queued (due to its confirmation requirement), but the unnecessary chain switch prompt has been eliminated (#2000).

Fixed

  • Fix issue where switching chain would ultimately fail due to the wrong networkClientId / type (#1962)

Fixed

  • Add missing methods that require confirmation (#1955)

Added

  • Initial release