Skip to content

Commit 2635adc

Browse files
authored
refactor: address tech debt for chain agnostic permission code repeated on extension and mobile codebases (#6225)
## Explanation While working on [adding Multichain API to Flask on mobile](MetaMask/metamask-mobile#14756), some code that is common to the browser extension repository was also created on the mobile codebase, namely [these permissions utilities](https://github.com/MetaMask/metamask-mobile/blob/main/app/util/permissions/index.ts) which are also present in the `extension` [metamask-controller module](https://github.com/MetaMask/metamask-extension/blob/main/app/scripts/metamask-controller.js): - `getCaip25PermissionFromLegacyPermissions` - `requestPermittedChainsPermissionIncremental` The work proposed in this pull request migrates these common functionalities onto our `@metamask/chain-agnostic-permissions` package, so that they can be imported on both `mobile` and `extension` to be used. <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> ## References * Fixes MetaMask/MetaMask-planning#4899 <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## Changelog <!-- THIS SECTION IS NO LONGER NEEDED. The process for updating changelogs has changed. Please consult the "Updating changelogs" section of the Contributing doc for more. --> ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
1 parent b8e4993 commit 2635adc

File tree

6 files changed

+812
-3
lines changed

6 files changed

+812
-3
lines changed

packages/chain-agnostic-permission/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Added `getCaip25PermissionFromLegacyPermissions` and `requestPermittedChainsPermissionIncremental` misc functions. ([#6225](https://github.com/MetaMask/core/pull/6225))
13+
1014
### Changed
1115

1216
- Bump `@metamask/controller-utils` from `^11.10.0` to `^11.11.0` ([#6069](https://github.com/MetaMask/core/pull/6069))

0 commit comments

Comments
 (0)