Skip to content

fix: cap send amount pad at available balance#4

Closed
CypherPoet wants to merge 1 commit into
masterfrom
fix/send-amount-cap
Closed

fix: cap send amount pad at available balance#4
CypherPoet wants to merge 1 commit into
masterfrom
fix/send-amount-cap

Conversation

@CypherPoet

@CypherPoet CypherPoet commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Fixes synonymdev#346

Description

This PR makes the send amount number pad refuse entry above your available balance. Before, you could type any amount and the screen only disabled the Continue button once you went over; now the number pad itself stops you at the maximum you can send, using the same haptic and error flash it already shows at its upper input limit.

The cap follows the selected wallet: spendable on-chain balance minus the network fee for savings, or outbound capacity minus the routing-fee estimate for spending. Tapping the Available label still fills the exact maximum, and the Continue-button validation stays in place as a backstop.

Linked Issues/Tasks

Fixes synonymdev#346

Screenshot / Video

346-onchain-send-cap.mp4
346-onchain-send-cap-still

QA Notes

Manual Tests

  • 1. Send -> paste/scan on-chain invoice -> Amount: type past the displayed Available: amount freezes at the max, haptic + error flash, can't exceed.
    • 1b. tap the Available label: fills exactly the max, Continue enabled.
    • 1c. regression: enter a normal under-balance amount: Continue enabled, proceeds to Confirm.
  • 2. Spending selected -> Amount: type past Available: capped at outbound max minus the routing-fee estimate.
  • 3. regression: zero available balance -> Amount: pad still accepts input (not frozen), Continue stays disabled.

Automated Checks

  • Unit tests added: dynamic input cap in BitkitTests/NumberPadTests.swift (testMaxAmountOverrideBlocksInputAboveBalance, testClearingMaxAmountOverrideRestoresGlobalCap).
  • Built for iOS Simulator (Debug) locally; BitkitTests/NumberPadTests passes (24 tests).
  • Verified on-device (iOS 26.4 simulator, regtest): on-chain Send number pad froze at the available balance and rejected over-max input (see recording).
  • CI: standard build/test checks run by the PR bot.

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

Copy link
Copy Markdown
Owner Author

Re-opened upstream as synonymdev#584. Closing this fork self-review PR.

@CypherPoet CypherPoet closed this Jun 5, 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.

[Bug]: Numberpad should auto cap max limit

1 participant