From cbd89215c1028a79338ccae270ead1e489eb82e1 Mon Sep 17 00:00:00 2001 From: Tien Nguyen Date: Tue, 9 Sep 2025 14:36:34 +0700 Subject: [PATCH 1/2] disconnect use wagmi --- .../sdk/src/global-account/react/hooks/useAuthentication.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/sdk/src/global-account/react/hooks/useAuthentication.ts b/packages/sdk/src/global-account/react/hooks/useAuthentication.ts index 739faafb5..f40eaf1ee 100644 --- a/packages/sdk/src/global-account/react/hooks/useAuthentication.ts +++ b/packages/sdk/src/global-account/react/hooks/useAuthentication.ts @@ -9,6 +9,7 @@ import { useEffect, useRef } from "react"; import { useActiveWallet, useAutoConnect, useConnectedWallets, useDisconnect } from "thirdweb/react"; import { ecosystemWallet } from "thirdweb/wallets"; import { preAuthenticate } from "thirdweb/wallets/in-app"; +import { useDisconnect as useDisconnectWagmi } from "wagmi"; import { useConnect } from "./useConnect"; import { useSiwe } from "./useSiwe"; @@ -16,6 +17,7 @@ const debug = debugB3React("useAuthentication"); export function useAuthentication(partnerId: string, loginWithSiwe?: boolean) { const { disconnect } = useDisconnect(); + const { disconnect: disconnectWagmi } = useDisconnectWagmi(); const wallets = useConnectedWallets(); const activeWallet = useActiveWallet(); const { authenticate } = useSiwe(); @@ -129,6 +131,8 @@ export function useAuthentication(partnerId: string, loginWithSiwe?: boolean) { if (activeWallet) { debug("@@logout:activeWallet", activeWallet); disconnect(activeWallet); + // disconnect wagmi + disconnectWagmi(); debug("@@logout:disconnected"); console.log("@@gio:logout:activeWallet", activeWallet); } From fac17403b9efbeaaaeede3f0ae6348a0794e344d Mon Sep 17 00:00:00 2001 From: Tien Nguyen Date: Tue, 9 Sep 2025 14:42:30 +0700 Subject: [PATCH 2/2] Correct logout --- .../sdk/src/global-account/react/hooks/useAuthentication.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/sdk/src/global-account/react/hooks/useAuthentication.ts b/packages/sdk/src/global-account/react/hooks/useAuthentication.ts index f40eaf1ee..a0d9e3d09 100644 --- a/packages/sdk/src/global-account/react/hooks/useAuthentication.ts +++ b/packages/sdk/src/global-account/react/hooks/useAuthentication.ts @@ -131,8 +131,6 @@ export function useAuthentication(partnerId: string, loginWithSiwe?: boolean) { if (activeWallet) { debug("@@logout:activeWallet", activeWallet); disconnect(activeWallet); - // disconnect wagmi - disconnectWagmi(); debug("@@logout:disconnected"); console.log("@@gio:logout:activeWallet", activeWallet); } @@ -143,6 +141,9 @@ export function useAuthentication(partnerId: string, loginWithSiwe?: boolean) { disconnect(wallet); }); + // disconnect wagmi + disconnectWagmi(); + // Delete localStorage thirdweb:connected-wallet-ids // https://npc-labs.slack.com/archives/C070E6HNG85/p1750185115273099 if (typeof localStorage !== "undefined") {