Skip to content

Issue 12: Pre-Flight Resource Fee Projection Modal for Complex Operations #12

Description

@elizabetheonoja-art

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

  1. 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
  2. The confirm button must be disabled when insufficient is true.
  3. Add a loading spinner on the confirm button during submission.
  4. Accept props: open, onClose, onConfirm, operation, resourceFee, balance.
  5. 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions