Skip to content

Conversation

@jvsena42
Copy link
Member

@jvsena42 jvsena42 commented Jan 16, 2026

Fixes #354

Description

This PR implement the balance validation of #354

Preview

zero-balance-scan-zero-amount-invoice.webm
zero-balance-sance-ln-amount-invoice.webm
invalid.webm
network-mismatch.webm
insufficient-savingsbalance-uniffied.webm

QA Notes

@jvsena42 jvsena42 self-assigned this Jan 16, 2026
@jvsena42 jvsena42 marked this pull request as ready for review January 16, 2026 16:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements balance validation for Bitcoin and Lightning invoice payments to address issue #354. The changes ensure users receive appropriate error messages when attempting to pay invoices with insufficient balance, invalid addresses, or network mismatches.

Changes:

  • Added network validation logic to detect and reject addresses from incompatible Bitcoin networks (mainnet/testnet/regtest)
  • Implemented balance validation for both on-chain and Lightning invoices with specific error messages showing the shortfall amount
  • Added debounced address validation with immediate user feedback via toast messages

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
NetworkValidationHelper.kt New utility class for detecting Bitcoin network from address prefixes and validating network compatibility
NetworkValidationHelperTest.kt Comprehensive unit tests covering address network detection and mismatch validation scenarios
AppViewModel.kt Integrated address validation with debouncing, balance checks, and user feedback for both input and scan flows
strings.xml Added new error message string for insufficient spending balance on Lightning invoices

jvsena42 and others added 2 commits January 16, 2026 13:39
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jvsena42
Copy link
Member Author

@piotr-iohk needs an update from E2E

@claude

This comment has been minimized.

@ovitrif ovitrif mentioned this pull request Jan 19, 2026
@jvsena42
Copy link
Member Author

jvsena42 commented Jan 19, 2026

when setting a duplicated Bit21, Bitkit core decode is digesting only the first one

https://github.com/synonymdev/bitkit-android/actions/runs/21116496130/job/60755069649?pr=625

Example, for

bitcoin:bcrt1qr289x0fhg62672e8urudfnxnsr8tcax64xk2vk?amount=0.0000002&message=Bitkitbitcoin:bcrt1qr289x0fhg62672e8urudfnxnsr8tcax64xk2vk?amount=0.0000003&message=Bitkit

It returns

bitcoin:bcrt1qr289x0fhg62672e8urudfnxnsr8tcax64xk2vk?amount=0.0000002&message=Bitkit

Expect: return decoding error

@jvsena42 jvsena42 marked this pull request as draft January 19, 2026 10:56
@jvsena42 jvsena42 marked this pull request as ready for review January 19, 2026 11:28
@claude

This comment has been minimized.

@jvsena42
Copy link
Member Author

@ovitrif all tests passing 👍🏼

@ovitrif
Copy link
Collaborator

ovitrif commented Jan 19, 2026

on-hold until I open PR to format money values in notifications with thousands separator (" ") like in the rest of the UI

@jvsena42 jvsena42 marked this pull request as draft January 19, 2026 15:28
@jvsena42
Copy link
Member Author

on-hold until I open PR to format money values in notifications with thousands separator (" ") like in the rest of the UI

set to draft

@ovitrif ovitrif marked this pull request as ready for review January 19, 2026 15:50
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

Merging this so the child PR targets master:

@ovitrif ovitrif merged commit eee3800 into master Jan 19, 2026
22 of 24 checks passed
@ovitrif ovitrif deleted the fix/address-validation branch January 19, 2026 15:52
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.

Address/balance validation on 'Send Bitcoin'

4 participants