Skip to content

feat: add decoding rules for erc20-token-allowance and native-token-allowance#8553

Draft
jeffsmale90 wants to merge 4 commits intomainfrom
feat/allowance-permissions
Draft

feat: add decoding rules for erc20-token-allowance and native-token-allowance#8553
jeffsmale90 wants to merge 4 commits intomainfrom
feat/allowance-permissions

Conversation

@jeffsmale90
Copy link
Copy Markdown
Contributor

@jeffsmale90 jeffsmale90 commented Apr 23, 2026

Explanation

Requires integration of new @metamask/7715-permission-types from MetaMask/smart-accounts-kit#214

References

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
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Decoding logic now selects among multiple candidate permission rules and adds two new permission types that share enforcer sets with existing periodic permissions, which could change how delegations are classified and error out on ambiguous/invalid caveats.

Overview
Adds decoding support for unbounded allowance permissions (native-token-allowance and erc20-token-allowance) by introducing new permission rules and extending DecodedPermission typing to include these locally-defined 7715 types.

Updates the permission-type resolution flow to allow multiple rules to match the same enforcer set (findRulesWithMatchingCaveatAddresses) and then disambiguates by validating/decoding terms (selectUniqueRuleAndDecodedPermission), with clearer errors for no-match and ambiguous delegations.

Tightens periodic decoders to explicitly reject UINT256_MAX periodDuration (reserved to indicate allowance), adds a shared UINT256_MAX constant, and expands test coverage for the new rules and edge cases.

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

@jeffsmale90 jeffsmale90 requested a review from a team as a code owner April 23, 2026 04:39
@jeffsmale90 jeffsmale90 requested a review from a team as a code owner April 23, 2026 04:40
@jeffsmale90 jeffsmale90 changed the title Feat/allowance permissions feat: add decoding rules for erc20-token-allowance and native-token-allowance Apr 23, 2026
@jeffsmale90 jeffsmale90 marked this pull request as draft April 23, 2026 04:41
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