Skip to content

fix(wallet): remove broken isKeplr guard rejecting real Keplr#156

Merged
kostovster merged 1 commit into
mainfrom
fix/keplr-connect-broken-by-isKeplr-guard
May 8, 2026
Merged

fix(wallet): remove broken isKeplr guard rejecting real Keplr#156
kostovster merged 1 commit into
mainfrom
fix/keplr-connect-broken-by-isKeplr-guard

Conversation

@kostovster
Copy link
Copy Markdown
Member

Summary

Removes the window.keplr.isKeplr === true strict-equality guard added to WalletUtils.getKeplrExtension in #155. The guard rejected real Keplr as "not installed" on app-dev; restoring the original if (w.keplr) semantics that worked pre-#155 unblocks Keplr connect immediately.

Root cause

The guard pattern-matched the isPhantom/isSolflare defenses on the Solana wallets (PR #155). It does not generalise to Keplr: isKeplr is declared in @keplr-wallet/types only on EthereumProvider (node_modules/@keplr-wallet/types/build/wallet/ethereum.d.ts:7) — Keplr's EVM bridge that competes with MetaMask. The main Cosmos Keplr interface that window.keplr resolves to does not expose that flag, so the strict-equality check rejected every real Keplr extension.

Changes

  • src/common/utils/WalletUtils.ts — drop isRealKeplr helper; restore the original if (w.keplr) return Promise.resolve(w.keplr) paths. Add a comment block above the function explaining why a Cosmos-side isKeplr check is not viable, so a future contributor does not re-add it.
  • src/common/utils/WalletUtils.test.ts — drop the two test cases that asserted the guard's behaviour; restore the original test fixtures (marker: "keplr-instance").

The Phantom and Solflare guards are unaffected and remain in place — those wallets do expose isPhantom/isSolflare on their Solana providers.

Verification

  • npx tsc --noEmit clean.
  • npm run lint clean.
  • npx vitest run — 760/760 passing (was 762; the two dropped tests targeted the removed guard).
  • npm run build clean.
  • Reproduced the original failure on app-dev (Error: Keplr wallet is not installed.) and traced it to getKeplrExtension returning undefined for a real Keplr lacking the marker.

Follow-ups

  • Devnet broadcast smoke for Phantom and Solflare (deferred to Solana go-live; unchanged).
  • A Cosmos-side identity signal for Keplr would still be valuable. None is documented today; do not re-add a marker check without one verified against the live window.keplr shape.

The isKeplr === true strict-equality guard added in #155 rejected real Keplr
as "not installed" on app-dev. Root cause: isKeplr is declared on Keplr's
EthereumProvider interface (the EVM bridge), NOT on the main Cosmos Keplr
interface that window.keplr resolves to. Pattern-matching from the
isPhantom/isSolflare guards on Solana wallets does not generalise — Keplr's
Cosmos provider exposes no equivalent identity flag.

Restores the original window.keplr-existence check. Adds a comment block
explaining the asymmetry so a future contributor does not re-add a marker
check without a verified Cosmos-side signal.
@kostovster kostovster merged commit 19c9a3d into main May 8, 2026
2 checks passed
@kostovster kostovster deleted the fix/keplr-connect-broken-by-isKeplr-guard branch May 8, 2026 10:13
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.

1 participant