@openfort/react 0.0.3 → 0.0.4

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.
package/README.md CHANGED
@@ -44,7 +44,7 @@ and much more...
44
44
 
45
45
  ### New app
46
46
 
47
- Get started with `create` Openfortkit + [wagmi](https://wagmi.sh/) + [viem](https://viem.sh) project by running one of the following in your terminal:
47
+ Get started with `create` Openfort + [wagmi](https://wagmi.sh/) + [viem](https://viem.sh) project by running one of the following in your terminal:
48
48
 
49
49
  #### npm
50
50
 
@@ -99,7 +99,7 @@ There are various runnable examples included in this repository in the [examples
99
99
  Clone the project and install the necessary dependencies:
100
100
 
101
101
  ```sh
102
- $ git clone git@github.com:openfort-xyz/openfort-kit.git
102
+ $ git clone git@github.com:openfort-xyz/openfort-react.git
103
103
  $ cd openfort
104
104
  $ yarn install
105
105
  ```
@@ -120,8 +120,8 @@ $ yarn dev:cra # Create React App
120
120
 
121
121
  ## License
122
122
 
123
- See [LICENSE](https://github.com/openfort-xyz/openfort-kit/blob/main/LICENSE) for more information.
123
+ See [LICENSE](https://github.com/openfort-xyz/openfort-react/blob/main/LICENSE) for more information.
124
124
 
125
125
  ## Credits
126
126
 
127
- OpenfortKit is a fork of [Connectkit](https://github.com/openfort-xyz/openfort-kit) developed by [Family](https://family.co). We're grateful to them for making Connectkit fast, beautiful and open-source.
127
+ Openfort is a fork of [Connectkit](https://github.com/openfort-xyz/openfort-react) developed by [Family](https://family.co). We're grateful to them for making Connectkit fast, beautiful and open-source.
@@ -17,7 +17,7 @@ type ConnectButtonRendererProps = {
17
17
  ensName?: string;
18
18
  }) => React.ReactNode;
19
19
  };
20
- type OpenfortKitButtonProps = {
20
+ type OpenfortButtonProps = {
21
21
  label?: string;
22
22
  showBalance?: boolean;
23
23
  showAvatar?: boolean;
@@ -26,8 +26,8 @@ type OpenfortKitButtonProps = {
26
26
  customTheme?: CustomTheme;
27
27
  onClick?: (open: () => void) => void;
28
28
  };
29
- export declare function OpenfortKitButton({ label, showBalance, showAvatar, theme, mode, customTheme, onClick, }: OpenfortKitButtonProps): import("react/jsx-runtime").JSX.Element | null;
30
- export declare namespace OpenfortKitButton {
29
+ export declare function OpenfortButton({ label, showBalance, showAvatar, theme, mode, customTheme, onClick, }: OpenfortButtonProps): import("react/jsx-runtime").JSX.Element | null;
30
+ export declare namespace OpenfortButton {
31
31
  var Custom: React.FC<ConnectButtonRendererProps>;
32
32
  }
33
33
  export {};
@@ -10,7 +10,7 @@ type OpenfortProviderProps = {
10
10
  walletConfig?: OpenfortWalletConfig;
11
11
  } & useConnectCallbackProps;
12
12
  /**
13
- * OpenfortProvider component provides context and configuration for OpenfortKit.
13
+ * OpenfortProvider component provides context and configuration for Openfort.
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.
@@ -34,5 +34,5 @@ export type ContextValue = {
34
34
  uiConfig?: OpenfortUIOptionsExtended;
35
35
  walletConfig?: OpenfortWalletConfig;
36
36
  } & useConnectCallbackProps;
37
- export declare const OpenfortKitContext: React.Context<ContextValue | null>;
37
+ export declare const Openfortcontext: React.Context<ContextValue | null>;
38
38
  export {};
@@ -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 { CoreOpenfortProviderProps } from '../../openfort/OpenfortProvider';
4
+ import { CoreOpenfortProviderProps } from '../../openfort/CoreOpenfortProvider';
5
5
  export declare const routes: {
6
6
  readonly PROVIDERS: "providers";
7
7
  readonly SOCIAL_PROVIDERS: "socialProviders";
@@ -84,7 +84,7 @@ export type OpenfortOptions = {
84
84
  termsOfServiceUrl?: string;
85
85
  privacyPolicyUrl?: string;
86
86
  logo?: React.ReactNode;
87
- openfortUrlOverrides?: CoreOpenfortProviderProps['overrides'];
87
+ overrides?: CoreOpenfortProviderProps['overrides'];
88
88
  };
89
89
  export type ConnectUIOptions = {
90
90
  theme?: Theme;
@@ -0,0 +1 @@
1
+ export declare const useOpenfort: () => import("./context").ContextValue;
@@ -14,7 +14,7 @@ type UseAuthCallbackOptions = {
14
14
  export declare const useAuthCallback: ({ enabled, ...hookOptions }?: UseAuthCallbackOptions) => {
15
15
  email: string | null;
16
16
  provider: AuthProvider | null;
17
- verifyEmail: ({ email, state, ...options }: import("./useEmailAuth").VerifyEmailOptions) => Promise<EmailVerificationResult>;
17
+ verifyEmail: (options: import("./useEmailAuth").VerifyEmailOptions) => Promise<EmailVerificationResult>;
18
18
  storeCredentials: ({ player, accessToken, refreshToken, ...options }: import("./useOAuth").StoreCredentialsOptions) => Promise<StoreCredentialsResult>;
19
19
  isLoading: boolean;
20
20
  isError: boolean;
@@ -53,7 +53,7 @@ export declare const useEmailAuth: (hookOptions?: UseEmailHookOptions) => {
53
53
  error: OpenfortError | null | undefined;
54
54
  signInEmail: (options: SignInEmailOptions) => Promise<EmailAuthResult>;
55
55
  signUpEmail: (options: SignUpEmailOptions) => Promise<EmailAuthResult>;
56
- verifyEmail: ({ email, state, ...options }: VerifyEmailOptions) => Promise<EmailVerificationResult>;
56
+ verifyEmail: (options: VerifyEmailOptions) => Promise<EmailVerificationResult>;
57
57
  linkEmail: (options: LinkEmailOptions) => Promise<EmailAuthResult>;
58
58
  requestResetPassword: (options: RequestResetPasswordOptions) => Promise<EmailAuthResult>;
59
59
  resetPassword: (options: ResetPasswordOptions) => Promise<EmailAuthResult>;
@@ -7,7 +7,7 @@ export type GuestHookResult = {
7
7
  user?: OpenfortUser;
8
8
  wallet?: UserWallet;
9
9
  };
10
- export type GuestHookOptions = OpenfortHookOptions<OpenfortUser> & CreateWalletPostAuthOptions;
10
+ export type GuestHookOptions = OpenfortHookOptions<GuestHookResult> & CreateWalletPostAuthOptions;
11
11
  export declare const useGuestAuth: (hookOptions?: GuestHookOptions) => {
12
12
  isLoading: boolean;
13
13
  isError: boolean;
@@ -1,12 +1,12 @@
1
- import { AuthProvider } from '../../../components/Openfort/types';
1
+ import { OAuthProvider } from '@openfort/openfort-js';
2
2
  import { OpenfortHookOptions, OpenfortError } from '../../../types';
3
3
  import { CreateWalletPostAuthOptions } from './useCreateWalletPostAuth';
4
4
  import { UserWallet } from "../useWallets";
5
5
  import { type AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
6
6
  export type InitializeOAuthOptions = {
7
- provider: AuthProvider;
7
+ provider: OAuthProvider;
8
8
  redirectTo?: string;
9
- } & OpenfortHookOptions;
9
+ } & OpenfortHookOptions<InitOAuthReturnType>;
10
10
  export type InitOAuthReturnType = {
11
11
  error?: OpenfortError;
12
12
  };
@@ -22,7 +22,7 @@ export type StoreCredentialsOptions = {
22
22
  } & OpenfortHookOptions<StoreCredentialsResult> & CreateWalletPostAuthOptions;
23
23
  export type AuthHookOptions = {
24
24
  redirectTo?: string;
25
- } & OpenfortHookOptions<StoreCredentialsResult> & CreateWalletPostAuthOptions;
25
+ } & OpenfortHookOptions<StoreCredentialsResult | InitOAuthReturnType> & CreateWalletPostAuthOptions;
26
26
  export declare const useOAuth: (hookOptions?: AuthHookOptions) => {
27
27
  isLoading: boolean;
28
28
  isError: boolean;
@@ -1,4 +1,4 @@
1
- export declare enum OpenfortKitStatus {
1
+ export declare enum OpenfortStatus {
2
2
  DISCONNECTED = 0,
3
3
  NEEDS_RECOVERY = 1,
4
4
  LOADING = 2,
@@ -1,9 +1,10 @@
1
+ import { RecoveryMethod } from "@openfort/openfort-js";
1
2
  import { Hex } from "viem";
2
3
  import { Connector } from "wagmi";
3
4
  import { embeddedWalletId } from "../../constants/openfort";
4
5
  import { OpenfortError, OpenfortHookOptions } from "../../types";
5
6
  export type UserWallet = {
6
- address?: `0x${string}`;
7
+ address?: Hex;
7
8
  connectorType?: string;
8
9
  walletClientType?: string;
9
10
  connector?: Connector;
@@ -24,11 +25,18 @@ type SetActiveWalletOptions = ({
24
25
  } | {
25
26
  connector: typeof embeddedWalletId;
26
27
  password?: string;
28
+ } | {
29
+ connector: Connector;
27
30
  })) & OpenfortHookOptions<SetActiveWalletResult>;
28
31
  type CreateWalletResult = SetActiveWalletResult;
29
32
  type CreateWalletOptions = {
30
33
  password?: string;
31
34
  } & OpenfortHookOptions<CreateWalletResult>;
35
+ type RecoverEmbeddedWalletResult = SetActiveWalletResult;
36
+ type SetRecoveryOptions = {
37
+ recoveryMethod: RecoveryMethod;
38
+ recoveryPassword?: string;
39
+ } & OpenfortHookOptions<CreateWalletResult>;
32
40
  type WalletOptions = OpenfortHookOptions<SetActiveWalletResult | CreateWalletResult>;
33
41
  export declare function useWallets(hookOptions?: WalletOptions): {
34
42
  exportPrivateKey: () => Promise<string>;
@@ -37,23 +45,15 @@ export declare function useWallets(hookOptions?: WalletOptions): {
37
45
  isSuccess: boolean;
38
46
  isCreating: boolean;
39
47
  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
- }[];
48
+ wallets: UserWallet[];
50
49
  availableWallets: import("../../wallets/useWallets").WalletProps[];
51
50
  activeWallet: UserWallet | undefined;
52
- setActiveWallet: (options: SetActiveWalletOptions | string) => Promise<SetActiveWalletResult>;
51
+ setRecovery: (params: SetRecoveryOptions) => Promise<RecoverEmbeddedWalletResult>;
53
52
  createWallet: ({ password, ...options }?: CreateWalletOptions) => Promise<{
54
53
  error: OpenfortError;
55
54
  } | {
56
55
  wallet: UserWallet;
57
56
  }>;
57
+ setActiveWallet: (options: SetActiveWalletOptions | string) => Promise<SetActiveWalletResult>;
58
58
  };
59
59
  export {};
package/build/index.d.ts CHANGED
@@ -1,17 +1,17 @@
1
- export { OPENFORTKIT_VERSION } from './version';
1
+ export { OPENFORT_VERSION } from './version';
2
2
  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
6
  export { AuthProvider, } from './components/Openfort/types';
7
- export { OpenfortKitContext, } from './components/Openfort/context';
8
- export { OpenfortProvider, } from './components/Openfort/OpenfortKit';
9
- export { OpenfortKitButton } from './components/ConnectButton';
7
+ export { Openfortcontext, } from './components/Openfort/context';
8
+ export { OpenfortProvider, } from './components/Openfort/OpenfortProvider';
9
+ export { OpenfortButton } from './components/ConnectButton';
10
10
  export { default as Avatar } from './components/Common/Avatar';
11
11
  export { default as ChainIcon } from './components/Common/Chain';
12
12
  export { useChains } from './hooks/useChains';
13
13
  export { useChainIsSupported } from './hooks/useChainIsSupported';
14
- export { useStatus, OpenfortKitStatus } from './hooks/openfort/useStatus';
14
+ export { useStatus, OpenfortStatus } 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";