Create Wallet Context for global wallet state management#9
Merged
Iwueseiter merged 3 commits intoHubDApp:mainfrom Feb 25, 2026
Merged
Create Wallet Context for global wallet state management#9Iwueseiter merged 3 commits intoHubDApp:mainfrom
Iwueseiter merged 3 commits intoHubDApp:mainfrom
Conversation
Contributor
Author
|
Hello @Iwueseiter, please review my PR |
Contributor
Contributor
Author
|
Hello @Iwueseiter Done with it, waiting for review. |
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.
Closes #4
Wallet Context Implementation
The global wallet state management feature has been successfully implemented to fulfill the requirements of Issue #4.
Implemented state tracking for publicKey, isConnected, and a new isConnecting loading state.
Designed to easily drop in the final Solana/Web3 provider later in Task #3 without changing the consumer signature.
State Persistence (localStorage):
Integrated localStorage to save the isConnected and publicKey values.
Added a useEffect hook that restores this state when the components mount.
This ensures the wallet remains visually disconnected/connected across page reloads seamlessly.
UX Enhancements (
page.tsx
):
Updated the main interface to consume the new isConnecting state.
Added a visually pleasing loading spinner and a "Connecting..." label when the user initiates a wallet connection.
Handled edge cases during hydration and button disabling states while connecting, delivering a highly professional Web3 feel.
Validation Results
The
WalletProvider
successfully wraps the main application tree via
layout.tsx
.
Connect/disconnect actions mock an 800ms delay to reflect realistic network latency.
Component state persists safely across browser sessions without causing hydration mismatch errors.
Visual feedback is responsive to user interactions as expected.
Screen.Recording.2026-02-22.002246.mp4