Fix #145: Remove encodePermissionContexts and decodePermissionContexts functions from public interface#148
Open
patchy-the-bot wants to merge 4 commits intoMetaMask:mainfrom
Conversation
6c41e9e to
e3e6d77
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #145 by removing
encodePermissionContextsanddecodePermissionContextsfunctions 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 coreencodeDelegations/decodeDelegationsfunctions.Changes
encodePermissionContextsanddecodePermissionContextsimplementations and JSDoc comments fromdelegation.tsutils/index.tsbarrel fileencodeDelegationsdirectly withArray.map()instead of the wrapper functionsdelegation.test.tsFiles modified:
delegation.ts,utils/index.ts,delegation.test.ts,delegateAndRedeem.test.ts,redeemDelegations.ts,write.tsTesting
encodeDelegationsusageencodeDelegationscallsThe 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
encodePermissionContextsanddecodePermissionContextsfromsmart-accounts-kit(implementation indelegation.tsand re-exports inutils/index.ts) to simplify the public API and align terminology around delegations.Updates all call sites that build
redeemDelegationscalldata (coreDelegationManagerredeemDelegationsmethod wrapper,write.tsredemption helper, and extensivedelegator-e2etests) to encode each delegation chain viaencodeDelegations(typicallydelegations.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.