Repository navigation
Conversation
Decode Permit2 `approve(address token, address spender, uint160 amount, uint48 expiration)` in `decodeTransactionData`, so `determineTransactionType` returns `tokenMethodApprove` instead of `contractInteraction` for these transactions, including untyped nested batch transactions. Only the `approve` fragment is added, so other Permit2 methods such as `transferFrom` keep their current type. Co-authored-by: Daniel <dan437@users.noreply.github.com>
…interactions Add a test that Permit2 `transferFrom` is still typed `contractInteraction`, so the decoder keeps only the Permit2 `approve` fragment, and clarify the `decodeTransactionData` JSDoc. Co-authored-by: Daniel <dan437@users.noreply.github.com>
…ively `mapLocalTransaction` compared the method ID to the Permit2 `approve` selector case-sensitively, so a Permit2 approve with an uppercase selector used the Permit2 contract as the approved token. Lowercase the method ID like the mapper's other method ID checks. Co-authored-by: Daniel <dan437@users.noreply.github.com>
Co-authored-by: Daniel <dan437@users.noreply.github.com>
Co-authored-by: Daniel <dan437@users.noreply.github.com>
3 of 11 tasks
This branch has not been deployed
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.
Explanation
Permit2
approve(address token, address spender, uint160 amount, uint48 expiration)transactions (selector0x87517c45) were typedcontractInteraction, becausedecodeTransactionDataonly knew the ERC-20, ERC-721, ERC-1155 and USDC ABIs. Clients choose the confirmation screen from the type, so these approvals got the generic contract interaction screen instead of the approval screen.The decoder now also knows the Permit2
approvefragment, sodetermineTransactionTypereturns the existingtokenMethodApprovetype for these transactions, including untyped nested transactions in a batch. Onlyapproveis added, so other Permit2 methods such astransferFromkeep their current type. This is breaking for clients:txParams.tois the Permit2 contract rather than the token, so the token, spender, amount and expiration must be read from the calldata.getSendRecipientsandgetEffectiveRecipientnever read approve arguments, and Pay, bridge and Money Account code set nested approve types explicitly, so they are unaffected. Theclient-utilsactivity mapper already omits the token for Permit2 approvals, but it compared the method ID case-sensitively; it now lowercases it like its other method ID checks.References
Checklist