@b3dotfun/sdk 0.0.47 → 0.0.48-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/README.md +225 -6
  2. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +5 -3
  3. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +3 -2
  4. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +15 -64
  5. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -2
  6. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +26 -21
  7. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +2 -0
  8. package/dist/cjs/global-account/react/components/B3Provider/types.js +2 -0
  9. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.d.ts +1 -2
  10. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  11. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
  12. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  13. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.js +1 -1
  14. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  15. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +6 -22
  16. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +1 -2
  17. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +3 -2
  18. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -2
  19. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +10 -45
  20. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +1 -2
  21. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -1
  22. package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +2 -1
  23. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +51 -2
  24. package/dist/cjs/global-account/react/hooks/useAuthentication.js +141 -81
  25. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  26. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -1
  27. package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +58 -0
  28. package/dist/cjs/global-account/react/hooks/useUserQuery.js +86 -0
  29. package/dist/cjs/global-account/react/hooks/useWagmiConfig.d.ts +13 -0
  30. package/dist/cjs/global-account/react/hooks/useWagmiConfig.js +42 -0
  31. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -2
  32. package/dist/cjs/notifications/index.d.ts +3 -0
  33. package/dist/cjs/notifications/index.js +25 -0
  34. package/dist/cjs/notifications/react/hooks/index.d.ts +1 -0
  35. package/dist/cjs/notifications/react/hooks/index.js +17 -0
  36. package/dist/cjs/notifications/react/hooks/useNotifications.d.ts +42 -0
  37. package/dist/cjs/notifications/react/hooks/useNotifications.js +148 -0
  38. package/dist/cjs/notifications/react/index.d.ts +1 -0
  39. package/dist/cjs/notifications/react/index.js +17 -0
  40. package/dist/cjs/notifications/services/api.d.ts +67 -0
  41. package/dist/cjs/notifications/services/api.js +184 -0
  42. package/dist/cjs/notifications/services/index.d.ts +1 -0
  43. package/dist/cjs/notifications/services/index.js +17 -0
  44. package/dist/cjs/notifications/types/index.d.ts +51 -0
  45. package/dist/cjs/notifications/types/index.js +2 -0
  46. package/dist/cjs/shared/utils/auth-token.d.ts +7 -0
  47. package/dist/cjs/shared/utils/auth-token.js +17 -0
  48. package/dist/cjs/shared/utils/index.d.ts +1 -0
  49. package/dist/cjs/shared/utils/index.js +1 -0
  50. package/dist/esm/anyspend/react/components/AnySpendCustom.js +5 -3
  51. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +3 -2
  52. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +19 -68
  53. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -2
  54. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +24 -19
  55. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +2 -0
  56. package/dist/esm/global-account/react/components/B3Provider/types.js +2 -0
  57. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +1 -2
  58. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  59. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
  60. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  61. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +2 -2
  62. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  63. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +7 -23
  64. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +1 -2
  65. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +4 -3
  66. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -2
  67. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +11 -46
  68. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +1 -2
  69. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +3 -2
  70. package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +3 -2
  71. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +51 -2
  72. package/dist/esm/global-account/react/hooks/useAuthentication.js +144 -84
  73. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  74. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +3 -2
  75. package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +58 -0
  76. package/dist/esm/global-account/react/hooks/useUserQuery.js +83 -0
  77. package/dist/esm/global-account/react/hooks/useWagmiConfig.d.ts +13 -0
  78. package/dist/esm/global-account/react/hooks/useWagmiConfig.js +39 -0
  79. package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -2
  80. package/dist/esm/notifications/index.d.ts +3 -0
  81. package/dist/esm/notifications/index.js +7 -0
  82. package/dist/esm/notifications/react/hooks/index.d.ts +1 -0
  83. package/dist/esm/notifications/react/hooks/index.js +1 -0
  84. package/dist/esm/notifications/react/hooks/useNotifications.d.ts +42 -0
  85. package/dist/esm/notifications/react/hooks/useNotifications.js +145 -0
  86. package/dist/esm/notifications/react/index.d.ts +1 -0
  87. package/dist/esm/notifications/react/index.js +1 -0
  88. package/dist/esm/notifications/services/api.d.ts +67 -0
  89. package/dist/esm/notifications/services/api.js +179 -0
  90. package/dist/esm/notifications/services/index.d.ts +1 -0
  91. package/dist/esm/notifications/services/index.js +1 -0
  92. package/dist/esm/notifications/types/index.d.ts +51 -0
  93. package/dist/esm/shared/utils/auth-token.d.ts +7 -0
  94. package/dist/esm/shared/utils/auth-token.js +11 -0
  95. package/dist/esm/shared/utils/index.d.ts +1 -0
  96. package/dist/esm/shared/utils/index.js +1 -0
  97. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +3 -2
  98. package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -2
  99. package/dist/types/global-account/react/components/B3Provider/types.d.ts +2 -0
  100. package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +1 -2
  101. package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  102. package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +1 -2
  103. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -2
  104. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +1 -2
  105. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +51 -2
  106. package/dist/types/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  107. package/dist/types/global-account/react/hooks/useUserQuery.d.ts +58 -0
  108. package/dist/types/global-account/react/hooks/useWagmiConfig.d.ts +13 -0
  109. package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -2
  110. package/dist/types/notifications/index.d.ts +3 -0
  111. package/dist/types/notifications/react/hooks/index.d.ts +1 -0
  112. package/dist/types/notifications/react/hooks/useNotifications.d.ts +42 -0
  113. package/dist/types/notifications/react/index.d.ts +1 -0
  114. package/dist/types/notifications/services/api.d.ts +67 -0
  115. package/dist/types/notifications/services/index.d.ts +1 -0
  116. package/dist/types/notifications/types/index.d.ts +51 -0
  117. package/dist/types/shared/utils/auth-token.d.ts +7 -0
  118. package/dist/types/shared/utils/index.d.ts +1 -0
  119. package/package.json +23 -3
  120. package/src/anyspend/react/components/AnySpendCustom.tsx +5 -3
  121. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +51 -35
  122. package/src/global-account/react/components/B3Provider/B3Provider.tsx +28 -72
  123. package/src/global-account/react/components/B3Provider/types.ts +4 -0
  124. package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +2 -3
  125. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +1 -1
  126. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
  127. package/src/global-account/react/components/SignInWithB3/SignInWithB3.tsx +2 -2
  128. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +4 -23
  129. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +4 -3
  130. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +8 -46
  131. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
  132. package/src/global-account/react/components/custom/ManageAccountButton.tsx +3 -2
  133. package/src/global-account/react/hooks/useAuthentication.ts +170 -89
  134. package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +3 -2
  135. package/src/global-account/react/hooks/useUserQuery.ts +95 -0
  136. package/src/global-account/react/hooks/useWagmiConfig.tsx +44 -0
  137. package/src/global-account/react/stores/useModalStore.ts +0 -2
  138. package/src/notifications/index.ts +9 -0
  139. package/src/notifications/react/hooks/index.ts +1 -0
  140. package/src/notifications/react/hooks/useNotifications.ts +153 -0
  141. package/src/notifications/react/index.ts +1 -0
  142. package/src/notifications/services/api.ts +217 -0
  143. package/src/notifications/services/index.ts +1 -0
  144. package/src/notifications/types/index.ts +58 -0
  145. package/src/shared/utils/auth-token.ts +13 -0
  146. package/src/shared/utils/index.ts +1 -0
  147. package/dist/cjs/shared/react/hooks/__tests__/useCurrencyConversion.test.js +0 -245
  148. package/dist/esm/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts +0 -1
  149. package/dist/esm/shared/react/hooks/__tests__/useCurrencyConversion.test.js +0 -243
  150. package/dist/types/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts +0 -1
  151. /package/dist/{cjs/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts → esm/notifications/types/index.js} +0 -0
@@ -0,0 +1,179 @@
1
+ import { getAuthToken } from "../../shared/utils/auth-token.js";
2
+ const DEFAULT_API_URL = "https://notifications.b3.fun";
3
+ let apiUrl = DEFAULT_API_URL;
4
+ export function setApiUrl(url) {
5
+ apiUrl = url;
6
+ }
7
+ export function getApiUrl() {
8
+ return apiUrl;
9
+ }
10
+ function getHeaders(includeAuth = false) {
11
+ const headers = {
12
+ "Content-Type": "application/json",
13
+ };
14
+ if (includeAuth) {
15
+ const token = getAuthToken();
16
+ if (token) {
17
+ headers["Authorization"] = `Bearer ${token}`;
18
+ }
19
+ }
20
+ return headers;
21
+ }
22
+ export const notificationsAPI = {
23
+ // ===== USER MANAGEMENT =====
24
+ /**
25
+ * Register the current user (userId extracted from JWT)
26
+ */
27
+ async registerUser() {
28
+ const res = await fetch(`${apiUrl}/users`, {
29
+ method: "POST",
30
+ headers: getHeaders(true),
31
+ });
32
+ if (!res.ok) {
33
+ const errorBody = await res.text().catch(() => "Could not read error body");
34
+ throw new Error(`API Error: ${res.status} ${res.statusText} - ${errorBody}`);
35
+ }
36
+ return res.json();
37
+ },
38
+ /**
39
+ * Get current user's profile and preferences
40
+ */
41
+ async getUser() {
42
+ const res = await fetch(`${apiUrl}/users/me`, {
43
+ headers: getHeaders(true),
44
+ });
45
+ return res.json();
46
+ },
47
+ /**
48
+ * Get current user's notification history
49
+ */
50
+ async getHistory(appId, limit = 100) {
51
+ const params = new URLSearchParams();
52
+ if (appId)
53
+ params.append("appId", appId);
54
+ params.append("limit", limit.toString());
55
+ const res = await fetch(`${apiUrl}/users/me/history?${params}`, {
56
+ headers: getHeaders(true),
57
+ });
58
+ return res.json();
59
+ },
60
+ // ===== CHANNELS =====
61
+ /**
62
+ * Add a notification channel for current user
63
+ */
64
+ async addChannel(channelType, channelIdentifier, metadata) {
65
+ const res = await fetch(`${apiUrl}/users/me/channels`, {
66
+ method: "POST",
67
+ headers: getHeaders(true),
68
+ body: JSON.stringify({
69
+ channelType,
70
+ channelIdentifier,
71
+ enabled: true,
72
+ metadata,
73
+ }),
74
+ });
75
+ return res.json();
76
+ },
77
+ /**
78
+ * Connect email for current user
79
+ */
80
+ async connectEmail(email) {
81
+ return this.addChannel("email", email);
82
+ },
83
+ /**
84
+ * Update a notification channel
85
+ */
86
+ async updateChannel(channelId, updates) {
87
+ const res = await fetch(`${apiUrl}/users/me/channels/${channelId}`, {
88
+ method: "PUT",
89
+ headers: getHeaders(true),
90
+ body: JSON.stringify(updates),
91
+ });
92
+ return res.json();
93
+ },
94
+ /**
95
+ * Delete a notification channel
96
+ */
97
+ async deleteChannel(channelId) {
98
+ const res = await fetch(`${apiUrl}/users/me/channels/${channelId}`, {
99
+ method: "DELETE",
100
+ headers: getHeaders(true),
101
+ });
102
+ return res.json();
103
+ },
104
+ // ===== TELEGRAM =====
105
+ /**
106
+ * Get Telegram deep link for current user
107
+ */
108
+ async getTelegramLink() {
109
+ const res = await fetch(`${apiUrl}/telegram/request-link`, {
110
+ method: "POST",
111
+ headers: getHeaders(true),
112
+ });
113
+ return res.json();
114
+ },
115
+ /**
116
+ * Check current user's Telegram connection status
117
+ */
118
+ async checkTelegramStatus() {
119
+ const res = await fetch(`${apiUrl}/telegram/status/me`, {
120
+ headers: getHeaders(true),
121
+ });
122
+ return res.json();
123
+ },
124
+ // ===== APP PREFERENCES =====
125
+ /**
126
+ * Save notification preferences for an app
127
+ * @param appId - The application ID
128
+ * @param settings - Notification preferences including channels, type, and enabled status (defaults to true)
129
+ */
130
+ async savePreferences(appId, settings) {
131
+ const res = await fetch(`${apiUrl}/users/me/apps/${appId}/settings`, {
132
+ method: "POST",
133
+ headers: getHeaders(true),
134
+ body: JSON.stringify({ enabled: true, ...settings }),
135
+ });
136
+ return res.json();
137
+ },
138
+ /**
139
+ * Get notification settings for an app
140
+ */
141
+ async getAppSettings(appId) {
142
+ const res = await fetch(`${apiUrl}/users/me/apps/${appId}/settings`, {
143
+ headers: getHeaders(true),
144
+ });
145
+ return res.json();
146
+ },
147
+ // ===== IN-APP NOTIFICATIONS =====
148
+ /**
149
+ * Get current user's in-app notifications
150
+ */
151
+ async getInAppNotifications() {
152
+ const res = await fetch(`${apiUrl}/users/me/notifications`, {
153
+ headers: getHeaders(true),
154
+ });
155
+ return res.json();
156
+ },
157
+ /**
158
+ * Mark a notification as read
159
+ */
160
+ async markNotificationAsRead(notificationId) {
161
+ const res = await fetch(`${apiUrl}/users/me/notifications/${notificationId}/read`, {
162
+ method: "PUT",
163
+ headers: getHeaders(true),
164
+ });
165
+ return res.json();
166
+ },
167
+ // ===== SENDING NOTIFICATIONS =====
168
+ /**
169
+ * Send a notification (requires auth)
170
+ */
171
+ async sendNotification(data) {
172
+ const res = await fetch(`${apiUrl}/send`, {
173
+ method: "POST",
174
+ headers: getHeaders(true),
175
+ body: JSON.stringify(data),
176
+ });
177
+ return res.json();
178
+ },
179
+ };
@@ -0,0 +1 @@
1
+ export * from "./api";
@@ -0,0 +1 @@
1
+ export * from "./api.js";
@@ -0,0 +1,51 @@
1
+ export type ChannelType = "email" | "telegram" | "discord" | "sms" | "whatsapp" | "in_app";
2
+ export interface NotificationChannel {
3
+ id: number;
4
+ channel_type: ChannelType;
5
+ enabled: number;
6
+ channel_identifier: string;
7
+ }
8
+ export interface UserData {
9
+ user: {
10
+ id: number;
11
+ user_id: string;
12
+ };
13
+ channels: NotificationChannel[];
14
+ appSettings: Array<{
15
+ app_id: string;
16
+ notification_type: string;
17
+ enabled: number;
18
+ channels: string;
19
+ }>;
20
+ }
21
+ export interface NotificationHistory {
22
+ id: string;
23
+ app_id: string;
24
+ notification_type: string;
25
+ title: string;
26
+ message: string;
27
+ created_at: string;
28
+ read: boolean;
29
+ }
30
+ export interface TelegramLinkResponse {
31
+ deepLink: string;
32
+ verificationCode: string;
33
+ botUsername: string;
34
+ }
35
+ export interface TelegramStatusResponse {
36
+ connected: boolean;
37
+ chatId?: string;
38
+ }
39
+ export interface NotificationPreferences {
40
+ notificationType: string;
41
+ channels: string[];
42
+ enabled?: boolean;
43
+ }
44
+ export interface SendNotificationRequest {
45
+ userId: string;
46
+ appId: string;
47
+ notificationType: string;
48
+ message: string;
49
+ title?: string;
50
+ data?: Record<string, any>;
51
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Get the authentication token from the B3 auth cookie
3
+ * This token is managed by the B3 Global Account authentication system
4
+ *
5
+ * @returns The JWT token string or null if not found
6
+ */
7
+ export declare function getAuthToken(): string | null;
@@ -0,0 +1,11 @@
1
+ import Cookies from "js-cookie";
2
+ const B3_AUTH_COOKIE_NAME = "b3-auth";
3
+ /**
4
+ * Get the authentication token from the B3 auth cookie
5
+ * This token is managed by the B3 Global Account authentication system
6
+ *
7
+ * @returns The JWT token string or null if not found
8
+ */
9
+ export function getAuthToken() {
10
+ return Cookies.get(B3_AUTH_COOKIE_NAME) || null;
11
+ }
@@ -1,3 +1,4 @@
1
+ export * from "./auth-token";
1
2
  export * from "./cn";
2
3
  export * from "./formatNumber";
3
4
  export * from "./formatUsername";
@@ -1,4 +1,5 @@
1
1
  // Export utility functions
2
+ export * from "./auth-token.js";
2
3
  export * from "./cn.js";
3
4
  export * from "./formatNumber.js";
4
5
  export * from "./formatUsername.js";
@@ -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, }: {
27
+ export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, }: {
28
28
  children: React.ReactNode;
29
29
  accountOverride?: Account;
30
30
  environment: B3ContextType["environment"];
@@ -32,4 +32,5 @@ export declare function InnerProvider({ children, accountOverride, environment,
32
32
  automaticallySetFirstEoa: boolean;
33
33
  theme: "light" | "dark";
34
34
  clientType?: ClientType;
35
+ partnerId: string;
35
36
  }): import("react/jsx-runtime").JSX.Element;
@@ -5,21 +5,25 @@ import { B3ContextType } from "./types";
5
5
  /**
6
6
  * Main B3Provider component
7
7
  */
8
- export declare function B3Provider({ theme, children, accountOverride, environment, clientType, }: {
8
+ export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, }: {
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>;
14
16
  }): import("react/jsx-runtime").JSX.Element;
15
17
  /**
16
18
  * Inner provider component that provides the actual B3Context
17
19
  */
18
- export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme, clientType, }: {
20
+ export declare function InnerProvider({ children, accountOverride, environment, defaultPermissions, theme, clientType, partnerId, rpcUrls, }: {
19
21
  children: React.ReactNode;
20
22
  accountOverride?: Account;
21
23
  environment: B3ContextType["environment"];
22
24
  defaultPermissions?: PermissionsConfig;
23
25
  theme: "light" | "dark";
24
26
  clientType?: ClientType;
27
+ partnerId: string;
28
+ rpcUrls?: Record<number, string>;
25
29
  }): import("react/jsx-runtime").JSX.Element;
@@ -12,12 +12,14 @@ export interface B3ContextType {
12
12
  setWallet: (wallet: Wallet) => void;
13
13
  wallet?: Wallet;
14
14
  setUser: (user?: Users) => void;
15
+ refetchUser: () => Promise<any>;
15
16
  initialized: boolean;
16
17
  ready: boolean;
17
18
  environment?: "development" | "production";
18
19
  defaultPermissions?: PermissionsConfig;
19
20
  theme: "light" | "dark";
20
21
  clientType: ClientType;
22
+ partnerId: string;
21
23
  }
22
24
  /**
23
25
  * Context for B3 provider
@@ -1,8 +1,7 @@
1
1
  interface BalanceContentProps {
2
2
  onLogout?: () => void;
3
- partnerId: string;
4
3
  showDeposit?: boolean;
5
4
  showSwap?: boolean;
6
5
  }
7
- export declare function BalanceContent({ onLogout, partnerId, showDeposit, showSwap }: BalanceContentProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function BalanceContent({ onLogout, showDeposit, showSwap }: BalanceContentProps): import("react/jsx-runtime").JSX.Element;
8
7
  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, loginWithSiwe, source, signersEnabled, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
6
+ export declare function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin, source, signersEnabled, }: SignInWithB3ModalProps): import("react/jsx-runtime").JSX.Element | null;
@@ -4,8 +4,7 @@ interface SignInWithB3PrivyProps {
4
4
  onError?: (error: Error) => Promise<void>;
5
5
  onSuccess: (account: Account) => Promise<void>;
6
6
  accessToken?: string;
7
- partnerId: string;
8
7
  chain: Chain;
9
8
  }
10
- export declare function SignInWithB3Privy({ onSuccess, onError, partnerId, chain }: SignInWithB3PrivyProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function SignInWithB3Privy({ onSuccess, onError, chain }: SignInWithB3PrivyProps): import("react/jsx-runtime").JSX.Element;
11
10
  export {};
@@ -9,7 +9,6 @@ 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;
13
12
  /** Blockchain chain information */
14
13
  chain: Chain;
15
14
  /** Optional authentication strategy options */
@@ -20,5 +19,5 @@ interface LoginStepContainerProps {
20
19
  partnerId?: string;
21
20
  }
22
21
  export declare function LoginStepContainer({ children, partnerId }: LoginStepContainerProps): import("react/jsx-runtime").JSX.Element;
23
- export declare function LoginStep({ onSuccess, onError, partnerId, chain }: LoginStepProps): import("react/jsx-runtime").JSX.Element;
22
+ export declare function LoginStep({ onSuccess, chain }: LoginStepProps): import("react/jsx-runtime").JSX.Element;
24
23
  export {};
@@ -5,10 +5,9 @@ interface LoginStepCustomProps {
5
5
  automaticallySetFirstEoa: boolean;
6
6
  onSuccess: (account: Account) => Promise<void>;
7
7
  onError?: (error: Error) => Promise<void>;
8
- partnerId: string;
9
8
  chain: Chain;
10
9
  strategies: AllowedStrategy[];
11
10
  maxInitialWallets?: number;
12
11
  }
13
- export declare function LoginStepCustom({ onSuccess, onError, partnerId, chain, strategies, maxInitialWallets, automaticallySetFirstEoa, }: LoginStepCustomProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function LoginStepCustom({ onSuccess, onError, chain, strategies, maxInitialWallets, automaticallySetFirstEoa, }: LoginStepCustomProps): import("react/jsx-runtime").JSX.Element;
14
13
  export {};
@@ -1,5 +1,6 @@
1
+ import { Wallet } from "thirdweb/wallets";
1
2
  import { preAuthenticate } from "thirdweb/wallets/in-app";
2
- export declare function useAuthentication(partnerId: string, loginWithSiwe?: boolean): {
3
+ export declare function useAuthentication(partnerId: string): {
3
4
  logout: (callback?: () => void) => Promise<void>;
4
5
  isAuthenticated: boolean;
5
6
  isReady: boolean;
@@ -7,6 +8,54 @@ export declare function useAuthentication(partnerId: string, loginWithSiwe?: boo
7
8
  isConnected: boolean;
8
9
  wallet: import("thirdweb/dist/types/wallets/in-app/core/wallet/types").EcosystemWallet;
9
10
  preAuthenticate: typeof preAuthenticate;
10
- connect: (strategyOptions?: import("thirdweb/wallets").SingleStepAuthArgsType) => Promise<import("thirdweb/wallets").Wallet | null>;
11
+ connect: (wallet: Wallet) => Promise<void>;
11
12
  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;
12
61
  };
@@ -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(partnerId: string, chain?: Chain, onSuccess?: (account: Account) => void): {
7
+ export declare function useHandleConnectWithPrivy(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;
@@ -0,0 +1,58 @@
1
+ import { Users } from "@b3dotfun/b3-api";
2
+ /**
3
+ * NOTE: THIS IS ONLY MEANT FOR INTERNAL USE, from useOnConnect
4
+ *
5
+ * Custom hook to manage user state with react-query
6
+ * This allows for invalidation and refetching of user data
7
+ */
8
+ export declare function useUserQuery(): {
9
+ user: {
10
+ email?: string | undefined;
11
+ username?: string | undefined;
12
+ telNumber?: string | undefined;
13
+ ens?: string | undefined;
14
+ avatar?: string | undefined;
15
+ preferences?: {} | undefined;
16
+ referredBy?: string | {} | undefined;
17
+ sourceApp?: string | undefined;
18
+ referralCode?: string | undefined;
19
+ userGroups?: number[] | undefined;
20
+ isMigratedFromBSMNT?: boolean | undefined;
21
+ privyLinkedAccounts?: {
22
+ name?: string | undefined;
23
+ address?: string | undefined;
24
+ email?: string | undefined;
25
+ chain_type?: string | undefined;
26
+ lv?: number | undefined;
27
+ wallet_client_type?: string | undefined;
28
+ smart_wallet_type?: string | undefined;
29
+ subject?: string | undefined;
30
+ type: string;
31
+ }[] | undefined;
32
+ twProfiles?: {
33
+ type: string;
34
+ details: {
35
+ id?: string | undefined;
36
+ name?: string | undefined;
37
+ address?: string | undefined;
38
+ email?: string | undefined;
39
+ phone?: string | undefined;
40
+ username?: string | undefined;
41
+ fid?: string | undefined;
42
+ };
43
+ }[] | undefined;
44
+ _id: string | {};
45
+ userId: string;
46
+ smartAccountAddress: string;
47
+ createdAt: number;
48
+ updatedAt: number;
49
+ partnerIds: {
50
+ privyId?: string | undefined;
51
+ thirdwebId?: string | undefined;
52
+ };
53
+ } | undefined;
54
+ setUser: (newUser?: Users) => void;
55
+ refetchUser: () => Promise<void>;
56
+ clearUser: () => void;
57
+ queryKey: string[];
58
+ };
@@ -0,0 +1,13 @@
1
+ export declare function useWagmiConfig(partnerId: string, rpcUrls?: Record<number, string>): import("wagmi").Config<readonly [import("viem").Chain, ...import("viem").Chain[]], {
2
+ [k: string]: import("viem").HttpTransport<undefined, false>;
3
+ }, readonly [import("wagmi").CreateConnectorFn<import("thirdweb/dist/types/adapters/eip1193").EIP1193Provider | undefined, {
4
+ connect<withCapabilities extends boolean = false>(parameters?: import("@thirdweb-dev/wagmi-adapter").ConnectionOptions<withCapabilities> | undefined): Promise<{
5
+ accounts: withCapabilities extends true ? readonly {
6
+ address: `0x${string}`;
7
+ capabilities: Record<string, unknown>;
8
+ }[] : readonly `0x${string}`[];
9
+ chainId: number;
10
+ }>;
11
+ }, {
12
+ "thirdweb:lastChainId": number;
13
+ }>]>;
@@ -32,8 +32,6 @@ 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;
37
35
  /** Whether to close the modal after successful login */
38
36
  closeAfterLogin?: boolean;
39
37
  /** Source of the sign-in request */
@@ -0,0 +1,3 @@
1
+ export * from "./types";
2
+ export * from "./services";
3
+ export { getAuthToken } from "../shared/utils/auth-token";
@@ -0,0 +1 @@
1
+ export * from "./useNotifications";
@@ -0,0 +1,42 @@
1
+ import type { UserData } from "../../types";
2
+ /**
3
+ * React hook for managing B3 notifications
4
+ * Automatically uses the authenticated user's ID from JWT
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * import { useNotifications } from '@b3dotfun/sdk/notifications/react';
9
+ *
10
+ * function NotificationSettings() {
11
+ * const { user, loading, connectEmail, connectTelegram, isEmailConnected } = useNotifications();
12
+ *
13
+ * if (loading) return <div>Loading...</div>;
14
+ *
15
+ * return (
16
+ * <div>
17
+ * {!isEmailConnected && (
18
+ * <button onClick={() => connectEmail('user@example.com')}>
19
+ * Connect Email
20
+ * </button>
21
+ * )}
22
+ * <button onClick={connectTelegram}>Connect Telegram</button>
23
+ * </div>
24
+ * );
25
+ * }
26
+ * ```
27
+ */
28
+ export declare function useNotifications(): {
29
+ user: UserData | null;
30
+ loading: boolean;
31
+ error: Error | null;
32
+ refresh: () => Promise<void>;
33
+ connectEmail: (email: string) => Promise<void>;
34
+ connectTelegram: () => Promise<void>;
35
+ updateChannel: (channelId: string, updates: {
36
+ enabled?: boolean;
37
+ }) => Promise<void>;
38
+ deleteChannel: (channelId: string) => Promise<void>;
39
+ isEmailConnected: boolean;
40
+ isTelegramConnected: boolean;
41
+ isDiscordConnected: boolean;
42
+ };
@@ -0,0 +1 @@
1
+ export * from "./hooks";