@b3dotfun/sdk 0.0.83-test.0 → 0.0.83

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.
Files changed (68) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +0 -3
  2. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +1 -1
  3. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +0 -3
  4. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +47 -177
  5. package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +0 -3
  6. package/dist/cjs/anyspend/utils/chain.d.ts +38 -0
  7. package/dist/cjs/anyspend/utils/chain.js +22 -1
  8. package/dist/cjs/anyspend/utils/token.d.ts +3 -0
  9. package/dist/cjs/anyspend/utils/token.js +17 -1
  10. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +12 -57
  11. package/dist/cjs/global-account/react/hooks/index.d.ts +0 -1
  12. package/dist/cjs/global-account/react/hooks/index.js +1 -3
  13. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -2
  14. package/dist/cjs/global-account/react/hooks/useAuthentication.js +63 -72
  15. package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +0 -3
  16. package/dist/cjs/global-account/react/hooks/useTWAuth.js +0 -8
  17. package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +24 -54
  18. package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +1 -1
  19. package/dist/esm/anyspend/react/components/AnySpend.js +0 -3
  20. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +1 -1
  21. package/dist/esm/anyspend/react/components/AnySpendCustom.js +0 -3
  22. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +45 -175
  23. package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +0 -3
  24. package/dist/esm/anyspend/utils/chain.d.ts +38 -0
  25. package/dist/esm/anyspend/utils/chain.js +22 -1
  26. package/dist/esm/anyspend/utils/token.d.ts +3 -0
  27. package/dist/esm/anyspend/utils/token.js +15 -1
  28. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +12 -57
  29. package/dist/esm/global-account/react/hooks/index.d.ts +0 -1
  30. package/dist/esm/global-account/react/hooks/index.js +0 -1
  31. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -2
  32. package/dist/esm/global-account/react/hooks/useAuthentication.js +63 -72
  33. package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +0 -3
  34. package/dist/esm/global-account/react/hooks/useTWAuth.js +0 -8
  35. package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +24 -54
  36. package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +1 -1
  37. package/dist/styles/index.css +1 -1
  38. package/dist/types/anyspend/utils/chain.d.ts +38 -0
  39. package/dist/types/anyspend/utils/token.d.ts +3 -0
  40. package/dist/types/global-account/react/hooks/index.d.ts +0 -1
  41. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -2
  42. package/dist/types/global-account/react/hooks/useTWAuth.d.ts +0 -3
  43. package/dist/types/global-account/react/hooks/useUserQuery.d.ts +1 -1
  44. package/package.json +1 -1
  45. package/src/anyspend/react/components/AnySpend.tsx +0 -4
  46. package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +1 -1
  47. package/src/anyspend/react/components/AnySpendCustom.tsx +0 -4
  48. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +22 -253
  49. package/src/anyspend/react/hooks/useAnyspendFlow.ts +0 -4
  50. package/src/anyspend/utils/chain.ts +31 -1
  51. package/src/anyspend/utils/token.ts +17 -1
  52. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +22 -77
  53. package/src/global-account/react/hooks/index.ts +0 -1
  54. package/src/global-account/react/hooks/useAuthentication.ts +85 -88
  55. package/src/global-account/react/hooks/useTWAuth.tsx +0 -10
  56. package/src/global-account/react/hooks/useTurnkeyAuth.ts +26 -59
  57. package/dist/cjs/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +0 -10
  58. package/dist/cjs/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.js +0 -73
  59. package/dist/cjs/global-account/react/hooks/useAuth.d.ts +0 -76
  60. package/dist/cjs/global-account/react/hooks/useAuth.js +0 -338
  61. package/dist/esm/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +0 -10
  62. package/dist/esm/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.js +0 -70
  63. package/dist/esm/global-account/react/hooks/useAuth.d.ts +0 -76
  64. package/dist/esm/global-account/react/hooks/useAuth.js +0 -332
  65. package/dist/types/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +0 -10
  66. package/dist/types/global-account/react/hooks/useAuth.d.ts +0 -76
  67. package/src/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.ts +0 -80
  68. package/src/global-account/react/hooks/useAuth.ts +0 -380
@@ -1,338 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.useAuth = useAuth;
7
- const app_1 = __importDefault(require("../../../global-account/app"));
8
- const bsmnt_1 = require("../../../global-account/bsmnt");
9
- const react_1 = require("../../../global-account/react");
10
- const constants_1 = require("../../../shared/constants");
11
- const debug_1 = require("../../../shared/utils/debug");
12
- const thirdweb_1 = require("../../../shared/utils/thirdweb");
13
- const core_1 = require("@wagmi/core");
14
- const react_2 = require("react");
15
- const react_3 = require("thirdweb/react");
16
- const wallets_1 = require("thirdweb/wallets");
17
- const in_app_1 = require("thirdweb/wallets/in-app");
18
- const wagmi_1 = require("wagmi");
19
- const LocalSDKProvider_1 = require("../components/B3Provider/LocalSDKProvider");
20
- const useB3_1 = require("../components/B3Provider/useB3");
21
- const createWagmiConfig_1 = require("../utils/createWagmiConfig");
22
- const useSearchParamsSSR_1 = require("./useSearchParamsSSR");
23
- const useUserQuery_1 = require("./useUserQuery");
24
- const debug = (0, debug_1.debugB3React)("useAuth");
25
- /**
26
- * Unified authentication hook that uses Turnkey for authentication
27
- * This replaces the previous Thirdweb-based authentication
28
- *
29
- * This hook provides 1:1 feature parity with useAuthentication.ts
30
- */
31
- function useAuth() {
32
- const { onConnectCallback } = (0, react_2.useContext)(LocalSDKProvider_1.LocalSDKContext);
33
- const { disconnect } = (0, react_3.useDisconnect)();
34
- const wallets = (0, react_3.useConnectedWallets)();
35
- const activeWallet = (0, react_3.useActiveWallet)();
36
- const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
37
- const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
38
- const setIsConnected = (0, react_1.useAuthStore)(state => state.setIsConnected);
39
- const isConnecting = (0, react_1.useAuthStore)(state => state.isConnecting);
40
- const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
41
- const isAuthenticating = (0, react_1.useAuthStore)(state => state.isAuthenticating);
42
- const setIsAuthenticating = (0, react_1.useAuthStore)(state => state.setIsAuthenticating);
43
- const setHasStartedConnecting = (0, react_1.useAuthStore)(state => state.setHasStartedConnecting);
44
- const setActiveWallet = (0, react_3.useSetActiveWallet)();
45
- const hasStartedConnecting = (0, react_1.useAuthStore)(state => state.hasStartedConnecting);
46
- const useAutoConnectLoadingPrevious = (0, react_2.useRef)(false);
47
- const referralCode = (0, useSearchParamsSSR_1.useSearchParam)("referralCode");
48
- const { partnerId } = (0, useB3_1.useB3)();
49
- const wagmiConfig = (0, createWagmiConfig_1.createWagmiConfig)({ partnerId });
50
- const { connect } = (0, wagmi_1.useConnect)();
51
- const activeWagmiAccount = (0, wagmi_1.useAccount)();
52
- const { switchAccount } = (0, wagmi_1.useSwitchAccount)();
53
- const { user, setUser } = (0, useUserQuery_1.useUserQuery)();
54
- debug("@@activeWagmiAccount", activeWagmiAccount);
55
- const wallet = (0, wallets_1.ecosystemWallet)(constants_1.ecosystemWalletId, {
56
- partnerId: partnerId,
57
- });
58
- /**
59
- * Re-authenticate using existing session
60
- * Also updates user state and authenticates with BSMNT
61
- */
62
- const reAuthenticate = (0, react_2.useCallback)(async () => {
63
- debug("Re-authenticating...");
64
- try {
65
- const response = await app_1.default.reAuthenticate();
66
- debug("Re-authentication successful", response);
67
- // Update user state if user data exists
68
- if (response.user) {
69
- setUser(response.user);
70
- debug("User state updated", response.user);
71
- }
72
- // Authenticate with BSMNT
73
- try {
74
- const b3Jwt = await (0, bsmnt_1.authenticateWithB3JWT)(response.accessToken);
75
- debug("BSMNT re-authentication successful", b3Jwt);
76
- }
77
- catch (bsmntError) {
78
- // BSMNT authentication failure shouldn't block the main auth flow
79
- debug("BSMNT re-authentication failed (non-critical)", bsmntError);
80
- }
81
- return response;
82
- }
83
- catch (err) {
84
- debug("Re-authentication failed", err);
85
- throw err;
86
- }
87
- }, [setUser]);
88
- const syncWagmi = (0, react_2.useCallback)(async () => {
89
- function syncWagmiFunc() {
90
- const connectors = (0, core_1.getConnectors)(wagmiConfig);
91
- debug("@@syncWagmi", {
92
- connectors,
93
- wallets,
94
- });
95
- // For each that matchs a TW wallet on wallets, connect to the wagmi connector
96
- // or, since ecosystem wallets is separate, connect those via in-app-wallet from wagmi
97
- connectors.forEach(async (connector) => {
98
- const twWallet = wallets.find(wallet => wallet.id === connector.id || connector.id === "in-app-wallet");
99
- // If no TW wallet, do not prompt the user to connect
100
- if (!twWallet) {
101
- return;
102
- }
103
- // Metamask will prompt to connect, we can just switch accounts here.
104
- if (connector.id === "io.metamask") {
105
- return switchAccount({ connector });
106
- }
107
- if (
108
- // If it's not an in-app wallet or it is the ecosystem wallet, connect
109
- connector.id !== "in-app-wallet" ||
110
- (connector.id === "in-app-wallet" && twWallet.id === constants_1.ecosystemWalletId)) {
111
- try {
112
- const options = {
113
- wallet: twWallet, // the connected wallet
114
- };
115
- debug("@@syncWagmi:connecting", { twWallet, connector });
116
- connect({
117
- connector,
118
- ...options,
119
- });
120
- }
121
- catch (error) {
122
- console.error("@@syncWagmi:error", error);
123
- }
124
- }
125
- else {
126
- debug("@@syncWagmi:not-connecting", connector);
127
- }
128
- });
129
- }
130
- syncWagmiFunc();
131
- // wagmi config shouldn't change
132
- // eslint-disable-next-line react-hooks/exhaustive-deps
133
- }, [partnerId, wallets]);
134
- (0, react_2.useEffect)(() => {
135
- syncWagmi();
136
- }, [wallets, syncWagmi]);
137
- /**
138
- * Authenticate user using Turnkey
139
- * Note: This no longer requires a wallet for authentication.
140
- * Wallets are still used for signing transactions, but authentication is done via Turnkey email OTP.
141
- *
142
- * For backward compatibility, this function still accepts a wallet parameter,
143
- * but it's not used for authentication anymore.
144
- */
145
- const authenticateUser = (0, react_2.useCallback)(async () => {
146
- setHasStartedConnecting(true);
147
- // Try to re-authenticate first
148
- try {
149
- const userAuth = await reAuthenticate();
150
- setUser(userAuth.user);
151
- setIsAuthenticated(true);
152
- setIsAuthenticating(false);
153
- debug("Re-authenticated successfully", { userAuth });
154
- // Authenticate on BSMNT with B3 JWT
155
- const b3Jwt = await (0, bsmnt_1.authenticateWithB3JWT)(userAuth.accessToken);
156
- debug("@@b3Jwt", b3Jwt);
157
- return userAuth;
158
- }
159
- catch (error) {
160
- // If re-authentication fails, user needs to authenticate via Turnkey
161
- // This should be handled by the Turnkey auth modal/flow
162
- debug("Re-authentication failed. User needs to authenticate via Turnkey.", error);
163
- setIsAuthenticated(false);
164
- setIsAuthenticating(false);
165
- throw new Error("Authentication required. Please authenticate via Turnkey.");
166
- }
167
- }, [reAuthenticate, setIsAuthenticated, setIsAuthenticating, setUser, setHasStartedConnecting]);
168
- /**
169
- * Authenticate with Turnkey using email OTP
170
- * This is the primary authentication method, replacing Thirdweb wallet-based auth
171
- *
172
- * This function:
173
- * 1. Authenticates with FeathersJS (persists session via cookies)
174
- * 2. Sets user state in the user store (persists to localStorage)
175
- * 3. Authenticates with BSMNT for basement integration
176
- */
177
- const authenticate = (0, react_2.useCallback)(async (turnkeySessionJwt, partnerId) => {
178
- if (!turnkeySessionJwt) {
179
- throw new Error("Turnkey session JWT is required");
180
- }
181
- debug("Authenticating with Turnkey JWT", { referralCode, partnerId });
182
- try {
183
- // Step 1: Authenticate with FeathersJS (session persisted via cookies)
184
- const response = await app_1.default.authenticate({
185
- strategy: "turnkey-jwt",
186
- accessToken: turnkeySessionJwt,
187
- referralCode,
188
- partnerId: partnerId,
189
- });
190
- debug("Authentication successful", response);
191
- // Step 2: Set user state (persists to localStorage via Zustand)
192
- if (response.user) {
193
- setUser(response.user);
194
- debug("User state updated", response.user);
195
- }
196
- // Step 3: Authenticate with BSMNT for basement integration
197
- try {
198
- const b3Jwt = await (0, bsmnt_1.authenticateWithB3JWT)(response.accessToken);
199
- debug("BSMNT authentication successful", b3Jwt);
200
- }
201
- catch (bsmntError) {
202
- // BSMNT authentication failure shouldn't block the main auth flow
203
- debug("BSMNT authentication failed (non-critical)", bsmntError);
204
- }
205
- return response;
206
- }
207
- catch (err) {
208
- debug("Authentication failed", err);
209
- throw err;
210
- }
211
- }, [referralCode, setUser]);
212
- /**
213
- * Handle wallet connection
214
- * Note: With Turnkey migration, wallet connection is primarily for signing transactions,
215
- * not for authentication. Authentication should be done separately via Turnkey email OTP.
216
- */
217
- /**
218
- * Handle wallet connection
219
- * Note: With Turnkey migration, wallet connection is primarily for signing transactions,
220
- * not for authentication. Authentication should be done separately via Turnkey email OTP.
221
- */
222
- const onConnect = (0, react_2.useCallback)(async (_walleAutoConnectedWith, allConnectedWallets) => {
223
- debug("@@useAuth:onConnect", { _walleAutoConnectedWith, allConnectedWallets });
224
- const wallet = allConnectedWallets.find(wallet => wallet.id.startsWith("ecosystem."));
225
- if (!wallet) {
226
- throw new Error("No smart wallet found during auto-connect");
227
- }
228
- debug("@@useAuth:onConnect", { wallet });
229
- try {
230
- setHasStartedConnecting(true);
231
- setIsConnected(true);
232
- setIsAuthenticating(true);
233
- await setActiveWallet(wallet);
234
- // Try to authenticate user (will use re-authenticate if session exists)
235
- // If no session exists, authentication will need to happen via Turnkey flow
236
- try {
237
- const userAuth = await authenticateUser();
238
- if (userAuth && onConnectCallback) {
239
- await onConnectCallback(wallet, userAuth.accessToken);
240
- }
241
- }
242
- catch (authError) {
243
- // Authentication failed - this is expected if user hasn't authenticated via Turnkey yet
244
- // The Turnkey auth modal should handle this
245
- debug("@@useAuth:onConnect:authFailed", { authError });
246
- // Don't set isAuthenticated to false here - let the Turnkey flow handle it
247
- }
248
- }
249
- catch (error) {
250
- debug("@@useAuth:onConnect:failed", { error });
251
- setIsAuthenticated(false);
252
- setUser(undefined);
253
- }
254
- finally {
255
- setIsAuthenticating(false);
256
- }
257
- debug({
258
- isAuthenticated,
259
- isAuthenticating,
260
- isConnected,
261
- });
262
- }, [
263
- onConnectCallback,
264
- authenticateUser,
265
- isAuthenticated,
266
- isAuthenticating,
267
- isConnected,
268
- setActiveWallet,
269
- setHasStartedConnecting,
270
- setIsAuthenticated,
271
- setIsAuthenticating,
272
- setIsConnected,
273
- setUser,
274
- ]);
275
- const logout = (0, react_2.useCallback)(async (callback) => {
276
- if (activeWallet) {
277
- debug("@@logout:activeWallet", activeWallet);
278
- disconnect(activeWallet);
279
- debug("@@logout:activeWallet", activeWallet);
280
- }
281
- // Log out of each wallet
282
- wallets.forEach(wallet => {
283
- console.log("@@logging out", wallet);
284
- disconnect(wallet);
285
- });
286
- // Delete localStorage thirdweb:connected-wallet-ids
287
- // https://npc-labs.slack.com/archives/C070E6HNG85/p1750185115273099
288
- if (typeof localStorage !== "undefined") {
289
- localStorage.removeItem("thirdweb:connected-wallet-ids");
290
- localStorage.removeItem("wagmi.store");
291
- localStorage.removeItem("lastAuthProvider");
292
- localStorage.removeItem("b3-user");
293
- }
294
- app_1.default.logout();
295
- debug("@@logout:loggedOut");
296
- setIsAuthenticated(false);
297
- setIsConnected(false);
298
- setUser();
299
- callback?.();
300
- }, [activeWallet, disconnect, wallets, setIsAuthenticated, setUser, setIsConnected]);
301
- const { isLoading: useAutoConnectLoading } = (0, react_3.useAutoConnect)({
302
- client: thirdweb_1.client,
303
- wallets: [wallet],
304
- onConnect,
305
- onTimeout: () => {
306
- logout().catch(error => {
307
- debug("@@useAuth:logout on timeout failed", { error });
308
- });
309
- },
310
- });
311
- /**
312
- * useAutoConnectLoading starts as false
313
- */
314
- (0, react_2.useEffect)(() => {
315
- if (!useAutoConnectLoading && useAutoConnectLoadingPrevious.current && !hasStartedConnecting) {
316
- setIsAuthenticating(false);
317
- }
318
- useAutoConnectLoadingPrevious.current = useAutoConnectLoading;
319
- }, [useAutoConnectLoading, hasStartedConnecting, setIsAuthenticating]);
320
- const isReady = isAuthenticated && !isAuthenticating;
321
- return {
322
- authenticate,
323
- reAuthenticate,
324
- logout,
325
- isAuthenticated,
326
- isReady,
327
- isConnecting,
328
- isConnected,
329
- wallet,
330
- preAuthenticate: in_app_1.preAuthenticate,
331
- connect: onConnect,
332
- isAuthenticating,
333
- onConnect,
334
- user,
335
- refetchUser: authenticateUser,
336
- setUser,
337
- };
338
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Hook that automatically sets the active thirdweb wallet when a wagmi wallet connects.
3
- *
4
- * This is useful for syncing wagmi wallet connections with thirdweb's wallet system,
5
- * ensuring that when users connect via wagmi, the active wallet is properly set.
6
- *
7
- * Place this hook in components that stay mounted throughout the user flow
8
- * (not in components that unmount during navigation).
9
- */
10
- export declare function useAutoSetActiveWalletFromWagmi(): void;
@@ -1,70 +0,0 @@
1
- import { client } from "../../../shared/utils/thirdweb.js";
2
- import { useCallback, useEffect, useRef } from "react";
3
- import { useSetActiveWallet } from "thirdweb/react";
4
- import { createWallet } from "thirdweb/wallets";
5
- import { useAccount } from "wagmi";
6
- /**
7
- * Hook that automatically sets the active thirdweb wallet when a wagmi wallet connects.
8
- *
9
- * This is useful for syncing wagmi wallet connections with thirdweb's wallet system,
10
- * ensuring that when users connect via wagmi, the active wallet is properly set.
11
- *
12
- * Place this hook in components that stay mounted throughout the user flow
13
- * (not in components that unmount during navigation).
14
- */
15
- export function useAutoSetActiveWalletFromWagmi() {
16
- const { address: wagmiAddress, connector: wagmiConnector } = useAccount();
17
- const setActiveWallet = useSetActiveWallet();
18
- const prevWagmiAddress = useRef(undefined);
19
- // Map wagmi connector names to thirdweb wallet IDs
20
- const getThirdwebWalletId = useCallback((connectorName) => {
21
- const walletMap = {
22
- MetaMask: "io.metamask",
23
- "Coinbase Wallet": "com.coinbase.wallet",
24
- Rainbow: "me.rainbow",
25
- WalletConnect: "walletConnect",
26
- Phantom: "app.phantom",
27
- };
28
- return walletMap[connectorName] || null;
29
- }, []);
30
- // Create thirdweb wallet from wagmi connector
31
- const createThirdwebWalletFromConnector = useCallback(async (connectorName) => {
32
- const walletId = getThirdwebWalletId(connectorName);
33
- if (!walletId) {
34
- console.warn(`No thirdweb wallet ID found for connector: ${connectorName}`);
35
- return null;
36
- }
37
- try {
38
- const thirdwebWallet = createWallet(walletId);
39
- await thirdwebWallet.connect({ client });
40
- return thirdwebWallet;
41
- }
42
- catch (error) {
43
- console.error(`Failed to create thirdweb wallet for ${connectorName}:`, error);
44
- return null;
45
- }
46
- }, [getThirdwebWalletId]);
47
- // Listen for wagmi wallet connections and automatically set active wallet
48
- useEffect(() => {
49
- const isNewConnection = wagmiAddress && wagmiAddress !== prevWagmiAddress.current;
50
- if (isNewConnection && wagmiConnector?.name) {
51
- prevWagmiAddress.current = wagmiAddress;
52
- const setupThirdwebWallet = async () => {
53
- try {
54
- const thirdwebWallet = await createThirdwebWalletFromConnector(wagmiConnector.name);
55
- if (thirdwebWallet) {
56
- setActiveWallet(thirdwebWallet);
57
- console.log(`Auto-set active wallet for ${wagmiConnector.name}`);
58
- }
59
- }
60
- catch (error) {
61
- console.error("Failed to auto-set active wallet:", error);
62
- }
63
- };
64
- setupThirdwebWallet();
65
- }
66
- if (!wagmiAddress) {
67
- prevWagmiAddress.current = undefined;
68
- }
69
- }, [wagmiAddress, wagmiConnector?.name, setActiveWallet, createThirdwebWalletFromConnector]);
70
- }
@@ -1,76 +0,0 @@
1
- import { Wallet } from "thirdweb/wallets";
2
- import { preAuthenticate } from "thirdweb/wallets/in-app";
3
- /**
4
- * Unified authentication hook that uses Turnkey for authentication
5
- * This replaces the previous Thirdweb-based authentication
6
- *
7
- * This hook provides 1:1 feature parity with useAuthentication.ts
8
- */
9
- export declare function useAuth(): {
10
- authenticate: (turnkeySessionJwt: string, partnerId: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
11
- reAuthenticate: () => Promise<import("@feathersjs/authentication").AuthenticationResult>;
12
- logout: (callback?: () => void) => Promise<void>;
13
- isAuthenticated: boolean;
14
- isReady: boolean;
15
- isConnecting: boolean;
16
- isConnected: boolean;
17
- wallet: import("thirdweb/dist/types/wallets/in-app/core/wallet/types").EcosystemWallet;
18
- preAuthenticate: typeof preAuthenticate;
19
- connect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
20
- isAuthenticating: boolean;
21
- onConnect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
22
- user: {
23
- email?: string | undefined;
24
- telNumber?: string | undefined;
25
- username?: string | undefined;
26
- ens?: string | undefined;
27
- avatar?: string | undefined;
28
- preferences?: {} | undefined;
29
- referredBy?: string | {} | undefined;
30
- sourceApp?: string | undefined;
31
- referralCode?: string | undefined;
32
- userGroups?: number[] | undefined;
33
- isMigratedFromBSMNT?: boolean | undefined;
34
- privyLinkedAccounts?: {
35
- name?: string | undefined;
36
- address?: string | undefined;
37
- email?: string | undefined;
38
- chain_type?: string | undefined;
39
- lv?: number | undefined;
40
- wallet_client_type?: string | undefined;
41
- smart_wallet_type?: string | undefined;
42
- subject?: string | undefined;
43
- type: string;
44
- }[] | undefined;
45
- twProfiles?: {
46
- type: string;
47
- details: {
48
- id?: string | undefined;
49
- name?: string | undefined;
50
- address?: string | undefined;
51
- email?: string | undefined;
52
- phone?: string | undefined;
53
- username?: string | undefined;
54
- fid?: string | undefined;
55
- };
56
- }[] | undefined;
57
- turnkeySubOrgs?: {
58
- hasDelegatedUser?: boolean | undefined;
59
- subOrgId: string;
60
- accounts: Record<string, any>[];
61
- }[] | undefined;
62
- _id: string | {};
63
- userId: string;
64
- smartAccountAddress: string;
65
- createdAt: number;
66
- updatedAt: number;
67
- partnerIds: {
68
- privyId?: string | undefined;
69
- thirdwebId?: string | undefined;
70
- turnkeyId?: string | undefined;
71
- turnkeyOtpId?: string | undefined;
72
- };
73
- } | undefined;
74
- refetchUser: () => Promise<import("@feathersjs/authentication").AuthenticationResult>;
75
- setUser: (newUser?: import("@b3dotfun/b3-api").Users) => void;
76
- };