Skip to content

Implement useWallet hook #5

Description

@iexwr

Context

src/lib/stellar.ts exposes connectWallet, but there is no React state around it, so components re-implement connection logic.

Acceptance criteria

  • Add src/hooks/useWallet.ts returning { publicKey, connected, connect, disconnect, network }.
  • connect calls connectWallet() and stores the pubkey; disconnect clears it (and localStorage).
  • Persist the connected pubkey across reloads; re-validate Freighter availability on mount.

Technical notes

  • Use useState/useEffect; wrap in a context provider in App.tsx if preferred.
  • Keep lib/stellar.ts as the low-level signer.

Testing

  • Unit test the hook with a mocked stellar-sdk wallet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions