Skip to content

fix input amount - #519

Merged
Kukks merged 1 commit into
masterfrom
fix_fiat_value_on_send
Apr 15, 2026
Merged

Kukks merged 1 commit into
masterfrom
fix_fiat_value_on_send

Conversation

@bordalix

@bordalix bordalix commented Apr 8, 2026 •

Copy link
Copy Markdown
Collaborator

closes #518

Summary by CodeRabbit

  • Bug Fixes
    • Fixed amount field synchronization when processing certain payment requests, ensuring the UI correctly displays the specified amount and validation behavior works as expected.

@coderabbitai

coderabbitai Bot commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c1869091-1618-4223-9a83-8b7482f40eca

📥 Commits

Reviewing files that changed from the base of the PR and between 7be9d4e and 1f87cb0.

📒 Files selected for processing (1)
  • src/screens/Wallet/Send/Form.tsx

Walkthrough

The change adds a state synchronization call in the parseRecipient function to set the component's local amount state when parsing a BIP21 payload with an assetId, complementing existing setState calls that update sendInfo.

Changes

Cohort / File(s) Summary
State Synchronization in BIP21 Parsing
src/screens/Wallet/Send/Form.tsx
Added setAmount(satoshis) call in parseRecipient when handling BIP21 payload with assetId to synchronize component's local amount state alongside existing sendInfo state updates.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested reviewers

  • pietro909
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'fix input amount' is vague and generic, using non-descriptive language that doesn't clearly convey the specific issue being addressed. Use a more specific title like 'Fix fiat value display for QR-scanned amounts' or 'Sync input amount state when parsing BIP21 payloads' to better describe the actual change.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The code change synchronizes the local amount state when parsing BIP21 payloads with assetId, which directly addresses the issue of fiat value not displaying for QR-scanned amounts.
Out of Scope Changes check ✅ Passed The single-line change in the parseRecipient function is directly scoped to fixing the fiat value display issue for QR-scanned amounts, with no extraneous modifications.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix_fiat_value_on_send

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.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying wallet-bitcoin with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1f87cb0
Status: ✅  Deploy successful!
Preview URL: https://36804634.wallet-bitcoin.pages.dev
Branch Preview URL: https://fix-fiat-value-on-send.wallet-bitcoin.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying wallet-mutinynet with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1f87cb0
Status: ✅  Deploy successful!
Preview URL: https://8d335036.arkade-wallet.pages.dev
Branch Preview URL: https://fix-fiat-value-on-send.arkade-wallet.pages.dev

View logs

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Approved — clean, correct fix

The bug: When scanning a BIP21 QR code with a prefilled amount (non-asset path), sendInfo.satoshis was being set via setState(), but the local amount state (passed as sats to <InputAmount>) was never updated. The InputAmount component needs the sats prop to drive the fiat conversion display — without it, the fiat value shows as empty.

The fix: Adding setAmount(satoshis) before setState(...) at Form.tsx:224 mirrors what every other code path already does:

  • Lightning invoice path (line 241): ✅ calls setAmount(satoshis)
  • handleAmountChange (line 504): ✅ calls setAmount(sats)
  • handleSendAll (line 588): ✅ calls setAmount(liquidBalance)
  • LNURL limits effect (line 330): ✅ calls setAmount(...)

The BIP21 non-asset path was the only one missing it. Fix is correct and minimal.

Edge case check: satoshis from decodeBip21() is typed number | undefined. If the BIP21 URI has no amount, satoshis is undefined → setAmount(undefined) correctly clears the field. If it has an amount, it's a positive number (0 and negatives are rejected by decodeBip21 validation). No issue.

Not protocol-critical — this is purely a UI display bug (fiat amount not rendering). No VTXO, signing, or transaction logic is affected.


Minor note (not blocking): The asset BIP21 path (lines 213-222) also doesn't call setAmount(). If asset BIP21 URIs with prefilled amounts show a similar fiat display issue, that's a separate bug to track. But assets set satoshis: 0 so it may not apply the same way.

🤖 Reviewed by Arkana

@Kukks
Kukks merged commit b7f91cd into master Apr 15, 2026
5 checks passed
@Kukks
Kukks deleted the fix_fiat_value_on_send branch April 15, 2026 12:08
@coderabbitai coderabbitai Bot mentioned this pull request May 14, 2026
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.

Fiat value missing on QR code scans

3 participants