fix: add wallet ready state to prevent signing with null keypair after page refresh (Closes #172) - #218
Open
waterWang wants to merge 1 commit into
Open
Conversation
…r page refresh (Closes Epta-Node#172) The wallet appeared connected after page refresh (publicKey restored from localStorage) but keypair was always null since Keypair is not JSON-serializable, causing all transaction signing to fail. Changes: - Add state to WalletContext — true for Freighter (always ready when connected), true for secret-key only when keypair is in memory - WalletPage: show reconnect prompt when secret-key wallet is connected but not ready (keypair null after refresh), with public key displayed for reference and Reconnect/Disconnect buttons - TopNav: show 'Reconnect Required' badge instead of full wallet UI when wallet is not ready - Navbar: show Connect button instead of wallet chip when not ready
|
@water is attempting to deploy a commit to the Jaja's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Summary
Fixes #172 — CRITICAL: Wallet Keypair Loss on Page Refresh.
Root Cause
The Stellar SDK
Keypairobject is not JSON-serializable and cannot be stored in localStorage. After page refresh:publicKeyis restored from localStorage →connected = truekeypairis alwaysnull→ signing failsSendXLMForm.handleConfirm()callstransaction.sign(keypair)with null → crashChanges
WalletContext.tsx — Added
readyderived state:WalletPage.tsx — When wallet is connected but not ready (secret-key after refresh), shows a reconnect prompt with:
TopNav.tsx — Shows "Reconnect Required" badge when wallet is not ready
Navbar.tsx — Shows Connect button instead of wallet chip when wallet is not ready
Acceptance Criteria