@b3dotfun/sdk 0.0.47-test.4 → 0.0.47

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 (90) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +2 -3
  3. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +64 -15
  4. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +2 -6
  5. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +21 -26
  6. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +0 -2
  7. package/dist/cjs/global-account/react/components/B3Provider/types.js +0 -2
  8. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.d.ts +2 -1
  9. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  10. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
  11. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  12. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.js +1 -1
  13. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  14. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +22 -6
  15. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +2 -1
  16. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -3
  17. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +2 -1
  18. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +45 -10
  19. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +2 -1
  20. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -2
  21. package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +1 -2
  22. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -51
  23. package/dist/cjs/global-account/react/hooks/useAuthentication.js +84 -134
  24. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  25. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +1 -2
  26. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -0
  27. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +2 -3
  28. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +68 -19
  29. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +2 -6
  30. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +19 -24
  31. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +0 -2
  32. package/dist/esm/global-account/react/components/B3Provider/types.js +0 -2
  33. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +2 -1
  34. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  35. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
  36. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  37. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +2 -2
  38. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  39. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +23 -7
  40. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +2 -1
  41. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +3 -4
  42. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +2 -1
  43. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +46 -11
  44. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +2 -1
  45. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -3
  46. package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +2 -3
  47. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -51
  48. package/dist/esm/global-account/react/hooks/useAuthentication.js +87 -137
  49. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  50. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -3
  51. package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -0
  52. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +2 -3
  53. package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +2 -6
  54. package/dist/types/global-account/react/components/B3Provider/types.d.ts +0 -2
  55. package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +2 -1
  56. package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  57. package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +2 -1
  58. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +2 -1
  59. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +2 -1
  60. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -51
  61. package/dist/types/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  62. package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -0
  63. package/package.json +3 -3
  64. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +35 -51
  65. package/src/global-account/react/components/B3Provider/B3Provider.tsx +72 -28
  66. package/src/global-account/react/components/B3Provider/types.ts +0 -4
  67. package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +3 -2
  68. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +1 -1
  69. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
  70. package/src/global-account/react/components/SignInWithB3/SignInWithB3.tsx +2 -2
  71. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +23 -4
  72. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +3 -4
  73. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +46 -8
  74. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
  75. package/src/global-account/react/components/custom/ManageAccountButton.tsx +2 -3
  76. package/src/global-account/react/hooks/useAuthentication.ts +90 -159
  77. package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +2 -3
  78. package/src/global-account/react/stores/useModalStore.ts +2 -0
  79. package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +0 -58
  80. package/dist/cjs/global-account/react/hooks/useUserQuery.js +0 -86
  81. package/dist/cjs/global-account/react/hooks/useWagmiConfig.d.ts +0 -13
  82. package/dist/cjs/global-account/react/hooks/useWagmiConfig.js +0 -42
  83. package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +0 -58
  84. package/dist/esm/global-account/react/hooks/useUserQuery.js +0 -83
  85. package/dist/esm/global-account/react/hooks/useWagmiConfig.d.ts +0 -13
  86. package/dist/esm/global-account/react/hooks/useWagmiConfig.js +0 -39
  87. package/dist/types/global-account/react/hooks/useUserQuery.d.ts +0 -58
  88. package/dist/types/global-account/react/hooks/useWagmiConfig.d.ts +0 -13
  89. package/src/global-account/react/hooks/useUserQuery.ts +0 -95
  90. package/src/global-account/react/hooks/useWagmiConfig.tsx +0 -44
@@ -1,149 +1,117 @@
1
1
  import app from "../../../global-account/app.js";
2
2
  import { authenticateWithB3JWT } from "../../../global-account/bsmnt.js";
3
- import { useAuthStore, useSiwe } from "../../../global-account/react/index.js";
3
+ import { useAuthStore, useB3 } from "../../../global-account/react/index.js";
4
4
  import { ecosystemWalletId } from "../../../shared/constants/index.js";
5
+ import { b3MainnetThirdWeb } from "../../../shared/constants/chains/supported.js";
5
6
  import { debugB3React } from "../../../shared/utils/debug.js";
6
7
  import { client } from "../../../shared/utils/thirdweb.js";
7
- import { getConnectors } from "@wagmi/core";
8
- import { useCallback, useEffect, useRef } from "react";
9
- import { useActiveWallet, useAutoConnect, useConnectedWallets, useDisconnect, useSetActiveWallet, } from "thirdweb/react";
8
+ import { useEffect, useRef } from "react";
9
+ import { useActiveWallet, useAutoConnect, useConnectedWallets, useDisconnect } from "thirdweb/react";
10
10
  import { ecosystemWallet } from "thirdweb/wallets";
11
11
  import { preAuthenticate } from "thirdweb/wallets/in-app";
12
- import { useAccount, useConnect } from "wagmi";
13
- import { useUserQuery } from "./useUserQuery.js";
14
- import { useWagmiConfig } from "./useWagmiConfig.js";
12
+ import { useConnect } from "./useConnect.js";
13
+ import { useSiwe } from "./useSiwe.js";
15
14
  const debug = debugB3React("useAuthentication");
16
- export function useAuthentication(partnerId) {
15
+ export function useAuthentication(partnerId, loginWithSiwe) {
17
16
  const { disconnect } = useDisconnect();
18
17
  const wallets = useConnectedWallets();
19
18
  const activeWallet = useActiveWallet();
19
+ const { authenticate } = useSiwe();
20
+ const { setUser } = useB3();
20
21
  const isAuthenticated = useAuthStore(state => state.isAuthenticated);
21
22
  const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
23
+ const setIsConnecting = useAuthStore(state => state.setIsConnecting);
22
24
  const setIsConnected = useAuthStore(state => state.setIsConnected);
23
25
  const isConnecting = useAuthStore(state => state.isConnecting);
24
26
  const isConnected = useAuthStore(state => state.isConnected);
25
- const isAuthenticating = useAuthStore(state => state.isAuthenticating);
27
+ const useAutoConnectLoadingPrevious = useRef(false);
26
28
  const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
27
- const setHasStartedConnecting = useAuthStore(state => state.setHasStartedConnecting);
28
- const setActiveWallet = useSetActiveWallet();
29
+ const isAuthenticating = useAuthStore(state => state.isAuthenticating);
29
30
  const hasStartedConnecting = useAuthStore(state => state.hasStartedConnecting);
30
- const { authenticate } = useSiwe();
31
- const { user, setUser } = useUserQuery();
32
- const useAutoConnectLoadingPrevious = useRef(false);
33
- const wagmiConfig = useWagmiConfig(partnerId);
34
- const { connect } = useConnect();
35
- const activeWagmiAccount = useAccount();
36
- debug("@@activeWagmiAccount", activeWagmiAccount);
31
+ const setHasStartedConnecting = useAuthStore(state => state.setHasStartedConnecting);
32
+ const { connect } = useConnect(partnerId, b3MainnetThirdWeb);
37
33
  const wallet = ecosystemWallet(ecosystemWalletId, {
38
34
  partnerId: partnerId,
39
35
  });
40
- const syncWagmi = useCallback(async () => {
41
- function syncWagmiFunc() {
42
- const connectors = getConnectors(wagmiConfig);
43
- debug("@@syncWagmi", {
44
- connectors,
45
- wallets,
46
- });
47
- // For each that matchs a TW wallet on wallets, connect to the wagmi connector
48
- // or, since ecosystem wallets is separate, connect those via in-app-wallet from wagmi
49
- connectors.forEach(async (connector) => {
50
- const twWallet = wallets.find(wallet => wallet.id === connector.id || connector.id === "in-app-wallet");
51
- if (twWallet &&
52
- // If it's not an in-app wallet or it is the ecosystem wallet, connect
53
- (connector.id !== "in-app-wallet" || (connector.id === "in-app-wallet" && twWallet.id === ecosystemWalletId))) {
54
- try {
55
- const options = {
56
- wallet: twWallet, // the connected wallet
57
- };
58
- debug("@@syncWagmi:connecting", { twWallet, connector });
59
- connect({
60
- connector,
61
- ...options,
62
- });
63
- }
64
- catch (error) {
65
- console.error("@@syncWagmi:error", error);
66
- }
36
+ const { isLoading: useAutoConnectLoading } = useAutoConnect({
37
+ client,
38
+ wallets: [wallet],
39
+ onConnect: async (wallet) => {
40
+ setHasStartedConnecting(true);
41
+ try {
42
+ setIsConnected(true);
43
+ if (!loginWithSiwe) {
44
+ debug("Skipping SIWE login", { loginWithSiwe });
45
+ setIsAuthenticated(true);
46
+ setIsAuthenticating(false);
47
+ return;
67
48
  }
68
- else {
69
- debug("@@syncWagmi:not-connecting", connector);
49
+ debug("setIsAuthenticating:true:4");
50
+ const account = await wallet.getAccount();
51
+ if (!account) {
52
+ throw new Error("No account found during auto-connect");
70
53
  }
71
- });
72
- }
73
- syncWagmiFunc();
74
- // wagmi config shouldn't change
75
- // eslint-disable-next-line react-hooks/exhaustive-deps
76
- }, [partnerId, wallets]);
77
- useEffect(() => {
78
- syncWagmi();
79
- }, [wallets, syncWagmi]);
80
- const authenticateUser = useCallback(async (wallet) => {
81
- setHasStartedConnecting(true);
82
- const account = wallet ? wallet.getAccount() : activeWallet?.getAccount();
83
- if (!account) {
84
- throw new Error("No account found during auto-connect");
85
- }
86
- if (!account) {
87
- throw new Error("No account found during auto-connect");
88
- }
89
- // Try to re-authenticate first
90
- try {
91
- const userAuth = await app.reAuthenticate();
92
- setUser(userAuth.user);
93
- setIsAuthenticated(true);
54
+ // Try to re-authenticate first
55
+ try {
56
+ const userAuth = await app.reAuthenticate();
57
+ setUser(userAuth.user);
58
+ setIsAuthenticated(true);
59
+ setIsAuthenticating(false);
60
+ debug("Re-authenticated successfully", { userAuth });
61
+ // Authenticate on BSMNT with B3 JWT
62
+ const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
63
+ console.log("@@b3Jwt", b3Jwt);
64
+ }
65
+ catch (error) {
66
+ // If re-authentication fails, try fresh authentication
67
+ debug("Re-authentication failed, attempting fresh authentication");
68
+ const userAuth = await authenticate(account, partnerId);
69
+ setUser(userAuth.user);
70
+ setIsAuthenticated(true);
71
+ setIsAuthenticating(false);
72
+ debug("Fresh authentication successful", { userAuth });
73
+ // Authenticate on BSMNT with B3 JWT
74
+ const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
75
+ console.log("@@b3Jwt", b3Jwt);
76
+ }
77
+ }
78
+ catch (error) {
79
+ debug("Auto-connect authentication failed", { error });
80
+ setIsAuthenticated(false);
81
+ debug("setIsAuthenticating:false:4");
82
+ setUser();
83
+ }
94
84
  setIsAuthenticating(false);
95
- debug("Re-authenticated successfully", { userAuth });
96
- // Authenticate on BSMNT with B3 JWT
97
- const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
98
- debug("@@b3Jwt", b3Jwt);
99
- }
100
- catch (error) {
101
- // If re-authentication fails, try fresh authentication
102
- debug("Re-authentication failed, attempting fresh authentication");
103
- const userAuth = await authenticate(account, partnerId);
104
- setUser(userAuth.user);
105
- setIsAuthenticated(true);
85
+ },
86
+ });
87
+ /**
88
+ * useAutoConnectLoading starts as false
89
+ */
90
+ useEffect(() => {
91
+ if (!useAutoConnectLoading && useAutoConnectLoadingPrevious.current && !hasStartedConnecting) {
106
92
  setIsAuthenticating(false);
107
- debug("Fresh authentication successful", { userAuth });
108
- // Authenticate on BSMNT with B3 JWT
109
- const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
110
- debug("@@b3Jwt", b3Jwt);
111
93
  }
112
- }, [activeWallet, partnerId, authenticate, setIsAuthenticated, setIsAuthenticating, setUser, setHasStartedConnecting]);
113
- const onConnect = useCallback(async (wallet) => {
114
- debug("@@useAuthentication:onConnect", { wallet });
115
- try {
116
- setHasStartedConnecting(true);
117
- setIsConnected(true);
118
- setIsAuthenticating(true);
119
- await setActiveWallet(wallet);
120
- await authenticateUser(wallet);
94
+ useAutoConnectLoadingPrevious.current = useAutoConnectLoading;
95
+ }, [useAutoConnectLoading, hasStartedConnecting, setIsAuthenticating]);
96
+ // Ensure isAuthenticating stays true until we're fully ready
97
+ useEffect(() => {
98
+ if (useAutoConnectLoading) {
99
+ setIsConnecting(true);
121
100
  }
122
- catch (error) {
123
- debug("@@useAuthentication:onConnect:failed", { error });
124
- setIsAuthenticated(false);
125
- setUser(undefined);
101
+ else if (!isAuthenticated) {
102
+ // Only set isAuthenticating to false if we're not authenticated
103
+ // This prevents the flicker state where both isAuthenticating and isAuthenticated are false
104
+ const timeout = setTimeout(() => {
105
+ debug("setIsAuthenticating:false:5a");
106
+ setIsConnecting(false);
107
+ }, 100); // Add a small delay to prevent quick flickers
108
+ return () => clearTimeout(timeout);
126
109
  }
127
- finally {
128
- setIsAuthenticating(false);
110
+ else {
111
+ debug("setIsAuthenticating:false:5b");
112
+ setIsConnecting(false);
129
113
  }
130
- debug({
131
- isAuthenticated,
132
- isAuthenticating,
133
- isConnected,
134
- });
135
- }, [
136
- authenticateUser,
137
- isAuthenticated,
138
- isAuthenticating,
139
- isConnected,
140
- setActiveWallet,
141
- setHasStartedConnecting,
142
- setIsAuthenticated,
143
- setIsAuthenticating,
144
- setIsConnected,
145
- setUser,
146
- ]);
114
+ }, [useAutoConnectLoading, isAuthenticated, setIsConnecting, setIsConnected]);
147
115
  const logout = async (callback) => {
148
116
  if (activeWallet) {
149
117
  debug("@@logout:activeWallet", activeWallet);
@@ -169,21 +137,7 @@ export function useAuthentication(partnerId) {
169
137
  setUser();
170
138
  callback?.();
171
139
  };
172
- const { isLoading: useAutoConnectLoading } = useAutoConnect({
173
- client,
174
- wallets: [wallet],
175
- onConnect: onConnect,
176
- });
177
- /**
178
- * useAutoConnectLoading starts as false
179
- */
180
- useEffect(() => {
181
- if (!useAutoConnectLoading && useAutoConnectLoadingPrevious.current && !hasStartedConnecting) {
182
- setIsAuthenticating(false);
183
- }
184
- useAutoConnectLoadingPrevious.current = useAutoConnectLoading;
185
- }, [useAutoConnectLoading, hasStartedConnecting, setIsAuthenticating]);
186
- const isReady = isAuthenticated && !isAuthenticating;
140
+ const isReady = isAuthenticated && !useAutoConnectLoading && !isAuthenticating;
187
141
  return {
188
142
  logout,
189
143
  isAuthenticated,
@@ -192,11 +146,7 @@ export function useAuthentication(partnerId) {
192
146
  isConnected,
193
147
  wallet,
194
148
  preAuthenticate,
195
- connect: onConnect,
149
+ connect,
196
150
  isAuthenticating,
197
- onConnect,
198
- user,
199
- refetchUser: authenticateUser,
200
- setUser,
201
151
  };
202
152
  }
@@ -4,7 +4,7 @@ import { Account } from "thirdweb/wallets";
4
4
  * This essentially wraps our useConnect hook to handle the Privy auth flow.
5
5
  * Currently, this is for the basement-privy strategy
6
6
  */
7
- export declare function useHandleConnectWithPrivy(chain?: Chain, onSuccess?: (account: Account) => void): {
7
+ export declare function useHandleConnectWithPrivy(partnerId: string, chain?: Chain, onSuccess?: (account: Account) => void): {
8
8
  connectTw: () => Promise<import("thirdweb/wallets").Wallet | null | undefined>;
9
9
  isLoading: boolean;
10
10
  fullToken: string | null;
@@ -1,4 +1,4 @@
1
- import { useB3, useConnect } from "../../../global-account/react/index.js";
1
+ import { useConnect } from "../../../global-account/react/index.js";
2
2
  import { debugB3React } from "../../../shared/utils/debug.js";
3
3
  import { useIdentityToken, usePrivy } from "@privy-io/react-auth";
4
4
  import { useCallback, useRef, useState } from "react";
@@ -7,8 +7,7 @@ const debug = debugB3React("@@b3:useHandleConnectWithPrivy");
7
7
  * This essentially wraps our useConnect hook to handle the Privy auth flow.
8
8
  * Currently, this is for the basement-privy strategy
9
9
  */
10
- export function useHandleConnectWithPrivy(chain, onSuccess) {
11
- const { partnerId } = useB3();
10
+ export function useHandleConnectWithPrivy(partnerId, chain, onSuccess) {
12
11
  if (!chain) {
13
12
  throw new Error("Chain is required");
14
13
  }
@@ -32,6 +32,8 @@ export interface SignInWithB3ModalProps extends BaseModalProps {
32
32
  sessionKeyAddress?: Address;
33
33
  /** Unique identifier for the partner application */
34
34
  partnerId: string;
35
+ /** Whether to authenticate with Sign In With Ethereum */
36
+ loginWithSiwe?: boolean;
35
37
  /** Whether to close the modal after successful login */
36
38
  closeAfterLogin?: boolean;
37
39
  /** Source of the sign-in request */
@@ -19,12 +19,12 @@ export declare function B3Provider({ theme, children, accountOverride, environme
19
19
  };
20
20
  clientType?: ClientType;
21
21
  rpcUrls?: Record<number, string>;
22
- partnerId: string;
22
+ partnerId?: string;
23
23
  }): import("react/jsx-runtime").JSX.Element;
24
24
  /**
25
25
  * Inner provider component that provides the actual B3Context
26
26
  */
27
- export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, }: {
27
+ export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, }: {
28
28
  children: React.ReactNode;
29
29
  accountOverride?: Account;
30
30
  environment: B3ContextType["environment"];
@@ -32,5 +32,4 @@ export declare function InnerProvider({ children, accountOverride, environment,
32
32
  automaticallySetFirstEoa: boolean;
33
33
  theme: "light" | "dark";
34
34
  clientType?: ClientType;
35
- partnerId: string;
36
35
  }): import("react/jsx-runtime").JSX.Element;
@@ -5,25 +5,21 @@ import { B3ContextType } from "./types";
5
5
  /**
6
6
  * Main B3Provider component
7
7
  */
8
- export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, }: {
8
+ export declare function B3Provider({ theme, children, accountOverride, environment, clientType, }: {
9
9
  theme: "light" | "dark";
10
10
  children: React.ReactNode;
11
11
  accountOverride?: Account;
12
12
  environment: B3ContextType["environment"];
13
13
  clientType?: ClientType;
14
- partnerId: string;
15
- rpcUrls?: Record<number, string>;
16
14
  }): import("react/jsx-runtime").JSX.Element;
17
15
  /**
18
16
  * Inner provider component that provides the actual B3Context
19
17
  */
20
- export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme, clientType, partnerId, rpcUrls, }: {
18
+ export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme, clientType, }: {
21
19
  children: React.ReactNode;
22
20
  accountOverride?: Account;
23
21
  environment: B3ContextType["environment"];
24
22
  defaultPermissions?: PermissionsConfig;
25
23
  theme: "light" | "dark";
26
24
  clientType?: ClientType;
27
- partnerId: string;
28
- rpcUrls?: Record<number, string>;
29
25
  }): import("react/jsx-runtime").JSX.Element;
@@ -12,14 +12,12 @@ export interface B3ContextType {
12
12
  setWallet: (wallet: Wallet) => void;
13
13
  wallet?: Wallet;
14
14
  setUser: (user?: Users) => void;
15
- refetchUser: () => Promise<any>;
16
15
  initialized: boolean;
17
16
  ready: boolean;
18
17
  environment?: "development" | "production";
19
18
  defaultPermissions?: PermissionsConfig;
20
19
  theme: "light" | "dark";
21
20
  clientType: ClientType;
22
- partnerId: string;
23
21
  }
24
22
  /**
25
23
  * Context for B3 provider
@@ -1,7 +1,8 @@
1
1
  interface BalanceContentProps {
2
2
  onLogout?: () => void;
3
+ partnerId: string;
3
4
  showDeposit?: boolean;
4
5
  showSwap?: boolean;
5
6
  }
6
- export declare function BalanceContent({ onLogout, showDeposit, showSwap }: BalanceContentProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function BalanceContent({ onLogout, partnerId, showDeposit, showSwap }: BalanceContentProps): import("react/jsx-runtime").JSX.Element;
7
8
  export {};
@@ -3,4 +3,4 @@ import { SignInWithB3ModalProps } from "@b3dotfun/sdk/global-account/react";
3
3
  * Component that manages the authentication flow for Sign In With B3
4
4
  * Handles different login providers, authentication steps, and session key management
5
5
  */
6
- export declare function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin, source, signersEnabled, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
6
+ export declare function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin, loginWithSiwe, source, signersEnabled, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
@@ -4,7 +4,8 @@ interface SignInWithB3PrivyProps {
4
4
  onError?: (error: Error) => Promise<void>;
5
5
  onSuccess: (account: Account) => Promise<void>;
6
6
  accessToken?: string;
7
+ partnerId: string;
7
8
  chain: Chain;
8
9
  }
9
- export declare function SignInWithB3Privy({ onSuccess, onError, chain }: SignInWithB3PrivyProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function SignInWithB3Privy({ onSuccess, onError, partnerId, chain }: SignInWithB3PrivyProps): import("react/jsx-runtime").JSX.Element;
10
11
  export {};
@@ -9,6 +9,7 @@ interface LoginStepProps {
9
9
  /** Optional callback function called when an error occurs */
10
10
  onError?: (error: Error) => Promise<void>;
11
11
  /** Partner ID used for authentication */
12
+ partnerId: string;
12
13
  /** Blockchain chain information */
13
14
  chain: Chain;
14
15
  /** Optional authentication strategy options */
@@ -19,5 +20,5 @@ interface LoginStepContainerProps {
19
20
  partnerId?: string;
20
21
  }
21
22
  export declare function LoginStepContainer({ children, partnerId }: LoginStepContainerProps): import("react/jsx-runtime").JSX.Element;
22
- export declare function LoginStep({ onSuccess, chain }: LoginStepProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function LoginStep({ onSuccess, onError, partnerId, chain }: LoginStepProps): import("react/jsx-runtime").JSX.Element;
23
24
  export {};
@@ -5,9 +5,10 @@ interface LoginStepCustomProps {
5
5
  automaticallySetFirstEoa: boolean;
6
6
  onSuccess: (account: Account) => Promise<void>;
7
7
  onError?: (error: Error) => Promise<void>;
8
+ partnerId: string;
8
9
  chain: Chain;
9
10
  strategies: AllowedStrategy[];
10
11
  maxInitialWallets?: number;
11
12
  }
12
- export declare function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInitialWallets, automaticallySetFirstEoa, }: LoginStepCustomProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, maxInitialWallets, automaticallySetFirstEoa, }: LoginStepCustomProps): import("react/jsx-runtime").JSX.Element;
13
14
  export {};
@@ -1,6 +1,5 @@
1
- import { Wallet } from "thirdweb/wallets";
2
1
  import { preAuthenticate } from "thirdweb/wallets/in-app";
3
- export declare function useAuthentication(partnerId: string): {
2
+ export declare function useAuthentication(partnerId: string, loginWithSiwe?: boolean): {
4
3
  logout: (callback?: () => void) => Promise<void>;
5
4
  isAuthenticated: boolean;
6
5
  isReady: boolean;
@@ -8,54 +7,6 @@ export declare function useAuthentication(partnerId: string): {
8
7
  isConnected: boolean;
9
8
  wallet: import("thirdweb/dist/types/wallets/in-app/core/wallet/types").EcosystemWallet;
10
9
  preAuthenticate: typeof preAuthenticate;
11
- connect: (wallet: Wallet) => Promise<void>;
10
+ connect: (strategyOptions?: import("thirdweb/wallets").SingleStepAuthArgsType) => Promise<import("thirdweb/wallets").Wallet | null>;
12
11
  isAuthenticating: boolean;
13
- onConnect: (wallet: Wallet) => Promise<void>;
14
- user: {
15
- email?: string | undefined;
16
- username?: string | undefined;
17
- telNumber?: string | undefined;
18
- ens?: string | undefined;
19
- avatar?: string | undefined;
20
- preferences?: {} | undefined;
21
- referredBy?: string | {} | undefined;
22
- sourceApp?: string | undefined;
23
- referralCode?: string | undefined;
24
- userGroups?: number[] | undefined;
25
- isMigratedFromBSMNT?: boolean | undefined;
26
- privyLinkedAccounts?: {
27
- name?: string | undefined;
28
- address?: string | undefined;
29
- email?: string | undefined;
30
- chain_type?: string | undefined;
31
- lv?: number | undefined;
32
- wallet_client_type?: string | undefined;
33
- smart_wallet_type?: string | undefined;
34
- subject?: string | undefined;
35
- type: string;
36
- }[] | undefined;
37
- twProfiles?: {
38
- type: string;
39
- details: {
40
- id?: string | undefined;
41
- name?: string | undefined;
42
- address?: string | undefined;
43
- email?: string | undefined;
44
- phone?: string | undefined;
45
- username?: string | undefined;
46
- fid?: string | undefined;
47
- };
48
- }[] | undefined;
49
- _id: string | {};
50
- userId: string;
51
- smartAccountAddress: string;
52
- createdAt: number;
53
- updatedAt: number;
54
- partnerIds: {
55
- privyId?: string | undefined;
56
- thirdwebId?: string | undefined;
57
- };
58
- } | undefined;
59
- refetchUser: (wallet?: Wallet) => Promise<void>;
60
- setUser: (newUser?: import("@b3dotfun/b3-api").Users) => void;
61
12
  };
@@ -4,7 +4,7 @@ import { Account } from "thirdweb/wallets";
4
4
  * This essentially wraps our useConnect hook to handle the Privy auth flow.
5
5
  * Currently, this is for the basement-privy strategy
6
6
  */
7
- export declare function useHandleConnectWithPrivy(chain?: Chain, onSuccess?: (account: Account) => void): {
7
+ export declare function useHandleConnectWithPrivy(partnerId: string, chain?: Chain, onSuccess?: (account: Account) => void): {
8
8
  connectTw: () => Promise<import("thirdweb/wallets").Wallet | null | undefined>;
9
9
  isLoading: boolean;
10
10
  fullToken: string | null;
@@ -32,6 +32,8 @@ export interface SignInWithB3ModalProps extends BaseModalProps {
32
32
  sessionKeyAddress?: Address;
33
33
  /** Unique identifier for the partner application */
34
34
  partnerId: string;
35
+ /** Whether to authenticate with Sign In With Ethereum */
36
+ loginWithSiwe?: boolean;
35
37
  /** Whether to close the modal after successful login */
36
38
  closeAfterLogin?: boolean;
37
39
  /** Source of the sign-in request */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.47-test.4",
3
+ "version": "0.0.47",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -281,7 +281,7 @@
281
281
  "@solana/web3.js": "^1.98.2",
282
282
  "@stripe/react-stripe-js": "^3.7.0",
283
283
  "@stripe/stripe-js": "^7.3.1",
284
- "@thirdweb-dev/wagmi-adapter": "0.2.159",
284
+ "@thirdweb-dev/wagmi-adapter": "^0.2.141",
285
285
  "@web3icons/react": "3.16.0",
286
286
  "big.js": "^7.0.1",
287
287
  "class-variance-authority": "0.7.0",
@@ -354,7 +354,7 @@
354
354
  "react": "^18.0.0 || ^19.0.0",
355
355
  "react-dom": "^18.0.0 || ^19.0.0",
356
356
  "react-native-mmkv": "^3.2.0",
357
- "thirdweb": "5.108.9",
357
+ "thirdweb": "5.106.0",
358
358
  "three": "^0.175.0",
359
359
  "viem": "^2.28.1",
360
360
  "wagmi": "^2.14.15"