Skip to content

fix: cap number pad on remaining amount screens#585

Open
CypherPoet wants to merge 4 commits into
synonymdev:masterfrom
CypherPoet:fix/amount-screens-cap
Open

fix: cap number pad on remaining amount screens#585
CypherPoet wants to merge 4 commits into
synonymdev:masterfrom
CypherPoet:fix/amount-screens-cap

Conversation

@CypherPoet
Copy link
Copy Markdown
Contributor

@CypherPoet CypherPoet commented Jun 5, 2026

Depends on

Depends on #584 (fix: cap send amount pad at available balance), which introduces the maxAmountOverride mechanism this PR reuses. Merge #584 first. This PR targets master, so until #584 lands its diff also contains #584's commit (1a5b8c62); review the fix: cap number pad input on remaining amount screens commit (5f439703) for this PR's changes.

Description

Building on the send-amount cap (#346), this PR applies the same number-pad cap to the other amount-entry screens that have a contextual maximum: LNURL pay, LNURL withdraw, transfer-to-spending, advanced spending, and manual external channel funding. Each now refuses entry above its limit instead of relying on the Continue button alone.

It also closes a gap on the manual external-funding screen, where Continue stayed enabled for amounts above the fundable balance; that screen is now gated on the available balance like the others.

The receive and CJIT amount screens are intentionally left uncapped: a receive amount has no balance ceiling.

Linked Issues/Tasks

Related: #346

Screenshot / Video

pr2-spending-amount-cap.mp4

QA Notes

Manual Tests

  • 1. Transfer -> Spending Amount: type past Available: amount freezes at the max.
  • 2. Spending Advanced: type past the max LSP balance: capped.
  • 3a. Fund Manual (external node) -> Amount: type past Available: capped.
    • 3b. Fund Manual -> enter an amount above the fundable balance: Continue is disabled (previously enabled).
  • 4. LNURL Pay -> Amount: type past max sendable: capped.
  • 5. LNURL Withdraw -> Amount: type past max withdrawable: capped.
  • 6. regression: Receive / CJIT Amount: no upper cap; any amount can still be entered.

Automated Checks

  • No new unit tests: the cap mechanism is covered by BitkitTests/NumberPadTests.swift (added in Create swift.yml #4); these screens are view-level wiring plus one button-validation fix, verified by build + manual QA.
  • Built for iOS Simulator (Debug) locally; BitkitTests/NumberPadTests passes (24 tests).
  • Verified on-device (geoblock-off regtest build): Transfer-to-Spending number pad capped at the max transfer amount (see recording); Receive/CJIT confirmed uncapped (minimum only).
  • CI: standard build/test checks run by the PR bot.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5f439703d6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread changelog.d/next/585.fixed.md
The send number pad now rejects keystrokes that would push the amount above the available sendable balance, reusing the existing over-max block (haptic + error flash) via a dynamic maxAmountOverride. Continue-button validation is unchanged as a backstop.

Closes synonymdev#346
@CypherPoet CypherPoet force-pushed the fix/amount-screens-cap branch from b96b812 to 6af6d68 Compare June 6, 2026 09:13
The cap rejected every keystroke whose result still exceeded it, including deletions. When an amount lands above the cap (a prefilled invoice over the available balance, or a cap that dropped after input), the user could not backspace to reduce it, since each intermediate value was still over the cap. Deletions now always apply; the cap only blocks growing the amount.
Applies the maxAmountOverride cap (from the send-amount fix) to the LNURL pay/withdraw, spending, advanced-spending, and manual channel-funding screens, so the number pad refuses entry above each screen's contextual maximum. FundManualAmountView also gains the previously-missing upper-bound button validation, which let users proceed above the fundable balance.

Receive and CJIT amount screens are intentionally left uncapped (a receive amount has no balance ceiling).
@CypherPoet CypherPoet force-pushed the fix/amount-screens-cap branch from 6af6d68 to bd7a772 Compare June 6, 2026 12:10
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