Description
Replace fragile boolean flags with a strict Finite State Machine (FSM) using XState to manage multi-wallet discovery, session timeouts, and hardware wallet connection flows.
Architecture & Context
Managing active states for Freighter, MetaMask, and hardware wallets simultaneously leads to unresolvable race conditions. An FSM strictly defines transitions (e.g., Idle -> Discovering -> Awaiting Signature -> Confirmed), making impossible UI states mathematically unreachable.
Technical Requirements
- Define the XState v5 machine configuration mapping all potential Web3 edge cases.
- Integrate EIP-6963 provider announcement listeners to populate the available wallet context.
- Map the state machine seamlessly to React Context for global component consumption.
Acceptance Criteria
Description
Replace fragile boolean flags with a strict Finite State Machine (FSM) using XState to manage multi-wallet discovery, session timeouts, and hardware wallet connection flows.
Architecture & Context
Managing active states for Freighter, MetaMask, and hardware wallets simultaneously leads to unresolvable race conditions. An FSM strictly defines transitions (e.g.,
Idle -> Discovering -> Awaiting Signature -> Confirmed), making impossible UI states mathematically unreachable.Technical Requirements
Acceptance Criteria