Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| return !showPasswordLessInput && !areSocialLoginsVisible; | ||
| }, [areSocialLoginsVisible, showPasswordLessInput]); | ||
|
|
||
| const isWalletConnectAccountLinkingVisible = useMemo(() => { |
There was a problem hiding this comment.
move all linking stuff to a new component pls
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3257baf. Configure here.
| @@ -1,4 +1,4 @@ | |||
| // import "./global"; | |||
| import "./global"; | |||
| const { showCallsStatus, isPending: isShowCallsStatusPending, error: showCallsStatusError } = useShowCallsStatus(); | ||
|
|
||
| // Account Linking | ||
| const { linkAccount, loading: isLinkAccountLoading, error: linkAccountError } = useLinkAccount(); |
There was a problem hiding this comment.
i think the useLinkAccount hook should handle and return linkAccountResult state so consumer don't have to handle it themselves everytime
There was a problem hiding this comment.
The hook return the function, linkAccount which internally handle the account linking logic though.
| useEffect(() => { | ||
| // TODO: maybe move this inside root | ||
| if (!modalState.modalVisibility) return; | ||
| if (modalState.accountLinking.active) return; |
There was a problem hiding this comment.
should add some comment here explaining why we don't do this effect if account linking active
There was a problem hiding this comment.
added comments here, chore: addressed comments
| activeAccount: this.activeAccount, | ||
| currentChainId: this.currentChainId, | ||
| }); | ||
| if (!switchResult) { |
There was a problem hiding this comment.
should we log something here if the switch doesn't do anything
There was a problem hiding this comment.
There's only one case that authConnector.switchAccount can return empty value, i.e when the target account is already active.
We should not need any log for that, this is not an error. Clients should handle it to prevent switching to same account again.
| if (connector.status === CONNECTOR_STATUS.NOT_READY && this.cachedConnector !== connectorName) { | ||
| if ( | ||
| connector.status === CONNECTOR_STATUS.NOT_READY && | ||
| this.cachedConnector !== connectorName && |
There was a problem hiding this comment.
do we need to check both ? what could be the case 1 of cached and current connection match
There was a problem hiding this comment.
On load, we init all the connectors (including external wallet connectors) again.
There's a case that user has linked the external wallet (the connector status is Connected) but it's not an active account (not cachedConnector).
| status: ACCOUNT_LINKING_STATUS.INITIALIZING, | ||
| }; | ||
| }); | ||
| this.setState({ |
There was a problem hiding this comment.
updateAccountLinkingState already setState i don't think we need this anymore

Jira Link
https://consensyssoftware.atlassian.net/browse/EMBED-85?atlOrigin=eyJpIjoiM2UxZDY3YTZlOGFkNGU2Nzg0YjFjYjliOTc5N2I1MjAiLCJwIjoiaiJ9
Description
This PR adds external wallet account linking to Web3Auth.
Users authenticated through the
AUTHconnector can now link and unlink external wallets, retrieve connected account metadata from user info, and access framework-level React/Vue helpers for the flow. The change also updates the demo apps to showcase the new linking UX.What Changed
linkAccount(params)andunlinkAccount(address)toWeb3AuthNoModal./v1/link/walletand/v1/unlink/walletrequests.AccountLinkingErrorerror codes and analytics events for linking/unlinking start, success, and failure.generateChallengeAndSign()so external wallets can produce proof-of-ownership signatures for linking.AuthConnector.getUserInfo()to includeconnectedAccountsfetched from Citadel/v1/user.useLinkAccounthooks/composables for:@web3auth/modal/react@web3auth/modal/vue@web3auth/no-modal/react@web3auth/no-modal/vueUser-Facing Features
useLinkAccountAPI with loading, error, and linked account state.Notes
AUTHconnector.METAMASKandWALLET_CONNECT_V2.How has this been tested?
AUTHconnector.getUserInfo()and verifyconnectedAccountsis returned.Screenshots (if appropriate)
Types of changes
Checklist
Note
Medium Risk
Adds new account-linking/switching flows (including WalletConnect modal-session handling) and changes wagmi provider resync behavior, which can impact connection state and wallet UX across frameworks. Demo and lockfile updates are lower risk but broaden surface area for regression in login/modal flows.
Overview
Adds external wallet account linking/switching support.
Web3Authinpackages/modalnow exposeslinkAccountandswitchAccount, with special handling for WalletConnect v2 that opens the modal, tracks an account-linking session, and cleans up connectors/listeners on success, failure, or user-close.Introduces account-linking UI state + screen. The login modal state gains an
accountLinkingstate machine (intent,status,walletConnectUri, errors), andRoot/Widgetnow render a dedicatedAccountLinkingQR flow and skip the normal WalletConnect “prewarm” during linking.Framework integrations updated. React/Vue exports add
useLinkAccount/useSwitchAccount, and the React/Vue wagmi providers now resync off the Web3Authconnectionobject (not the stable provider proxy) to correctly refresh wagmi state on account switches.Demos refreshed. The Vue demo adds an
AccountLinkingSection(list/switch/unlink/link wallets) and usesgetUserInfo()for fresh connected account data; the wagmi React demo adds a simple “Link Wallet” UI. Miscellaneous formatting/typings tweaks andpackage-lock.jsonchurn accompany the feature.Reviewed by Cursor Bugbot for commit 8573cb0. Bugbot is set up for automated code reviews on this repo. Configure here.