Skip to content

fix range error - #212

Merged
bordalix merged 1 commit into
masterfrom
fix_range_error
Nov 7, 2025
Merged

bordalix merged 1 commit into
masterfrom
fix_range_error

Conversation

@bordalix

@bordalix bordalix commented Nov 6, 2025 •

Copy link
Copy Markdown
Collaborator

Closes #211

@louisinger please review

Summary by CodeRabbit

  • Bug Fixes
    • 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.

@coderabbitai

coderabbitai Bot commented Nov 6, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

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.

Changes

Cohort / File(s) Summary
Satoshi calculation integer enforcement
src/screens/Wallet/Send/Form.tsx
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)
  • GitHub Check: test
🔇 Additional comments (1)
src/screens/Wallet/Send/Form.tsx (1)

202-204: LGTM! Fix correctly prevents fractional satoshis.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying wallet-signet with  Cloudflare Pages  Cloudflare Pages

Latest commit: d7fd0b8
Status: ✅  Deploy successful!
Preview URL: https://66c7f401.wallet-23u.pages.dev
Branch Preview URL: https://fix-range-error.wallet-23u.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying wallet-mutinynet with  Cloudflare Pages  Cloudflare Pages

Latest commit: d7fd0b8
Status: ✅  Deploy successful!
Preview URL: https://ba3ff74f.arkade-wallet.pages.dev
Branch Preview URL: https://fix-range-error.arkade-wallet.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying wallet-bitcoin with  Cloudflare Pages  Cloudflare Pages

Latest commit: d7fd0b8
Status: ✅  Deploy successful!
Preview URL: https://3a3c7cac.wallet-bitcoin.pages.dev
Branch Preview URL: https://fix-range-error.wallet-bitcoin.pages.dev

View logs

@bordalix
bordalix merged commit 5b32314 into master Nov 7, 2025
1 check passed
@bordalix
bordalix deleted the fix_range_error branch November 26, 2025 14:30
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.

Send page RangeError

1 participant