Skip to content

Fix #145: Remove encodePermissionContexts and decodePermissionContexts functions from public interface#148

Open
patchy-the-bot wants to merge 5 commits intoMetaMask:mainfrom
patchy-the-bot:patchy/issue-145-remove-encodepermissioncontext
Open

Fix #145: Remove encodePermissionContexts and decodePermissionContexts functions from public interface#148
patchy-the-bot wants to merge 5 commits intoMetaMask:mainfrom
patchy-the-bot:patchy/issue-145-remove-encodepermissioncontext

Conversation

@patchy-the-bot
Copy link
Contributor

@patchy-the-bot patchy-the-bot commented Feb 11, 2026

Summary

Fixes #145 by removing encodePermissionContexts and decodePermissionContexts functions from the public API. These functions were confusing in terminology (mixing "Permission Context" with delegation concepts) and provided minimal value as they were just forEach wrappers around the core encodeDelegations/decodeDelegations functions.

Changes

  • Removed functions: Deleted encodePermissionContexts and decodePermissionContexts implementations and JSDoc comments from delegation.ts
  • Updated exports: Removed function exports from utils/index.ts barrel file
  • Replaced usage: Updated all call sites to use encodeDelegations directly with Array.map() instead of the wrapper functions
  • Test cleanup: Removed dedicated test suites for both removed functions from delegation.test.ts

Files modified: delegation.ts, utils/index.ts, delegation.test.ts, delegateAndRedeem.test.ts, redeemDelegations.ts, write.ts

Testing

  • All existing tests pass with the updated encodeDelegations usage
  • Removed 68 test cases specific to the deprecated functions
  • E2E tests continue to work with direct encodeDelegations calls
  • Build and lint checks pass successfully

The API is now cleaner with consistent terminology focused on "delegations" rather than mixing "permission contexts".

Fixes #145


Note

Medium Risk
API surface change may break downstream consumers still importing encodePermissionContexts/decodePermissionContexts. Runtime risk is otherwise low since the new encoding is equivalent map-based wiring.

Overview
Removes the confusing encodePermissionContexts/decodePermissionContexts helpers from the @metamask/smart-accounts-kit public utils surface and switches callers to directly encode each delegation chain via encodeDelegations.

Updates redeemDelegations encoding/simulation and write.redeemDelegations to build the on-chain args with delegations.map(encodeDelegations), and adjusts the delegator E2E tests accordingly.

Written by Cursor Bugbot for commit 004153e. This will update automatically on new commits. Configure here.

@patchy-the-bot patchy-the-bot requested a review from a team as a code owner February 11, 2026 21:41
Copy link

@cursor cursor bot left a comment

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.

@jeffsmale90 jeffsmale90 force-pushed the patchy/issue-145-remove-encodepermissioncontext branch from 6c41e9e to e3e6d77 Compare February 12, 2026 04:15
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.

Remove encodePermissionContexts and decodePermissionContexts functions from public interface

2 participants