Skip to content

feat: distinguish Freighter locked state from not-installed with clear UI - #1017

Open
Horlarmmy wants to merge 1 commit into
Iris-IV:mainfrom
Horlarmmy:feat/show-extension-state-correctly
Open

feat: distinguish Freighter locked state from not-installed with clear UI#1017
Horlarmmy wants to merge 1 commit into
Iris-IV:mainfrom
Horlarmmy:feat/show-extension-state-correctly

Conversation

@Horlarmmy

Copy link
Copy Markdown

Summary

Closes #809

When Freighter is installed but locked (password-protected), the wallet connection flow previously showed the same "Install Freighter" modal as when the extension is not installed at all. This led to confusing guidance — users were told to install something they already had.

This PR detects the locked-wallet error distinctly and surfaces copy telling the user to unlock Freighter rather than reinstall it.

Changes

src/utils/freighterErrors.ts

  • Added FreighterLockedError class
  • Added isFreighterLockedError(error) — detects error messages matching patterns like "freighter is locked", "wallet is locked", "unlock your wallet", "extension is locked"

src/components/InstallFreighterModal.tsx

  • Added optional isLocked prop (default false)
  • When locked:
    • Heading: "Freighter Wallet Locked" (vs "Freighter Wallet Required")
    • Body: instructs user to unlock Freighter with their password
    • Amber info box replaces the "Install Freighter" CTA link
    • Retry button: "I unlocked it — check again"

src/components/WalletContext.tsx

  • Added isFreighterLocked state
  • After getAddress() returns, checks key.error for locked patterns (Freighter API v6 returns error objects, not thrown exceptions)
  • Also checks the catch block for thrown locked errors
  • When locked: shows the modal with isLocked=true instead of the generic error toast
  • handleRetryInstall simplified — closes modal, resets locked flag, calls connectWallet() which re-opens in the correct mode if still locked

src/components/__tests__/WalletContext.test.tsx

  • Added "connectWallet - freighter locked" test — mocks getAddress to return { error: { message: "Freighter is locked" } }, verifies locked-specific heading and unlock guidance appear

Flow

Scenario Before After
Not installed Modal: "Freighter Wallet Required" + Install link Same (unchanged)
Installed & locked Modal: "Freighter Wallet Required" + Install link Modal: "Freighter Wallet Locked" + unlock guidance
Installed & unlocked Connection succeeds Same (unchanged)

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Horlarmmy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@sshdopey

Copy link
Copy Markdown
Contributor

Auto-review failed (API error). Leaving PR for human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Wallet] Surface a clear message when Freighter is locked (not just not installed)

2 participants