Skip to content

feat(transaction-controller)!: type Permit2 approve transactions as tokenMethodApprove - #11416

Draft
dan437 wants to merge 5 commits into
mainfrom
cursor/permit2-approve-token-approve-type-4de4
Draft

dan437 wants to merge 5 commits into
mainfrom
cursor/permit2-approve-token-approve-type-4de4

Conversation

@dan437

@dan437 dan437 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Explanation

Permit2 approve(address token, address spender, uint160 amount, uint48 expiration) transactions (selector 0x87517c45) were typed contractInteraction, because decodeTransactionData only 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 approve fragment, so determineTransactionType returns the existing tokenMethodApprove type for these transactions, including untyped nested transactions in a batch. Only approve is added, so other Permit2 methods such as transferFrom keep their current type. This is breaking for clients: txParams.to is the Permit2 contract rather than the token, so the token, spender, amount and expiration must be read from the calldata.

getSendRecipients and getEffectiveRecipient never read approve arguments, and Pay, bridge and Money Account code set nested approve types explicitly, so they are unaffected. The client-utils activity 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

  • Related to CONF-2202
  • Extension and mobile changes that read the approved token from Permit2 calldata are in progress.

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
Open in Web Open in Cursor 

cursoragent and others added 5 commits November 10, 2026 11:07
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>

This branch has not been deployed

No deployments
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.

2 participants