@openfort/react 0.0.1 → 0.0.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 (29) hide show
  1. package/README.md +18 -30
  2. package/build/components/{OpenfortKit → Openfort}/OpenfortKit.d.ts +6 -6
  3. package/build/components/{OpenfortKit → Openfort}/context.d.ts +2 -2
  4. package/build/components/{OpenfortKit → Openfort}/types.d.ts +4 -4
  5. package/build/components/Pages/Providers/index.d.ts +1 -1
  6. package/build/hooks/openfort/auth/status.d.ts +3 -3
  7. package/build/hooks/openfort/auth/useAuthCallback.d.ts +17 -32
  8. package/build/hooks/openfort/auth/useCreateWalletPostAuth.d.ts +13 -2
  9. package/build/hooks/openfort/auth/useEmailAuth.d.ts +16 -6
  10. package/build/hooks/openfort/auth/useGuestAuth.d.ts +5 -4
  11. package/build/hooks/openfort/auth/useOAuth.d.ts +21 -7
  12. package/build/hooks/openfort/auth/useSignOut.d.ts +2 -2
  13. package/build/hooks/openfort/auth/useWalletAuth.d.ts +4 -4
  14. package/build/hooks/openfort/hookConsistency.d.ts +3 -3
  15. package/build/hooks/openfort/useProviders.d.ts +1 -1
  16. package/build/hooks/openfort/useStatus.d.ts +6 -9
  17. package/build/hooks/openfort/useUser.d.ts +1 -0
  18. package/build/hooks/openfort/useWallet.d.ts +1 -0
  19. package/build/hooks/openfort/useWallets.d.ts +34 -12
  20. package/build/index.d.ts +5 -4
  21. package/build/index.es.js +615 -433
  22. package/build/index.es.js.map +1 -1
  23. package/build/openfort/OpenfortProvider.d.ts +2 -2
  24. package/build/openfort/useOpenfort.d.ts +1 -1
  25. package/build/types.d.ts +10 -9
  26. package/build/version.d.ts +1 -1
  27. package/package.json +3 -3
  28. package/build/openfort/OpenfortProvider_old.d.ts +0 -0
  29. /package/build/components/{OpenfortKit → Openfort}/useOpenfortKit.d.ts +0 -0
package/README.md CHANGED
@@ -10,22 +10,18 @@
10
10
  Documentation
11
11
  </a>
12
12
  <span> | </span>
13
- <a href="https://www.openfort.io/docs/reference/api/authentication">
14
- API Docs
15
- </a>
16
- <span> | </span>
17
13
  <a href="https://x.com/openfort_hq">
18
14
  X
19
15
  </a>
20
- <span> | </span>
21
- <a href="https://create-next-app.openfort.xyz/">
16
+ <span> | </span>
17
+ <a href="https://playground.openfort.io/">
22
18
  Demo
23
19
  </a>
24
20
  </h4>
25
21
  </div>
26
22
 
27
23
 
28
- # Openfort Kit
24
+ # Openfort React SDK
29
25
 
30
26
  [![Downloads](https://img.shields.io/npm/dm/@openfort/react.svg)](https://www.npmjs.com/package/@openfort/react)
31
27
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
@@ -33,18 +29,14 @@
33
29
  [![Version](https://img.shields.io/npm/v/@openfort/react.svg)](https://www.npmjs.org/package/@openfort/react)
34
30
 
35
31
 
36
- The easiest way to integrate Openfort to your project, with built-in authentication and seamless wallet connectivity.
37
-
38
- It offers a simple, customizable UI. Supports authentication providers like Google, X, or Facebook out of the box. Access your address through Openfort’s [invisible wallet](https://www.openfort.io/docs/products/embedded-wallet/javascript) or connect their own wallet provider effortlessly.
39
-
40
- Docs: https://www.openfort.io/docs/products/embedded-wallet/react/kit
32
+ The easiest way to use embedded wallets, with built-in authentication and payments capabilities.
41
33
 
42
34
  ## Features
43
35
 
44
36
  - 💡 TypeScript Ready — Get types straight out of the box.
45
- - 🌱 Ecosystem Standards — Uses top libraries such as [wagmi](https://github.com/wagmi-dev/wagmi).
46
- - 🖥️ Simple UXGive users a simple, attractive experience.
47
- - 🎨 Beautiful Themes Predesigned themes or full customization.
37
+ - 🌱 Ecosystem Friendly — Uses top libraries such as [wagmi](https://github.com/wagmi-dev/wagmi) for hooks.
38
+ - 🎨 Simple UIUse prebuilt elements for authenticaiton and wallet connection.
39
+ - 🖥️ React Hooks - To interact directly with embedded wallet capabilities.
48
40
 
49
41
  and much more...
50
42
 
@@ -57,24 +49,24 @@ Get started with `create` Openfortkit + [wagmi](https://wagmi.sh/) + [viem](http
57
49
  #### npm
58
50
 
59
51
  ```sh
60
- npx create openfortkit
52
+ npx create openfort
61
53
  ```
62
54
 
63
55
  #### yarn
64
56
 
65
57
  ```sh
66
- yarn create openfortkit
58
+ yarn create openfort
67
59
  ```
68
60
 
69
61
  #### pnpm
70
62
 
71
63
  ```sh
72
- pnpm create openfortkit
64
+ pnpm create openfort
73
65
  ```
74
66
 
75
- ### Import `OpenfortKit` to your project
67
+ ### Import `Openfort` to your project
76
68
 
77
- Add OpenfortKit to your already existing project.
69
+ Add Openfort to your already existing project.
78
70
 
79
71
  #### npm
80
72
 
@@ -94,25 +86,21 @@ yarn add @openfort/react @tanstack/react-query wagmi viem
94
86
  pnpm add @openfort/react @tanstack/react-query wagmi viem
95
87
  ```
96
88
 
97
- ## Documentation
98
-
99
- You can find the full OpenfortKit documentation in the Family docs [here]().
100
-
101
89
  ## Examples
102
90
 
103
- There are various runnable examples included in this repository in the [examples folder](https://github.com/openfort-xyz/openfort-kit/tree/main/examples):
91
+ There are various runnable examples included in this repository in the [examples folder](https://github.com/openfort-xyz/openfort-react/tree/main/examples):
104
92
 
105
- - [Create React App Example (TypeScript)](https://github.com/openfort-xyz/openfort-kit/tree/main/examples/cra)
106
- - [Next.js Example (TypeScript)](https://github.com/openfort-xyz/openfort-kit/tree/main/examples/nextjs)
107
- - [Vite Example (TypeScript)](https://github.com/openfort-xyz/openfort-kit/tree/main/examples/vite)
93
+ - [Create React App Example (TypeScript)](https://github.com/openfort-xyz/openfort-react/tree/main/examples/cra)
94
+ - [Next.js Example (TypeScript)](https://github.com/openfort-xyz/openfort-react/tree/main/examples/nextjs)
95
+ - [Vite Example (TypeScript)](https://github.com/openfort-xyz/openfort-react/tree/main/examples/vite)
108
96
 
109
97
  ### Running Examples Locally
110
98
 
111
- Clone the FortKit project and install the necessary dependencies:
99
+ Clone the project and install the necessary dependencies:
112
100
 
113
101
  ```sh
114
102
  $ git clone git@github.com:openfort-xyz/openfort-kit.git
115
- $ cd openfort-kit
103
+ $ cd openfort
116
104
  $ yarn install
117
105
  ```
118
106
 
@@ -1,28 +1,28 @@
1
1
  import React from 'react';
2
2
  import { useConnectCallbackProps } from '../../hooks/useConnectCallback';
3
3
  import { ContextValue } from './context';
4
- import { ConnectKitOptions, OpenfortWalletConfig } from './types';
5
- type OpenfortKitProviderProps = {
4
+ import { ConnectUIOptions, OpenfortWalletConfig } from './types';
5
+ type OpenfortProviderProps = {
6
6
  children?: React.ReactNode;
7
7
  debugMode?: boolean;
8
8
  publishableKey: string;
9
- uiConfig?: ConnectKitOptions;
9
+ uiConfig?: ConnectUIOptions;
10
10
  walletConfig?: OpenfortWalletConfig;
11
11
  } & useConnectCallbackProps;
12
12
  /**
13
- * OpenfortKitProvider component provides context and configuration for OpenfortKit.
13
+ * OpenfortProvider component provides context and configuration for OpenfortKit.
14
14
  * It must be used within a WagmiProvider.
15
15
  *
16
16
  * @param {React.ReactNode} children - The child components to be wrapped by the provider.
17
17
  * @param {string} [theme='auto'] - The theme to be used, default is 'auto'.
18
18
  * @param {string} [mode='auto'] - The mode to be used, default is 'auto'.
19
19
  * @param {CustomTheme} [customTheme] - Custom theme configuration.
20
- * @param {ConnectKitOptions} [options] - Additional configuration options.
20
+ * @param {ConnectUIOptions} [options] - Additional configuration options.
21
21
  * @param {Function} [onConnect] - Callback function to be called on connect.
22
22
  * @param {Function} [onDisconnect] - Callback function to be called on disconnect.
23
23
  * @param {boolean} [debugMode=false] - Enable or disable debug mode, default is false.
24
24
  * @param {OpenfortOptions} [openfortOptions] - Options for Openfort integration.
25
25
  * @throws Will throw an error if used outside of a WagmiProvider or if nested usages are detected.
26
26
  */
27
- export declare const OpenfortKitProvider: ({ children, uiConfig, onConnect, onDisconnect, debugMode, publishableKey, walletConfig, }: OpenfortKitProviderProps) => React.FunctionComponentElement<React.ProviderProps<ContextValue | null>>;
27
+ export declare const OpenfortProvider: ({ children, uiConfig, onConnect, onDisconnect, debugMode, publishableKey, walletConfig, }: OpenfortProviderProps) => React.FunctionComponentElement<React.ProviderProps<ContextValue | null>>;
28
28
  export {};
@@ -3,7 +3,7 @@ import { CustomTheme, Languages, Mode, Theme } from '../../types';
3
3
  import { OAuthProvider } from '@openfort/openfort-js';
4
4
  import { ValueOf } from 'viem/_types/types/utils';
5
5
  import { useConnectCallbackProps } from '../../hooks/useConnectCallback';
6
- import { ConnectKitOptionsExtended, OpenfortWalletConfig, routes } from './types';
6
+ import { OpenfortUIOptionsExtended, OpenfortWalletConfig, routes } from './types';
7
7
  type Connector = {
8
8
  id: string;
9
9
  type?: "wallet";
@@ -31,7 +31,7 @@ export type ContextValue = {
31
31
  displayError: (message: string | React.ReactNode | null, code?: any) => void;
32
32
  resize: number;
33
33
  triggerResize: () => void;
34
- uiConfig?: ConnectKitOptionsExtended;
34
+ uiConfig?: OpenfortUIOptionsExtended;
35
35
  walletConfig?: OpenfortWalletConfig;
36
36
  } & useConnectCallbackProps;
37
37
  export declare const OpenfortKitContext: React.Context<ContextValue | null>;
@@ -1,7 +1,7 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { CustomAvatarProps, CustomTheme, Languages, Mode, Theme } from '../../types';
3
3
  import { RecoveryMethod } from '@openfort/openfort-js';
4
- import { OpenfortProviderProps } from '../../openfort/OpenfortProvider';
4
+ import { CoreOpenfortProviderProps } from '../../openfort/OpenfortProvider';
5
5
  export declare const routes: {
6
6
  readonly PROVIDERS: "providers";
7
7
  readonly SOCIAL_PROVIDERS: "socialProviders";
@@ -84,9 +84,9 @@ export type OpenfortOptions = {
84
84
  termsOfServiceUrl?: string;
85
85
  privacyPolicyUrl?: string;
86
86
  logo?: React.ReactNode;
87
- openfortUrlOverrides?: OpenfortProviderProps['overrides'];
87
+ openfortUrlOverrides?: CoreOpenfortProviderProps['overrides'];
88
88
  };
89
- export type ConnectKitOptions = {
89
+ export type ConnectUIOptions = {
90
90
  theme?: Theme;
91
91
  mode?: Mode;
92
92
  customTheme?: CustomTheme;
@@ -107,7 +107,7 @@ export type ConnectKitOptions = {
107
107
  enforceSupportedChains?: boolean;
108
108
  overlayBlur?: number;
109
109
  } & OpenfortOptions;
110
- export type ConnectKitOptionsExtended = {
110
+ export type OpenfortUIOptionsExtended = {
111
111
  theme: Theme;
112
112
  mode: Mode;
113
113
  customTheme?: CustomTheme;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { AuthProvider } from "../../OpenfortKit/types";
2
+ import { AuthProvider } from "../../Openfort/types";
3
3
  export declare const ProviderButtonSwitch: React.FC<{
4
4
  provider: AuthProvider;
5
5
  }>;
@@ -1,14 +1,14 @@
1
- import { OpenfortKitError } from "../../../types";
1
+ import { OpenfortError } from "../../../types";
2
2
  export type BaseFlowState = {
3
3
  status: "idle" | 'awaiting-input' | 'loading' | 'success';
4
4
  error?: never;
5
5
  } | {
6
6
  status: 'error';
7
- error: OpenfortKitError | null;
7
+ error: OpenfortError | null;
8
8
  };
9
9
  export declare const mapStatus: (status: BaseFlowState) => {
10
10
  isLoading: boolean;
11
11
  isError: boolean;
12
12
  isSuccess: boolean;
13
- error: OpenfortKitError | null | undefined;
13
+ error: OpenfortError | null | undefined;
14
14
  };
@@ -1,39 +1,24 @@
1
- import { OpenfortHookOptions, OpenfortKitError } from "../../../types";
2
- import { AuthProvider } from "../../../components/OpenfortKit/types";
3
- import { UserWallet } from "../useWallets";
4
- import { type AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
5
- type CallbackResult = StoreCredentialsResult | EmailVerificationResult;
6
- type EmailVerificationResult = {
7
- type: "verifyEmail";
8
- email?: string;
9
- error?: OpenfortKitError;
10
- };
11
- type StoreCredentialsResult = {
1
+ import { OpenfortHookOptions, OpenfortError } from "../../../types";
2
+ import { AuthProvider } from "../../../components/Openfort/types";
3
+ import { CreateWalletPostAuthOptions } from "./useCreateWalletPostAuth";
4
+ import { EmailVerificationResult } from "./useEmailAuth";
5
+ import { StoreCredentialsResult } from "./useOAuth";
6
+ type CallbackResult = (StoreCredentialsResult & {
12
7
  type: "storeCredentials";
13
- user?: OpenfortUser;
14
- wallet?: UserWallet;
15
- error?: OpenfortKitError;
16
- };
17
- type VerifyEmailOptions = {
18
- email: string;
19
- state: string;
20
- } & OpenfortHookOptions<EmailVerificationResult>;
21
- type StoreCredentialsOptions = {
22
- player: string;
23
- accessToken: string;
24
- refreshToken: string;
25
- } & OpenfortHookOptions<StoreCredentialsResult>;
8
+ }) | (EmailVerificationResult & {
9
+ type: "verifyEmail";
10
+ });
26
11
  type UseAuthCallbackOptions = {
27
- automaticallyHandleCallback?: boolean;
28
- } & OpenfortHookOptions<CallbackResult>;
29
- export declare const useAuthCallback: ({ automaticallyHandleCallback, ...hookOptions }?: UseAuthCallbackOptions) => {
12
+ enabled?: boolean;
13
+ } & OpenfortHookOptions<CallbackResult> & CreateWalletPostAuthOptions;
14
+ export declare const useAuthCallback: ({ enabled, ...hookOptions }?: UseAuthCallbackOptions) => {
15
+ email: string | null;
16
+ provider: AuthProvider | null;
17
+ verifyEmail: ({ email, state, ...options }: import("./useEmailAuth").VerifyEmailOptions) => Promise<EmailVerificationResult>;
18
+ storeCredentials: ({ player, accessToken, refreshToken, ...options }: import("./useOAuth").StoreCredentialsOptions) => Promise<StoreCredentialsResult>;
30
19
  isLoading: boolean;
31
20
  isError: boolean;
32
21
  isSuccess: boolean;
33
- error: OpenfortKitError | null | undefined;
34
- email: string | null;
35
- provider: AuthProvider | null;
36
- verifyEmail: ({ email, state, ...options }: VerifyEmailOptions) => Promise<EmailVerificationResult>;
37
- storeCredentials: ({ player, accessToken, refreshToken, ...options }: StoreCredentialsOptions) => Promise<StoreCredentialsResult>;
22
+ error: OpenfortError | null | undefined;
38
23
  };
39
24
  export {};
@@ -1,6 +1,17 @@
1
+ export type CreateWalletPostAuthOptions = {
2
+ /**
3
+ * @default true
4
+ * It will log out the user if there is an error while trying to create a wallet (automatic recovery).
5
+ */
6
+ logoutOnError?: boolean;
7
+ /**
8
+ *
9
+ */
10
+ automaticRecovery?: boolean;
11
+ };
1
12
  export declare const useCreateWalletPostAuth: () => {
2
- tryUseWallet: () => Promise<{
3
- error?: string;
13
+ tryUseWallet: ({ logoutOnError: signOutOnError, automaticRecovery }: CreateWalletPostAuthOptions) => Promise<{
14
+ error?: import("../../..").OpenfortError;
4
15
  wallet?: import("../useWallets").UserWallet;
5
16
  }>;
6
17
  };
@@ -1,8 +1,9 @@
1
1
  import { type AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
2
- import { OpenfortHookOptions, OpenfortKitError } from "../../../types";
2
+ import { OpenfortHookOptions, OpenfortError } from "../../../types";
3
+ import { CreateWalletPostAuthOptions } from './useCreateWalletPostAuth';
3
4
  import { UserWallet } from '../useWallets';
4
5
  export type EmailAuthResult = {
5
- error?: OpenfortKitError;
6
+ error?: OpenfortError;
6
7
  user?: OpenfortUser;
7
8
  wallet?: UserWallet;
8
9
  requiresEmailVerification?: boolean;
@@ -11,13 +12,13 @@ export type SignInEmailOptions = {
11
12
  email: string;
12
13
  password: string;
13
14
  emailVerificationRedirectTo?: string;
14
- } & OpenfortHookOptions<EmailAuthResult>;
15
+ } & OpenfortHookOptions<EmailAuthResult> & CreateWalletPostAuthOptions;
15
16
  export type SignUpEmailOptions = {
16
17
  email: string;
17
18
  password: string;
18
19
  name?: string;
19
20
  emailVerificationRedirectTo?: string;
20
- } & OpenfortHookOptions<EmailAuthResult>;
21
+ } & OpenfortHookOptions<EmailAuthResult> & CreateWalletPostAuthOptions;
21
22
  export type RequestResetPasswordOptions = {
22
23
  email: string;
23
24
  emailVerificationRedirectTo?: string;
@@ -32,18 +33,27 @@ export type LinkEmailOptions = {
32
33
  password: string;
33
34
  emailVerificationRedirectTo?: string;
34
35
  } & OpenfortHookOptions<EmailAuthResult>;
36
+ export type VerifyEmailOptions = {
37
+ email: string;
38
+ state: string;
39
+ } & OpenfortHookOptions<EmailVerificationResult>;
40
+ export type EmailVerificationResult = {
41
+ email?: string;
42
+ error?: OpenfortError;
43
+ };
35
44
  export type UseEmailHookOptions = {
36
45
  emailVerificationRedirectTo?: string;
37
- } & OpenfortHookOptions<EmailAuthResult>;
46
+ } & OpenfortHookOptions<EmailAuthResult | EmailVerificationResult> & CreateWalletPostAuthOptions;
38
47
  export declare const useEmailAuth: (hookOptions?: UseEmailHookOptions) => {
39
48
  requiresEmailVerification: boolean;
40
49
  isAwaitingInput: boolean;
41
50
  isLoading: boolean;
42
51
  isError: boolean;
43
52
  isSuccess: boolean;
44
- error: OpenfortKitError | null | undefined;
53
+ error: OpenfortError | null | undefined;
45
54
  signInEmail: (options: SignInEmailOptions) => Promise<EmailAuthResult>;
46
55
  signUpEmail: (options: SignUpEmailOptions) => Promise<EmailAuthResult>;
56
+ verifyEmail: ({ email, state, ...options }: VerifyEmailOptions) => Promise<EmailVerificationResult>;
47
57
  linkEmail: (options: LinkEmailOptions) => Promise<EmailAuthResult>;
48
58
  requestResetPassword: (options: RequestResetPasswordOptions) => Promise<EmailAuthResult>;
49
59
  resetPassword: (options: ResetPasswordOptions) => Promise<EmailAuthResult>;
@@ -1,16 +1,17 @@
1
1
  import { type AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
2
- import { OpenfortHookOptions, OpenfortKitError } from "../../../types";
2
+ import { OpenfortHookOptions, OpenfortError } from "../../../types";
3
+ import { CreateWalletPostAuthOptions } from "./useCreateWalletPostAuth";
3
4
  import { UserWallet } from "../useWallets";
4
5
  export type GuestHookResult = {
5
- error?: OpenfortKitError;
6
+ error?: OpenfortError;
6
7
  user?: OpenfortUser;
7
8
  wallet?: UserWallet;
8
9
  };
9
- export type GuestHookOptions = OpenfortHookOptions<OpenfortUser>;
10
+ export type GuestHookOptions = OpenfortHookOptions<OpenfortUser> & CreateWalletPostAuthOptions;
10
11
  export declare const useGuestAuth: (hookOptions?: GuestHookOptions) => {
11
12
  isLoading: boolean;
12
13
  isError: boolean;
13
14
  isSuccess: boolean;
14
- error: OpenfortKitError | null | undefined;
15
+ error: OpenfortError | null | undefined;
15
16
  signUpGuest: (options?: GuestHookOptions) => Promise<GuestHookResult>;
16
17
  };
@@ -1,20 +1,34 @@
1
- import { AuthProvider } from '../../../components/OpenfortKit/types';
2
- import { OpenfortHookOptions, OpenfortKitError } from '../../../types';
1
+ import { AuthProvider } from '../../../components/Openfort/types';
2
+ import { OpenfortHookOptions, OpenfortError } from '../../../types';
3
+ import { CreateWalletPostAuthOptions } from './useCreateWalletPostAuth';
4
+ import { UserWallet } from "../useWallets";
5
+ import { type AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
3
6
  export type InitializeOAuthOptions = {
4
7
  provider: AuthProvider;
5
8
  redirectTo?: string;
6
9
  } & OpenfortHookOptions;
7
- export type AuthHookOptions = {
8
- redirectTo?: string;
9
- } & OpenfortHookOptions;
10
10
  export type InitOAuthReturnType = {
11
- error?: OpenfortKitError;
11
+ error?: OpenfortError;
12
12
  };
13
+ export type StoreCredentialsResult = {
14
+ user?: OpenfortUser;
15
+ wallet?: UserWallet;
16
+ error?: OpenfortError;
17
+ };
18
+ export type StoreCredentialsOptions = {
19
+ player: string;
20
+ accessToken: string;
21
+ refreshToken: string;
22
+ } & OpenfortHookOptions<StoreCredentialsResult> & CreateWalletPostAuthOptions;
23
+ export type AuthHookOptions = {
24
+ redirectTo?: string;
25
+ } & OpenfortHookOptions<StoreCredentialsResult> & CreateWalletPostAuthOptions;
13
26
  export declare const useOAuth: (hookOptions?: AuthHookOptions) => {
14
27
  isLoading: boolean;
15
28
  isError: boolean;
16
29
  isSuccess: boolean;
17
- error: OpenfortKitError | null | undefined;
30
+ error: OpenfortError | null | undefined;
18
31
  initOAuth: (options: InitializeOAuthOptions) => Promise<InitOAuthReturnType>;
19
32
  linkOauth: (options: InitializeOAuthOptions) => Promise<InitOAuthReturnType>;
33
+ storeCredentials: ({ player, accessToken, refreshToken, ...options }: StoreCredentialsOptions) => Promise<StoreCredentialsResult>;
20
34
  };
@@ -1,8 +1,8 @@
1
- import { OpenfortHookOptions, OpenfortKitError } from '../../../types';
1
+ import { OpenfortHookOptions, OpenfortError } from '../../../types';
2
2
  export declare function useSignOut(hookOptions?: OpenfortHookOptions): {
3
3
  signOut: (options?: OpenfortHookOptions) => Promise<{} | undefined>;
4
4
  isLoading: boolean;
5
5
  isError: boolean;
6
6
  isSuccess: boolean;
7
- error: OpenfortKitError | null | undefined;
7
+ error: OpenfortError | null | undefined;
8
8
  };
@@ -1,5 +1,5 @@
1
1
  import { Connector } from "wagmi";
2
- import { OpenfortHookOptions, OpenfortKitError } from "../../../types";
2
+ import { OpenfortHookOptions, OpenfortError } from "../../../types";
3
3
  type ConnectWalletOptions = {
4
4
  connector: Connector | string;
5
5
  };
@@ -7,13 +7,13 @@ export declare const useWalletAuth: (hookOptions?: OpenfortHookOptions) => {
7
7
  isLoading: boolean;
8
8
  isError: boolean;
9
9
  isSuccess: boolean;
10
- error: OpenfortKitError | null | undefined;
10
+ error: OpenfortError | null | undefined;
11
11
  walletConnectingTo: string | null;
12
12
  connectWallet: (options: ConnectWalletOptions) => Promise<{
13
- error: OpenfortKitError;
13
+ error: OpenfortError;
14
14
  } | undefined>;
15
15
  linkWallet: (options: ConnectWalletOptions) => Promise<{
16
- error: OpenfortKitError;
16
+ error: OpenfortError;
17
17
  } | undefined>;
18
18
  availableWallets: import("../../../wallets/useWallets").WalletProps[];
19
19
  };
@@ -1,4 +1,4 @@
1
- import { OpenfortHookOptions, OpenfortKitError } from "../../types";
1
+ import { OpenfortHookOptions, OpenfortError } from "../../types";
2
2
  export declare const onSuccess: <T>({ hookOptions, options, data, }: {
3
3
  hookOptions?: OpenfortHookOptions<T>;
4
4
  options?: OpenfortHookOptions<T>;
@@ -7,7 +7,7 @@ export declare const onSuccess: <T>({ hookOptions, options, data, }: {
7
7
  export declare const onError: <T>({ hookOptions, options, error, }: {
8
8
  hookOptions?: OpenfortHookOptions<T>;
9
9
  options?: OpenfortHookOptions<T>;
10
- error: OpenfortKitError;
10
+ error: OpenfortError;
11
11
  }) => {
12
- error: OpenfortKitError;
12
+ error: OpenfortError;
13
13
  };
@@ -1,4 +1,4 @@
1
- import { AuthProvider } from "../../components/OpenfortKit/types";
1
+ import { AuthProvider } from "../../components/Openfort/types";
2
2
  export declare function useProviders(): {
3
3
  availableProviders: AuthProvider[];
4
4
  linkedProviders: AuthProvider[];
@@ -1,16 +1,13 @@
1
1
  export declare enum OpenfortKitStatus {
2
- LOADING = 0,
3
- CONNECTED = 1,
4
- DISCONNECTED = 2,
5
- NEEDS_RECOVERY = 3,
6
- CONNECTED_WITHOUT_USER = 4
2
+ DISCONNECTED = 0,
3
+ NEEDS_RECOVERY = 1,
4
+ LOADING = 2,
5
+ CONNECTED = 3
7
6
  }
8
7
  export declare function useStatus(): {
9
- status: OpenfortKitStatus;
10
8
  isLoading: boolean;
11
- hasUser: boolean;
12
9
  isConnected: boolean;
13
10
  isDisconnected: boolean;
14
- isConnectedWithoutUser: boolean;
15
- needsRecovery: boolean;
11
+ isConnecting: boolean;
12
+ isAuthenticated: boolean;
16
13
  };
@@ -1,5 +1,6 @@
1
1
  export declare function useUser(): {
2
2
  user: import("@openfort/openfort-js").AuthPlayerResponse | null;
3
+ isAuthenticated: boolean;
3
4
  getAccessToken: () => Promise<string | null>;
4
5
  validateAndRefreshToken: () => Promise<void>;
5
6
  };
@@ -0,0 +1 @@
1
+ export declare function useWallet(): import("./useWallets").UserWallet | undefined;
@@ -1,7 +1,7 @@
1
+ import { Hex } from "viem";
1
2
  import { Connector } from "wagmi";
2
3
  import { embeddedWalletId } from "../../constants/openfort";
3
- import { Hex } from "viem";
4
- import { OpenfortKitError } from "../../types";
4
+ import { OpenfortError, OpenfortHookOptions } from "../../types";
5
5
  export type UserWallet = {
6
6
  address?: `0x${string}`;
7
7
  connectorType?: string;
@@ -9,9 +9,14 @@ export type UserWallet = {
9
9
  connector?: Connector;
10
10
  id: string;
11
11
  isAvailable: boolean;
12
- isActive: boolean;
12
+ isActive?: boolean;
13
+ isConnecting?: boolean;
13
14
  };
14
- type SetActiveWalletOptions = {
15
+ type SetActiveWalletResult = {
16
+ error?: OpenfortError;
17
+ wallet?: UserWallet;
18
+ };
19
+ type SetActiveWalletOptions = ({
15
20
  showUI?: boolean;
16
21
  address?: Hex | undefined;
17
22
  } & ({
@@ -19,19 +24,36 @@ type SetActiveWalletOptions = {
19
24
  } | {
20
25
  connector: typeof embeddedWalletId;
21
26
  password?: string;
22
- });
23
- export declare function useWallets(): {
27
+ })) & OpenfortHookOptions<SetActiveWalletResult>;
28
+ type CreateWalletResult = SetActiveWalletResult;
29
+ type CreateWalletOptions = {
30
+ password?: string;
31
+ } & OpenfortHookOptions<CreateWalletResult>;
32
+ type WalletOptions = OpenfortHookOptions<SetActiveWalletResult | CreateWalletResult>;
33
+ export declare function useWallets(hookOptions?: WalletOptions): {
24
34
  exportPrivateKey: () => Promise<string>;
25
- isLoading: boolean;
35
+ error: OpenfortError | null | undefined;
26
36
  isError: boolean;
27
37
  isSuccess: boolean;
28
- error: OpenfortKitError | null | undefined;
29
- wallets: UserWallet[];
38
+ isCreating: boolean;
39
+ isConnecting: boolean;
40
+ wallets: {
41
+ isConnecting: boolean;
42
+ isActive: boolean;
43
+ address?: `0x${string}`;
44
+ connectorType?: string;
45
+ walletClientType?: string;
46
+ connector?: Connector;
47
+ id: string;
48
+ isAvailable: boolean;
49
+ }[];
30
50
  availableWallets: import("../../wallets/useWallets").WalletProps[];
31
51
  activeWallet: UserWallet | undefined;
32
- setActiveWallet: (options: SetActiveWalletOptions | string) => Promise<{
33
- error?: string;
34
- wallet?: UserWallet;
52
+ setActiveWallet: (options: SetActiveWalletOptions | string) => Promise<SetActiveWalletResult>;
53
+ createWallet: ({ password, ...options }?: CreateWalletOptions) => Promise<{
54
+ error: OpenfortError;
55
+ } | {
56
+ wallet: UserWallet;
35
57
  }>;
36
58
  };
37
59
  export {};
package/build/index.d.ts CHANGED
@@ -3,9 +3,9 @@ export * from './types';
3
3
  export { default as getDefaultConfig } from './defaultConfig';
4
4
  export { default as getDefaultConnectors } from './defaultConnectors';
5
5
  export { wallets } from './wallets';
6
- export { AuthProvider, } from './components/OpenfortKit/types';
7
- export { OpenfortKitContext, } from './components/OpenfortKit/context';
8
- export { OpenfortKitProvider, } from './components/OpenfortKit/OpenfortKit';
6
+ export { AuthProvider, } from './components/Openfort/types';
7
+ export { OpenfortKitContext, } from './components/Openfort/context';
8
+ export { OpenfortProvider, } from './components/Openfort/OpenfortKit';
9
9
  export { OpenfortKitButton } from './components/ConnectButton';
10
10
  export { default as Avatar } from './components/Common/Avatar';
11
11
  export { default as ChainIcon } from './components/Common/Chain';
@@ -15,8 +15,9 @@ export { useStatus, OpenfortKitStatus } from './hooks/openfort/useStatus';
15
15
  export { useUser } from './hooks/openfort/useUser';
16
16
  export { useUI } from "./hooks/openfort/useUI";
17
17
  export { useWallets, UserWallet } from "./hooks/openfort/useWallets";
18
+ export { useWallet } from "./hooks/openfort/useWallet";
18
19
  export { RecoveryMethod, AuthPlayerResponse } from "@openfort/openfort-js";
19
- export { useOpenfort } from './openfort/useOpenfort';
20
+ export { useOpenfortCore as useOpenfort } from './openfort/useOpenfort';
20
21
  export { useConnectWithSiwe } from './hooks/openfort/useConnectWithSiwe';
21
22
  export { embeddedWalletId } from './constants/openfort';
22
23
  export { useEmailAuth } from './hooks/openfort/auth/useEmailAuth';