Scope
File: src/components/wallet/TxModal.tsx
Problem
Users are prompted to sign transactions without seeing the estimated resource fee (gas) in XLM. This leads to signature rejections due to insufficient balances or unexpected fee amounts, creating a poor UX where users must approve blindly or cancel and re-enter the flow.
Requirements
- The modal must display the following before the user signs:
- Operation name (e.g., "Update Tariff", "Deposit Collateral")
- Estimated resource fee in XLM (7-decimal precision)
- Current account balance
- A visual warning (
insufficient state) if balance < fee
- The
confirm button must be disabled when insufficient is true.
- Add a loading spinner on the confirm button during submission.
- Accept props:
open, onClose, onConfirm, operation, resourceFee, balance.
- Accessibility: focus trap,
Escape to close, aria-modal="true", role="dialog".
Resolution Strategy
- Stateless modal — parent owns state and passes props.
- Use
BigNumber comparison inside useEffect for insufficiency check.
useCallback for confirm handler to avoid re-renders.
- Fixed positioning with backdrop blur for focus isolation.
Tags
wallet, modal, fees, ux
Scope
File:
src/components/wallet/TxModal.tsxProblem
Users are prompted to sign transactions without seeing the estimated resource fee (gas) in XLM. This leads to signature rejections due to insufficient balances or unexpected fee amounts, creating a poor UX where users must approve blindly or cancel and re-enter the flow.
Requirements
insufficientstate) if balance < feeconfirmbutton must be disabled wheninsufficientis true.open,onClose,onConfirm,operation,resourceFee,balance.Escapeto close,aria-modal="true", role="dialog".Resolution Strategy
BigNumbercomparison insideuseEffectfor insufficiency check.useCallbackfor confirm handler to avoid re-renders.Tags
wallet, modal, fees, ux