Skip to content

fix: normalized token address before the payment token comparison#8297

Merged
lwin-kyaw merged 6 commits intomainfrom
fix/payment-token-comparison
Mar 25, 2026
Merged

fix: normalized token address before the payment token comparison#8297
lwin-kyaw merged 6 commits intomainfrom
fix/payment-token-comparison

Conversation

@lwin-kyaw
Copy link
Copy Markdown
Contributor

@lwin-kyaw lwin-kyaw commented Mar 25, 2026

Explanation

This PR addresses ~

  • Normalize payment token address comparison in SubscriptionController#getCryptoApproveTransactionParams.
  • Prevent valid mixed-case or checksummed payment token addresses from being rejected when building approve transaction params.
  • Add regression coverage for case-insensitive payment token matching.

Testing

  • yarn workspace @metamask/subscription-controller run changelog:validate
  • Jest not rerun in this pass

References

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

Note

Low Risk
Low risk: a small change to token-address matching when building crypto approve params, plus a targeted regression test; only behavior change is accepting mixed-case/checksummed addresses that previously errored.

Overview
Fixes SubscriptionController#getCryptoApproveTransactionParams to normalize payment token address comparisons (lowercasing both sides) so mixed-case/checksummed token addresses no longer fail with "Invalid token address".

Adds a Jest regression test covering case-insensitive token matching, and records the change in the @metamask/subscription-controller changelog.

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

@lwin-kyaw lwin-kyaw requested a review from a team as a code owner March 25, 2026 13:03
@lwin-kyaw lwin-kyaw added area-shield Transaction Shield team-shield labels Mar 25, 2026
@lwin-kyaw lwin-kyaw requested a review from a team as a code owner March 25, 2026 13:07
chaitanyapotti
chaitanyapotti previously approved these changes Mar 25, 2026
@lwin-kyaw lwin-kyaw force-pushed the fix/payment-token-comparison branch from ef2e13f to 33abe9e Compare March 25, 2026 15:41
chaitanyapotti
chaitanyapotti previously approved these changes Mar 25, 2026
@lwin-kyaw lwin-kyaw enabled auto-merge March 25, 2026 15:54
@lwin-kyaw lwin-kyaw added this pull request to the merge queue Mar 25, 2026
Merged via the queue into main with commit 952ed74 Mar 25, 2026
326 checks passed
@lwin-kyaw lwin-kyaw deleted the fix/payment-token-comparison branch March 25, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-shield Transaction Shield team-shield

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants