Skip to content

Implement guided, validated chain-switching UX #246

Description

@Lakes41

Difficulty: Advanced | Type: Feature / Architecture

Background: NEXT_PUBLIC_WALLET_CHAINS restricts supported chains to a subset of mainnet, base, sepolia, validated by lib/wallet/config.ts.

Problem: If a user's wallet is connected to a chain outside the configured NEXT_PUBLIC_WALLET_CHAINS set (e.g. connected to Polygon while the app only supports mainnet/base), the app's behavior in that scenario isn't described — it likely either silently misbehaves or shows a generic wagmi error.

Expected Outcome: The app detects an unsupported connected chain and guides the user through switching to a supported one via wagmi's switchChain, with a clear explanatory UI rather than a silent failure or cryptic error.

Suggested Implementation: Add a chain-mismatch detector (comparing wagmi's active chainId against the configured supported set from lib/wallet/config.ts) rendered as a persistent banner with a "Switch to " button calling useSwitchChain(), handling the case where the wallet doesn't support programmatic switching (fallback to manual instructions).

Acceptance Criteria:

  • Connecting on an unsupported chain shows a clear banner naming the required chain(s).
  • "Switch" button successfully changes chain via wagmi where supported.
  • Manual-switch instructions are shown for wallets/chains where programmatic switching isn't available.
  • Covered by a test simulating an unsupported active chain.

Likely Affected Files/Directories: lib/wallet/config.ts, lib/wallet/providers.tsx, components/wallet/connect-button.tsx

Labels: feature, architecture, GrantFox OSS, Maybe Rewarded, Official Campaign | FWC26

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox Open Source Sponsorship program tagMaybe RewardedIssue may qualify for a reward upon successful completion per campaign rulesOfficial Campaign | FWC26Official FWC26 campaign issue — eligible for campaign scoring and rewardsarchitectureStructural / design-level changefeatureNew feature, enhancement, or functional addition

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions