-
Notifications
You must be signed in to change notification settings - Fork 50
Add validation to the Send form (address and amount) #462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
666aff7
to
1e81bb6
Compare
setAmountError(tr("Amount must be greater than zero")); | ||
} else if (m_amount->satoshi() > MAX_MONEY) { | ||
setAmountError(tr("Amount exceeds maximum limit")); | ||
} else if (m_amount->satoshi() > m_wallet->balanceSatoshi()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could remove this case for now as it allows removing the circular dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might be a good idea and I can just do this validation when creating the transaction in the wallet model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think im going to leave the circular dependency in for now.and take another look when doing validation with multiple recipients
Nice addition. A few notes:
Always a bit finicky these input fields. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- the UX is better if the verification is done without having to change focus from the field:
Screencast.from.2025-06-02.13-12-13.webm
- the amount converter doesn't seem to be working as it should:
Screencast.from.2025-06-02.13-14-41.webm
Good catch, I will split up the validation and formatting helpers so that validation can happen while editing and it will reformat once editing is finished.
bummer, must have introduced a bug with conversion. I will double check the sats to btc conversion. |
I will look at what options there are to restrict the character limit
Thats interesting. I will double check. Could it be regtest/testnet/mainnet differences in format.
I can update the error string to include this
This is a precursor to what will end up being the rich formatting of the amount. If you are inputing BTC amounts it will add the satoshi trailing 0's
I will consider this. |
The SendRecipientsListModel is owned by WalletQmlModel
This merges BitcoinAmount with SendRecipient to simplify the qml logic. By doing so, the conversions can be managed all in c++ against the satoshi member variable. Each recipient having its own BitcoinAmount allows the amounts to be saved independantly when there are multiple recipients.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested LGTM 3630bc2
Note that when entering full balance, Review
is highlighted but not clickable.
As the GUI won't allow creating tx's with 0 fees, maybe Review
should only be highlighted when amount < balance
Looking good. Address input
Amount input
|
This is a good one. I will add an issue to include this in my validation when I add proper fee estimation. |
This is built on top of #450 so when reviewing, its best to select just the new commits in the "Files changed" tab.
These changes add properties for the error strings used in the QML to SendRecipient and add validation methods that are checked when the relevant properties are changed by the user.