Skip to content

fix: align withdraw minimum, gate, and summary math#223

Merged
raulriera merged 3 commits into
mainfrom
fix/withdraw-minimum-validation
May 1, 2026
Merged

fix: align withdraw minimum, gate, and summary math#223
raulriera merged 3 commits into
mainfrom
fix/withdraw-minimum-validation

Conversation

@raulriera

@raulriera raulriera commented May 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Below-fee withdrawals now surface a dialog from Next instead of disabling the button silently, with the floor shown as "Minimum withdrawal X" in red. Displayed minimum, the validation gate, and the summary's fee/net all derive from one rounded fee value, so the three numbers stay consistent across rates and currencies. Verified-state and submission paths are untouched.

Test plan

  • Enter a USD amount below $0.50 fee — subtitle reads "Minimum withdrawal $0.51" in red and Next remains enabled.
  • Tap Next on a below-minimum amount — dialog "Withdrawal Amount Too Small" appears, no advance.
  • Enter exactly the displayed minimum in USD, JPY, and one bonded mint — Next advances.
  • On the summary screen, verify Withdrawal amount − Less fee = Net amount for each currency.
  • Submit a successful withdrawal end-to-end and confirm the on-chain delivered amount matches what the summary previewed.

raulriera added 3 commits May 1, 2026 17:03
The amount-screen minimum and the summary's "Less fee"/"Net amount" used
to compute through different rounding paths, producing user-visible math
mismatches at certain rates (e.g. minimum displayed as ¥80 with summary
fee shown as ¥78). Display, gate, and summary now derive from one
half-up-rounded fee × rate, so the three numbers always match.

The Next button below the fee is enabled and surfaces a "Withdrawal
Amount Too Small" dialog instead of being silently disabled. Subtitle
copy reads "Minimum withdrawal X" in red. Verified-state and submission
paths are unchanged.
NumberFormatter.decimal(from:) is locale-aware and parses "0.69" as 0
on non-"." separator locales (and through the .none-style fallback in
the parse chain), so isBelowMinimumWithdraw fired even when the user
entered exactly the displayed minimum. The keypad always emits "."
regardless of device locale, matching what Decimal(string:) expects —
and what EnterAmountView.isExceedingLimit already uses.
Captures the locale-parsing trap that wasted hours on the withdraw
minimum gate. NumberFormatter.decimal(from:) silently parses "0.69" as
0 on non-"." locales; Decimal(string:) is the established pattern for
keypad input and matches EnterAmountView.isExceedingLimit.
@raulriera raulriera merged commit 746aa76 into main May 1, 2026
@raulriera raulriera deleted the fix/withdraw-minimum-validation branch May 1, 2026 21:25
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.

1 participant