@b3dotfun/sdk 0.0.62-alpha.5 → 0.0.63-alpha.0
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/SignInWithB3Flow.js +3 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +7 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +3 -1
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.js +7 -2
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/package.json +3 -3
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +3 -1
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
- package/src/global-account/react/hooks/useAuthentication.ts +10 -2
|
@@ -22,6 +22,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
22
22
|
const { setB3ModalContentType, setB3ModalOpen, isOpen } = (0, react_1.useModalStore)();
|
|
23
23
|
const account = (0, react_3.useActiveAccount)();
|
|
24
24
|
const isAuthenticating = (0, react_1.useAuthStore)(state => state.isAuthenticating);
|
|
25
|
+
const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
|
|
25
26
|
const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
|
|
26
27
|
const [refetchCount, setRefetchCount] = (0, react_2.useState)(0);
|
|
27
28
|
const [refetchError, setRefetchError] = (0, react_2.useState)(null);
|
|
@@ -64,7 +65,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
64
65
|
isOpen,
|
|
65
66
|
source,
|
|
66
67
|
});
|
|
67
|
-
if (isConnected) {
|
|
68
|
+
if (isConnected && isAuthenticated) {
|
|
68
69
|
// Check if we already have a signer for this partner
|
|
69
70
|
const hasExistingSigner = signers?.some(signer => signer.partner.id === partnerId);
|
|
70
71
|
if (hasExistingSigner) {
|
|
@@ -114,6 +115,7 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
114
115
|
signersEnabled,
|
|
115
116
|
isConnected,
|
|
116
117
|
isAuthenticating,
|
|
118
|
+
isAuthenticated,
|
|
117
119
|
isOpen,
|
|
118
120
|
]);
|
|
119
121
|
debug("render", {
|
|
@@ -41,8 +41,8 @@ function LoginStep({ onSuccess, chain }) {
|
|
|
41
41
|
}, header: {
|
|
42
42
|
title: "Sign in with B3",
|
|
43
43
|
titleIcon: "https://cdn.b3.fun/b3_logo.svg",
|
|
44
|
-
}, className: "b3-login-step", onConnect: async (wallet) => {
|
|
45
|
-
await onConnect(wallet);
|
|
44
|
+
}, className: "b3-login-step", onConnect: async (wallet, allConnectedWallets) => {
|
|
45
|
+
await onConnect(wallet, allConnectedWallets);
|
|
46
46
|
const account = wallet.getAccount();
|
|
47
47
|
if (!account)
|
|
48
48
|
throw new Error("No account found");
|
|
@@ -8,9 +8,9 @@ export declare function useAuthentication(partnerId: string): {
|
|
|
8
8
|
isConnected: boolean;
|
|
9
9
|
wallet: import("thirdweb/dist/types/wallets/in-app/core/wallet/types").EcosystemWallet;
|
|
10
10
|
preAuthenticate: typeof preAuthenticate;
|
|
11
|
-
connect: (
|
|
11
|
+
connect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
|
|
12
12
|
isAuthenticating: boolean;
|
|
13
|
-
onConnect: (
|
|
13
|
+
onConnect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
|
|
14
14
|
user: {
|
|
15
15
|
email?: string | undefined;
|
|
16
16
|
username?: string | undefined;
|
|
@@ -142,7 +142,12 @@ function useAuthentication(partnerId) {
|
|
|
142
142
|
return userAuth;
|
|
143
143
|
}
|
|
144
144
|
}, [activeWallet, partnerId, authenticate, setIsAuthenticated, setIsAuthenticating, setUser, setHasStartedConnecting]);
|
|
145
|
-
const onConnect = (0, react_2.useCallback)(async (
|
|
145
|
+
const onConnect = (0, react_2.useCallback)(async (_walleAutoConnectedWith, allConnectedWallets) => {
|
|
146
|
+
debug("@@useAuthentication:onConnect", { _walleAutoConnectedWith, allConnectedWallets });
|
|
147
|
+
const wallet = allConnectedWallets.find(wallet => wallet.id.startsWith("ecosystem."));
|
|
148
|
+
if (!wallet) {
|
|
149
|
+
throw new Error("No smart wallet found during auto-connect");
|
|
150
|
+
}
|
|
146
151
|
debug("@@useAuthentication:onConnect", { wallet });
|
|
147
152
|
try {
|
|
148
153
|
setHasStartedConnecting(true);
|
|
@@ -209,7 +214,7 @@ function useAuthentication(partnerId) {
|
|
|
209
214
|
const { isLoading: useAutoConnectLoading } = (0, react_3.useAutoConnect)({
|
|
210
215
|
client: thirdweb_1.client,
|
|
211
216
|
wallets: [wallet],
|
|
212
|
-
onConnect
|
|
217
|
+
onConnect,
|
|
213
218
|
});
|
|
214
219
|
/**
|
|
215
220
|
* useAutoConnectLoading starts as false
|
|
@@ -19,6 +19,7 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
19
19
|
const { setB3ModalContentType, setB3ModalOpen, isOpen } = useModalStore();
|
|
20
20
|
const account = useActiveAccount();
|
|
21
21
|
const isAuthenticating = useAuthStore(state => state.isAuthenticating);
|
|
22
|
+
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
22
23
|
const isConnected = useAuthStore(state => state.isConnected);
|
|
23
24
|
const [refetchCount, setRefetchCount] = useState(0);
|
|
24
25
|
const [refetchError, setRefetchError] = useState(null);
|
|
@@ -61,7 +62,7 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
61
62
|
isOpen,
|
|
62
63
|
source,
|
|
63
64
|
});
|
|
64
|
-
if (isConnected) {
|
|
65
|
+
if (isConnected && isAuthenticated) {
|
|
65
66
|
// Check if we already have a signer for this partner
|
|
66
67
|
const hasExistingSigner = signers?.some(signer => signer.partner.id === partnerId);
|
|
67
68
|
if (hasExistingSigner) {
|
|
@@ -111,6 +112,7 @@ export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySucce
|
|
|
111
112
|
signersEnabled,
|
|
112
113
|
isConnected,
|
|
113
114
|
isAuthenticating,
|
|
115
|
+
isAuthenticated,
|
|
114
116
|
isOpen,
|
|
115
117
|
]);
|
|
116
118
|
debug("render", {
|
|
@@ -37,8 +37,8 @@ export function LoginStep({ onSuccess, chain }) {
|
|
|
37
37
|
}, header: {
|
|
38
38
|
title: "Sign in with B3",
|
|
39
39
|
titleIcon: "https://cdn.b3.fun/b3_logo.svg",
|
|
40
|
-
}, className: "b3-login-step", onConnect: async (wallet) => {
|
|
41
|
-
await onConnect(wallet);
|
|
40
|
+
}, className: "b3-login-step", onConnect: async (wallet, allConnectedWallets) => {
|
|
41
|
+
await onConnect(wallet, allConnectedWallets);
|
|
42
42
|
const account = wallet.getAccount();
|
|
43
43
|
if (!account)
|
|
44
44
|
throw new Error("No account found");
|
|
@@ -8,9 +8,9 @@ export declare function useAuthentication(partnerId: string): {
|
|
|
8
8
|
isConnected: boolean;
|
|
9
9
|
wallet: import("thirdweb/dist/types/wallets/in-app/core/wallet/types").EcosystemWallet;
|
|
10
10
|
preAuthenticate: typeof preAuthenticate;
|
|
11
|
-
connect: (
|
|
11
|
+
connect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
|
|
12
12
|
isAuthenticating: boolean;
|
|
13
|
-
onConnect: (
|
|
13
|
+
onConnect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
|
|
14
14
|
user: {
|
|
15
15
|
email?: string | undefined;
|
|
16
16
|
username?: string | undefined;
|
|
@@ -136,7 +136,12 @@ export function useAuthentication(partnerId) {
|
|
|
136
136
|
return userAuth;
|
|
137
137
|
}
|
|
138
138
|
}, [activeWallet, partnerId, authenticate, setIsAuthenticated, setIsAuthenticating, setUser, setHasStartedConnecting]);
|
|
139
|
-
const onConnect = useCallback(async (
|
|
139
|
+
const onConnect = useCallback(async (_walleAutoConnectedWith, allConnectedWallets) => {
|
|
140
|
+
debug("@@useAuthentication:onConnect", { _walleAutoConnectedWith, allConnectedWallets });
|
|
141
|
+
const wallet = allConnectedWallets.find(wallet => wallet.id.startsWith("ecosystem."));
|
|
142
|
+
if (!wallet) {
|
|
143
|
+
throw new Error("No smart wallet found during auto-connect");
|
|
144
|
+
}
|
|
140
145
|
debug("@@useAuthentication:onConnect", { wallet });
|
|
141
146
|
try {
|
|
142
147
|
setHasStartedConnecting(true);
|
|
@@ -203,7 +208,7 @@ export function useAuthentication(partnerId) {
|
|
|
203
208
|
const { isLoading: useAutoConnectLoading } = useAutoConnect({
|
|
204
209
|
client,
|
|
205
210
|
wallets: [wallet],
|
|
206
|
-
onConnect
|
|
211
|
+
onConnect,
|
|
207
212
|
});
|
|
208
213
|
/**
|
|
209
214
|
* useAutoConnectLoading starts as false
|
|
@@ -8,9 +8,9 @@ export declare function useAuthentication(partnerId: string): {
|
|
|
8
8
|
isConnected: boolean;
|
|
9
9
|
wallet: import("thirdweb/dist/types/wallets/in-app/core/wallet/types").EcosystemWallet;
|
|
10
10
|
preAuthenticate: typeof preAuthenticate;
|
|
11
|
-
connect: (
|
|
11
|
+
connect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
|
|
12
12
|
isAuthenticating: boolean;
|
|
13
|
-
onConnect: (
|
|
13
|
+
onConnect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
|
|
14
14
|
user: {
|
|
15
15
|
email?: string | undefined;
|
|
16
16
|
username?: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b3dotfun/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.63-alpha.0",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"react-native": "./dist/cjs/index.native.js",
|
|
@@ -358,7 +358,7 @@
|
|
|
358
358
|
"postcss-prefix-selector": "^2.1.1",
|
|
359
359
|
"tailwindcss": "3.4.1",
|
|
360
360
|
"tailwindcss-animate": "^1.0.7",
|
|
361
|
-
"thirdweb": "5.
|
|
361
|
+
"thirdweb": "5.112.0",
|
|
362
362
|
"tsc-alias": "^1.8.16",
|
|
363
363
|
"tsc-watch": "^7.1.1",
|
|
364
364
|
"vitest": "^3.2.4"
|
|
@@ -381,7 +381,7 @@
|
|
|
381
381
|
"react": "^18.0.0 || ^19.0.0",
|
|
382
382
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
383
383
|
"react-native-mmkv": "^3.2.0",
|
|
384
|
-
"thirdweb": "5.
|
|
384
|
+
"thirdweb": "5.112.0",
|
|
385
385
|
"three": "^0.175.0",
|
|
386
386
|
"viem": "2.37.9",
|
|
387
387
|
"wagmi": "2.16.9"
|
|
@@ -39,6 +39,7 @@ export function SignInWithB3Flow({
|
|
|
39
39
|
const { setB3ModalContentType, setB3ModalOpen, isOpen } = useModalStore();
|
|
40
40
|
const account = useActiveAccount();
|
|
41
41
|
const isAuthenticating = useAuthStore(state => state.isAuthenticating);
|
|
42
|
+
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
42
43
|
const isConnected = useAuthStore(state => state.isConnected);
|
|
43
44
|
const [refetchCount, setRefetchCount] = useState(0);
|
|
44
45
|
const [refetchError, setRefetchError] = useState<string | null>(null);
|
|
@@ -92,7 +93,7 @@ export function SignInWithB3Flow({
|
|
|
92
93
|
source,
|
|
93
94
|
});
|
|
94
95
|
|
|
95
|
-
if (isConnected) {
|
|
96
|
+
if (isConnected && isAuthenticated) {
|
|
96
97
|
// Check if we already have a signer for this partner
|
|
97
98
|
const hasExistingSigner = signers?.some(signer => signer.partner.id === partnerId);
|
|
98
99
|
if (hasExistingSigner) {
|
|
@@ -139,6 +140,7 @@ export function SignInWithB3Flow({
|
|
|
139
140
|
signersEnabled,
|
|
140
141
|
isConnected,
|
|
141
142
|
isAuthenticating,
|
|
143
|
+
isAuthenticated,
|
|
142
144
|
isOpen,
|
|
143
145
|
]);
|
|
144
146
|
|
|
@@ -86,8 +86,8 @@ export function LoginStep({ onSuccess, chain }: LoginStepProps) {
|
|
|
86
86
|
titleIcon: "https://cdn.b3.fun/b3_logo.svg",
|
|
87
87
|
}}
|
|
88
88
|
className="b3-login-step"
|
|
89
|
-
onConnect={async wallet => {
|
|
90
|
-
await onConnect(wallet);
|
|
89
|
+
onConnect={async (wallet, allConnectedWallets) => {
|
|
90
|
+
await onConnect(wallet, allConnectedWallets);
|
|
91
91
|
const account = wallet.getAccount();
|
|
92
92
|
if (!account) throw new Error("No account found");
|
|
93
93
|
await onSuccess(account);
|
|
@@ -164,7 +164,15 @@ export function useAuthentication(partnerId: string) {
|
|
|
164
164
|
);
|
|
165
165
|
|
|
166
166
|
const onConnect = useCallback(
|
|
167
|
-
async (
|
|
167
|
+
async (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => {
|
|
168
|
+
debug("@@useAuthentication:onConnect", { _walleAutoConnectedWith, allConnectedWallets });
|
|
169
|
+
|
|
170
|
+
const wallet = allConnectedWallets.find(wallet => wallet.id.startsWith("ecosystem."));
|
|
171
|
+
|
|
172
|
+
if (!wallet) {
|
|
173
|
+
throw new Error("No smart wallet found during auto-connect");
|
|
174
|
+
}
|
|
175
|
+
|
|
168
176
|
debug("@@useAuthentication:onConnect", { wallet });
|
|
169
177
|
|
|
170
178
|
try {
|
|
@@ -243,7 +251,7 @@ export function useAuthentication(partnerId: string) {
|
|
|
243
251
|
const { isLoading: useAutoConnectLoading } = useAutoConnect({
|
|
244
252
|
client,
|
|
245
253
|
wallets: [wallet],
|
|
246
|
-
onConnect
|
|
254
|
+
onConnect,
|
|
247
255
|
});
|
|
248
256
|
|
|
249
257
|
/**
|