@b3dotfun/sdk 0.1.68-alpha.1 → 0.1.68-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -132,21 +132,17 @@ function useAuthentication(partnerId) {
|
|
|
132
132
|
}
|
|
133
133
|
}, [activeWallet, partnerId, authenticate, setIsAuthenticated, setIsAuthenticating, setUser, setHasStartedConnecting]);
|
|
134
134
|
const logout = (0, react_2.useCallback)(async (callback) => {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
disconnect(activeWallet);
|
|
138
|
-
debug("@@logout:activeWallet", activeWallet);
|
|
139
|
-
}
|
|
140
|
-
// Log out of each wallet
|
|
135
|
+
// Only disconnect ecosystem/smart wallets, preserve EOA wallets (e.g. MetaMask)
|
|
136
|
+
// so they remain available after re-login
|
|
141
137
|
wallets.forEach(wallet => {
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
debug("@@logout:wallet", wallet.id);
|
|
139
|
+
if (wallet.id.startsWith("ecosystem.") || wallet.id === "smart") {
|
|
140
|
+
disconnect(wallet);
|
|
141
|
+
}
|
|
144
142
|
});
|
|
145
|
-
//
|
|
146
|
-
//
|
|
143
|
+
// Clear user-specific storage but preserve wallet connection state
|
|
144
|
+
// so EOA wallets (e.g. MetaMask) can auto-reconnect on next login
|
|
147
145
|
if (typeof localStorage !== "undefined") {
|
|
148
|
-
localStorage.removeItem("thirdweb:connected-wallet-ids");
|
|
149
|
-
localStorage.removeItem("wagmi.store");
|
|
150
146
|
localStorage.removeItem("lastAuthProvider");
|
|
151
147
|
localStorage.removeItem("b3-user");
|
|
152
148
|
}
|
|
@@ -159,7 +155,7 @@ function useAuthentication(partnerId) {
|
|
|
159
155
|
if (onLogoutCallback) {
|
|
160
156
|
await onLogoutCallback();
|
|
161
157
|
}
|
|
162
|
-
}, [
|
|
158
|
+
}, [disconnect, wallets, setIsAuthenticated, setUser, setIsConnected, onLogoutCallback]);
|
|
163
159
|
const onConnect = (0, react_2.useCallback)(async (_walleAutoConnectedWith, allConnectedWallets) => {
|
|
164
160
|
debug("@@useAuthentication:onConnect", { _walleAutoConnectedWith, allConnectedWallets });
|
|
165
161
|
try {
|
|
@@ -126,21 +126,17 @@ export function useAuthentication(partnerId) {
|
|
|
126
126
|
}
|
|
127
127
|
}, [activeWallet, partnerId, authenticate, setIsAuthenticated, setIsAuthenticating, setUser, setHasStartedConnecting]);
|
|
128
128
|
const logout = useCallback(async (callback) => {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
disconnect(activeWallet);
|
|
132
|
-
debug("@@logout:activeWallet", activeWallet);
|
|
133
|
-
}
|
|
134
|
-
// Log out of each wallet
|
|
129
|
+
// Only disconnect ecosystem/smart wallets, preserve EOA wallets (e.g. MetaMask)
|
|
130
|
+
// so they remain available after re-login
|
|
135
131
|
wallets.forEach(wallet => {
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
debug("@@logout:wallet", wallet.id);
|
|
133
|
+
if (wallet.id.startsWith("ecosystem.") || wallet.id === "smart") {
|
|
134
|
+
disconnect(wallet);
|
|
135
|
+
}
|
|
138
136
|
});
|
|
139
|
-
//
|
|
140
|
-
//
|
|
137
|
+
// Clear user-specific storage but preserve wallet connection state
|
|
138
|
+
// so EOA wallets (e.g. MetaMask) can auto-reconnect on next login
|
|
141
139
|
if (typeof localStorage !== "undefined") {
|
|
142
|
-
localStorage.removeItem("thirdweb:connected-wallet-ids");
|
|
143
|
-
localStorage.removeItem("wagmi.store");
|
|
144
140
|
localStorage.removeItem("lastAuthProvider");
|
|
145
141
|
localStorage.removeItem("b3-user");
|
|
146
142
|
}
|
|
@@ -153,7 +149,7 @@ export function useAuthentication(partnerId) {
|
|
|
153
149
|
if (onLogoutCallback) {
|
|
154
150
|
await onLogoutCallback();
|
|
155
151
|
}
|
|
156
|
-
}, [
|
|
152
|
+
}, [disconnect, wallets, setIsAuthenticated, setUser, setIsConnected, onLogoutCallback]);
|
|
157
153
|
const onConnect = useCallback(async (_walleAutoConnectedWith, allConnectedWallets) => {
|
|
158
154
|
debug("@@useAuthentication:onConnect", { _walleAutoConnectedWith, allConnectedWallets });
|
|
159
155
|
try {
|
package/package.json
CHANGED
|
@@ -153,23 +153,18 @@ export function useAuthentication(partnerId: string) {
|
|
|
153
153
|
|
|
154
154
|
const logout = useCallback(
|
|
155
155
|
async (callback?: () => void) => {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
disconnect(activeWallet);
|
|
159
|
-
debug("@@logout:activeWallet", activeWallet);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// Log out of each wallet
|
|
156
|
+
// Only disconnect ecosystem/smart wallets, preserve EOA wallets (e.g. MetaMask)
|
|
157
|
+
// so they remain available after re-login
|
|
163
158
|
wallets.forEach(wallet => {
|
|
164
|
-
|
|
165
|
-
|
|
159
|
+
debug("@@logout:wallet", wallet.id);
|
|
160
|
+
if (wallet.id.startsWith("ecosystem.") || wallet.id === "smart") {
|
|
161
|
+
disconnect(wallet);
|
|
162
|
+
}
|
|
166
163
|
});
|
|
167
164
|
|
|
168
|
-
//
|
|
169
|
-
//
|
|
165
|
+
// Clear user-specific storage but preserve wallet connection state
|
|
166
|
+
// so EOA wallets (e.g. MetaMask) can auto-reconnect on next login
|
|
170
167
|
if (typeof localStorage !== "undefined") {
|
|
171
|
-
localStorage.removeItem("thirdweb:connected-wallet-ids");
|
|
172
|
-
localStorage.removeItem("wagmi.store");
|
|
173
168
|
localStorage.removeItem("lastAuthProvider");
|
|
174
169
|
localStorage.removeItem("b3-user");
|
|
175
170
|
}
|
|
@@ -186,7 +181,7 @@ export function useAuthentication(partnerId: string) {
|
|
|
186
181
|
await onLogoutCallback();
|
|
187
182
|
}
|
|
188
183
|
},
|
|
189
|
-
[
|
|
184
|
+
[disconnect, wallets, setIsAuthenticated, setUser, setIsConnected, onLogoutCallback],
|
|
190
185
|
);
|
|
191
186
|
|
|
192
187
|
const onConnect = useCallback(
|