Skip to content

Amount Input Denomination Toggle Between XLM and USDC #476

Description

@Kingsman-99

Description

Users must mentally convert between XLM and USDC when entering payment amounts because the creation form only accepts a single denomination input with no switching mechanism. An inline denomination toggle on the amount input field should allow entry in either unit with real-time conversion.

Technical Context

src/components/invoice/AmountInput.tsx (new or refactored) renders a <input type="number"> paired with a toggle button that cycles between XLM and USDC. src/hooks/useFiatRate.ts supplies the XLM/USDC exchange rate. On toggle, the displayed value is converted and the underlying form state in src/hooks/useInvoiceForm.ts always stores the canonical amount in stroops. react-hook-form Controller wraps the component for validation integration.

Acceptance Criteria

  • The amount field shows a denomination badge (XLM or USDC) that acts as a clickable toggle
  • Switching denomination converts the currently entered value using the live exchange rate
  • The underlying invoice amount stored and submitted is always in XLM stroops regardless of display denomination
  • If the exchange rate is unavailable, USDC denomination is disabled with a tooltip explaining the reason
  • The toggle is keyboard-accessible and the active denomination is announced via aria-label
  • All CI checks (npm test, npm run build, ESLint/TypeScript) pass and the branch has no merge conflicts

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions