Skip to content

Conversation

@adonesky1
Copy link
Contributor

@adonesky1 adonesky1 commented Apr 7, 2025

Changelog

Added

  • Added getCaipAccountIdsFromScopesObjects, getCaipAccountIdsFromCaip25CaveatValue, isInternalAccountInPermittedAccountIds, and isCaipAccountIdInPermittedAccountIds account id functions. (#5609)
  • Added getSupportedScopeObjects, getAllScopesFromScopesObjects, getAllScopesFromCaip25CaveatValue, getAllNonWalletNamespacesFromCaip25CaveatValue, getAllScopesFromPermission, getAllScopesFromCaip25CaveatValue, and isNamespaceInScopesObject
    scope functions. (#5609)
  • Added isKnownSessionPropertyValue and getCaip25CaveatFromPermission misc functions. (#5609)

Changed

  • BREAKING: Renamed setPermittedAccounts to setNonSCACaipAccountIdsInCaip25CaveatValue. (#5609)
  • BREAKING: Renamed setPermittedChainIds to overwriteCaipChainIdsInCaip25CaveatValue. (#5609)
  • BREAKING: Renamed addPermittedChainId to addCaipChainIdInCaip25CaveatValue. (#5609)

Extension: MetaMask/metamask-extension#32152

adonesky1 added a commit to MetaMask/metamask-extension that referenced this pull request Apr 9, 2025
Attempt to address [some concerns about time complexity raised by
@FrederikBolding](#29887 (comment))

rename and reorganize these helpers for easier navigation.

I have [an open PR against core
here](MetaMask/core#5609) where I've made the
improvements + name changes that can be reviewed and merged immediately
after 12.17.0 cut
@adonesky1 adonesky1 force-pushed the ad/more-sip-26-utilities branch from f83ad4d to 7221a6e Compare April 14, 2025 20:49
@adonesky1 adonesky1 force-pushed the ad/more-sip-26-utilities branch from dd7f242 to caaeb88 Compare April 14, 2025 21:13
@jiexi
Copy link
Contributor

jiexi commented Apr 21, 2025

@metamaskbot publish-previews

@github-actions
Copy link
Contributor

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/accounts-controller": "27.0.0-preview-634cc823",
  "@metamask-previews/address-book-controller": "6.0.3-preview-634cc823",
  "@metamask-previews/announcement-controller": "7.0.3-preview-634cc823",
  "@metamask-previews/app-metadata-controller": "1.0.0-preview-634cc823",
  "@metamask-previews/approval-controller": "7.1.3-preview-634cc823",
  "@metamask-previews/assets-controllers": "56.0.0-preview-634cc823",
  "@metamask-previews/base-controller": "8.0.0-preview-634cc823",
  "@metamask-previews/bridge-controller": "13.0.0-preview-634cc823",
  "@metamask-previews/bridge-status-controller": "12.0.1-preview-634cc823",
  "@metamask-previews/build-utils": "3.0.3-preview-634cc823",
  "@metamask-previews/chain-agnostic-permission": "0.3.0-preview-634cc823",
  "@metamask-previews/composable-controller": "11.0.0-preview-634cc823",
  "@metamask-previews/controller-utils": "11.7.0-preview-634cc823",
  "@metamask-previews/earn-controller": "0.11.0-preview-634cc823",
  "@metamask-previews/eip1193-permission-middleware": "0.1.0-preview-634cc823",
  "@metamask-previews/ens-controller": "16.0.0-preview-634cc823",
  "@metamask-previews/eth-json-rpc-provider": "4.1.8-preview-634cc823",
  "@metamask-previews/gas-fee-controller": "23.0.0-preview-634cc823",
  "@metamask-previews/json-rpc-engine": "10.0.3-preview-634cc823",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.7-preview-634cc823",
  "@metamask-previews/keyring-controller": "21.0.2-preview-634cc823",
  "@metamask-previews/logging-controller": "6.0.4-preview-634cc823",
  "@metamask-previews/message-manager": "12.0.1-preview-634cc823",
  "@metamask-previews/multichain": "4.0.0-preview-634cc823",
  "@metamask-previews/multichain-api-middleware": "0.1.1-preview-634cc823",
  "@metamask-previews/multichain-network-controller": "0.3.0-preview-634cc823",
  "@metamask-previews/multichain-transactions-controller": "0.9.0-preview-634cc823",
  "@metamask-previews/name-controller": "8.0.3-preview-634cc823",
  "@metamask-previews/network-controller": "23.2.0-preview-634cc823",
  "@metamask-previews/notification-services-controller": "5.0.1-preview-634cc823",
  "@metamask-previews/permission-controller": "11.0.6-preview-634cc823",
  "@metamask-previews/permission-log-controller": "3.0.3-preview-634cc823",
  "@metamask-previews/phishing-controller": "12.4.1-preview-634cc823",
  "@metamask-previews/polling-controller": "13.0.0-preview-634cc823",
  "@metamask-previews/preferences-controller": "17.0.0-preview-634cc823",
  "@metamask-previews/profile-sync-controller": "11.0.1-preview-634cc823",
  "@metamask-previews/queued-request-controller": "10.0.0-preview-634cc823",
  "@metamask-previews/rate-limit-controller": "6.0.3-preview-634cc823",
  "@metamask-previews/remote-feature-flag-controller": "1.6.0-preview-634cc823",
  "@metamask-previews/sample-controllers": "0.1.0-preview-634cc823",
  "@metamask-previews/selected-network-controller": "22.0.0-preview-634cc823",
  "@metamask-previews/signature-controller": "27.1.0-preview-634cc823",
  "@metamask-previews/token-search-discovery-controller": "2.1.0-preview-634cc823",
  "@metamask-previews/transaction-controller": "54.0.0-preview-634cc823",
  "@metamask-previews/user-operation-controller": "33.0.0-preview-634cc823"
}

@jiexi
Copy link
Contributor

jiexi commented Apr 21, 2025

@metamaskbot publish-previews

@github-actions
Copy link
Contributor

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/accounts-controller": "27.0.0-preview-c76a33e4",
  "@metamask-previews/address-book-controller": "6.0.3-preview-c76a33e4",
  "@metamask-previews/announcement-controller": "7.0.3-preview-c76a33e4",
  "@metamask-previews/app-metadata-controller": "1.0.0-preview-c76a33e4",
  "@metamask-previews/approval-controller": "7.1.3-preview-c76a33e4",
  "@metamask-previews/assets-controllers": "56.0.0-preview-c76a33e4",
  "@metamask-previews/base-controller": "8.0.0-preview-c76a33e4",
  "@metamask-previews/bridge-controller": "13.0.0-preview-c76a33e4",
  "@metamask-previews/bridge-status-controller": "12.0.1-preview-c76a33e4",
  "@metamask-previews/build-utils": "3.0.3-preview-c76a33e4",
  "@metamask-previews/chain-agnostic-permission": "0.3.0-preview-c76a33e4",
  "@metamask-previews/composable-controller": "11.0.0-preview-c76a33e4",
  "@metamask-previews/controller-utils": "11.7.0-preview-c76a33e4",
  "@metamask-previews/earn-controller": "0.11.0-preview-c76a33e4",
  "@metamask-previews/eip1193-permission-middleware": "0.1.0-preview-c76a33e4",
  "@metamask-previews/ens-controller": "16.0.0-preview-c76a33e4",
  "@metamask-previews/eth-json-rpc-provider": "4.1.8-preview-c76a33e4",
  "@metamask-previews/gas-fee-controller": "23.0.0-preview-c76a33e4",
  "@metamask-previews/json-rpc-engine": "10.0.3-preview-c76a33e4",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.7-preview-c76a33e4",
  "@metamask-previews/keyring-controller": "21.0.2-preview-c76a33e4",
  "@metamask-previews/logging-controller": "6.0.4-preview-c76a33e4",
  "@metamask-previews/message-manager": "12.0.1-preview-c76a33e4",
  "@metamask-previews/multichain": "4.0.0-preview-c76a33e4",
  "@metamask-previews/multichain-api-middleware": "0.1.1-preview-c76a33e4",
  "@metamask-previews/multichain-network-controller": "0.3.0-preview-c76a33e4",
  "@metamask-previews/multichain-transactions-controller": "0.9.0-preview-c76a33e4",
  "@metamask-previews/name-controller": "8.0.3-preview-c76a33e4",
  "@metamask-previews/network-controller": "23.2.0-preview-c76a33e4",
  "@metamask-previews/notification-services-controller": "5.0.1-preview-c76a33e4",
  "@metamask-previews/permission-controller": "11.0.6-preview-c76a33e4",
  "@metamask-previews/permission-log-controller": "3.0.3-preview-c76a33e4",
  "@metamask-previews/phishing-controller": "12.4.1-preview-c76a33e4",
  "@metamask-previews/polling-controller": "13.0.0-preview-c76a33e4",
  "@metamask-previews/preferences-controller": "17.0.0-preview-c76a33e4",
  "@metamask-previews/profile-sync-controller": "11.0.1-preview-c76a33e4",
  "@metamask-previews/queued-request-controller": "10.0.0-preview-c76a33e4",
  "@metamask-previews/rate-limit-controller": "6.0.3-preview-c76a33e4",
  "@metamask-previews/remote-feature-flag-controller": "1.6.0-preview-c76a33e4",
  "@metamask-previews/sample-controllers": "0.1.0-preview-c76a33e4",
  "@metamask-previews/selected-network-controller": "22.0.0-preview-c76a33e4",
  "@metamask-previews/signature-controller": "27.1.0-preview-c76a33e4",
  "@metamask-previews/token-search-discovery-controller": "2.1.0-preview-c76a33e4",
  "@metamask-previews/transaction-controller": "54.0.0-preview-c76a33e4",
  "@metamask-previews/user-operation-controller": "33.0.0-preview-c76a33e4"
}

Comment on lines 14 to 17
- Add and Export `isKnownSessionPropertyValue` validation utility function ([#5647](https://github.com/MetaMask/core/pull/5647))
- Add and Export `getCaipAccountIdsFromScopesObjects` filtering utility function ([#5647](https://github.com/MetaMask/core/pull/5647))
- Add and Export `getAllScopesFromScopesObjects` filtering utility function ([#5647](https://github.com/MetaMask/core/pull/5647))
- Add and Export `getSupportedScopeObjects` filtering utility function ([#5647](https://github.com/MetaMask/core/pull/5647))
- Added `getCaipAccountIdsFromScopesObjects`, `getCaipAccountIdsFromCaip25CaveatValue`, `isInternalAccountInPermittedAccountIds`, and `isCaipAccountIdInPermittedAccountIds` account id functions. ([#5609](https://github.com/MetaMask/core/pull/5609))
- Added `getSupportedScopeObjects`, `getAllScopesFromScopesObjects`, `getAllScopesFromCaip25CaveatValue`, `getAllNonWalletNamespacesFromCaip25CaveatValue`, `getAllScopesFromPermission`, `getAllScopesFromCaip25CaveatValue`, and `isNamespaceInScopesObject`
scope functions. ([#5609](https://github.com/MetaMask/core/pull/5609))
- Added `isKnownSessionPropertyValue` and `getCaip25CaveatFromPermission` misc functions. ([#5609](https://github.com/MetaMask/core/pull/5609))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I did this... not sure why I overwrote entries in the 0.4.0 changelog rather than add these to the unreleased section?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh i think i did this. These came from Joao's earlier PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jiexi jiexi changed the title adding more chain-agnostic sip-26 utility functions feat: Add more chain-agnostic sip-26 utility functions Apr 22, 2025
@jiexi jiexi changed the title feat: Add more chain-agnostic sip-26 utility functions feat: Add more chain-agnostic-permission utility functions from sip-26 usage Apr 22, 2025
@jiexi jiexi marked this pull request as ready for review April 22, 2025 22:22
@jiexi jiexi requested review from a team as code owners April 22, 2025 22:22
@jiexi
Copy link
Contributor

jiexi commented Apr 22, 2025

@metamaskbot publish-previews

@github-actions
Copy link
Contributor

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/accounts-controller": "27.0.0-preview-72122b6f",
  "@metamask-previews/address-book-controller": "6.0.3-preview-72122b6f",
  "@metamask-previews/announcement-controller": "7.0.3-preview-72122b6f",
  "@metamask-previews/app-metadata-controller": "1.0.0-preview-72122b6f",
  "@metamask-previews/approval-controller": "7.1.3-preview-72122b6f",
  "@metamask-previews/assets-controllers": "58.0.0-preview-72122b6f",
  "@metamask-previews/base-controller": "8.0.0-preview-72122b6f",
  "@metamask-previews/bridge-controller": "16.0.0-preview-72122b6f",
  "@metamask-previews/bridge-status-controller": "13.1.0-preview-72122b6f",
  "@metamask-previews/build-utils": "3.0.3-preview-72122b6f",
  "@metamask-previews/chain-agnostic-permission": "0.4.0-preview-72122b6f",
  "@metamask-previews/composable-controller": "11.0.0-preview-72122b6f",
  "@metamask-previews/controller-utils": "11.7.0-preview-72122b6f",
  "@metamask-previews/delegation-controller": "0.1.0-preview-72122b6f",
  "@metamask-previews/earn-controller": "0.12.0-preview-72122b6f",
  "@metamask-previews/eip1193-permission-middleware": "0.1.0-preview-72122b6f",
  "@metamask-previews/ens-controller": "16.0.0-preview-72122b6f",
  "@metamask-previews/eth-json-rpc-provider": "4.1.8-preview-72122b6f",
  "@metamask-previews/gas-fee-controller": "23.0.0-preview-72122b6f",
  "@metamask-previews/json-rpc-engine": "10.0.3-preview-72122b6f",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.7-preview-72122b6f",
  "@metamask-previews/keyring-controller": "21.0.3-preview-72122b6f",
  "@metamask-previews/logging-controller": "6.0.4-preview-72122b6f",
  "@metamask-previews/message-manager": "12.0.1-preview-72122b6f",
  "@metamask-previews/multichain": "4.0.0-preview-72122b6f",
  "@metamask-previews/multichain-api-middleware": "0.2.0-preview-72122b6f",
  "@metamask-previews/multichain-network-controller": "0.5.1-preview-72122b6f",
  "@metamask-previews/multichain-transactions-controller": "0.9.0-preview-72122b6f",
  "@metamask-previews/name-controller": "8.0.3-preview-72122b6f",
  "@metamask-previews/network-controller": "23.2.0-preview-72122b6f",
  "@metamask-previews/notification-services-controller": "6.0.0-preview-72122b6f",
  "@metamask-previews/permission-controller": "11.0.6-preview-72122b6f",
  "@metamask-previews/permission-log-controller": "3.0.3-preview-72122b6f",
  "@metamask-previews/phishing-controller": "12.5.0-preview-72122b6f",
  "@metamask-previews/polling-controller": "13.0.0-preview-72122b6f",
  "@metamask-previews/preferences-controller": "17.0.0-preview-72122b6f",
  "@metamask-previews/profile-sync-controller": "12.0.0-preview-72122b6f",
  "@metamask-previews/queued-request-controller": "10.0.0-preview-72122b6f",
  "@metamask-previews/rate-limit-controller": "6.0.3-preview-72122b6f",
  "@metamask-previews/remote-feature-flag-controller": "1.6.0-preview-72122b6f",
  "@metamask-previews/sample-controllers": "0.1.0-preview-72122b6f",
  "@metamask-previews/selected-network-controller": "22.0.0-preview-72122b6f",
  "@metamask-previews/signature-controller": "27.1.0-preview-72122b6f",
  "@metamask-previews/token-search-discovery-controller": "3.1.0-preview-72122b6f",
  "@metamask-previews/transaction-controller": "54.1.0-preview-72122b6f",
  "@metamask-previews/user-operation-controller": "33.0.0-preview-72122b6f"
}

@@ -1,11 +1,16 @@
import type { CaipAccountId } from '@metamask/utils';

import {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't have to be in this PR, but we should rename this adapter files

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, let's do it in a follow up PR, but totally agree

@adonesky1 adonesky1 enabled auto-merge (squash) April 23, 2025 20:11
@adonesky1 adonesky1 merged commit 6b0fa3a into main Apr 23, 2025
202 checks passed
@adonesky1 adonesky1 deleted the ad/more-sip-26-utilities branch April 23, 2025 20:53
@adonesky1 adonesky1 mentioned this pull request May 15, 2025
4 tasks
adonesky1 added a commit that referenced this pull request May 15, 2025
## @metamask/chain-agnostic-permission

## [0.7.0]

### Changed

- Bump `@metamask/api-specs` to `^0.14.0`
([#5817](#5817))
- Bump `@metamask/network-controller` to `^23.5.0`
([#5765](#5765),
[#5812](#5812))
- Bump `@metamask/controller-utils` to `^11.8.0`
([#5765](#5765),
[#5812](#5812))


## @metamask/multichain-api-middleware

## [0.3.0]

### Changed

- feat: Add more chain-agnostic-permission utility functions from sip-26
usage ([#5609](#5609))
- Bump `@metamask/chain-agnostic-permission` to `^0.6.0`
([#5715](https://github.com/MetaMask/core/pull/5715),[#5760](https://github.com/MetaMask/core/pull/5760))
- Bump `@metamask/api-specs` to `^0.14.0`
([#5817](#5817))
- Bump `@metamask/controller-utils` to `^11.9.0`
([#5765](#5765),
[#5812](#5812))
- Bump `@metamask/network-controller` to `^23.5.0`
([#5765](#5765),
[#5812](#5812))

## @metamask/multichain

## [4.1.0]

### Changed

- Bump `@metamask/api-specs` to `^0.14.0`
([#5817](#5817))
- Bump `@metamask/controller-utils` to `^11.9.0`
([#5583](#5583),
[#5765](#5765),
[#5812](#5812))

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] 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
- [ ] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request May 21, 2025
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

Moves caip-25 helpers added in sip-26 branch into the core package

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/32152?quickstart=1)

## **Related issues**

See: MetaMask/core#5609

## **Manual testing steps**

No user facing changes

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request May 21, 2025
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

Moves caip-25 helpers added in sip-26 branch into the core package

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/32152?quickstart=1)

## **Related issues**

See: MetaMask/core#5609

## **Manual testing steps**

No user facing changes

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request May 21, 2025
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

Moves caip-25 helpers added in sip-26 branch into the core package

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/32152?quickstart=1)

## **Related issues**

See: MetaMask/core#5609

## **Manual testing steps**

No user facing changes

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants