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.
This PR aims at avoiding initialization errors caused by wallets.
Rationale
On a webpage that was already connected to a wallet (if
__wallet_kit_connected_wallet
is set in localstorage), when refreshing the page, the connection to this wallet is triggered on page startup.However, if anything in this startup fails, wallet-kit stays in INITIALIZED mode and the loading of any other wallet won't work.
Proposed solution
If an error is thrown during wallet startup or info query on initial wallet connection, the wallet is not connected but the WalletProvider startup is not interrupted and can continue. This allows errors during first initialization (for instance if the wallet password is not indicated correctly)
Current Use case where it's needed
I implemented a local wallet for my Webapp (for easier on-boarding). Once my user is connected, if they fail to give their password (for instance if it's forgotten), the webpage won't be able to connect any wallet anymore. They are facing a blocked state due to wallet-kit not being able to initialize correctly.