@b3dotfun/sdk 0.0.47-alpha.1 → 0.0.47-alpha.3

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 (148) hide show
  1. package/README.md +225 -6
  2. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +3 -2
  3. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +15 -64
  4. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -2
  5. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +26 -21
  6. package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +2 -0
  7. package/dist/cjs/global-account/react/components/B3Provider/types.js +2 -0
  8. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.d.ts +1 -2
  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 +6 -22
  15. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +1 -2
  16. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +3 -2
  17. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -2
  18. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +10 -45
  19. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +1 -2
  20. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +2 -1
  21. package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +2 -1
  22. package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +51 -2
  23. package/dist/cjs/global-account/react/hooks/useAuthentication.js +141 -81
  24. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  25. package/dist/cjs/global-account/react/hooks/useHandleConnectWithPrivy.js +2 -1
  26. package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +58 -0
  27. package/dist/cjs/global-account/react/hooks/useUserQuery.js +86 -0
  28. package/dist/cjs/global-account/react/hooks/useWagmiConfig.d.ts +13 -0
  29. package/dist/cjs/global-account/react/hooks/useWagmiConfig.js +42 -0
  30. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -2
  31. package/dist/cjs/notifications/index.d.ts +3 -0
  32. package/dist/cjs/notifications/index.js +25 -0
  33. package/dist/cjs/notifications/react/hooks/index.d.ts +1 -0
  34. package/dist/cjs/notifications/react/hooks/index.js +17 -0
  35. package/dist/cjs/notifications/react/hooks/useNotifications.d.ts +42 -0
  36. package/dist/cjs/notifications/react/hooks/useNotifications.js +148 -0
  37. package/dist/cjs/notifications/react/index.d.ts +1 -0
  38. package/dist/cjs/notifications/react/index.js +17 -0
  39. package/dist/cjs/notifications/services/api.d.ts +67 -0
  40. package/dist/cjs/notifications/services/api.js +184 -0
  41. package/dist/cjs/notifications/services/index.d.ts +1 -0
  42. package/dist/cjs/notifications/services/index.js +17 -0
  43. package/dist/cjs/notifications/types/index.d.ts +51 -0
  44. package/dist/cjs/notifications/types/index.js +2 -0
  45. package/dist/cjs/shared/utils/auth-token.d.ts +7 -0
  46. package/dist/cjs/shared/utils/auth-token.js +17 -0
  47. package/dist/cjs/shared/utils/index.d.ts +1 -0
  48. package/dist/cjs/shared/utils/index.js +1 -0
  49. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +3 -2
  50. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +19 -68
  51. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -2
  52. package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +24 -19
  53. package/dist/esm/global-account/react/components/B3Provider/types.d.ts +2 -0
  54. package/dist/esm/global-account/react/components/B3Provider/types.js +2 -0
  55. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +1 -2
  56. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
  57. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +1 -1
  58. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +2 -2
  59. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +2 -2
  60. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  61. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +7 -23
  62. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +1 -2
  63. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +4 -3
  64. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -2
  65. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +11 -46
  66. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +1 -2
  67. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +3 -2
  68. package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +3 -2
  69. package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +51 -2
  70. package/dist/esm/global-account/react/hooks/useAuthentication.js +144 -84
  71. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  72. package/dist/esm/global-account/react/hooks/useHandleConnectWithPrivy.js +3 -2
  73. package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +58 -0
  74. package/dist/esm/global-account/react/hooks/useUserQuery.js +83 -0
  75. package/dist/esm/global-account/react/hooks/useWagmiConfig.d.ts +13 -0
  76. package/dist/esm/global-account/react/hooks/useWagmiConfig.js +39 -0
  77. package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -2
  78. package/dist/esm/notifications/index.d.ts +3 -0
  79. package/dist/esm/notifications/index.js +7 -0
  80. package/dist/esm/notifications/react/hooks/index.d.ts +1 -0
  81. package/dist/esm/notifications/react/hooks/index.js +1 -0
  82. package/dist/esm/notifications/react/hooks/useNotifications.d.ts +42 -0
  83. package/dist/esm/notifications/react/hooks/useNotifications.js +145 -0
  84. package/dist/esm/notifications/react/index.d.ts +1 -0
  85. package/dist/esm/notifications/react/index.js +1 -0
  86. package/dist/esm/notifications/services/api.d.ts +67 -0
  87. package/dist/esm/notifications/services/api.js +179 -0
  88. package/dist/esm/notifications/services/index.d.ts +1 -0
  89. package/dist/esm/notifications/services/index.js +1 -0
  90. package/dist/esm/notifications/types/index.d.ts +51 -0
  91. package/dist/esm/shared/utils/auth-token.d.ts +7 -0
  92. package/dist/esm/shared/utils/auth-token.js +11 -0
  93. package/dist/esm/shared/utils/index.d.ts +1 -0
  94. package/dist/esm/shared/utils/index.js +1 -0
  95. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +3 -2
  96. package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +6 -2
  97. package/dist/types/global-account/react/components/B3Provider/types.d.ts +2 -0
  98. package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +1 -2
  99. package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Flow.d.ts +1 -1
  100. package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3Privy.d.ts +1 -2
  101. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -2
  102. package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStepCustom.d.ts +1 -2
  103. package/dist/types/global-account/react/hooks/useAuthentication.d.ts +51 -2
  104. package/dist/types/global-account/react/hooks/useHandleConnectWithPrivy.d.ts +1 -1
  105. package/dist/types/global-account/react/hooks/useUserQuery.d.ts +58 -0
  106. package/dist/types/global-account/react/hooks/useWagmiConfig.d.ts +13 -0
  107. package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -2
  108. package/dist/types/notifications/index.d.ts +3 -0
  109. package/dist/types/notifications/react/hooks/index.d.ts +1 -0
  110. package/dist/types/notifications/react/hooks/useNotifications.d.ts +42 -0
  111. package/dist/types/notifications/react/index.d.ts +1 -0
  112. package/dist/types/notifications/services/api.d.ts +67 -0
  113. package/dist/types/notifications/services/index.d.ts +1 -0
  114. package/dist/types/notifications/types/index.d.ts +51 -0
  115. package/dist/types/shared/utils/auth-token.d.ts +7 -0
  116. package/dist/types/shared/utils/index.d.ts +1 -0
  117. package/package.json +23 -3
  118. package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +51 -35
  119. package/src/global-account/react/components/B3Provider/B3Provider.tsx +28 -72
  120. package/src/global-account/react/components/B3Provider/types.ts +4 -0
  121. package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +2 -3
  122. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +1 -1
  123. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +2 -2
  124. package/src/global-account/react/components/SignInWithB3/SignInWithB3.tsx +2 -2
  125. package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +4 -23
  126. package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +4 -3
  127. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +8 -46
  128. package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +2 -2
  129. package/src/global-account/react/components/custom/ManageAccountButton.tsx +3 -2
  130. package/src/global-account/react/hooks/useAuthentication.ts +170 -89
  131. package/src/global-account/react/hooks/useHandleConnectWithPrivy.tsx +3 -2
  132. package/src/global-account/react/hooks/useUserQuery.ts +95 -0
  133. package/src/global-account/react/hooks/useWagmiConfig.tsx +44 -0
  134. package/src/global-account/react/stores/useModalStore.ts +0 -2
  135. package/src/notifications/index.ts +9 -0
  136. package/src/notifications/react/hooks/index.ts +1 -0
  137. package/src/notifications/react/hooks/useNotifications.ts +153 -0
  138. package/src/notifications/react/index.ts +1 -0
  139. package/src/notifications/services/api.ts +217 -0
  140. package/src/notifications/services/index.ts +1 -0
  141. package/src/notifications/types/index.ts +58 -0
  142. package/src/shared/utils/auth-token.ts +13 -0
  143. package/src/shared/utils/index.ts +1 -0
  144. package/dist/cjs/shared/react/hooks/__tests__/useCurrencyConversion.test.js +0 -245
  145. package/dist/esm/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts +0 -1
  146. package/dist/esm/shared/react/hooks/__tests__/useCurrencyConversion.test.js +0 -243
  147. package/dist/types/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts +0 -1
  148. /package/dist/{cjs/shared/react/hooks/__tests__/useCurrencyConversion.test.d.ts → esm/notifications/types/index.js} +0 -0
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.notificationsAPI = void 0;
4
+ exports.setApiUrl = setApiUrl;
5
+ exports.getApiUrl = getApiUrl;
6
+ const auth_token_1 = require("../../shared/utils/auth-token");
7
+ const DEFAULT_API_URL = "https://notifications.b3.fun";
8
+ let apiUrl = DEFAULT_API_URL;
9
+ function setApiUrl(url) {
10
+ apiUrl = url;
11
+ }
12
+ function getApiUrl() {
13
+ return apiUrl;
14
+ }
15
+ function getHeaders(includeAuth = false) {
16
+ const headers = {
17
+ "Content-Type": "application/json",
18
+ };
19
+ if (includeAuth) {
20
+ const token = (0, auth_token_1.getAuthToken)();
21
+ if (token) {
22
+ headers["Authorization"] = `Bearer ${token}`;
23
+ }
24
+ }
25
+ return headers;
26
+ }
27
+ exports.notificationsAPI = {
28
+ // ===== USER MANAGEMENT =====
29
+ /**
30
+ * Register the current user (userId extracted from JWT)
31
+ */
32
+ async registerUser() {
33
+ const res = await fetch(`${apiUrl}/users`, {
34
+ method: "POST",
35
+ headers: getHeaders(true),
36
+ });
37
+ if (!res.ok) {
38
+ const errorBody = await res.text().catch(() => "Could not read error body");
39
+ throw new Error(`API Error: ${res.status} ${res.statusText} - ${errorBody}`);
40
+ }
41
+ return res.json();
42
+ },
43
+ /**
44
+ * Get current user's profile and preferences
45
+ */
46
+ async getUser() {
47
+ const res = await fetch(`${apiUrl}/users/me`, {
48
+ headers: getHeaders(true),
49
+ });
50
+ return res.json();
51
+ },
52
+ /**
53
+ * Get current user's notification history
54
+ */
55
+ async getHistory(appId, limit = 100) {
56
+ const params = new URLSearchParams();
57
+ if (appId)
58
+ params.append("appId", appId);
59
+ params.append("limit", limit.toString());
60
+ const res = await fetch(`${apiUrl}/users/me/history?${params}`, {
61
+ headers: getHeaders(true),
62
+ });
63
+ return res.json();
64
+ },
65
+ // ===== CHANNELS =====
66
+ /**
67
+ * Add a notification channel for current user
68
+ */
69
+ async addChannel(channelType, channelIdentifier, metadata) {
70
+ const res = await fetch(`${apiUrl}/users/me/channels`, {
71
+ method: "POST",
72
+ headers: getHeaders(true),
73
+ body: JSON.stringify({
74
+ channelType,
75
+ channelIdentifier,
76
+ enabled: true,
77
+ metadata,
78
+ }),
79
+ });
80
+ return res.json();
81
+ },
82
+ /**
83
+ * Connect email for current user
84
+ */
85
+ async connectEmail(email) {
86
+ return this.addChannel("email", email);
87
+ },
88
+ /**
89
+ * Update a notification channel
90
+ */
91
+ async updateChannel(channelId, updates) {
92
+ const res = await fetch(`${apiUrl}/users/me/channels/${channelId}`, {
93
+ method: "PUT",
94
+ headers: getHeaders(true),
95
+ body: JSON.stringify(updates),
96
+ });
97
+ return res.json();
98
+ },
99
+ /**
100
+ * Delete a notification channel
101
+ */
102
+ async deleteChannel(channelId) {
103
+ const res = await fetch(`${apiUrl}/users/me/channels/${channelId}`, {
104
+ method: "DELETE",
105
+ headers: getHeaders(true),
106
+ });
107
+ return res.json();
108
+ },
109
+ // ===== TELEGRAM =====
110
+ /**
111
+ * Get Telegram deep link for current user
112
+ */
113
+ async getTelegramLink() {
114
+ const res = await fetch(`${apiUrl}/telegram/request-link`, {
115
+ method: "POST",
116
+ headers: getHeaders(true),
117
+ });
118
+ return res.json();
119
+ },
120
+ /**
121
+ * Check current user's Telegram connection status
122
+ */
123
+ async checkTelegramStatus() {
124
+ const res = await fetch(`${apiUrl}/telegram/status/me`, {
125
+ headers: getHeaders(true),
126
+ });
127
+ return res.json();
128
+ },
129
+ // ===== APP PREFERENCES =====
130
+ /**
131
+ * Save notification preferences for an app
132
+ * @param appId - The application ID
133
+ * @param settings - Notification preferences including channels, type, and enabled status (defaults to true)
134
+ */
135
+ async savePreferences(appId, settings) {
136
+ const res = await fetch(`${apiUrl}/users/me/apps/${appId}/settings`, {
137
+ method: "POST",
138
+ headers: getHeaders(true),
139
+ body: JSON.stringify({ enabled: true, ...settings }),
140
+ });
141
+ return res.json();
142
+ },
143
+ /**
144
+ * Get notification settings for an app
145
+ */
146
+ async getAppSettings(appId) {
147
+ const res = await fetch(`${apiUrl}/users/me/apps/${appId}/settings`, {
148
+ headers: getHeaders(true),
149
+ });
150
+ return res.json();
151
+ },
152
+ // ===== IN-APP NOTIFICATIONS =====
153
+ /**
154
+ * Get current user's in-app notifications
155
+ */
156
+ async getInAppNotifications() {
157
+ const res = await fetch(`${apiUrl}/users/me/notifications`, {
158
+ headers: getHeaders(true),
159
+ });
160
+ return res.json();
161
+ },
162
+ /**
163
+ * Mark a notification as read
164
+ */
165
+ async markNotificationAsRead(notificationId) {
166
+ const res = await fetch(`${apiUrl}/users/me/notifications/${notificationId}/read`, {
167
+ method: "PUT",
168
+ headers: getHeaders(true),
169
+ });
170
+ return res.json();
171
+ },
172
+ // ===== SENDING NOTIFICATIONS =====
173
+ /**
174
+ * Send a notification (requires auth)
175
+ */
176
+ async sendNotification(data) {
177
+ const res = await fetch(`${apiUrl}/send`, {
178
+ method: "POST",
179
+ headers: getHeaders(true),
180
+ body: JSON.stringify(data),
181
+ });
182
+ return res.json();
183
+ },
184
+ };
@@ -0,0 +1 @@
1
+ export * from "./api";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./api"), exports);
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getAuthToken = getAuthToken;
7
+ const js_cookie_1 = __importDefault(require("js-cookie"));
8
+ const B3_AUTH_COOKIE_NAME = "b3-auth";
9
+ /**
10
+ * Get the authentication token from the B3 auth cookie
11
+ * This token is managed by the B3 Global Account authentication system
12
+ *
13
+ * @returns The JWT token string or null if not found
14
+ */
15
+ function getAuthToken() {
16
+ return js_cookie_1.default.get(B3_AUTH_COOKIE_NAME) || null;
17
+ }
@@ -1,3 +1,4 @@
1
+ export * from "./auth-token";
1
2
  export * from "./cn";
2
3
  export * from "./formatNumber";
3
4
  export * from "./formatUsername";
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  // Export utility functions
18
+ __exportStar(require("./auth-token"), exports);
18
19
  __exportStar(require("./cn"), exports);
19
20
  __exportStar(require("./formatNumber"), exports);
20
21
  __exportStar(require("./formatUsername"), exports);
@@ -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;
@@ -1,17 +1,14 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { RelayKitProviderWrapper, TooltipProvider, useAuthStore } from "../../../../global-account/react/index.js";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { RelayKitProviderWrapper, TooltipProvider, useAuthentication, useAuthStore, } from "../../../../global-account/react/index.js";
3
+ import { useWagmiConfig } from "../../../../global-account/react/hooks/useWagmiConfig.js";
3
4
  import { loadGA4Script } from "../../../../global-account/utils/analytics.js";
4
- import { ecosystemWalletId } from "../../../../shared/constants/index.js";
5
- import { supportedChains } from "../../../../shared/constants/chains/supported.js";
6
5
  import { debugB3React } from "../../../../shared/utils/debug.js";
7
- import { client } from "../../../../shared/utils/thirdweb.js";
8
6
  import "@reservoir0x/relay-kit-ui/styles.css";
9
7
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
10
- import { inAppWalletConnector } from "@thirdweb-dev/wagmi-adapter";
11
- import { useCallback, useEffect, useMemo, useState } from "react";
8
+ import { useCallback, useEffect, useState } from "react";
12
9
  import { Toaster } from "sonner";
13
10
  import { getLastAuthProvider, ThirdwebProvider, useActiveAccount, useConnectedWallets, useSetActiveWallet, } from "thirdweb/react";
14
- import { createConfig, http, WagmiProvider } from "wagmi";
11
+ import { WagmiProvider } from "wagmi";
15
12
  import { setClientType } from "../../../client-manager.js";
16
13
  import { StyleRoot } from "../StyleRoot.js";
17
14
  import { B3Context } from "./types.js";
@@ -39,76 +36,25 @@ export function B3Provider({ theme = "light", children, accountOverride, environ
39
36
  useEffect(() => {
40
37
  setClientType(clientType);
41
38
  }, [clientType]);
42
- const ecocystemConfig = useMemo(() => {
43
- if (!partnerId)
44
- return undefined;
45
- return {
46
- ecosystemId: ecosystemWalletId,
47
- partnerId: partnerId,
48
- client,
49
- };
50
- }, [partnerId]);
51
- // Stringify rpcUrls for stable comparison to prevent wagmiConfig recreation
52
- // when parent component passes new object references with same content
53
- const rpcUrlsString = useMemo(() => (rpcUrls ? JSON.stringify(rpcUrls) : undefined), [rpcUrls]);
54
- /**
55
- * Creates wagmi config with optional custom RPC URLs
56
- * @param rpcUrls - Optional mapping of chain IDs to RPC URLs
57
- */
58
- const wagmiConfig = useMemo(() => {
59
- const parsedRpcUrls = rpcUrlsString ? JSON.parse(rpcUrlsString) : undefined;
60
- return createConfig({
61
- chains: [supportedChains[0], ...supportedChains.slice(1)],
62
- transports: Object.fromEntries(supportedChains.map(chain => [chain.id, http(parsedRpcUrls?.[chain.id])])),
63
- connectors: [
64
- inAppWalletConnector({
65
- ...(ecocystemConfig || {}),
66
- client,
67
- }),
68
- // injected(),
69
- // coinbaseWallet({ appName: "HypeDuel" }),
70
- ],
71
- });
72
- }, [ecocystemConfig, rpcUrlsString]);
73
- return (_jsx(ThirdwebProvider, { children: _jsx(WagmiProvider, { config: wagmiConfig, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(TooltipProvider, { children: _jsx(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, children: _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" }), _jsx(Toaster, { theme: theme, position: toaster?.position, style: toaster?.style })] }) }) }) }) }) }));
39
+ const wagmiConfig = useWagmiConfig(partnerId, rpcUrls);
40
+ return (_jsx(ThirdwebProvider, { children: _jsx(WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(TooltipProvider, { children: _jsx(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, automaticallySetFirstEoa: !!automaticallySetFirstEoa, clientType: clientType, partnerId: partnerId, children: _jsxs(RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, _jsx(StyleRoot, { id: "b3-root" }), _jsx(Toaster, { theme: theme, position: toaster?.position, style: toaster?.style })] }) }) }) }) }) }));
74
41
  }
75
42
  /**
76
43
  * Inner provider component that provides the actual B3Context
77
44
  */
78
- export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", }) {
45
+ export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", partnerId, }) {
79
46
  const activeAccount = useActiveAccount();
80
47
  const [manuallySelectedWallet, setManuallySelectedWallet] = useState(undefined);
81
48
  const wallets = useConnectedWallets();
82
- const setActiveWallet = useSetActiveWallet();
83
49
  const isAuthenticated = useAuthStore(state => state.isAuthenticated);
50
+ const isConnected = useAuthStore(state => state.isConnected);
51
+ const setActiveWallet = useSetActiveWallet();
52
+ const { user, setUser, refetchUser } = useAuthentication(partnerId);
53
+ debug("@@B3Provider:isConnected", isConnected);
84
54
  debug("@@wallets", wallets);
85
- const [user, setUser] = useState(() => {
86
- // Try to restore user from localStorage on initialization
87
- if (typeof window !== "undefined") {
88
- try {
89
- const storedUser = localStorage.getItem("b3-user");
90
- return storedUser ? JSON.parse(storedUser) : undefined;
91
- }
92
- catch (error) {
93
- console.warn("Failed to restore user from localStorage:", error);
94
- return undefined;
95
- }
96
- }
97
- return undefined;
98
- });
55
+ debug("@@B3Provider:user", user);
99
56
  // Use given accountOverride or activeAccount from thirdweb
100
57
  const effectiveAccount = isAuthenticated ? accountOverride || activeAccount : undefined;
101
- // Persist user to localStorage when it changes
102
- useEffect(() => {
103
- if (typeof window !== "undefined") {
104
- if (user) {
105
- localStorage.setItem("b3-user", JSON.stringify(user));
106
- }
107
- else {
108
- localStorage.removeItem("b3-user");
109
- }
110
- }
111
- }, [user]);
112
58
  const setWallet = useCallback((wallet) => {
113
59
  setManuallySelectedWallet(wallet);
114
60
  const account = wallet.getAccount();
@@ -141,6 +87,7 @@ export function InnerProvider({ children, accountOverride, environment, defaultP
141
87
  wallet: manuallySelectedWallet,
142
88
  user,
143
89
  setUser,
90
+ refetchUser,
144
91
  initialized: true,
145
92
  ready: !!effectiveAccount,
146
93
  automaticallySetFirstEoa,
@@ -148,5 +95,9 @@ export function InnerProvider({ children, accountOverride, environment, defaultP
148
95
  defaultPermissions,
149
96
  theme,
150
97
  clientType,
151
- }, children: children }));
98
+ partnerId: partnerId,
99
+ }, children: _jsx(InnerProvider2, { children: children }) }));
152
100
  }
101
+ const InnerProvider2 = ({ children }) => {
102
+ return _jsx(_Fragment, { children: children });
103
+ };
@@ -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;
@@ -1,7 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
3
- import { useState } from "react";
4
3
  import { ThirdwebProvider, useActiveAccount } from "thirdweb/react";
4
+ import { WagmiProvider } from "wagmi";
5
+ import { useAuthentication } from "../../hooks/useAuthentication.js";
6
+ import { useWagmiConfig } from "../../hooks/useWagmiConfig.js";
5
7
  import { B3Context } from "./types.js";
6
8
  /**
7
9
  * Default permissions configuration for B3 provider
@@ -17,29 +19,32 @@ const queryClient = new QueryClient();
17
19
  /**
18
20
  * Main B3Provider component
19
21
  */
20
- export function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", }) {
21
- return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(ThirdwebProvider, { children: _jsx(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, clientType: clientType, children: children }) }) }));
22
+ export function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls, }) {
23
+ return (_jsx(ThirdwebProvider, { children: _jsx(InnerProvider, { accountOverride: accountOverride, environment: environment, theme: theme, clientType: clientType, partnerId: partnerId, rpcUrls: rpcUrls, children: children }) }));
22
24
  }
23
25
  /**
24
26
  * Inner provider component that provides the actual B3Context
25
27
  */
26
- export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, theme = "light", clientType = "socket", }) {
28
+ export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, theme = "light", clientType = "socket", partnerId, rpcUrls, }) {
27
29
  const activeAccount = useActiveAccount();
28
- const [user, setUser] = useState(undefined);
30
+ const { user, setUser, refetchUser } = useAuthentication(partnerId);
31
+ const wagmiConfig = useWagmiConfig(partnerId, rpcUrls);
29
32
  // Use given accountOverride or activeAccount from thirdweb
30
33
  const effectiveAccount = accountOverride || activeAccount;
31
- return (_jsx(B3Context.Provider, { value: {
32
- account: effectiveAccount,
33
- automaticallySetFirstEoa: false,
34
- setWallet: () => { },
35
- wallet: undefined,
36
- user,
37
- setUser,
38
- initialized: true,
39
- ready: !!effectiveAccount,
40
- environment,
41
- defaultPermissions,
42
- theme,
43
- clientType,
44
- }, children: children }));
34
+ return (_jsx(WagmiProvider, { config: wagmiConfig, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(B3Context.Provider, { value: {
35
+ account: effectiveAccount,
36
+ automaticallySetFirstEoa: false,
37
+ setWallet: () => { },
38
+ wallet: undefined,
39
+ user,
40
+ setUser,
41
+ initialized: true,
42
+ ready: !!effectiveAccount,
43
+ environment,
44
+ defaultPermissions,
45
+ theme,
46
+ clientType,
47
+ partnerId,
48
+ refetchUser,
49
+ }, children: children }) }) }));
45
50
  }
@@ -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
@@ -9,9 +9,11 @@ export const B3Context = createContext({
9
9
  setWallet: () => { },
10
10
  wallet: undefined,
11
11
  setUser: () => { },
12
+ refetchUser: async () => { },
12
13
  initialized: false,
13
14
  ready: false,
14
15
  environment: "development",
15
16
  theme: "light",
16
17
  clientType: "rest",
18
+ partnerId: "",
17
19
  });
@@ -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 {};
@@ -17,14 +17,14 @@ function centerTruncate(str, length = 4) {
17
17
  return str;
18
18
  return `${str.slice(0, length)}...${str.slice(-length)}`;
19
19
  }
20
- export function BalanceContent({ onLogout, partnerId, showDeposit = true, showSwap = true }) {
20
+ export function BalanceContent({ onLogout, showDeposit = true, showSwap = true }) {
21
21
  const account = useActiveAccount();
22
22
  const { address: eoaAddress, info: eoaInfo } = useFirstEOA();
23
23
  const { data: profile } = useProfile({
24
24
  address: eoaAddress || account?.address,
25
25
  fresh: true,
26
26
  });
27
- const { user } = useB3();
27
+ const { user, partnerId } = useB3();
28
28
  const { setB3ModalOpen, setB3ModalContentType, navigateBack } = useModalStore();
29
29
  const { logout } = useAuthentication(partnerId);
30
30
  const [logoutLoading, setLogoutLoading] = useState(false);
@@ -196,5 +196,5 @@ export function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit
196
196
  if (["overview", "tokens", "nfts", "apps", "settings"].includes(tab)) {
197
197
  setActiveTab?.(tab);
198
198
  }
199
- }, children: [_jsx("div", { className: "px-4", children: _jsxs(TabsListPrimitive, { className: "grid h-auto grid-cols-2 grid-rows-2 gap-3 rounded-none border-none bg-transparent", children: [_jsxs(TabTriggerPrimitive, { value: "overview", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(BarChart3, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Overview" })] }), _jsxs(TabTriggerPrimitive, { value: "tokens", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(Coins, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Tokens" })] }), _jsxs(TabTriggerPrimitive, { value: "nfts", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(Image, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "NFTs" })] }), _jsxs(TabTriggerPrimitive, { value: "settings", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(Settings, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Settings" })] })] }) }), _jsx(TabsContentPrimitive, { value: "overview", className: "px-4 pb-4 pt-2", children: _jsx(BalanceContent, { onLogout: onLogout, partnerId: partnerId, showDeposit: showDeposit, showSwap: showSwap }) }), _jsx(TabsContentPrimitive, { value: "tokens", className: "px-4 pb-4 pt-2", children: _jsx(ContentTokens, { activeTab: activeTab }) }), _jsx(TabsContentPrimitive, { value: "nfts", className: "px-4 pb-4 pt-2", children: _jsx("div", { className: "grid grid-cols-3 gap-4", children: nfts?.nftResponse ? (_jsx(AccountAssets, { nfts: nfts.nftResponse, isLoading: isLoading })) : (_jsx("div", { className: "col-span-3 py-12 text-center text-gray-500", children: "No NFTs found" })) }) }), _jsx(TabsContentPrimitive, { value: "apps", className: "px-4 pb-4 pt-2", children: _jsx(AppsContent, {}) }), _jsx(TabsContentPrimitive, { value: "settings", className: "px-4 pb-4 pt-2", children: _jsx(SettingsContent, {}) })] }) }) }));
199
+ }, children: [_jsx("div", { className: "px-4", children: _jsxs(TabsListPrimitive, { className: "grid h-auto grid-cols-2 grid-rows-2 gap-3 rounded-none border-none bg-transparent", children: [_jsxs(TabTriggerPrimitive, { value: "overview", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(BarChart3, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Overview" })] }), _jsxs(TabTriggerPrimitive, { value: "tokens", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(Coins, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Tokens" })] }), _jsxs(TabTriggerPrimitive, { value: "nfts", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(Image, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "NFTs" })] }), _jsxs(TabTriggerPrimitive, { value: "settings", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(Settings, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Settings" })] })] }) }), _jsx(TabsContentPrimitive, { value: "overview", className: "px-4 pb-4 pt-2", children: _jsx(BalanceContent, { onLogout: onLogout, showDeposit: showDeposit, showSwap: showSwap }) }), _jsx(TabsContentPrimitive, { value: "tokens", className: "px-4 pb-4 pt-2", children: _jsx(ContentTokens, { activeTab: activeTab }) }), _jsx(TabsContentPrimitive, { value: "nfts", className: "px-4 pb-4 pt-2", children: _jsx("div", { className: "grid grid-cols-3 gap-4", children: nfts?.nftResponse ? (_jsx(AccountAssets, { nfts: nfts.nftResponse, isLoading: isLoading })) : (_jsx("div", { className: "col-span-3 py-12 text-center text-gray-500", children: "No NFTs found" })) }) }), _jsx(TabsContentPrimitive, { value: "apps", className: "px-4 pb-4 pt-2", children: _jsx(AppsContent, {}) }), _jsx(TabsContentPrimitive, { value: "settings", className: "px-4 pb-4 pt-2", children: _jsx(SettingsContent, {}) })] }) }) }));
200
200
  }
@@ -9,10 +9,10 @@ import { useConnectedWallets, useSetActiveWallet, useWalletInfo } from "thirdweb
9
9
  import { ManageAccountButton } from "../custom/ManageAccountButton.js";
10
10
  export function SignIn(props) {
11
11
  const { className } = props;
12
- const { automaticallySetFirstEoa } = useB3();
12
+ const { automaticallySetFirstEoa, partnerId } = useB3();
13
13
  const { wallet, address: globalAddress, ensName, connectedSmartWallet, connectedEOAWallet, isActiveSmartWallet, isActiveEOAWallet, smartWalletIcon, eoaWalletIcon, } = useAccountWallet();
14
14
  const isMobile = useIsMobile();
15
- const { logout } = useAuthentication(String(process.env.NEXT_PUBLIC_THIRDWEB_PARTNER_ID));
15
+ const { logout } = useAuthentication(partnerId);
16
16
  const onDisconnect = async () => {
17
17
  await logout();
18
18
  };
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Button, StyleRoot, useAuthentication, useB3, useIsMobile, useModalStore, } from "../../../../global-account/react/index.js";
2
+ import { Button, StyleRoot, useAuthStore, useB3, useIsMobile, useModalStore, } from "../../../../global-account/react/index.js";
3
3
  import { useEffect } from "react";
4
4
  import { ManageAccountButton } from "../custom/ManageAccountButton.js";
5
5
  import { Loading } from "../ui/Loading.js";
6
6
  export function SignInWithB3(props) {
7
7
  const { setB3ModalOpen, setB3ModalContentType, setEcoSystemAccountAddress } = useModalStore();
8
8
  const { account } = useB3();
9
- const { isAuthenticating, isAuthenticated } = useAuthentication(props.partnerId, props.loginWithSiwe);
9
+ const { isAuthenticating, isAuthenticated } = useAuthStore();
10
10
  const isMobile = useIsMobile();
11
11
  useEffect(() => {
12
12
  if (account) {