fix: handle chain initialization failures with localStorage cleanup and page reload #959
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.
fix: handle chain initialization failures with localStorage cleanup and page reload
Summary
This PR adds graceful error handling for wallet initialization failures in the react-wallet-v2 application. When a chain wallet fails to initialize (e.g., due to a corrupted or invalid private key stored in localStorage), the application now:
The implementation handles both the critical EIP155 wallet (which blocks initialization) and the non-critical secondary chain wallets (Cosmos, Solana, Polkadot, Near, MultiversX, Tron, Tezos, Kadena, Bitcoin, Sui, Stacks, TON) which are initialized in the background.
Review & Testing Checklist for Human
CHAIN_STORAGE_KEYS(lines 20-34) match exactly what each wallet utility file uses (e.g.,EIP155_MNEMONIC_1,SOLANA_SECRET_KEY_1, etc.)EIP155_MNEMONIC_1value in localStorage and verify the alert appears, keys are cleared, and page reloads with fresh walletCOSMOS_MNEMONIC_1) and verify the batched error handling works correctlyRecommended test plan:
EIP155_MNEMONIC_1to an invalid value (e.g., "invalid")Notes
alert()for user notification as requested - this is blocking but simpleLink to Devin run: https://app.devin.ai/sessions/a3a891873d5945c5b15258801e05832b
Requested by: gancho@reown.com (@ganchoradkov)