Skip to content

Settles amount automatically if min and max are equal in lnurl condit… - #330

Merged
bordalix merged 1 commit into
masterfrom
hotfix_lnurl
Feb 25, 2026
Merged

bordalix merged 1 commit into
masterfrom
hotfix_lnurl

Conversation

@bordalix

@bordalix bordalix commented Feb 25, 2026 •

Copy link
Copy Markdown
Collaborator

…ions

Summary by CodeRabbit

  • New Features
    • Wallet Send Form now automatically populates the transfer amount when LNURL payments specify a fixed amount, eliminating manual entry steps when only one valid amount is available.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying wallet-bitcoin with  Cloudflare Pages  Cloudflare Pages

Latest commit: 77573bb
Status: ✅  Deploy successful!
Preview URL: https://da699a5c.wallet-bitcoin.pages.dev
Branch Preview URL: https://hotfix-lnurl.wallet-bitcoin.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying wallet-mutinynet with  Cloudflare Pages  Cloudflare Pages

Latest commit: 77573bb
Status: ✅  Deploy successful!
Preview URL: https://54fbbe28.arkade-wallet.pages.dev
Branch Preview URL: https://hotfix-lnurl.arkade-wallet.pages.dev

View logs

@coderabbitai

coderabbitai Bot commented Feb 25, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

The change adds automatic satoshi amount assignment when LNURL returns identical minimum and maximum limits. When these bounds collapse to a single value, the code auto-sets satoshis to the minimum limit (converted from millisatoshis) before updating the LNURL limits.

Changes

Cohort / File(s) Summary
LNURL Limit Handling
src/screens/Wallet/Send/Form.tsx
Auto-sets satoshis to minimum limit when LNURL min and max values are identical.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • fix max send in fiat only mode #214: Modifies the same Form.tsx file with LNURL limit and satoshi amount synchronization logic, directly related to the automatic satoshi setting when limits are equal.
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: automatic amount settlement when LNURL min and max limits are equal, which matches the core functionality added in the changeset.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hotfix_lnurl

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.

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/screens/Wallet/Send/Form.tsx (1)

185-191: ⚠️ Potential issue | 🟠 Major

Use a functional updater to prevent stale sendInfo overwrites in async LNURL callback.

At line 190, setSendInfo({ ...sendInfo, satoshis: min }) captures sendInfo inside an async callback. Since checkLnUrlConditions performs a network fetch with variable latency, other state updates can occur while waiting. When the promise resolves, this captured state snapshot overwrites newer fields that were set concurrently, such as arkAddress.

Replace with a functional updater to apply the change against the latest state:

Suggested patch
-        if (min === max) setSendInfo({ ...sendInfo, satoshis: min }) // set amount automatically
+        if (min === max) {
+          setSendInfo((prev) => ({ ...prev, satoshis: min })) // set amount automatically
+        }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/screens/Wallet/Send/Form.tsx` around lines 185 - 191, The async LNURL
callback in checkLnUrlConditions currently uses the captured sendInfo when
calling setSendInfo, which can overwrite newer state; change setSendInfo to use
the functional updater form so the update merges satoshis into the latest state
(pass a function that receives the previous state and returns a new object
spreading previous and setting satoshis to min), and keep the rest of the
callback behavior (still call setLnUrlLimits and setError as appropriate) to
avoid stale overwrites of fields like arkAddress.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/screens/Wallet/Send/Form.tsx`:
- Around line 185-191: The async LNURL callback in checkLnUrlConditions
currently uses the captured sendInfo when calling setSendInfo, which can
overwrite newer state; change setSendInfo to use the functional updater form so
the update merges satoshis into the latest state (pass a function that receives
the previous state and returns a new object spreading previous and setting
satoshis to min), and keep the rest of the callback behavior (still call
setLnUrlLimits and setError as appropriate) to avoid stale overwrites of fields
like arkAddress.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 286f3bc and 77573bb.

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

@bordalix
bordalix merged commit bf891f7 into master Feb 25, 2026
5 checks passed
@bordalix
bordalix deleted the hotfix_lnurl branch March 4, 2026 10:12
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.

1 participant