Repository navigation
fix(wallet): correct the fiat balance and send the max amount - #417
Merged
Merged
Conversation
The wallet multiplied the balance by the placeholder XEC rate of 1 and labeled it as USD. Use the selected currency's XEC price instead.
Contributor
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Max fills the largest amount the miner fee leaves spendable. After a broadcast, the wallet subtracts those coins locally and ignores Chronik snapshots that still include them.
nghiacc
marked this pull request as ready for review
September 23, 2026 21:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The wallet balance line multiplied XEC by the placeholder rate
{ coin: 'xec', rate: 1 }thattransformFiatRatesadds for self-conversion, then labeled the result with the selected fiat code. 1,556,887.19 XEC therefore showed as ~1,556,887.19 USD.The balance now uses the selected currency's XEC price (
fiat per 1 XEC) fromgetAllFiatRate. At the current production rate that balance is about 14.24 USD. If that price is missing, the fiat line is omitted instead of showing a 1:1 figure.The send form has a Max button. It fills the largest amount a P2PKH payment can include after the miner fee, using the same fee rules as the transaction builder. Change that would be below dust is left out, and that value is counted in the fee. The network fee for the entered amount is shown under the field.
After a successful broadcast, the balance drops immediately on the wallet page and in the header. Chronik often still returns the spent coins for a while; those snapshots are ignored until they no longer contain the spent outpoints, and then the balance syncs from the indexer. A partial send keeps the change locally until that sync.
Test
Checked the fiat conversion against a USD group whose XEC rate is 0.00002 (not 1) and against the live
getAllFiatRateresponse, where both the USD and XEC groups report9.14855882329e-06USD per XEC.Compared max, partial, and dust-change quotes with
TxBuilder.signfor 1, 2, and 8 inputs. One coin of 1,556,887.19 XEC quotes a max send of 1,556,883.47 XEC and a 3.72 XEC network fee.next buildtypechecked. The signed-in wallet screen was not opened in a browser.