@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,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";
@@ -0,0 +1,67 @@
1
+ import type { NotificationHistory, NotificationPreferences, SendNotificationRequest, TelegramLinkResponse, TelegramStatusResponse, UserData } from "../types";
2
+ export declare function setApiUrl(url: string): void;
3
+ export declare function getApiUrl(): string;
4
+ export declare const notificationsAPI: {
5
+ /**
6
+ * Register the current user (userId extracted from JWT)
7
+ */
8
+ registerUser(): Promise<any>;
9
+ /**
10
+ * Get current user's profile and preferences
11
+ */
12
+ getUser(): Promise<UserData>;
13
+ /**
14
+ * Get current user's notification history
15
+ */
16
+ getHistory(appId?: string, limit?: number): Promise<NotificationHistory[]>;
17
+ /**
18
+ * Add a notification channel for current user
19
+ */
20
+ addChannel(channelType: string, channelIdentifier: string, metadata?: Record<string, any>): Promise<any>;
21
+ /**
22
+ * Connect email for current user
23
+ */
24
+ connectEmail(email: string): Promise<any>;
25
+ /**
26
+ * Update a notification channel
27
+ */
28
+ updateChannel(channelId: string, updates: {
29
+ enabled?: boolean;
30
+ channelIdentifier?: string;
31
+ metadata?: Record<string, any>;
32
+ }): Promise<any>;
33
+ /**
34
+ * Delete a notification channel
35
+ */
36
+ deleteChannel(channelId: string): Promise<any>;
37
+ /**
38
+ * Get Telegram deep link for current user
39
+ */
40
+ getTelegramLink(): Promise<TelegramLinkResponse>;
41
+ /**
42
+ * Check current user's Telegram connection status
43
+ */
44
+ checkTelegramStatus(): Promise<TelegramStatusResponse>;
45
+ /**
46
+ * Save notification preferences for an app
47
+ * @param appId - The application ID
48
+ * @param settings - Notification preferences including channels, type, and enabled status (defaults to true)
49
+ */
50
+ savePreferences(appId: string, settings: NotificationPreferences): Promise<any>;
51
+ /**
52
+ * Get notification settings for an app
53
+ */
54
+ getAppSettings(appId: string): Promise<any>;
55
+ /**
56
+ * Get current user's in-app notifications
57
+ */
58
+ getInAppNotifications(): Promise<any>;
59
+ /**
60
+ * Mark a notification as read
61
+ */
62
+ markNotificationAsRead(notificationId: string): Promise<any>;
63
+ /**
64
+ * Send a notification (requires auth)
65
+ */
66
+ sendNotification(data: SendNotificationRequest): Promise<any>;
67
+ };
@@ -0,0 +1 @@
1
+ export * from "./api";
@@ -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;
@@ -1,3 +1,4 @@
1
+ export * from "./auth-token";
1
2
  export * from "./cn";
2
3
  export * from "./formatNumber";
3
4
  export * from "./formatUsername";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.47-alpha.1",
3
+ "version": "0.0.47-alpha.3",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -170,6 +170,26 @@
170
170
  "import": "./dist/esm/global-account/server.js",
171
171
  "require": "./dist/cjs/global-account/server.js"
172
172
  },
173
+ "./notifications": {
174
+ "types": "./dist/types/notifications/index.d.ts",
175
+ "import": "./dist/esm/notifications/index.js",
176
+ "require": "./dist/cjs/notifications/index.js"
177
+ },
178
+ "./notifications/react": {
179
+ "types": "./dist/types/notifications/react/index.d.ts",
180
+ "import": "./dist/esm/notifications/react/index.js",
181
+ "require": "./dist/cjs/notifications/react/index.js"
182
+ },
183
+ "./notifications/services": {
184
+ "types": "./dist/types/notifications/services/index.d.ts",
185
+ "import": "./dist/esm/notifications/services/index.js",
186
+ "require": "./dist/cjs/notifications/services/index.js"
187
+ },
188
+ "./notifications/types": {
189
+ "types": "./dist/types/notifications/types/index.d.ts",
190
+ "import": "./dist/esm/notifications/types/index.js",
191
+ "require": "./dist/cjs/notifications/types/index.js"
192
+ },
173
193
  "./shared/utils": {
174
194
  "types": "./dist/types/shared/utils/index.d.ts",
175
195
  "import": "./dist/esm/shared/utils/index.js",
@@ -281,7 +301,7 @@
281
301
  "@solana/web3.js": "^1.98.2",
282
302
  "@stripe/react-stripe-js": "^3.7.0",
283
303
  "@stripe/stripe-js": "^7.3.1",
284
- "@thirdweb-dev/wagmi-adapter": "^0.2.141",
304
+ "@thirdweb-dev/wagmi-adapter": "0.2.159",
285
305
  "@web3icons/react": "3.16.0",
286
306
  "big.js": "^7.0.1",
287
307
  "class-variance-authority": "0.7.0",
@@ -354,7 +374,7 @@
354
374
  "react": "^18.0.0 || ^19.0.0",
355
375
  "react-dom": "^18.0.0 || ^19.0.0",
356
376
  "react-native-mmkv": "^3.2.0",
357
- "thirdweb": "5.106.0",
377
+ "thirdweb": "5.108.9",
358
378
  "three": "^0.175.0",
359
379
  "viem": "^2.28.1",
360
380
  "wagmi": "^2.14.15"