Skip to content

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

Open
patchy-the-bot wants to merge 4 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 4 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

Low Risk
Primarily an API surface cleanup plus mechanical call-site updates; behavior should be unchanged aside from potential breakage for external consumers still importing the removed helpers.

Overview
Removes encodePermissionContexts and decodePermissionContexts from smart-accounts-kit (implementation in delegation.ts and re-exports in utils/index.ts) to simplify the public API and align terminology around delegations.

Updates all call sites that build redeemDelegations calldata (core DelegationManager redeemDelegations method wrapper, write.ts redemption helper, and extensive delegator-e2e tests) to encode each delegation chain via encodeDelegations (typically delegations.map(encodeDelegations) or [encodeDelegations([...])]) instead of the removed wrappers. Also deletes the unit tests that specifically covered the removed permission-context helpers.

Written by Cursor Bugbot for commit e3e6d77. 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