Skip to content

Conversation

@salimtb
Copy link
Contributor

@salimtb salimtb commented Jan 8, 2026

Explanation

Current state:
When the keyring is unlocked, the AccountTrackerController sets #isLocked = false but does not trigger a balance refresh. This means users have to wait for the next polling cycle before their account balances update after unlocking their wallet.

Solution:
This PR adds a call to refresh() when the KeyringController:unlock event is received. This triggers an immediate balance refresh for all network clients, providing users with up-to-date balances as soon as they unlock their wallet.

The implementation follows the same pattern used for other events that trigger refreshes, such as selectedEvmAccountChange and NetworkController:networkAdded.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Ensures balances update instantly after unlocking, instead of waiting for the next poll.

  • On KeyringController:unlock, AccountTrackerController now calls refresh() for all networkClientIds and logs errors
  • Adds unit test asserting a refresh is triggered on unlock
  • Updates CHANGELOG.md under Unreleased to document the behavior change

Written by Cursor Bugbot for commit 4fa976b. This will update automatically on new commits. Configure here.

@salimtb salimtb marked this pull request as ready for review January 8, 2026 14:36
@salimtb salimtb requested review from a team as code owners January 8, 2026 14:36
@salimtb salimtb added this pull request to the merge queue Jan 9, 2026
Merged via the queue into main with commit 9866419 Jan 9, 2026
286 checks passed
@salimtb salimtb deleted the refresh-balances-on-unlock branch January 9, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants