@b3dotfun/sdk 0.0.19-alpha.1 → 0.0.19-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.
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.js +2 -2
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +18 -11
- package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +2 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -0
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +12 -1
- package/dist/cjs/global-account/react/stores/useAuthStore.d.ts +4 -0
- package/dist/cjs/global-account/react/stores/useAuthStore.js +4 -0
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +19 -12
- package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +2 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -0
- package/dist/esm/global-account/react/hooks/useAuthentication.js +12 -1
- package/dist/esm/global-account/react/stores/useAuthStore.d.ts +4 -0
- package/dist/esm/global-account/react/stores/useAuthStore.js +4 -0
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -0
- package/dist/types/global-account/react/stores/useAuthStore.d.ts +4 -0
- package/package.json +1 -1
- package/src/global-account/react/components/SignInWithB3/SignInWithB3.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +19 -11
- package/src/global-account/react/components/custom/ManageAccountButton.tsx +2 -2
- package/src/global-account/react/hooks/useAuthentication.ts +12 -1
- package/src/global-account/react/stores/useAuthStore.ts +8 -0
|
@@ -9,7 +9,7 @@ const Loading_1 = require("../ui/Loading");
|
|
|
9
9
|
function SignInWithB3(props) {
|
|
10
10
|
const { setB3ModalOpen, setB3ModalContentType, setEcoSystemAccountAddress } = (0, react_1.useModalStore)();
|
|
11
11
|
const { account } = (0, react_1.useB3)();
|
|
12
|
-
const { isAuthenticating,
|
|
12
|
+
const { isAuthenticating, isConnected } = (0, react_1.useAuthentication)(props.partnerId, props.loginWithSiwe);
|
|
13
13
|
const isMobile = (0, react_1.useIsMobile)();
|
|
14
14
|
(0, react_2.useEffect)(() => {
|
|
15
15
|
if (account) {
|
|
@@ -24,7 +24,7 @@ function SignInWithB3(props) {
|
|
|
24
24
|
});
|
|
25
25
|
setB3ModalOpen(true);
|
|
26
26
|
};
|
|
27
|
-
if (
|
|
27
|
+
if (isConnected) {
|
|
28
28
|
return (0, jsx_runtime_1.jsx)(ManageAccountButton_1.ManageAccountButton, { ...props });
|
|
29
29
|
}
|
|
30
30
|
if (isAuthenticating) {
|
|
@@ -19,9 +19,12 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
19
19
|
const { setUser, automaticallySetFirstEoa } = (0, react_1.useB3)();
|
|
20
20
|
const [step, setStep] = (0, react_2.useState)(source === "requestPermissions" ? null : "login");
|
|
21
21
|
const [sessionKeyAdded, setSessionKeyAdded] = (0, react_2.useState)(source === "requestPermissions" ? true : false);
|
|
22
|
-
const { setB3ModalContentType, setB3ModalOpen } = (0, react_1.useModalStore)();
|
|
22
|
+
const { setB3ModalContentType, setB3ModalOpen, isOpen } = (0, react_1.useModalStore)();
|
|
23
23
|
const account = (0, react_3.useActiveAccount)();
|
|
24
|
-
const
|
|
24
|
+
const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
|
|
25
|
+
const isAuthenticating = (0, react_1.useAuthStore)(state => state.isAuthenticating);
|
|
26
|
+
const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
|
|
27
|
+
const setIsConnected = (0, react_1.useAuthStore)(state => state.setIsConnected);
|
|
25
28
|
const [refetchCount, setRefetchCount] = (0, react_2.useState)(0);
|
|
26
29
|
const [refetchError, setRefetchError] = (0, react_2.useState)(null);
|
|
27
30
|
const { data: signers, refetch: refetchSigners, isFetching: isFetchingSigners, } = (0, react_1.useGetAllTWSigners)({
|
|
@@ -32,7 +35,6 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
32
35
|
},
|
|
33
36
|
});
|
|
34
37
|
const { authenticate } = (0, react_1.useSiwe)();
|
|
35
|
-
const [authenticatingWithB3, setAuthenticatingWithB3] = (0, react_2.useState)(false);
|
|
36
38
|
const [refetchQueued, setRefetchQueued] = (0, react_2.useState)(false);
|
|
37
39
|
// Enhanced refetchSigners function that tracks number of attempts
|
|
38
40
|
const handleRefetchSigners = (0, react_2.useCallback)(() => {
|
|
@@ -58,11 +60,14 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
58
60
|
// Handle post-login flow after signers are loaded
|
|
59
61
|
(0, react_2.useEffect)(() => {
|
|
60
62
|
debug("@@SignInWithB3Flow:useEffect", {
|
|
61
|
-
|
|
63
|
+
isConnected,
|
|
64
|
+
isAuthenticating,
|
|
62
65
|
isFetchingSigners,
|
|
66
|
+
closeAfterLogin,
|
|
67
|
+
isOpen,
|
|
63
68
|
source,
|
|
64
69
|
});
|
|
65
|
-
if (
|
|
70
|
+
if (isConnected) {
|
|
66
71
|
// Check if we already have a signer for this partner
|
|
67
72
|
const hasExistingSigner = signers?.some(signer => signer.partner.id === partnerId);
|
|
68
73
|
if (hasExistingSigner) {
|
|
@@ -102,7 +107,6 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
102
107
|
signers,
|
|
103
108
|
isFetchingSigners,
|
|
104
109
|
partnerId,
|
|
105
|
-
loginComplete,
|
|
106
110
|
handleRefetchSigners,
|
|
107
111
|
source,
|
|
108
112
|
closeAfterLogin,
|
|
@@ -111,6 +115,9 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
111
115
|
onSessionKeySuccess,
|
|
112
116
|
setB3ModalOpen,
|
|
113
117
|
signersEnabled,
|
|
118
|
+
isConnected,
|
|
119
|
+
isAuthenticating,
|
|
120
|
+
isOpen,
|
|
114
121
|
]);
|
|
115
122
|
debug("render", {
|
|
116
123
|
step,
|
|
@@ -155,16 +162,16 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
155
162
|
]);
|
|
156
163
|
const handleLoginSuccess = (0, react_2.useCallback)(async (account) => {
|
|
157
164
|
debug("Authenticating with B3 via SIWE");
|
|
165
|
+
setIsConnected(true);
|
|
158
166
|
if (loginWithSiwe) {
|
|
159
|
-
|
|
167
|
+
setIsAuthenticating(true);
|
|
160
168
|
const userAuth = await authenticate(account, partnerId);
|
|
161
169
|
setUser(userAuth.user);
|
|
162
170
|
}
|
|
163
171
|
debug("handleLoginSuccess:account", account);
|
|
164
172
|
onLoginSuccess?.(account);
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}, [authenticate, loginWithSiwe, onLoginSuccess, setUser, partnerId]);
|
|
173
|
+
setIsAuthenticating(false);
|
|
174
|
+
}, [loginWithSiwe, onLoginSuccess, setIsAuthenticating, authenticate, partnerId, setUser, setIsConnected]);
|
|
168
175
|
(0, react_2.useEffect)(() => {
|
|
169
176
|
if (step === "permissions") {
|
|
170
177
|
setB3ModalContentType({
|
|
@@ -180,7 +187,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
180
187
|
if (refetchError) {
|
|
181
188
|
return ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "p-4 text-center text-red-500", children: refetchError }) }));
|
|
182
189
|
}
|
|
183
|
-
if (
|
|
190
|
+
if (isAuthenticating || (isFetchingSigners && step === "login") || source === "requestPermissions") {
|
|
184
191
|
return ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "mt-8 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)(react_1.Loading, { variant: "white", size: "lg" }) }) }));
|
|
185
192
|
}
|
|
186
193
|
if (step === "login") {
|
|
@@ -6,7 +6,7 @@ const react_1 = require("../../../../global-account/react");
|
|
|
6
6
|
const utils_1 = require("../../../../shared/utils");
|
|
7
7
|
function ManageAccountButton(props) {
|
|
8
8
|
const { setB3ModalOpen, setB3ModalContentType } = (0, react_1.useModalStore)();
|
|
9
|
-
const {
|
|
9
|
+
const { isConnected } = (0, react_1.useAuthentication)(props.partnerId, props.loginWithSiwe);
|
|
10
10
|
const handleClickManageAccount = () => {
|
|
11
11
|
setB3ModalContentType({
|
|
12
12
|
...props,
|
|
@@ -14,7 +14,7 @@ function ManageAccountButton(props) {
|
|
|
14
14
|
});
|
|
15
15
|
setB3ModalOpen(true);
|
|
16
16
|
};
|
|
17
|
-
if (!
|
|
17
|
+
if (!isConnected)
|
|
18
18
|
return null;
|
|
19
19
|
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsxs)(react_1.Button, { onClick: handleClickManageAccount, style: { backgroundColor: "#3368ef" }, className: (0, utils_1.cn)("b3-manage-account-button flex items-center gap-2 text-white", props.className), children: [props.withLogo !== false && ((0, jsx_runtime_1.jsx)("img", { src: "https://cdn.b3.fun/b3_logo_white.svg", alt: "B3 Logo", className: "h-5 w-5" })), props.loggedInButtonText || "Manage Account"] }) }));
|
|
20
20
|
}
|
|
@@ -4,6 +4,8 @@ export declare function useAuthentication(partnerId: string, loginWithSiwe?: boo
|
|
|
4
4
|
isAuthenticating: boolean;
|
|
5
5
|
isAuthenticated: boolean;
|
|
6
6
|
isReady: boolean;
|
|
7
|
+
isConnecting: boolean;
|
|
8
|
+
isConnected: boolean;
|
|
7
9
|
wallet: import("thirdweb/dist/types/wallets/in-app/core/wallet/types").EcosystemWallet;
|
|
8
10
|
preAuthenticate: typeof preAuthenticate;
|
|
9
11
|
connect: (strategyOptions?: import("thirdweb/wallets").SingleStepAuthArgsType) => Promise<import("thirdweb/wallets").Wallet | null>;
|
|
@@ -27,6 +27,10 @@ function useAuthentication(partnerId, loginWithSiwe) {
|
|
|
27
27
|
const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
|
|
28
28
|
const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
|
|
29
29
|
const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
|
|
30
|
+
const setIsConnecting = (0, react_1.useAuthStore)(state => state.setIsConnecting);
|
|
31
|
+
const setIsConnected = (0, react_1.useAuthStore)(state => state.setIsConnected);
|
|
32
|
+
const isConnecting = (0, react_1.useAuthStore)(state => state.isConnecting);
|
|
33
|
+
const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
|
|
30
34
|
const { connect } = (0, useConnect_1.useConnect)(partnerId, supported_1.b3MainnetThirdWeb);
|
|
31
35
|
const wallet = (0, wallets_1.ecosystemWallet)(constants_1.ecosystemWalletId, {
|
|
32
36
|
partnerId: partnerId,
|
|
@@ -36,6 +40,7 @@ function useAuthentication(partnerId, loginWithSiwe) {
|
|
|
36
40
|
wallets: [wallet],
|
|
37
41
|
onConnect: async (wallet) => {
|
|
38
42
|
try {
|
|
43
|
+
setIsConnected(true);
|
|
39
44
|
if (!loginWithSiwe) {
|
|
40
45
|
debug("Skipping SIWE login", { loginWithSiwe });
|
|
41
46
|
setIsAuthenticated(true);
|
|
@@ -73,19 +78,22 @@ function useAuthentication(partnerId, loginWithSiwe) {
|
|
|
73
78
|
(0, react_2.useEffect)(() => {
|
|
74
79
|
if (useAutoConnectLoading) {
|
|
75
80
|
setIsAuthenticating(true);
|
|
81
|
+
setIsConnecting(true);
|
|
76
82
|
}
|
|
77
83
|
else if (!isAuthenticated) {
|
|
78
84
|
// Only set isAuthenticating to false if we're not authenticated
|
|
79
85
|
// This prevents the flicker state where both isAuthenticating and isAuthenticated are false
|
|
80
86
|
const timeout = setTimeout(() => {
|
|
81
87
|
setIsAuthenticating(false);
|
|
88
|
+
setIsConnecting(false);
|
|
82
89
|
}, 100); // Add a small delay to prevent quick flickers
|
|
83
90
|
return () => clearTimeout(timeout);
|
|
84
91
|
}
|
|
85
92
|
else {
|
|
86
93
|
setIsAuthenticating(false);
|
|
94
|
+
setIsConnecting(false);
|
|
87
95
|
}
|
|
88
|
-
}, [useAutoConnectLoading, isAuthenticated, setIsAuthenticating]);
|
|
96
|
+
}, [useAutoConnectLoading, isAuthenticated, setIsAuthenticating, setIsConnecting, setIsConnected]);
|
|
89
97
|
const logout = async (callback) => {
|
|
90
98
|
if (activeWallet) {
|
|
91
99
|
debug("@@logout:activeWallet", activeWallet);
|
|
@@ -108,6 +116,7 @@ function useAuthentication(partnerId, loginWithSiwe) {
|
|
|
108
116
|
app_1.default.logout();
|
|
109
117
|
debug("@@logout:loggedOut");
|
|
110
118
|
setIsAuthenticated(false);
|
|
119
|
+
setIsConnected(false);
|
|
111
120
|
setUser();
|
|
112
121
|
callback?.();
|
|
113
122
|
};
|
|
@@ -117,6 +126,8 @@ function useAuthentication(partnerId, loginWithSiwe) {
|
|
|
117
126
|
isAuthenticating: useAutoConnectLoading || isAuthenticating,
|
|
118
127
|
isAuthenticated,
|
|
119
128
|
isReady,
|
|
129
|
+
isConnecting,
|
|
130
|
+
isConnected,
|
|
120
131
|
wallet,
|
|
121
132
|
preAuthenticate: in_app_1.preAuthenticate,
|
|
122
133
|
connect,
|
|
@@ -7,10 +7,14 @@ interface AuthState {
|
|
|
7
7
|
chain?: Chain;
|
|
8
8
|
isAuthenticating: boolean;
|
|
9
9
|
isAuthenticated: boolean;
|
|
10
|
+
isConnecting: boolean;
|
|
11
|
+
isConnected: boolean;
|
|
10
12
|
onSuccess?: (account: any) => void;
|
|
11
13
|
onError?: (error: Error) => void;
|
|
12
14
|
setB3ModalOpen: (isOpen: boolean) => void;
|
|
13
15
|
setStep: (step: "login" | "permissions") => void;
|
|
16
|
+
setIsConnecting: (isConnecting: boolean) => void;
|
|
17
|
+
setIsConnected: (isConnected: boolean) => void;
|
|
14
18
|
setIsAuthenticating: (isAuthenticating: boolean) => void;
|
|
15
19
|
setIsAuthenticated: (isAuthenticated: boolean) => void;
|
|
16
20
|
startAuth: (params: {
|
|
@@ -10,10 +10,14 @@ exports.useAuthStore = (0, zustand_1.create)(set => ({
|
|
|
10
10
|
chain: undefined,
|
|
11
11
|
isAuthenticating: false,
|
|
12
12
|
isAuthenticated: false,
|
|
13
|
+
isConnecting: false,
|
|
14
|
+
isConnected: false,
|
|
13
15
|
onSuccess: undefined,
|
|
14
16
|
onError: undefined,
|
|
15
17
|
setB3ModalOpen: isOpen => set({ isOpen }),
|
|
16
18
|
setStep: step => set({ step }),
|
|
19
|
+
setIsConnecting: isConnecting => set({ isConnecting }),
|
|
20
|
+
setIsConnected: isConnected => set({ isConnected }),
|
|
17
21
|
setIsAuthenticating: isAuthenticating => set({ isAuthenticating }),
|
|
18
22
|
setIsAuthenticated: isAuthenticated => set({ isAuthenticated }),
|
|
19
23
|
startAuth: params => set({
|
|
@@ -6,7 +6,7 @@ import { Loading } from "../ui/Loading.js";
|
|
|
6
6
|
export function SignInWithB3(props) {
|
|
7
7
|
const { setB3ModalOpen, setB3ModalContentType, setEcoSystemAccountAddress } = useModalStore();
|
|
8
8
|
const { account } = useB3();
|
|
9
|
-
const { isAuthenticating,
|
|
9
|
+
const { isAuthenticating, isConnected } = useAuthentication(props.partnerId, props.loginWithSiwe);
|
|
10
10
|
const isMobile = useIsMobile();
|
|
11
11
|
useEffect(() => {
|
|
12
12
|
if (account) {
|
|
@@ -21,7 +21,7 @@ export function SignInWithB3(props) {
|
|
|
21
21
|
});
|
|
22
22
|
setB3ModalOpen(true);
|
|
23
23
|
};
|
|
24
|
-
if (
|
|
24
|
+
if (isConnected) {
|
|
25
25
|
return _jsx(ManageAccountButton, { ...props });
|
|
26
26
|
}
|
|
27
27
|
if (isAuthenticating) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Loading, useB3, useGetAllTWSigners, useModalStore, useSiwe, } from "../../../../global-account/react/index.js";
|
|
2
|
+
import { Loading, useAuthStore, useB3, useGetAllTWSigners, useModalStore, useSiwe, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
4
4
|
import { useCallback, useEffect, useState } from "react";
|
|
5
5
|
import { useActiveAccount } from "thirdweb/react";
|
|
@@ -16,9 +16,12 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
16
16
|
const { setUser, automaticallySetFirstEoa } = useB3();
|
|
17
17
|
const [step, setStep] = useState(source === "requestPermissions" ? null : "login");
|
|
18
18
|
const [sessionKeyAdded, setSessionKeyAdded] = useState(source === "requestPermissions" ? true : false);
|
|
19
|
-
const { setB3ModalContentType, setB3ModalOpen } = useModalStore();
|
|
19
|
+
const { setB3ModalContentType, setB3ModalOpen, isOpen } = useModalStore();
|
|
20
20
|
const account = useActiveAccount();
|
|
21
|
-
const
|
|
21
|
+
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
|
|
22
|
+
const isAuthenticating = useAuthStore(state => state.isAuthenticating);
|
|
23
|
+
const isConnected = useAuthStore(state => state.isConnected);
|
|
24
|
+
const setIsConnected = useAuthStore(state => state.setIsConnected);
|
|
22
25
|
const [refetchCount, setRefetchCount] = useState(0);
|
|
23
26
|
const [refetchError, setRefetchError] = useState(null);
|
|
24
27
|
const { data: signers, refetch: refetchSigners, isFetching: isFetchingSigners, } = useGetAllTWSigners({
|
|
@@ -29,7 +32,6 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
29
32
|
},
|
|
30
33
|
});
|
|
31
34
|
const { authenticate } = useSiwe();
|
|
32
|
-
const [authenticatingWithB3, setAuthenticatingWithB3] = useState(false);
|
|
33
35
|
const [refetchQueued, setRefetchQueued] = useState(false);
|
|
34
36
|
// Enhanced refetchSigners function that tracks number of attempts
|
|
35
37
|
const handleRefetchSigners = useCallback(() => {
|
|
@@ -55,11 +57,14 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
55
57
|
// Handle post-login flow after signers are loaded
|
|
56
58
|
useEffect(() => {
|
|
57
59
|
debug("@@SignInWithB3Flow:useEffect", {
|
|
58
|
-
|
|
60
|
+
isConnected,
|
|
61
|
+
isAuthenticating,
|
|
59
62
|
isFetchingSigners,
|
|
63
|
+
closeAfterLogin,
|
|
64
|
+
isOpen,
|
|
60
65
|
source,
|
|
61
66
|
});
|
|
62
|
-
if (
|
|
67
|
+
if (isConnected) {
|
|
63
68
|
// Check if we already have a signer for this partner
|
|
64
69
|
const hasExistingSigner = signers?.some(signer => signer.partner.id === partnerId);
|
|
65
70
|
if (hasExistingSigner) {
|
|
@@ -99,7 +104,6 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
99
104
|
signers,
|
|
100
105
|
isFetchingSigners,
|
|
101
106
|
partnerId,
|
|
102
|
-
loginComplete,
|
|
103
107
|
handleRefetchSigners,
|
|
104
108
|
source,
|
|
105
109
|
closeAfterLogin,
|
|
@@ -108,6 +112,9 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
108
112
|
onSessionKeySuccess,
|
|
109
113
|
setB3ModalOpen,
|
|
110
114
|
signersEnabled,
|
|
115
|
+
isConnected,
|
|
116
|
+
isAuthenticating,
|
|
117
|
+
isOpen,
|
|
111
118
|
]);
|
|
112
119
|
debug("render", {
|
|
113
120
|
step,
|
|
@@ -152,16 +159,16 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
152
159
|
]);
|
|
153
160
|
const handleLoginSuccess = useCallback(async (account) => {
|
|
154
161
|
debug("Authenticating with B3 via SIWE");
|
|
162
|
+
setIsConnected(true);
|
|
155
163
|
if (loginWithSiwe) {
|
|
156
|
-
|
|
164
|
+
setIsAuthenticating(true);
|
|
157
165
|
const userAuth = await authenticate(account, partnerId);
|
|
158
166
|
setUser(userAuth.user);
|
|
159
167
|
}
|
|
160
168
|
debug("handleLoginSuccess:account", account);
|
|
161
169
|
onLoginSuccess?.(account);
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}, [authenticate, loginWithSiwe, onLoginSuccess, setUser, partnerId]);
|
|
170
|
+
setIsAuthenticating(false);
|
|
171
|
+
}, [loginWithSiwe, onLoginSuccess, setIsAuthenticating, authenticate, partnerId, setUser, setIsConnected]);
|
|
165
172
|
useEffect(() => {
|
|
166
173
|
if (step === "permissions") {
|
|
167
174
|
setB3ModalContentType({
|
|
@@ -177,7 +184,7 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
177
184
|
if (refetchError) {
|
|
178
185
|
return (_jsx(LoginStepContainer, { partnerId: partnerId, children: _jsx("div", { className: "p-4 text-center text-red-500", children: refetchError }) }));
|
|
179
186
|
}
|
|
180
|
-
if (
|
|
187
|
+
if (isAuthenticating || (isFetchingSigners && step === "login") || source === "requestPermissions") {
|
|
181
188
|
return (_jsx(LoginStepContainer, { partnerId: partnerId, children: _jsx("div", { className: "mt-8 flex items-center justify-center", children: _jsx(Loading, { variant: "white", size: "lg" }) }) }));
|
|
182
189
|
}
|
|
183
190
|
if (step === "login") {
|
|
@@ -3,7 +3,7 @@ import { Button, StyleRoot, useAuthentication, useModalStore } from "../../../..
|
|
|
3
3
|
import { cn } from "../../../../shared/utils/index.js";
|
|
4
4
|
export function ManageAccountButton(props) {
|
|
5
5
|
const { setB3ModalOpen, setB3ModalContentType } = useModalStore();
|
|
6
|
-
const {
|
|
6
|
+
const { isConnected } = useAuthentication(props.partnerId, props.loginWithSiwe);
|
|
7
7
|
const handleClickManageAccount = () => {
|
|
8
8
|
setB3ModalContentType({
|
|
9
9
|
...props,
|
|
@@ -11,7 +11,7 @@ export function ManageAccountButton(props) {
|
|
|
11
11
|
});
|
|
12
12
|
setB3ModalOpen(true);
|
|
13
13
|
};
|
|
14
|
-
if (!
|
|
14
|
+
if (!isConnected)
|
|
15
15
|
return null;
|
|
16
16
|
return (_jsx(StyleRoot, { children: _jsxs(Button, { onClick: handleClickManageAccount, style: { backgroundColor: "#3368ef" }, className: cn("b3-manage-account-button flex items-center gap-2 text-white", props.className), children: [props.withLogo !== false && (_jsx("img", { src: "https://cdn.b3.fun/b3_logo_white.svg", alt: "B3 Logo", className: "h-5 w-5" })), props.loggedInButtonText || "Manage Account"] }) }));
|
|
17
17
|
}
|
|
@@ -4,6 +4,8 @@ export declare function useAuthentication(partnerId: string, loginWithSiwe?: boo
|
|
|
4
4
|
isAuthenticating: boolean;
|
|
5
5
|
isAuthenticated: boolean;
|
|
6
6
|
isReady: boolean;
|
|
7
|
+
isConnecting: boolean;
|
|
8
|
+
isConnected: boolean;
|
|
7
9
|
wallet: import("thirdweb/dist/types/wallets/in-app/core/wallet/types").EcosystemWallet;
|
|
8
10
|
preAuthenticate: typeof preAuthenticate;
|
|
9
11
|
connect: (strategyOptions?: import("thirdweb/wallets").SingleStepAuthArgsType) => Promise<import("thirdweb/wallets").Wallet | null>;
|
|
@@ -21,6 +21,10 @@ export function useAuthentication(partnerId, loginWithSiwe) {
|
|
|
21
21
|
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
22
22
|
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
|
|
23
23
|
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
|
|
24
|
+
const setIsConnecting = useAuthStore(state => state.setIsConnecting);
|
|
25
|
+
const setIsConnected = useAuthStore(state => state.setIsConnected);
|
|
26
|
+
const isConnecting = useAuthStore(state => state.isConnecting);
|
|
27
|
+
const isConnected = useAuthStore(state => state.isConnected);
|
|
24
28
|
const { connect } = useConnect(partnerId, b3MainnetThirdWeb);
|
|
25
29
|
const wallet = ecosystemWallet(ecosystemWalletId, {
|
|
26
30
|
partnerId: partnerId,
|
|
@@ -30,6 +34,7 @@ export function useAuthentication(partnerId, loginWithSiwe) {
|
|
|
30
34
|
wallets: [wallet],
|
|
31
35
|
onConnect: async (wallet) => {
|
|
32
36
|
try {
|
|
37
|
+
setIsConnected(true);
|
|
33
38
|
if (!loginWithSiwe) {
|
|
34
39
|
debug("Skipping SIWE login", { loginWithSiwe });
|
|
35
40
|
setIsAuthenticated(true);
|
|
@@ -67,19 +72,22 @@ export function useAuthentication(partnerId, loginWithSiwe) {
|
|
|
67
72
|
useEffect(() => {
|
|
68
73
|
if (useAutoConnectLoading) {
|
|
69
74
|
setIsAuthenticating(true);
|
|
75
|
+
setIsConnecting(true);
|
|
70
76
|
}
|
|
71
77
|
else if (!isAuthenticated) {
|
|
72
78
|
// Only set isAuthenticating to false if we're not authenticated
|
|
73
79
|
// This prevents the flicker state where both isAuthenticating and isAuthenticated are false
|
|
74
80
|
const timeout = setTimeout(() => {
|
|
75
81
|
setIsAuthenticating(false);
|
|
82
|
+
setIsConnecting(false);
|
|
76
83
|
}, 100); // Add a small delay to prevent quick flickers
|
|
77
84
|
return () => clearTimeout(timeout);
|
|
78
85
|
}
|
|
79
86
|
else {
|
|
80
87
|
setIsAuthenticating(false);
|
|
88
|
+
setIsConnecting(false);
|
|
81
89
|
}
|
|
82
|
-
}, [useAutoConnectLoading, isAuthenticated, setIsAuthenticating]);
|
|
90
|
+
}, [useAutoConnectLoading, isAuthenticated, setIsAuthenticating, setIsConnecting, setIsConnected]);
|
|
83
91
|
const logout = async (callback) => {
|
|
84
92
|
if (activeWallet) {
|
|
85
93
|
debug("@@logout:activeWallet", activeWallet);
|
|
@@ -102,6 +110,7 @@ export function useAuthentication(partnerId, loginWithSiwe) {
|
|
|
102
110
|
app.logout();
|
|
103
111
|
debug("@@logout:loggedOut");
|
|
104
112
|
setIsAuthenticated(false);
|
|
113
|
+
setIsConnected(false);
|
|
105
114
|
setUser();
|
|
106
115
|
callback?.();
|
|
107
116
|
};
|
|
@@ -111,6 +120,8 @@ export function useAuthentication(partnerId, loginWithSiwe) {
|
|
|
111
120
|
isAuthenticating: useAutoConnectLoading || isAuthenticating,
|
|
112
121
|
isAuthenticated,
|
|
113
122
|
isReady,
|
|
123
|
+
isConnecting,
|
|
124
|
+
isConnected,
|
|
114
125
|
wallet,
|
|
115
126
|
preAuthenticate,
|
|
116
127
|
connect,
|
|
@@ -7,10 +7,14 @@ interface AuthState {
|
|
|
7
7
|
chain?: Chain;
|
|
8
8
|
isAuthenticating: boolean;
|
|
9
9
|
isAuthenticated: boolean;
|
|
10
|
+
isConnecting: boolean;
|
|
11
|
+
isConnected: boolean;
|
|
10
12
|
onSuccess?: (account: any) => void;
|
|
11
13
|
onError?: (error: Error) => void;
|
|
12
14
|
setB3ModalOpen: (isOpen: boolean) => void;
|
|
13
15
|
setStep: (step: "login" | "permissions") => void;
|
|
16
|
+
setIsConnecting: (isConnecting: boolean) => void;
|
|
17
|
+
setIsConnected: (isConnected: boolean) => void;
|
|
14
18
|
setIsAuthenticating: (isAuthenticating: boolean) => void;
|
|
15
19
|
setIsAuthenticated: (isAuthenticated: boolean) => void;
|
|
16
20
|
startAuth: (params: {
|
|
@@ -7,10 +7,14 @@ export const useAuthStore = create(set => ({
|
|
|
7
7
|
chain: undefined,
|
|
8
8
|
isAuthenticating: false,
|
|
9
9
|
isAuthenticated: false,
|
|
10
|
+
isConnecting: false,
|
|
11
|
+
isConnected: false,
|
|
10
12
|
onSuccess: undefined,
|
|
11
13
|
onError: undefined,
|
|
12
14
|
setB3ModalOpen: isOpen => set({ isOpen }),
|
|
13
15
|
setStep: step => set({ step }),
|
|
16
|
+
setIsConnecting: isConnecting => set({ isConnecting }),
|
|
17
|
+
setIsConnected: isConnected => set({ isConnected }),
|
|
14
18
|
setIsAuthenticating: isAuthenticating => set({ isAuthenticating }),
|
|
15
19
|
setIsAuthenticated: isAuthenticated => set({ isAuthenticated }),
|
|
16
20
|
startAuth: params => set({
|
|
@@ -4,6 +4,8 @@ export declare function useAuthentication(partnerId: string, loginWithSiwe?: boo
|
|
|
4
4
|
isAuthenticating: boolean;
|
|
5
5
|
isAuthenticated: boolean;
|
|
6
6
|
isReady: boolean;
|
|
7
|
+
isConnecting: boolean;
|
|
8
|
+
isConnected: boolean;
|
|
7
9
|
wallet: import("thirdweb/dist/types/wallets/in-app/core/wallet/types").EcosystemWallet;
|
|
8
10
|
preAuthenticate: typeof preAuthenticate;
|
|
9
11
|
connect: (strategyOptions?: import("thirdweb/wallets").SingleStepAuthArgsType) => Promise<import("thirdweb/wallets").Wallet | null>;
|
|
@@ -7,10 +7,14 @@ interface AuthState {
|
|
|
7
7
|
chain?: Chain;
|
|
8
8
|
isAuthenticating: boolean;
|
|
9
9
|
isAuthenticated: boolean;
|
|
10
|
+
isConnecting: boolean;
|
|
11
|
+
isConnected: boolean;
|
|
10
12
|
onSuccess?: (account: any) => void;
|
|
11
13
|
onError?: (error: Error) => void;
|
|
12
14
|
setB3ModalOpen: (isOpen: boolean) => void;
|
|
13
15
|
setStep: (step: "login" | "permissions") => void;
|
|
16
|
+
setIsConnecting: (isConnecting: boolean) => void;
|
|
17
|
+
setIsConnected: (isConnected: boolean) => void;
|
|
14
18
|
setIsAuthenticating: (isAuthenticating: boolean) => void;
|
|
15
19
|
setIsAuthenticated: (isAuthenticated: boolean) => void;
|
|
16
20
|
startAuth: (params: {
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ export type SignInWithB3Props = Omit<SignInWithB3ModalProps, "type" | "showBackB
|
|
|
21
21
|
export function SignInWithB3(props: SignInWithB3Props) {
|
|
22
22
|
const { setB3ModalOpen, setB3ModalContentType, setEcoSystemAccountAddress } = useModalStore();
|
|
23
23
|
const { account } = useB3();
|
|
24
|
-
const { isAuthenticating,
|
|
24
|
+
const { isAuthenticating, isConnected } = useAuthentication(props.partnerId, props.loginWithSiwe);
|
|
25
25
|
const isMobile = useIsMobile();
|
|
26
26
|
|
|
27
27
|
useEffect(() => {
|
|
@@ -39,7 +39,7 @@ export function SignInWithB3(props: SignInWithB3Props) {
|
|
|
39
39
|
setB3ModalOpen(true);
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
if (
|
|
42
|
+
if (isConnected) {
|
|
43
43
|
return <ManageAccountButton {...props} />;
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Loading,
|
|
3
3
|
SignInWithB3ModalProps,
|
|
4
|
+
useAuthStore,
|
|
4
5
|
useB3,
|
|
5
6
|
useGetAllTWSigners,
|
|
6
7
|
useModalStore,
|
|
@@ -37,9 +38,12 @@ export function SignInWithB3Flow({
|
|
|
37
38
|
const { setUser, automaticallySetFirstEoa } = useB3();
|
|
38
39
|
const [step, setStep] = useState<"login" | "permissions" | null>(source === "requestPermissions" ? null : "login");
|
|
39
40
|
const [sessionKeyAdded, setSessionKeyAdded] = useState(source === "requestPermissions" ? true : false);
|
|
40
|
-
const { setB3ModalContentType, setB3ModalOpen } = useModalStore();
|
|
41
|
+
const { setB3ModalContentType, setB3ModalOpen, isOpen } = useModalStore();
|
|
41
42
|
const account = useActiveAccount();
|
|
42
|
-
const
|
|
43
|
+
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
|
|
44
|
+
const isAuthenticating = useAuthStore(state => state.isAuthenticating);
|
|
45
|
+
const isConnected = useAuthStore(state => state.isConnected);
|
|
46
|
+
const setIsConnected = useAuthStore(state => state.setIsConnected);
|
|
43
47
|
const [refetchCount, setRefetchCount] = useState(0);
|
|
44
48
|
const [refetchError, setRefetchError] = useState<string | null>(null);
|
|
45
49
|
const {
|
|
@@ -54,7 +58,6 @@ export function SignInWithB3Flow({
|
|
|
54
58
|
},
|
|
55
59
|
});
|
|
56
60
|
const { authenticate } = useSiwe();
|
|
57
|
-
const [authenticatingWithB3, setAuthenticatingWithB3] = useState(false);
|
|
58
61
|
const [refetchQueued, setRefetchQueued] = useState(false);
|
|
59
62
|
|
|
60
63
|
// Enhanced refetchSigners function that tracks number of attempts
|
|
@@ -86,12 +89,15 @@ export function SignInWithB3Flow({
|
|
|
86
89
|
// Handle post-login flow after signers are loaded
|
|
87
90
|
useEffect(() => {
|
|
88
91
|
debug("@@SignInWithB3Flow:useEffect", {
|
|
89
|
-
|
|
92
|
+
isConnected,
|
|
93
|
+
isAuthenticating,
|
|
90
94
|
isFetchingSigners,
|
|
95
|
+
closeAfterLogin,
|
|
96
|
+
isOpen,
|
|
91
97
|
source,
|
|
92
98
|
});
|
|
93
99
|
|
|
94
|
-
if (
|
|
100
|
+
if (isConnected) {
|
|
95
101
|
// Check if we already have a signer for this partner
|
|
96
102
|
const hasExistingSigner = signers?.some(signer => signer.partner.id === partnerId);
|
|
97
103
|
if (hasExistingSigner) {
|
|
@@ -128,7 +134,6 @@ export function SignInWithB3Flow({
|
|
|
128
134
|
signers,
|
|
129
135
|
isFetchingSigners,
|
|
130
136
|
partnerId,
|
|
131
|
-
loginComplete,
|
|
132
137
|
handleRefetchSigners,
|
|
133
138
|
source,
|
|
134
139
|
closeAfterLogin,
|
|
@@ -137,6 +142,9 @@ export function SignInWithB3Flow({
|
|
|
137
142
|
onSessionKeySuccess,
|
|
138
143
|
setB3ModalOpen,
|
|
139
144
|
signersEnabled,
|
|
145
|
+
isConnected,
|
|
146
|
+
isAuthenticating,
|
|
147
|
+
isOpen,
|
|
140
148
|
]);
|
|
141
149
|
|
|
142
150
|
debug("render", {
|
|
@@ -186,17 +194,17 @@ export function SignInWithB3Flow({
|
|
|
186
194
|
const handleLoginSuccess = useCallback(
|
|
187
195
|
async (account: Account) => {
|
|
188
196
|
debug("Authenticating with B3 via SIWE");
|
|
197
|
+
setIsConnected(true);
|
|
189
198
|
if (loginWithSiwe) {
|
|
190
|
-
|
|
199
|
+
setIsAuthenticating(true);
|
|
191
200
|
const userAuth = await authenticate(account, partnerId);
|
|
192
201
|
setUser(userAuth.user);
|
|
193
202
|
}
|
|
194
203
|
debug("handleLoginSuccess:account", account);
|
|
195
204
|
onLoginSuccess?.(account);
|
|
196
|
-
|
|
197
|
-
setAuthenticatingWithB3(false);
|
|
205
|
+
setIsAuthenticating(false);
|
|
198
206
|
},
|
|
199
|
-
[
|
|
207
|
+
[loginWithSiwe, onLoginSuccess, setIsAuthenticating, authenticate, partnerId, setUser, setIsConnected],
|
|
200
208
|
);
|
|
201
209
|
|
|
202
210
|
useEffect(() => {
|
|
@@ -220,7 +228,7 @@ export function SignInWithB3Flow({
|
|
|
220
228
|
);
|
|
221
229
|
}
|
|
222
230
|
|
|
223
|
-
if (
|
|
231
|
+
if (isAuthenticating || (isFetchingSigners && step === "login") || source === "requestPermissions") {
|
|
224
232
|
return (
|
|
225
233
|
<LoginStepContainer partnerId={partnerId}>
|
|
226
234
|
<div className="mt-8 flex items-center justify-center">
|
|
@@ -4,7 +4,7 @@ import { SignInWithB3Props } from "../SignInWithB3/SignInWithB3";
|
|
|
4
4
|
|
|
5
5
|
export function ManageAccountButton(props: SignInWithB3Props & { className?: string }) {
|
|
6
6
|
const { setB3ModalOpen, setB3ModalContentType } = useModalStore();
|
|
7
|
-
const {
|
|
7
|
+
const { isConnected } = useAuthentication(props.partnerId, props.loginWithSiwe);
|
|
8
8
|
|
|
9
9
|
const handleClickManageAccount = () => {
|
|
10
10
|
setB3ModalContentType({
|
|
@@ -14,7 +14,7 @@ export function ManageAccountButton(props: SignInWithB3Props & { className?: str
|
|
|
14
14
|
setB3ModalOpen(true);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
if (!
|
|
17
|
+
if (!isConnected) return null;
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
20
|
<StyleRoot>
|
|
@@ -23,6 +23,10 @@ export function useAuthentication(partnerId: string, loginWithSiwe?: boolean) {
|
|
|
23
23
|
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
24
24
|
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
|
|
25
25
|
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
|
|
26
|
+
const setIsConnecting = useAuthStore(state => state.setIsConnecting);
|
|
27
|
+
const setIsConnected = useAuthStore(state => state.setIsConnected);
|
|
28
|
+
const isConnecting = useAuthStore(state => state.isConnecting);
|
|
29
|
+
const isConnected = useAuthStore(state => state.isConnected);
|
|
26
30
|
const { connect } = useConnect(partnerId, b3MainnetThirdWeb);
|
|
27
31
|
|
|
28
32
|
const wallet = ecosystemWallet(ecosystemWalletId, {
|
|
@@ -34,6 +38,7 @@ export function useAuthentication(partnerId: string, loginWithSiwe?: boolean) {
|
|
|
34
38
|
wallets: [wallet],
|
|
35
39
|
onConnect: async wallet => {
|
|
36
40
|
try {
|
|
41
|
+
setIsConnected(true);
|
|
37
42
|
if (!loginWithSiwe) {
|
|
38
43
|
debug("Skipping SIWE login", { loginWithSiwe });
|
|
39
44
|
setIsAuthenticated(true);
|
|
@@ -72,17 +77,20 @@ export function useAuthentication(partnerId: string, loginWithSiwe?: boolean) {
|
|
|
72
77
|
useEffect(() => {
|
|
73
78
|
if (useAutoConnectLoading) {
|
|
74
79
|
setIsAuthenticating(true);
|
|
80
|
+
setIsConnecting(true);
|
|
75
81
|
} else if (!isAuthenticated) {
|
|
76
82
|
// Only set isAuthenticating to false if we're not authenticated
|
|
77
83
|
// This prevents the flicker state where both isAuthenticating and isAuthenticated are false
|
|
78
84
|
const timeout = setTimeout(() => {
|
|
79
85
|
setIsAuthenticating(false);
|
|
86
|
+
setIsConnecting(false);
|
|
80
87
|
}, 100); // Add a small delay to prevent quick flickers
|
|
81
88
|
return () => clearTimeout(timeout);
|
|
82
89
|
} else {
|
|
83
90
|
setIsAuthenticating(false);
|
|
91
|
+
setIsConnecting(false);
|
|
84
92
|
}
|
|
85
|
-
}, [useAutoConnectLoading, isAuthenticated, setIsAuthenticating]);
|
|
93
|
+
}, [useAutoConnectLoading, isAuthenticated, setIsAuthenticating, setIsConnecting, setIsConnected]);
|
|
86
94
|
|
|
87
95
|
const logout = async (callback?: () => void) => {
|
|
88
96
|
if (activeWallet) {
|
|
@@ -110,6 +118,7 @@ export function useAuthentication(partnerId: string, loginWithSiwe?: boolean) {
|
|
|
110
118
|
debug("@@logout:loggedOut");
|
|
111
119
|
|
|
112
120
|
setIsAuthenticated(false);
|
|
121
|
+
setIsConnected(false);
|
|
113
122
|
setUser();
|
|
114
123
|
callback?.();
|
|
115
124
|
};
|
|
@@ -121,6 +130,8 @@ export function useAuthentication(partnerId: string, loginWithSiwe?: boolean) {
|
|
|
121
130
|
isAuthenticating: useAutoConnectLoading || isAuthenticating,
|
|
122
131
|
isAuthenticated,
|
|
123
132
|
isReady,
|
|
133
|
+
isConnecting,
|
|
134
|
+
isConnected,
|
|
124
135
|
wallet,
|
|
125
136
|
preAuthenticate,
|
|
126
137
|
connect,
|
|
@@ -9,10 +9,14 @@ interface AuthState {
|
|
|
9
9
|
chain?: Chain;
|
|
10
10
|
isAuthenticating: boolean;
|
|
11
11
|
isAuthenticated: boolean;
|
|
12
|
+
isConnecting: boolean;
|
|
13
|
+
isConnected: boolean;
|
|
12
14
|
onSuccess?: (account: any) => void;
|
|
13
15
|
onError?: (error: Error) => void;
|
|
14
16
|
setB3ModalOpen: (isOpen: boolean) => void;
|
|
15
17
|
setStep: (step: "login" | "permissions") => void;
|
|
18
|
+
setIsConnecting: (isConnecting: boolean) => void;
|
|
19
|
+
setIsConnected: (isConnected: boolean) => void;
|
|
16
20
|
setIsAuthenticating: (isAuthenticating: boolean) => void;
|
|
17
21
|
setIsAuthenticated: (isAuthenticated: boolean) => void;
|
|
18
22
|
startAuth: (params: {
|
|
@@ -33,10 +37,14 @@ export const useAuthStore = create<AuthState>(set => ({
|
|
|
33
37
|
chain: undefined,
|
|
34
38
|
isAuthenticating: false,
|
|
35
39
|
isAuthenticated: false,
|
|
40
|
+
isConnecting: false,
|
|
41
|
+
isConnected: false,
|
|
36
42
|
onSuccess: undefined,
|
|
37
43
|
onError: undefined,
|
|
38
44
|
setB3ModalOpen: isOpen => set({ isOpen }),
|
|
39
45
|
setStep: step => set({ step }),
|
|
46
|
+
setIsConnecting: isConnecting => set({ isConnecting }),
|
|
47
|
+
setIsConnected: isConnected => set({ isConnected }),
|
|
40
48
|
setIsAuthenticating: isAuthenticating => set({ isAuthenticating }),
|
|
41
49
|
setIsAuthenticated: isAuthenticated => set({ isAuthenticated }),
|
|
42
50
|
startAuth: params =>
|