Skip to content

adds account changed handler#1044

Merged
joshuascan merged 3 commits intomasterfrom
account-changed-handler
Feb 26, 2026
Merged

adds account changed handler#1044
joshuascan merged 3 commits intomasterfrom
account-changed-handler

Conversation

@joshuascan
Copy link
Member

@joshuascan joshuascan commented Feb 26, 2026

📦 Pull Request

Adds onAccountChanged callback to that fires when the user switches wallet accounts and re-authentication completes

✅ Fixed Issues

  • Adds onAccountChanged callback

🚨 Test instructions

[Describe any additional context required to test the PR/feature/bug fix.]

⚠️ Don't forget to add a semver label!

Please 🚨 ONLY ADD ONE 🚨 of the following labels, failing to do so may lead to adverse versioning of your changes when published:

  • patch: Bug Fix?
  • minor: New Feature?
  • major: Breaking Change?
  • skip-release: It's unnecessary to publish this change.

Special Note

Please avoid adding any of the Priority labels as they conflict with the labels above ☝️

📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @magic-ext/wallet-kit@0.6.0-canary.1044.22455768697.0
# or 
yarn add @magic-ext/wallet-kit@0.6.0-canary.1044.22455768697.0

@joshuascan joshuascan requested a review from a team as a code owner February 26, 2026 17:51
@joshuascan joshuascan added the minor Increment the minor version when merged label Feb 26, 2026
hcote
hcote previously approved these changes Feb 26, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new consumer-facing callback for detecting when a connected wallet account changes and SIWE re-auth completes, wiring it from the React widget down into the extension’s silent re-auth flow.

Changes:

  • Add onAccountChanged to MagicWidgetProps.
  • Add callback registration (setAccountChangedCallbacks) to WalletKitExtension and invoke it after silent SIWE re-auth.
  • Wire the prop into MagicWidget via a useEffect.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
packages/@magic-ext/wallet-kit/src/types.ts Adds the onAccountChanged prop and docs to the public widget props type.
packages/@magic-ext/wallet-kit/src/extension.ts Stores account-changed callbacks and triggers them after successful silent SIWE re-auth; adds error callback support.
packages/@magic-ext/wallet-kit/src/MagicWidget.tsx Registers the new callbacks on the singleton extension instance from React props.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@joshuascan joshuascan enabled auto-merge February 26, 2026 18:42
@joshuascan joshuascan added this pull request to the merge queue Feb 26, 2026
Merged via the queue into master with commit dda8d3c Feb 26, 2026
4 of 6 checks passed
@joshuascan joshuascan deleted the account-changed-handler branch February 26, 2026 18:52
@Ethella
Copy link
Member

Ethella commented Feb 26, 2026

🚀 PR was released in @magic-ext/wallet-kit@0.6.0 🚀

@Ethella Ethella added the released This issue/pull request has been released. label Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Increment the minor version when merged released This issue/pull request has been released.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants