Skip to content

feat: add token approval revocation permission type#232

Merged
mj-kiwi merged 6 commits into
feat/approval-revocation-enforcerfrom
feat/token-approval-revocation-permission-type
May 18, 2026
Merged

feat: add token approval revocation permission type#232
mj-kiwi merged 6 commits into
feat/approval-revocation-enforcerfrom
feat/token-approval-revocation-permission-type

Conversation

@mj-kiwi
Copy link
Copy Markdown
Contributor

@mj-kiwi mj-kiwi commented May 18, 2026

📝 Description

Adds ERC-7715 token-approval-revocation permission type support to @metamask/7715-permission-types and @metamask/smart-accounts-kit.

🔄 What Changed?

  • Added TokenApprovalRevocationPermission to @metamask/7715-permission-types
  • Added smart-accounts-kit developer-facing type exports
  • Added request/RPC mapping support that preserves all approval revocation flags, including false values
  • Added mapping tests and changelog entries

🚀 Why?

  • Enables dapps to request token approval revocation permissions through the ERC-7715 permission flow
  • Aligns the permission data shape with ApprovalRevocationTerms

🧪 How to Test?

  • Manual testing steps:
  1. Import TokenApprovalRevocationPermission from the package API.
  2. Request a token-approval-revocation permission with mixed true and false flags.
  3. Verify the RPC payload preserves all six approval revocation fields.
  • Automated tests added/updated
  • All existing tests pass

Automated verification run locally:

  • yarn workspace @metamask/smart-accounts-kit exec vitest run test/actions/erc7715Mapping.test.ts
  • yarn workspace @metamask/7715-permission-types build
  • yarn workspace @metamask/smart-accounts-kit typecheck

⚠️ Breaking Changes

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

📋 Checklist

  • 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

Related to #

📚 Additional Notes

Changelog entries added for:

  • @metamask/7715-permission-types: New permission type token-approval-revocation
  • @metamask/smart-accounts-kit: ERC-7715 token-approval-revocation permission type

Note

Medium Risk
Extends the public ERC-7715 permission type union and request/RPC mapping; incorrect flag serialization could lead to unexpected revocation behavior or wallet rejections, but changes are additive and covered by targeted tests.

Overview
Adds a new ERC-7715 permission type, token-approval-revocation, to @metamask/7715-permission-types and @metamask/smart-accounts-kit, with a structured data payload containing explicit boolean flags for different approval revocation actions.

Updates the smart-accounts-kit request→RPC conversion to support the new type and preserve all boolean fields including false values, and marks erc20-token-revocation as deprecated in favor of the new permission. Changelogs and mapping tests are updated accordingly.

Reviewed by Cursor Bugbot for commit 56a4a80. 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 May 18, 2026 05:04
@jeffsmale90 jeffsmale90 force-pushed the feat/approval-revocation-enforcer branch from 54b8c0d to 26f37ce Compare May 18, 2026 07:34
Copy link
Copy Markdown
Collaborator

@jeffsmale90 jeffsmale90 left a comment

Choose a reason for hiding this comment

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

lgtm

@mj-kiwi mj-kiwi merged commit dccbe69 into feat/approval-revocation-enforcer May 18, 2026
18 checks passed
@mj-kiwi mj-kiwi deleted the feat/token-approval-revocation-permission-type branch May 18, 2026 09:09
jeffsmale90 added a commit that referenced this pull request May 18, 2026
* Add create / decode terms functions to @metamask/delegation-core for ApprovalRevocationEnforcer

* Add caveat builder for ApprovalRevocation enforcer

* Convert decodeCaveat function to use CaveatType rather than string literals.

* Add changelog

* Bump delegatable-framework to d0ebab5 Merge pull request #177 from MetaMask/feat/erc20-allowance-revocation-enforcer

* Add ApprovalRevocationEnforcer abis

* Add e2e test for approval revocation enforcer

* Add ApprovalRevocationEnforcer to environment, and contract deployments

* Tweak nativeTokenStreaming e2e test to make likelihood of false positive lower
The test occasionally succeeds, likely because the streaming amount probably accumulates sufficiently for the transfer amount.
We decrease the amountPerSecond, and increase the transferAmount

* Changelogs

* fix approval revocation reserved-bit messaging

Co-authored-by: jeffsmale90 <jeffsmale90@users.noreply.github.com>

* Checksum ApprovalRevocationEnforcer address in deployments package

* Use CaveatType.AllowedCalldata instead of 'allowedCalldata' in decodeCaveat function

* feat: add token approval revocation permission type (#232)

* Add token-approval-revocation permission type and related RPC conversion

* feat: add token approval revocation permission type

* Revert "Add token-approval-revocation permission type and related RPC conversion"

This reverts commit 086175b.

* fix: link changelog entries to PR

* feat: deprecate erc20-token-revocation in favor of token-approval-revocation

* Tweak changelogs - all changes point to #226

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: jeffsmale90 <jeffsmale90@users.noreply.github.com>
Co-authored-by: MJ Kiwi <mj.liang@consensys.net>
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.

2 participants