Skip to content

Move permission schema metadata into 7715 permission types#267

Open
mj-kiwi wants to merge 2 commits into
mainfrom
feat/permission-schema
Open

Move permission schema metadata into 7715 permission types#267
mj-kiwi wants to merge 2 commits into
mainfrom
feat/permission-schema

Conversation

@mj-kiwi

@mj-kiwi mj-kiwi commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

📝 Description

Moves shared ERC-7715 permission schema metadata into @metamask/7715-permission-types.

🔄 What Changed?

List the specific changes made:

  • Added permission schema types, schema registry, constants, and pure schema utilities to @metamask/7715-permission-types
  • Added MetaMask facilitator address grouping helpers
  • Exported the schema API from the package root and permissions module
  • Added tests for schema lookup and facilitator address matching

🚀 Why?

Explain the motivation behind these changes:

  • Allows MetaMask Extension to consume shared permission schema definitions from the package
  • Keeps rendering/UI behavior in extension while centralizing reusable permission metadata

🧪 How to Test?

Describe how to test these changes:

  • Manual testing steps:
  1. yarn workspace @metamask/7715-permission-types test
  2. yarn workspace @metamask/7715-permission-types build
  3. yarn workspace @metamask/7715-permission-types lint
  • Automated tests added/updated
  • All existing tests pass

⚠️ Breaking Changes

List any breaking changes:

  • No breaking changes
  • Breaking changes (describe below):

📋 Checklist

Check off completed items:

  • Code follows the project's coding standards
  • Self-review completed
  • Documentation updated (if needed)
  • Tests added/updated
  • Changelog updated (if needed)
  • All CI checks pass

🔗 Related Issues

Link to related issues:
Closes #
Related to #

📚 Additional Notes

Rendering remains in MetaMask Extension; this PR only moves shared schema metadata and pure helpers.


Note

Low Risk
Additive package API and declarative metadata only; no runtime permission enforcement changes, with tests for schema lookup edge cases.

Overview
Adds a new permissions/schema module to @metamask/7715-permission-types so MetaMask Extension (and other consumers) can share declarative metadata for Gator permission confirmation/review UI instead of duplicating it locally.

The module defines schema types (PermissionRenderContext, field elements, sections), a registry for supported types (native/ERC20 periodic, stream, allowance, token-approval-revocation), and getPermissionSchemaEntry with an unknown-type fallback and optional strict mode. Schemas describe which fields appear in confirmation, reviewDetail, and reviewSummary, including redeemer/payee display logic that treats known MetaMask facilitator addresses specially.

Also ships pure helpers: time/MAX_UINT256 constants, hex amount parsing, period/frequency i18n keys, stream rate conversions, and isMetaMaskFacilitatorAddress / areOnlyMetaMaskFacilitatorAddresses. The API is re-exported from the package root and permissions index; changelog and unit tests cover lookup, __proto__ safety, and facilitator matching.

Reviewed by Cursor Bugbot for commit 668318e. Bugbot is set up for automated code reviews on this repo. Configure here.

@mj-kiwi mj-kiwi requested a review from a team as a code owner June 22, 2026 03:41

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 49ce0fa. Configure here.

Comment thread packages/7715-permission-types/src/permissions/schema/index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant