Skip to content

fix: match EVM ERC-20 ids case-insensitively in setSelectedToken - #10545

Merged
saustrie-consensys merged 4 commits into
mainfrom
fix/set-selected-token-evm-case
Sep 30, 2026
Merged

saustrie-consensys merged 4 commits into
mainfrom
fix/set-selected-token-evm-case

Conversation

@amitabh94

Copy link
Copy Markdown
Contributor

Summary

  • RampsController.setSelectedToken looked up allTokens, then topTokens, with an exact CAIP-19 match. A checksummed catalog row and a lowercase caller (the pay controller's mUSD id) missed and threw.
  • Exact match is unchanged. If it misses and the id is eip155:<chain>/erc20:0x…, match case-insensitively and keep the catalog token's own assetId. Solana, Tron, and Bitcoin still require an exact match.

Test plan

  • yarn workspace @metamask/ramps-controller run jest --no-coverage src/RampsController.test.ts -t setSelectedToken
  • Selecting lowercase eip155:143/erc20:0xaca92e… against a checksummed catalog row selects that row
  • A Solana mint that differs only by letter case still throws not found

Made with Cursor

amitabh94 and others added 2 commits September 28, 2026 14:46
Catalog rows and callers can differ by EIP-55 checksum case. Exact match stays for Solana, Tron, and Bitcoin, where case is part of the id.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@amitabh94
amitabh94 requested review from a team as code owners September 28, 2026 19:52
@amitabh94
amitabh94 deployed to default-branch September 28, 2026 19:53 — with GitHub Actions Active
Co-authored-by: Cursor <cursoragent@cursor.com>

@saustrie-consensys saustrie-consensys left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@saustrie-consensys
saustrie-consensys added this pull request to the merge queue Sep 30, 2026
Merged via the queue into main with commit 1a3bd34 Sep 30, 2026
48 checks passed
@saustrie-consensys
saustrie-consensys deleted the fix/set-selected-token-evm-case branch September 30, 2026 18:24
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.

3 participants