fix: json rpc errors because of nonce out of sync #2833
Merged
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.
What does this PR do?
🤖 Generated by Copilot at 2409232
This pull request refactors the user signature nonce management in the web app. It introduces a new zustand store, a new query, and a new provider component to handle the user signature nonce state. It updates various components and mutations to use the new store and query. It also adds a dependency on
shared-zustand
to enable syncing the user signature nonce across different tabs or windows. It removes the user signature nonce logic from the app store and theUserProfiles
query.Related issues
Fixes #2804
Type of change
Explanation of the changes
🤖 Generated by Copilot at 2409232
shared-zustand
dependency to enable sharing zustand stores across React contexts or iframes (link)useNonceStore
to manage the user signature nonce state and persist it in local storage (link, link)UserSigNonces
to fetch the user signature nonce for the current user from the Lens API (link)UserSigNoncesProvider
that uses theUserSigNonces
query and theuseNonceStore
hook to sync the user signature nonce across different tabs or windows (link)UserSigNoncesProvider
component inside theProviders
component to ensure that the user signature nonce is fetched and updated for every page (link, link)userSigNonce
andsetUserSigNonce
properties and selectors from theAppState
interface and theuseAppStore
hook as they are no longer needed (link, link)userSigNonces
field from theUserProfiles
query as it is no longer needed (link)useNonceStore
hook and replace theuseAppStore
hook for theuserSigNonce
andsetUserSigNonce
selectors in various components that require signing transactions with the user signature nonce (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)Emoji
🔒🚀🧹