Skip to content

fix: cap onchain send amount to balance#870

Merged
piotr-iohk merged 1 commit intomasterfrom
fix/cannot-send-over-balance
Mar 26, 2026
Merged

fix: cap onchain send amount to balance#870
piotr-iohk merged 1 commit intomasterfrom
fix/cannot-send-over-balance

Conversation

@piotr-iohk
Copy link
Collaborator

@piotr-iohk piotr-iohk commented Mar 26, 2026

Fixes #611

This PR caps the on-chain send amount to the available balance, disabling the Continue button when the entered amount exceeds spendable sats.

Description

The validateAmount function in AppViewModel only checked that the on-chain amount was above dust limit — it never compared against maxSendOnchainSats. This allowed users to proceed with amounts exceeding their balance. Lightning already had this check in place.

The fix adds amount <= maxSendOnchainSats to the on-chain validation branch, matching the Lightning behavior.

Preview

Screen.Recording.2026-03-26.at.15.31.44.mov

QA Notes

  1. Fund an on-chain wallet with a known balance
  2. Initiate an on-chain send (scan a BTC address QR)
  3. Enter an amount greater than your available balance
  4. Verify the Continue button is disabled
  5. Enter an amount within balance — verify the Continue button is enabled
  6. Verify Lightning send behavior is unchanged (should still cap correctly)

E2E test coverage: synonymdev/bitkit-e2e-tests#137

Made with Cursor

@piotr-iohk piotr-iohk marked this pull request as ready for review March 26, 2026 14:33
@piotr-iohk piotr-iohk self-assigned this Mar 26, 2026
@piotr-iohk piotr-iohk added this to the 2.2.0 milestone Mar 26, 2026
@claude
Copy link

claude bot commented Mar 26, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@piotr-iohk piotr-iohk enabled auto-merge March 26, 2026 14:46
@piotr-iohk piotr-iohk requested review from jvsena42 and ovitrif March 26, 2026 14:46
Copy link
Collaborator

@ovitrif ovitrif left a comment

Choose a reason for hiding this comment

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

tAck

LGTM

Note that in order to get this to the level of polishing we had in the RN app, we should also prevent entering a higher amount than the max while using the numpad.

IIRC RN bitkit also had a toast or just red numbers while typing 🤷🏻

@piotr-iohk piotr-iohk merged commit 8c8e25e into master Mar 26, 2026
26 checks passed
@piotr-iohk piotr-iohk deleted the fix/cannot-send-over-balance branch March 26, 2026 16:50
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.

Bitkit should auto cap max limit (Android only)

2 participants