You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed satoshi amount calculation in the Send feature to ensure values are properly rounded to whole numbers when converting from fiat amounts, improving the accuracy of cryptocurrency amount conversions.
The Send form's satoshi calculation effect now applies Math.floor() to ensure amounts converted from fiat or direct inputs result in integer satoshi values, preventing fractional satoshis.
Added Math.floor() to satoshi calculation in the amount change effect to convert fiat-derived and direct amounts to integers, preventing non-integer satoshi values.
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~5–10 minutes
Single file with a focused logic change
Verify Math.floor() is applied consistently to both fiat conversion and direct amount paths
Check that the fix resolves the RangeError when entering small fractional amounts like "0.00003359"
Suggested reviewers
Kukks
Pre-merge checks and finishing touches
❌ Failed checks (1 warning)
Check name
Status
Explanation
Resolution
Docstring Coverage
⚠️ Warning
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.
You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name
Status
Explanation
Description Check
✅ Passed
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
✅ Passed
The title 'fix range error' is concise and relates to the PR's primary objective of fixing a RangeError crash when entering specific fiat amounts, though it lacks implementation detail.
Linked Issues check
✅ Passed
The PR addresses issue #211 by applying Math.floor to satoshi calculations, which prevents non-integer value crashes when entering amounts like '0.00003359' in the Send form.
Out of Scope Changes check
✅ Passed
All changes are directly related to fixing the RangeError crash in the Send form by ensuring integer satoshi values; no out-of-scope modifications detected.
✨ Finishing touches
📝 Generate docstrings
🧪 Generate unit tests (beta)
Create PR with unit tests
Post copyable unit tests in a comment
Commit unit tests in branch fix_range_error
📜 Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between e9784bc and d7fd0b8.
📒 Files selected for processing (1)
src/screens/Wallet/Send/Form.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
The addition of Math.floor() ensures that satoshi values are always integers, which is correct since satoshis are the atomic unit of Bitcoin. This directly addresses the RangeError from issue #211 by preventing fractional values from propagating downstream. The existing validation at lines 215-216 properly handles cases where flooring results in amounts below 1 satoshi.
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.
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
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.
Closes #211
@louisinger please review
Summary by CodeRabbit