Skip to content

Conversation

@NeOMakinG
Copy link
Collaborator

@NeOMakinG NeOMakinG commented Jan 30, 2026

Description

Set the asset in the send modal after scanning only if it was a scheme address in the QR code, so we can select the asset then scan a QR code and the asset stay the one we've selected

Issue (if applicable)

closes #11793

Risk

Low

High Risk PRs Require 2 approvals

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

Testing

  • Go to any asset page
  • Select "send"
  • Open the QR code modal from this send modal
  • Scan a QR code on your mobile app wallet
  • The send flow should continue to use the same asset you've been selected

Engineering

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

Screenshots (if applicable)

https://jam.dev/c/6d4cd6e4-d65d-406b-bb7e-42ed7beb8d91

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where scanning a QR code with a plain address would override your currently selected asset/account. The system now correctly preserves your asset selection when scanning plain addresses and only updates the asset/account when scanning payment URIs.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

The change modifies QR code scanning logic in the Send form to restrict asset and account ID updates to payment URIs only, preventing plain scanned addresses from overriding the user's previously selected asset.

Changes

Cohort / File(s) Summary
QR Code Asset Selection Logic
src/components/Modals/Send/Form.tsx
Updated condition to gate assetId/accountId updates to payment URI scenarios only by adding urlDirectResult && check; plain addresses now preserve user's asset choice instead of defaulting to network's primary asset.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • gomesalexandre
  • premiumjibles
  • 0xApotheosis

Poem

🐰 A QR code hops by with address in sight,
But now we're more careful—plain scans feel quite right,
No snatching your USDC for ETH anymore,
Your asset selection we'll honor and store! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main fix: preventing asset changes when a QR code contains only an address (not a scheme URL).
Linked Issues check ✅ Passed The code changes directly address the linked issue requirements by preventing automatic asset override for plain addresses, allowing users to send EVM tokens via QR scanner while preserving their selected asset.
Out of Scope Changes check ✅ Passed All changes are focused on the QR code asset-handling logic in the send modal form, directly addressing the linked issue without introducing unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/ss-5488-qr-scanner-amount-parsing-clean

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@NeOMakinG NeOMakinG force-pushed the fix/ss-5488-qr-scanner-amount-parsing-clean branch from 55c658f to 4b92ce6 Compare January 30, 2026 03:24
@NeOMakinG NeOMakinG changed the title fix: parse amount parameter for ERC-20 tokens in QR codes fix: set send asset only if scheme url is detected from qr code Jan 30, 2026
@NeOMakinG NeOMakinG marked this pull request as ready for review January 30, 2026 03:27
@NeOMakinG NeOMakinG requested a review from a team as a code owner January 30, 2026 03:27
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/components/Modals/Send/Form.tsx`:
- Around line 313-315: Remove the two newly added inline comment lines
immediately above the if statement that reads "if (urlDirectResult &&
maybeUrlResult.assetId)" in src/components/Modals/Send/Form.tsx; leave the
conditional and its body unchanged so the code remains self-explanatory and
complies with the rule prohibiting added comments.

Comment on lines +313 to +315
// Update assetId and accountId only if from payment URI (not plain address)
// Plain addresses should preserve the user's selected asset
if (urlDirectResult && maybeUrlResult.assetId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove the newly added inline comments.

The code is already self-explanatory; these comments violate the project rule against adding comments.
As per coding guidelines, never add code comments unless explicitly requested.

🧹 Suggested cleanup
-        // Update assetId and accountId only if from payment URI (not plain address)
-        // Plain addresses should preserve the user's selected asset
         if (urlDirectResult && maybeUrlResult.assetId) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Update assetId and accountId only if from payment URI (not plain address)
// Plain addresses should preserve the user's selected asset
if (urlDirectResult && maybeUrlResult.assetId) {
if (urlDirectResult && maybeUrlResult.assetId) {
🤖 Prompt for AI Agents
In `@src/components/Modals/Send/Form.tsx` around lines 313 - 315, Remove the two
newly added inline comment lines immediately above the if statement that reads
"if (urlDirectResult && maybeUrlResult.assetId)" in
src/components/Modals/Send/Form.tsx; leave the conditional and its body
unchanged so the code remains self-explanatory and complies with the rule
prohibiting added comments.

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.

Unable to send USDC (or other token on evm chain) with qr scanner as it only registers ETH

2 participants