@b3dotfun/sdk 0.0.88-alpha.4 → 0.0.88-alpha.6

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 (166) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.js +1 -1
  2. package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +2 -2
  3. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +14 -1
  4. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +2 -2
  5. package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +3 -4
  6. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +1 -1
  7. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -1
  8. package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +1 -1
  9. package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +1 -1
  10. package/dist/cjs/global-account/react/components/B3DynamicModal.js +2 -3
  11. package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
  12. package/dist/cjs/global-account/react/components/B3Provider/AuthenticationProvider.js +12 -0
  13. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
  14. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +23 -57
  15. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
  16. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +38 -35
  17. package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +14 -4
  18. package/dist/cjs/global-account/react/components/B3Provider/useB3.js +4 -11
  19. package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +5 -2
  20. package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
  21. package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +18 -17
  22. package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +1 -2
  23. package/dist/cjs/global-account/react/components/ManageAccount/channels/DiscordChannel.js +6 -6
  24. package/dist/cjs/global-account/react/components/ManageAccount/channels/EmailChannel.js +7 -7
  25. package/dist/cjs/global-account/react/components/ManageAccount/channels/PhoneChannel.js +7 -7
  26. package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +5 -5
  27. package/dist/cjs/global-account/react/components/RequestPermissions/RequestPermissions.js +8 -9
  28. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
  29. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
  30. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
  31. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
  32. package/dist/cjs/global-account/react/components/StyleRoot.js +3 -3
  33. package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +1 -2
  34. package/dist/cjs/global-account/react/components/index.d.ts +1 -2
  35. package/dist/cjs/global-account/react/components/index.js +3 -6
  36. package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
  37. package/dist/cjs/global-account/react/hooks/index.js +3 -1
  38. package/dist/cjs/global-account/react/hooks/useAuth.js +1 -2
  39. package/dist/cjs/global-account/react/hooks/useClient.js +1 -1
  40. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +1 -1
  41. package/dist/cjs/global-account/react/hooks/useNotifications.js +14 -14
  42. package/dist/cjs/global-account/react/hooks/useTokenBalance.js +5 -5
  43. package/dist/cjs/global-account/react/hooks/useUser.d.ts +60 -0
  44. package/dist/cjs/global-account/react/hooks/useUser.js +20 -0
  45. package/dist/cjs/global-account/react/hooks/useUserQuery.js +9 -35
  46. package/dist/cjs/global-account/react/index.native.d.ts +0 -2
  47. package/dist/cjs/global-account/react/index.native.js +1 -5
  48. package/dist/cjs/global-account/react/stores/configStore.d.ts +24 -0
  49. package/dist/cjs/global-account/react/stores/configStore.js +30 -0
  50. package/dist/cjs/global-account/react/stores/index.d.ts +1 -0
  51. package/dist/cjs/global-account/react/stores/index.js +3 -1
  52. package/dist/cjs/global-account/react/stores/userStore.d.ts +22 -0
  53. package/dist/cjs/global-account/react/stores/userStore.js +30 -0
  54. package/dist/esm/anyspend/react/components/AnySpend.js +2 -2
  55. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +2 -2
  56. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +14 -1
  57. package/dist/esm/anyspend/react/components/common/OrderDetails.js +3 -3
  58. package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +3 -4
  59. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +2 -2
  60. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +2 -2
  61. package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +2 -2
  62. package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +2 -2
  63. package/dist/esm/global-account/react/components/B3DynamicModal.js +3 -4
  64. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
  65. package/dist/esm/global-account/react/components/B3Provider/AuthenticationProvider.js +10 -0
  66. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
  67. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +22 -58
  68. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
  69. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +36 -36
  70. package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +14 -4
  71. package/dist/esm/global-account/react/components/B3Provider/useB3.js +4 -11
  72. package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +5 -2
  73. package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
  74. package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +18 -17
  75. package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +2 -3
  76. package/dist/esm/global-account/react/components/ManageAccount/channels/DiscordChannel.js +2 -2
  77. package/dist/esm/global-account/react/components/ManageAccount/channels/EmailChannel.js +2 -2
  78. package/dist/esm/global-account/react/components/ManageAccount/channels/PhoneChannel.js +2 -2
  79. package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +2 -2
  80. package/dist/esm/global-account/react/components/RequestPermissions/RequestPermissions.js +2 -3
  81. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  82. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +2 -2
  83. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +2 -2
  84. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -2
  85. package/dist/esm/global-account/react/components/StyleRoot.js +3 -3
  86. package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +2 -3
  87. package/dist/esm/global-account/react/components/index.d.ts +1 -2
  88. package/dist/esm/global-account/react/components/index.js +1 -2
  89. package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
  90. package/dist/esm/global-account/react/hooks/index.js +1 -0
  91. package/dist/esm/global-account/react/hooks/useAuth.js +2 -3
  92. package/dist/esm/global-account/react/hooks/useClient.js +2 -2
  93. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -2
  94. package/dist/esm/global-account/react/hooks/useNotifications.js +2 -2
  95. package/dist/esm/global-account/react/hooks/useTokenBalance.js +6 -6
  96. package/dist/esm/global-account/react/hooks/useUser.d.ts +60 -0
  97. package/dist/esm/global-account/react/hooks/useUser.js +17 -0
  98. package/dist/esm/global-account/react/hooks/useUserQuery.js +1 -27
  99. package/dist/esm/global-account/react/index.native.d.ts +0 -2
  100. package/dist/esm/global-account/react/index.native.js +0 -2
  101. package/dist/esm/global-account/react/stores/configStore.d.ts +24 -0
  102. package/dist/esm/global-account/react/stores/configStore.js +27 -0
  103. package/dist/esm/global-account/react/stores/index.d.ts +1 -0
  104. package/dist/esm/global-account/react/stores/index.js +1 -0
  105. package/dist/esm/global-account/react/stores/userStore.d.ts +22 -0
  106. package/dist/esm/global-account/react/stores/userStore.js +27 -0
  107. package/dist/types/global-account/react/components/B3Provider/AuthenticationProvider.d.ts +5 -0
  108. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +2 -18
  109. package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +5 -5
  110. package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +14 -4
  111. package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +10 -2
  112. package/dist/types/global-account/react/components/index.d.ts +1 -2
  113. package/dist/types/global-account/react/hooks/index.d.ts +1 -0
  114. package/dist/types/global-account/react/hooks/useUser.d.ts +60 -0
  115. package/dist/types/global-account/react/index.native.d.ts +0 -2
  116. package/dist/types/global-account/react/stores/configStore.d.ts +24 -0
  117. package/dist/types/global-account/react/stores/index.d.ts +1 -0
  118. package/dist/types/global-account/react/stores/userStore.d.ts +22 -0
  119. package/package.json +1 -1
  120. package/src/anyspend/react/components/AnySpend.tsx +2 -2
  121. package/src/anyspend/react/components/AnySpendDeposit.tsx +3 -1
  122. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +15 -1
  123. package/src/anyspend/react/components/common/OrderDetails.tsx +8 -2
  124. package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +3 -4
  125. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +2 -2
  126. package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -2
  127. package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +2 -2
  128. package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +2 -2
  129. package/src/global-account/react/components/B3DynamicModal.tsx +3 -4
  130. package/src/global-account/react/components/B3Provider/AuthenticationProvider.tsx +19 -0
  131. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +43 -54
  132. package/src/global-account/react/components/B3Provider/B3Provider.tsx +32 -117
  133. package/src/global-account/react/components/B3Provider/useB3.ts +4 -13
  134. package/src/global-account/react/components/B3Provider/useB3Account.ts +6 -2
  135. package/src/global-account/react/components/B3Provider/useB3Config.ts +18 -31
  136. package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +2 -4
  137. package/src/global-account/react/components/ManageAccount/channels/DiscordChannel.tsx +2 -2
  138. package/src/global-account/react/components/ManageAccount/channels/EmailChannel.tsx +2 -2
  139. package/src/global-account/react/components/ManageAccount/channels/PhoneChannel.tsx +2 -2
  140. package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +2 -2
  141. package/src/global-account/react/components/RequestPermissions/RequestPermissions.tsx +4 -4
  142. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
  143. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +2 -2
  144. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +2 -2
  145. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
  146. package/src/global-account/react/components/StyleRoot.tsx +3 -3
  147. package/src/global-account/react/components/custom/ManageAccountButton.tsx +2 -3
  148. package/src/global-account/react/components/index.ts +1 -2
  149. package/src/global-account/react/hooks/index.ts +1 -0
  150. package/src/global-account/react/hooks/useAuth.ts +2 -3
  151. package/src/global-account/react/hooks/useClient.ts +2 -2
  152. package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +2 -2
  153. package/src/global-account/react/hooks/useNotifications.ts +2 -2
  154. package/src/global-account/react/hooks/useTokenBalance.tsx +8 -7
  155. package/src/global-account/react/hooks/useUser.ts +20 -0
  156. package/src/global-account/react/hooks/useUserQuery.ts +1 -40
  157. package/src/global-account/react/index.native.ts +0 -2
  158. package/src/global-account/react/stores/configStore.ts +51 -0
  159. package/src/global-account/react/stores/index.ts +1 -0
  160. package/src/global-account/react/stores/userStore.ts +41 -0
  161. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +0 -27
  162. package/dist/cjs/global-account/react/components/B3Provider/types.js +0 -24
  163. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +0 -27
  164. package/dist/esm/global-account/react/components/B3Provider/types.js +0 -21
  165. package/dist/types/global-account/react/components/B3Provider/types.d.ts +0 -27
  166. package/src/global-account/react/components/B3Provider/types.ts +0 -50
@@ -1,10 +1,9 @@
1
1
  import {
2
2
  useAccountWallet,
3
- useAuthentication,
4
- useB3Config,
5
3
  useModalStore,
6
4
  useProfile,
7
5
  useSimBalance,
6
+ useUser,
8
7
  } from "@b3dotfun/sdk/global-account/react";
9
8
  import { formatUsername } from "@b3dotfun/sdk/shared/utils";
10
9
  import { formatDisplayNumber } from "@b3dotfun/sdk/shared/utils/number";
@@ -22,8 +21,7 @@ const ProfileSection = () => {
22
21
  address: eoaAddress || account?.address,
23
22
  fresh: true,
24
23
  });
25
- const { partnerId } = useB3Config();
26
- const { user } = useAuthentication(partnerId);
24
+ const { user } = useUser();
27
25
  const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
28
26
  const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
29
27
  const navigateBack = useModalStore(state => state.navigateBack);
@@ -1,7 +1,7 @@
1
+ import { useB3Config } from "@b3dotfun/sdk/global-account/react";
1
2
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
2
3
  import { useState } from "react";
3
4
  import { notificationsAPI } from "../../../utils/notificationsAPI";
4
- import { useB3 } from "../../B3Provider/useB3";
5
5
  import { toast } from "../../Toast/toastApi";
6
6
  import { NotificationChannel } from "../NotificationChannel";
7
7
 
@@ -26,7 +26,7 @@ export const DiscordChannel = ({
26
26
  onConnectionChange,
27
27
  onToggle,
28
28
  }: DiscordChannelProps) => {
29
- const { partnerId } = useB3();
29
+ const { partnerId } = useB3Config();
30
30
 
31
31
  const [discordId, setDiscordId] = useState("");
32
32
  const [isConnecting, setIsConnecting] = useState(false);
@@ -1,7 +1,7 @@
1
+ import { useB3Config } from "@b3dotfun/sdk/global-account/react";
1
2
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
2
3
  import { useState } from "react";
3
4
  import { notificationsAPI } from "../../../utils/notificationsAPI";
4
- import { useB3 } from "../../B3Provider/useB3";
5
5
  import { toast } from "../../Toast/toastApi";
6
6
  import { NotificationChannel } from "../NotificationChannel";
7
7
 
@@ -31,7 +31,7 @@ export const EmailChannel = ({
31
31
  onConnectionChange,
32
32
  onToggle,
33
33
  }: EmailChannelProps) => {
34
- const { partnerId } = useB3();
34
+ const { partnerId } = useB3Config();
35
35
 
36
36
  const [email, setEmail] = useState("");
37
37
  const [emailError, setEmailError] = useState<string | null>(null);
@@ -1,7 +1,7 @@
1
+ import { useB3Config } from "@b3dotfun/sdk/global-account/react";
1
2
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
2
3
  import { useState } from "react";
3
4
  import { notificationsAPI } from "../../../utils/notificationsAPI";
4
- import { useB3 } from "../../B3Provider/useB3";
5
5
  import { toast } from "../../Toast/toastApi";
6
6
  import { NotificationChannel } from "../NotificationChannel";
7
7
 
@@ -32,7 +32,7 @@ export const PhoneChannel = ({
32
32
  onConnectionChange,
33
33
  onToggle,
34
34
  }: PhoneChannelProps) => {
35
- const { partnerId } = useB3();
35
+ const { partnerId } = useB3Config();
36
36
 
37
37
  const [phoneNumber, setPhoneNumber] = useState("");
38
38
  const [isConnectingSMS, setIsConnectingSMS] = useState(false);
@@ -1,7 +1,7 @@
1
+ import { useB3Config } from "@b3dotfun/sdk/global-account/react";
1
2
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
2
3
  import { useState } from "react";
3
4
  import { notificationsAPI } from "../../../utils/notificationsAPI";
4
- import { useB3 } from "../../B3Provider/useB3";
5
5
  import { toast } from "../../Toast/toastApi";
6
6
  import { NotificationChannel } from "../NotificationChannel";
7
7
 
@@ -26,7 +26,7 @@ export const TelegramChannel = ({
26
26
  onConnectionChange,
27
27
  onToggle,
28
28
  }: TelegramChannelProps) => {
29
- const { partnerId } = useB3();
29
+ const { partnerId } = useB3Config();
30
30
 
31
31
  const [isConnecting, setIsConnecting] = useState(false);
32
32
  const [status, setStatus] = useState<"idle" | "pending" | "connected">("idle");
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  Button,
3
- useB3,
3
+ PermissionItem,
4
+ RequestPermissionsModalProps,
4
5
  useAddTWSessionKey,
6
+ useB3Config,
5
7
  useGetAllTWSigners,
6
- RequestPermissionsModalProps,
7
8
  } from "@b3dotfun/sdk/global-account/react";
8
- import { PermissionItem } from "@b3dotfun/sdk/global-account/react";
9
9
  import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
10
10
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
11
11
  import { formatAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
@@ -30,7 +30,7 @@ export function RequestPermissions({
30
30
  }: RequestPermissionsModalProps) {
31
31
  const [isApproving, setIsApproving] = useState(false);
32
32
  const account = useActiveAccount();
33
- const { defaultPermissions } = useB3();
33
+ const { defaultPermissions } = useB3Config();
34
34
  const DEFAULT_PERMISSIONS = useMemo(
35
35
  () => permissions ?? (defaultPermissions as PermissionsConfig),
36
36
  [defaultPermissions, permissions],
@@ -5,7 +5,7 @@ import {
5
5
  StyleRoot,
6
6
  useAccountWallet,
7
7
  useAuthentication,
8
- useB3,
8
+ useB3Config,
9
9
  useIsMobile,
10
10
  } from "@b3dotfun/sdk/global-account/react";
11
11
  import Icon from "@b3dotfun/sdk/global-account/react/components/custom/Icon";
@@ -30,7 +30,7 @@ type SignInWithB3Props = Omit<SignInWithB3ModalProps, "type" | "showBackButton">
30
30
 
31
31
  export function SignIn(props: SignInWithB3Props) {
32
32
  const { className } = props;
33
- const { automaticallySetFirstEoa, partnerId } = useB3();
33
+ const { automaticallySetFirstEoa, partnerId } = useB3Config();
34
34
  const {
35
35
  address: globalAddress,
36
36
  ensName,
@@ -2,7 +2,7 @@ import {
2
2
  Loading,
3
3
  useAuthentication,
4
4
  useAuthStore,
5
- useB3,
5
+ useB3Config,
6
6
  useHandleConnectWithPrivy,
7
7
  } from "@b3dotfun/sdk/global-account/react";
8
8
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
@@ -19,7 +19,7 @@ interface SignInWithB3PrivyProps {
19
19
  }
20
20
 
21
21
  export function SignInWithB3Privy({ onSuccess, onError, chain }: SignInWithB3PrivyProps) {
22
- const { partnerId } = useB3();
22
+ const { partnerId } = useB3Config();
23
23
  const { isLoading, connectTw, fullToken } = useHandleConnectWithPrivy(chain, onSuccess);
24
24
  const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
25
25
  const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
@@ -1,4 +1,4 @@
1
- import { useAuthentication, useB3, useQueryB3 } from "@b3dotfun/sdk/global-account/react";
1
+ import { useAuthentication, useB3Config, useQueryB3 } from "@b3dotfun/sdk/global-account/react";
2
2
  import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
3
3
  import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
4
4
  import { Chain } from "thirdweb";
@@ -50,7 +50,7 @@ export function LoginStepContainer({ children, partnerId }: LoginStepContainerPr
50
50
  }
51
51
 
52
52
  export function LoginStep({ onSuccess, chain }: LoginStepProps) {
53
- const { partnerId, theme } = useB3();
53
+ const { partnerId, theme } = useB3Config();
54
54
  const wallet = ecosystemWallet(ecosystemWalletId, {
55
55
  partnerId: partnerId,
56
56
  });
@@ -7,7 +7,7 @@ import {
7
7
  LoginStepContainer,
8
8
  useAuthentication,
9
9
  useAuthStore,
10
- useB3,
10
+ useB3Config,
11
11
  useConnect,
12
12
  WalletRow,
13
13
  } from "@b3dotfun/sdk/global-account/react";
@@ -37,7 +37,7 @@ export function LoginStepCustom({
37
37
  maxInitialWallets = 2,
38
38
  automaticallySetFirstEoa,
39
39
  }: LoginStepCustomProps) {
40
- const { partnerId } = useB3();
40
+ const { partnerId } = useB3Config();
41
41
  const [isLoading, setIsLoading] = useState(false);
42
42
  const [showAllWallets, setShowAllWallets] = useState(false);
43
43
  const { connect } = useConnect(partnerId, chain);
@@ -1,11 +1,11 @@
1
1
  import { PropsWithChildren } from "react";
2
- import { useB3 } from "./B3Provider/useB3";
2
+ import { useB3Config } from "./B3Provider/useB3Config";
3
3
 
4
4
  export function StyleRoot({ children, id }: PropsWithChildren<{ id?: string }>) {
5
- const { theme: b3Theme } = useB3();
5
+ const { theme } = useB3Config();
6
6
 
7
7
  return (
8
- <div className="b3-root" id={id} data-theme={b3Theme}>
8
+ <div className="b3-root" id={id} data-theme={theme}>
9
9
  {children}
10
10
  </div>
11
11
  );
@@ -1,11 +1,10 @@
1
- import { Button, StyleRoot, useAuthentication, useB3, useModalStore } from "@b3dotfun/sdk/global-account/react";
1
+ import { Button, StyleRoot, useModalStore, useUser } from "@b3dotfun/sdk/global-account/react";
2
2
  import { cn } from "@b3dotfun/sdk/shared/utils";
3
3
  import { SignInWithB3Props } from "../SignInWithB3/SignInWithB3";
4
4
 
5
5
  export function ManageAccountButton(props: SignInWithB3Props & { className?: string }) {
6
- const { partnerId } = useB3();
7
6
  const { setB3ModalOpen, setB3ModalContentType } = useModalStore();
8
- const { isConnected } = useAuthentication(partnerId);
7
+ const { isConnected } = useUser();
9
8
 
10
9
  const handleClickManageAccount = () => {
11
10
  setB3ModalContentType({
@@ -1,9 +1,8 @@
1
1
  // TODO woj: Barrel file for all components, this might be reason of bundle size issues
2
2
  // Core Components
3
3
  export { B3DynamicModal } from "./B3DynamicModal";
4
- export { B3Provider, InnerProvider } from "./B3Provider/B3Provider";
4
+ export { B3Provider } from "./B3Provider/B3Provider";
5
5
  export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
6
- export { B3Context, type B3ContextType } from "./B3Provider/types";
7
6
  export { useB3 } from "./B3Provider/useB3";
8
7
  export { useB3Account } from "./B3Provider/useB3Account";
9
8
  export { useB3Config } from "./B3Provider/useB3Config";
@@ -52,3 +52,4 @@ export { useTokensFromAddress } from "./useTokensFromAddress";
52
52
  export { useTurnkeyAuth } from "./useTurnkeyAuth";
53
53
  export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute";
54
54
  export { useURLParams } from "./useURLParams";
55
+ export { useUser } from "./useUser";
@@ -1,6 +1,6 @@
1
1
  import app from "@b3dotfun/sdk/global-account/app";
2
2
  import { authenticateWithB3JWT } from "@b3dotfun/sdk/global-account/bsmnt";
3
- import { useAuthStore } from "@b3dotfun/sdk/global-account/react";
3
+ import { useAuthStore, useB3Config } from "@b3dotfun/sdk/global-account/react";
4
4
  import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
5
5
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
6
6
  import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
@@ -18,7 +18,6 @@ import { Wallet, ecosystemWallet } from "thirdweb/wallets";
18
18
  import { preAuthenticate } from "thirdweb/wallets/in-app";
19
19
  import { useAccount, useConnect, useSwitchAccount } from "wagmi";
20
20
  import { LocalSDKContext } from "../components/B3Provider/LocalSDKProvider";
21
- import { useB3 } from "../components/B3Provider/useB3";
22
21
  import { createWagmiConfig } from "../utils/createWagmiConfig";
23
22
  import { useSearchParam } from "./useSearchParamsSSR";
24
23
  import { useUserQuery } from "./useUserQuery";
@@ -48,7 +47,7 @@ export function useAuth() {
48
47
  const hasStartedConnecting = useAuthStore(state => state.hasStartedConnecting);
49
48
  const useAutoConnectLoadingPrevious = useRef(false);
50
49
  const referralCode = useSearchParam("referralCode");
51
- const { partnerId } = useB3();
50
+ const { partnerId } = useB3Config();
52
51
  const wagmiConfig = createWagmiConfig({ partnerId });
53
52
  const { connect } = useConnect();
54
53
  const activeWagmiAccount = useAccount();
@@ -1,4 +1,4 @@
1
- import { useB3 } from "@b3dotfun/sdk/global-account/react";
1
+ import { useB3Config } from "@b3dotfun/sdk/global-account/react";
2
2
  import { useCallback } from "react";
3
3
  import {
4
4
  ClientType,
@@ -13,7 +13,7 @@ import {
13
13
  * Hook to access the current FeathersJS client and client management utilities
14
14
  */
15
15
  export function useClient() {
16
- const { clientType } = useB3();
16
+ const { clientType } = useB3Config();
17
17
 
18
18
  const getCurrentClient = useCallback(() => {
19
19
  return getClient();
@@ -1,4 +1,4 @@
1
- import { useB3, useConnect } from "@b3dotfun/sdk/global-account/react";
1
+ import { useB3Config, useConnect } from "@b3dotfun/sdk/global-account/react";
2
2
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
3
3
  import { useIdentityToken, usePrivy } from "@privy-io/react-auth";
4
4
  import { useCallback, useRef, useState } from "react";
@@ -11,7 +11,7 @@ const debug = debugB3React("@@b3:useHandleConnectWithPrivy");
11
11
  * Currently, this is for the basement-privy strategy
12
12
  */
13
13
  export function useHandleConnectWithPrivy(chain?: Chain, onSuccess?: (account: Account) => void) {
14
- const { partnerId } = useB3();
14
+ const { partnerId } = useB3Config();
15
15
  if (!chain) {
16
16
  throw new Error("Chain is required");
17
17
  }
@@ -1,7 +1,7 @@
1
+ import { useB3Config } from "@b3dotfun/sdk/global-account/react";
1
2
  import { getAuthToken } from "@b3dotfun/sdk/shared/utils/auth-token";
2
3
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
3
4
  import { useCallback, useEffect, useState } from "react";
4
- import { useB3 } from "../components";
5
5
  import { notificationsAPI, UserData } from "../utils/notificationsAPI";
6
6
  import { useUserQuery } from "./useUserQuery";
7
7
 
@@ -56,7 +56,7 @@ export interface UseNotificationsReturn {
56
56
  */
57
57
  export function useNotifications(): UseNotificationsReturn {
58
58
  const { user } = useUserQuery();
59
- const { partnerId } = useB3();
59
+ const { partnerId } = useB3Config();
60
60
  const [userData, setUserData] = useState<UserData | null>(null);
61
61
  const [loading, setLoading] = useState(true);
62
62
  const [error, setError] = useState<string | null>(null);
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
 
3
3
  import { isNativeToken } from "@b3dotfun/sdk/anyspend";
4
- import { useB3, useAccountWallet } from "@b3dotfun/sdk/global-account/react";
4
+ import { components } from "@b3dotfun/sdk/anyspend/types/api";
5
+ import { useAccountWallet, useAuthStore } from "@b3dotfun/sdk/global-account/react";
5
6
  import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
6
7
  import { getERC20Balances, getNativeTokenBalance } from "@b3dotfun/sdk/shared/utils/thirdweb-insights";
7
8
  import { useQuery } from "@tanstack/react-query";
8
9
  import { useEffect } from "react";
9
- import { components } from "@b3dotfun/sdk/anyspend/types/api";
10
10
 
11
11
  interface UseTokenBalanceProps {
12
12
  token: components["schemas"]["Token"];
@@ -20,7 +20,8 @@ export interface TokenBalanceResult {
20
20
  }
21
21
 
22
22
  export function useTokenBalance({ token, address }: UseTokenBalanceProps): TokenBalanceResult {
23
- const { ready } = useB3();
23
+ const isAuthenticated = useAuthStore(state => state.isAuthenticated);
24
+
24
25
  const account = useAccountWallet();
25
26
 
26
27
  const effectiveAddress = address || account?.address;
@@ -60,7 +61,7 @@ export function useTokenBalance({ token, address }: UseTokenBalanceProps): Token
60
61
  }
61
62
  return { formatted: "0", raw: null };
62
63
  },
63
- enabled: ready && !!effectiveAddress,
64
+ enabled: isAuthenticated && !!effectiveAddress,
64
65
  staleTime: 30000,
65
66
  gcTime: 5 * 60 * 1000,
66
67
  retry: 2,
@@ -69,13 +70,13 @@ export function useTokenBalance({ token, address }: UseTokenBalanceProps): Token
69
70
 
70
71
  // Force a refetch when the wallet or token changes
71
72
  useEffect(() => {
72
- if (ready && effectiveAddress) {
73
+ if (isAuthenticated && effectiveAddress) {
73
74
  refetch();
74
75
  }
75
- }, [ready, effectiveAddress, token.address, token.chainId, token.symbol, refetch]);
76
+ }, [isAuthenticated, effectiveAddress, token.address, token.chainId, token.symbol, refetch]);
76
77
 
77
78
  // Determine if we're actually loading
78
- const isActuallyLoading = !ready || !effectiveAddress || isLoading || (isFetching && !tokenBalance);
79
+ const isActuallyLoading = !isAuthenticated || !effectiveAddress || isLoading || (isFetching && !tokenBalance);
79
80
 
80
81
  return {
81
82
  rawBalance: tokenBalance?.raw || BigInt(0),
@@ -0,0 +1,20 @@
1
+ import { useAuthStore } from "@b3dotfun/sdk/global-account/react";
2
+ import { useUserStore } from "../stores/userStore";
3
+
4
+ /**
5
+ * Preferred Hook to get the user data
6
+ */
7
+ export function useUser() {
8
+ const user = useUserStore(state => state.user);
9
+
10
+ const isConnecting = useAuthStore(state => state.isConnecting);
11
+ const isConnected = useAuthStore(state => state.isConnected);
12
+ const isAuthenticating = useAuthStore(state => state.isAuthenticating);
13
+
14
+ return {
15
+ user,
16
+ isConnecting,
17
+ isConnected,
18
+ isAuthenticating,
19
+ };
20
+ }
@@ -1,48 +1,9 @@
1
1
  import { Users } from "@b3dotfun/b3-api";
2
- import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
3
2
  import { useEffect } from "react";
4
- import { create } from "zustand";
5
- import { persist } from "zustand/middleware";
6
-
7
- const debug = debugB3React("useUserQuery");
3
+ import { useUserStore } from "../stores/userStore";
8
4
 
9
5
  const USER_QUERY_KEY = ["b3-user"];
10
6
 
11
- interface UserStore {
12
- user: Users | null;
13
- setUser: (user: Users | undefined) => void;
14
- clearUser: () => void;
15
- }
16
-
17
- /**
18
- * Zustand store for managing user state
19
- * Persists user data to localStorage
20
- */
21
- const useUserStore = create<UserStore>()(
22
- persist(
23
- set => ({
24
- user: null,
25
- setUser: (newUser: Users | undefined) => {
26
- const userToSave = newUser ?? null;
27
- set({ user: userToSave });
28
- debug("User updated", userToSave);
29
- },
30
- clearUser: () => {
31
- set({ user: null });
32
- debug("User cleared");
33
- },
34
- }),
35
- {
36
- name: "b3-user",
37
- onRehydrateStorage: () => (_, error) => {
38
- if (error) {
39
- console.warn("Failed to rehydrate user store:", error);
40
- }
41
- },
42
- },
43
- ),
44
- );
45
-
46
7
  /**
47
8
  * NOTE: THIS IS ONLY MEANT FOR INTERNAL USE, from useOnConnect
48
9
  *
@@ -6,8 +6,6 @@
6
6
 
7
7
  export { B3Provider } from "./components/B3Provider/B3Provider.native";
8
8
 
9
- export { B3Context, type B3ContextType } from "./components/B3Provider/types";
10
- export { useB3 } from "./components/B3Provider/useB3";
11
9
  export { useAccountWallet } from "./hooks/useAccountWallet";
12
10
  export { useAuthentication } from "./hooks/useAuthentication";
13
11
  export { useProfile } from "./hooks/useProfile";
@@ -0,0 +1,51 @@
1
+ import { CreateOnrampOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOnrampOrder";
2
+ import { CreateOrderParams } from "@b3dotfun/sdk/anyspend/react/hooks/useAnyspendCreateOrder";
3
+ import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
4
+ import { Account } from "thirdweb/wallets";
5
+ import { create } from "zustand";
6
+ import { ClientType } from "../../client-manager";
7
+
8
+ /**
9
+ * Default permissions configuration for B3 provider
10
+ */
11
+ const DEFAULT_PERMISSIONS: PermissionsConfig = {
12
+ approvedTargets: ["0xa8e42121e318e3D3BeD7f5969AF6D360045317DD"],
13
+ nativeTokenLimitPerTransaction: 0.1,
14
+ startDate: new Date(),
15
+ endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
16
+ };
17
+
18
+ interface ConfigStore {
19
+ accountOverride?: Account;
20
+ automaticallySetFirstEoa: boolean;
21
+ environment: "development" | "production";
22
+ defaultPermissions: PermissionsConfig;
23
+ theme: "light" | "dark";
24
+ clientType: ClientType;
25
+ partnerId: string;
26
+ stripePublishableKey?: string;
27
+ createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
28
+ enableTurnkey: boolean;
29
+
30
+ // Actions
31
+ setConfig: (config: Partial<Omit<ConfigStore, "setConfig">>) => void;
32
+ }
33
+
34
+ /**
35
+ * Zustand store for B3 configuration
36
+ * NOT persisted - these are developer-set configuration values
37
+ */
38
+ export const useB3ConfigStore = create<ConfigStore>(set => ({
39
+ accountOverride: undefined,
40
+ automaticallySetFirstEoa: false,
41
+ environment: "development",
42
+ defaultPermissions: DEFAULT_PERMISSIONS,
43
+ theme: "light",
44
+ clientType: "rest",
45
+ partnerId: "",
46
+ stripePublishableKey: undefined,
47
+ createClientReferenceId: undefined,
48
+ enableTurnkey: false,
49
+
50
+ setConfig: config => set(state => ({ ...state, ...config })),
51
+ }));
@@ -1,4 +1,5 @@
1
1
  export { useAuthStore } from "./useAuthStore";
2
+ export { useB3ConfigStore } from "./configStore";
2
3
  export { useModalStore } from "./useModalStore";
3
4
  export { useRecentAddressesStore } from "./useRecentAddressesStore";
4
5
 
@@ -0,0 +1,41 @@
1
+ import { Users } from "@b3dotfun/b3-api";
2
+ import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
3
+ import { create } from "zustand";
4
+ import { persist } from "zustand/middleware";
5
+
6
+ const debug = debugB3React("useUserQuery");
7
+
8
+ interface UserStore {
9
+ user: Users | null;
10
+ setUser: (user: Users | undefined) => void;
11
+ clearUser: () => void;
12
+ }
13
+
14
+ /**
15
+ * Zustand store for managing user state
16
+ * Persists user data to localStorage
17
+ */
18
+ export const useUserStore = create<UserStore>()(
19
+ persist(
20
+ set => ({
21
+ user: null,
22
+ setUser: (newUser: Users | undefined) => {
23
+ const userToSave = newUser ?? null;
24
+ set({ user: userToSave });
25
+ debug("User updated", userToSave);
26
+ },
27
+ clearUser: () => {
28
+ set({ user: null });
29
+ debug("User cleared");
30
+ },
31
+ }),
32
+ {
33
+ name: "b3-user",
34
+ onRehydrateStorage: () => (_, error) => {
35
+ if (error) {
36
+ console.warn("Failed to rehydrate user store:", error);
37
+ }
38
+ },
39
+ },
40
+ ),
41
+ );
@@ -1,27 +0,0 @@
1
- import { CreateOnrampOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOnrampOrder";
2
- import { CreateOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOrder";
3
- import { PermissionsConfig } from "../../../../global-account/types/permissions";
4
- import { Account, Wallet } from "thirdweb/wallets";
5
- import { ClientType } from "../../../client-manager";
6
- /**
7
- * Context type for B3Provider
8
- */
9
- export interface B3ContextType {
10
- account?: Account;
11
- automaticallySetFirstEoa: boolean;
12
- wallet?: Wallet;
13
- initialized: boolean;
14
- ready: boolean;
15
- environment?: "development" | "production";
16
- defaultPermissions?: PermissionsConfig;
17
- theme: "light" | "dark";
18
- clientType: ClientType;
19
- partnerId: string;
20
- stripePublishableKey?: string;
21
- createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
22
- enableTurnkey?: boolean;
23
- }
24
- /**
25
- * Context for B3 provider
26
- */
27
- export declare const B3Context: import("react").Context<B3ContextType>;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.B3Context = void 0;
4
- const react_1 = require("react");
5
- /**
6
- * Context for B3 provider
7
- */
8
- exports.B3Context = (0, react_1.createContext)({
9
- account: undefined,
10
- automaticallySetFirstEoa: false,
11
- //user: undefined,
12
- //setWallet: () => {},
13
- wallet: undefined,
14
- //setUser: () => {},
15
- //refetchUser: async () => {},
16
- initialized: false,
17
- ready: false,
18
- environment: "development",
19
- theme: "light",
20
- clientType: "rest",
21
- partnerId: "",
22
- createClientReferenceId: undefined,
23
- enableTurnkey: false,
24
- });
@@ -1,27 +0,0 @@
1
- import { CreateOnrampOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOnrampOrder";
2
- import { CreateOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOrder";
3
- import { PermissionsConfig } from "../../../../global-account/types/permissions";
4
- import { Account, Wallet } from "thirdweb/wallets";
5
- import { ClientType } from "../../../client-manager";
6
- /**
7
- * Context type for B3Provider
8
- */
9
- export interface B3ContextType {
10
- account?: Account;
11
- automaticallySetFirstEoa: boolean;
12
- wallet?: Wallet;
13
- initialized: boolean;
14
- ready: boolean;
15
- environment?: "development" | "production";
16
- defaultPermissions?: PermissionsConfig;
17
- theme: "light" | "dark";
18
- clientType: ClientType;
19
- partnerId: string;
20
- stripePublishableKey?: string;
21
- createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
22
- enableTurnkey?: boolean;
23
- }
24
- /**
25
- * Context for B3 provider
26
- */
27
- export declare const B3Context: import("react").Context<B3ContextType>;
@@ -1,21 +0,0 @@
1
- import { createContext } from "react";
2
- /**
3
- * Context for B3 provider
4
- */
5
- export const B3Context = createContext({
6
- account: undefined,
7
- automaticallySetFirstEoa: false,
8
- //user: undefined,
9
- //setWallet: () => {},
10
- wallet: undefined,
11
- //setUser: () => {},
12
- //refetchUser: async () => {},
13
- initialized: false,
14
- ready: false,
15
- environment: "development",
16
- theme: "light",
17
- clientType: "rest",
18
- partnerId: "",
19
- createClientReferenceId: undefined,
20
- enableTurnkey: false,
21
- });