feat: add network-mismatch warning for unsupported Stellar network (#… - #149
Merged
Chucks1093 merged 1 commit intoApr 25, 2026
Merged
Conversation
…ccesslayerorg#117) - Add useNetworkMismatch hook that compares the connected wallet's chain against the app's defaultChain (wagmi); only flags a mismatch when a wallet is actually connected so disconnected users are unaffected - Add NetworkMismatchBanner component styled consistently with WalletConnectCalloutBanner; self-contained (calls the hook internally), renders nothing when there is no mismatch, role=alert + aria-live for accessibility - Wire mismatch guard into CreatorCard: buy button disabled, handleBuy returns early with a toast, BuyActionHelperText receives disabledReason, NetworkMismatchBanner shown when connected + mismatched - Wire mismatch guard into LandingPage: desktop and mobile Buy/Sell buttons disabled, NetworkMismatchBanner shown above trade buttons - Add useNetworkMismatch unit tests (4/4 passing): disconnected wallet, correct chain, wrong chain, static expected-chain values
|
@victorEdeh 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #117
Summary
Closes #117
Detects when a connected wallet is on a different network than the app's
configured default chain and surfaces a warning banner while disabling
unsafe trade actions. Read-only browsing remains fully available.
Changes
New:
src/hooks/useNetworkMismatch.tsA focused hook that compares the active wallet's chain ID (via wagmi
useChainId) againstdefaultChainfrom the app config. Only flags amismatch when a wallet is actually connected — disconnected users are
unaffected.
Returns:
isMismatch— true when connected and on the wrong chainconnectedChainId— wallet's current chain (undefined when disconnected)expectedChainId/expectedChainName— the app's configured chainNew:
src/components/common/NetworkMismatchBanner.tsxSelf-contained warning banner that calls
useNetworkMismatchinternallyand renders nothing when there is no mismatch — safe to place
unconditionally. Styled consistently with
WalletConnectCalloutBanner.Accessible via
role="alert"andaria-live="polite".Updated:
src/components/common/CreatorCard.tsxdisabled={isNetworkMismatch}handleBuyreturns early with a descriptive toast when mismatchedBuyActionHelperTextreceives adisabledReasonstring when mismatchedNetworkMismatchBannerrenders below the helper text when connected + mismatchedUpdated:
src/pages/LandingPage.tsxNetworkMismatchBannerrenders above the trade buttons in the profile sectionNew:
src/hooks/__tests__/useNetworkMismatch.test.ts4 unit tests — all passing:
Behaviour
Testing locally
VITE_DEFAULT_CHAIN_ID(default: Base Sepolia, 84532)profile section
the user to switch networks
re-enables trade actions