@openfort/react 0.0.3 → 0.0.5
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 +4 -4
- package/build/components/ConnectButton/index.d.ts +3 -3
- package/build/components/Openfort/{OpenfortKit.d.ts → OpenfortProvider.d.ts} +5 -2
- package/build/components/Openfort/context.d.ts +4 -2
- package/build/components/Openfort/types.d.ts +9 -6
- package/build/components/Openfort/useOpenfort.d.ts +1 -0
- package/build/hooks/openfort/auth/useAuthCallback.d.ts +1 -1
- package/build/hooks/openfort/auth/useEmailAuth.d.ts +1 -1
- package/build/hooks/openfort/auth/useGuestAuth.d.ts +1 -1
- package/build/hooks/openfort/auth/useOAuth.d.ts +4 -4
- package/build/hooks/openfort/auth/useSignOut.d.ts +1 -1
- package/build/hooks/openfort/useStatus.d.ts +1 -1
- package/build/hooks/openfort/useWallets.d.ts +16 -16
- package/build/index.d.ts +4 -5
- package/build/index.es.js +341 -290
- package/build/index.es.js.map +1 -1
- package/build/openfort/{OpenfortProvider.d.ts → CoreOpenfortProvider.d.ts} +1 -1
- package/build/openfort/context.d.ts +1 -1
- package/build/openfort/core/client.d.ts +1 -1
- package/build/openfort/core/index.d.ts +0 -2
- package/build/openfort/useOpenfort.d.ts +1 -1
- package/build/styles/styled/index.d.ts +1 -1
- package/build/styles/types.d.ts +1 -1
- package/build/types.d.ts +4 -2
- package/build/version.d.ts +1 -1
- package/package.json +3 -3
- package/build/components/Openfort/useOpenfortKit.d.ts +0 -1
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ and much more...
|
|
|
44
44
|
|
|
45
45
|
### New app
|
|
46
46
|
|
|
47
|
-
Get started with `create`
|
|
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-
|
|
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-
|
|
123
|
+
See [LICENSE](https://github.com/openfort-xyz/openfort-react/blob/main/LICENSE) for more information.
|
|
124
124
|
|
|
125
125
|
## Credits
|
|
126
126
|
|
|
127
|
-
|
|
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
|
|
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
|
|
30
|
-
export declare namespace
|
|
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 {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { SDKOverrides, ThirdPartyAuthConfiguration } from '@openfort/openfort-js';
|
|
2
3
|
import { useConnectCallbackProps } from '../../hooks/useConnectCallback';
|
|
3
4
|
import { ContextValue } from './context';
|
|
4
5
|
import { ConnectUIOptions, OpenfortWalletConfig } from './types';
|
|
@@ -8,9 +9,11 @@ type OpenfortProviderProps = {
|
|
|
8
9
|
publishableKey: string;
|
|
9
10
|
uiConfig?: ConnectUIOptions;
|
|
10
11
|
walletConfig?: OpenfortWalletConfig;
|
|
12
|
+
overrides?: SDKOverrides;
|
|
13
|
+
thirdPartyAuth?: ThirdPartyAuthConfiguration;
|
|
11
14
|
} & useConnectCallbackProps;
|
|
12
15
|
/**
|
|
13
|
-
* OpenfortProvider component provides context and configuration for
|
|
16
|
+
* OpenfortProvider component provides context and configuration for Openfort.
|
|
14
17
|
* It must be used within a WagmiProvider.
|
|
15
18
|
*
|
|
16
19
|
* @param {React.ReactNode} children - The child components to be wrapped by the provider.
|
|
@@ -24,5 +27,5 @@ type OpenfortProviderProps = {
|
|
|
24
27
|
* @param {OpenfortOptions} [openfortOptions] - Options for Openfort integration.
|
|
25
28
|
* @throws Will throw an error if used outside of a WagmiProvider or if nested usages are detected.
|
|
26
29
|
*/
|
|
27
|
-
export declare const OpenfortProvider: ({ children, uiConfig, onConnect, onDisconnect, debugMode, publishableKey, walletConfig, }: OpenfortProviderProps) => React.FunctionComponentElement<React.ProviderProps<ContextValue | null>>;
|
|
30
|
+
export declare const OpenfortProvider: ({ children, uiConfig, onConnect, onDisconnect, debugMode, publishableKey, walletConfig, overrides, thirdPartyAuth, }: OpenfortProviderProps) => React.FunctionComponentElement<React.ProviderProps<ContextValue | null>>;
|
|
28
31
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CustomTheme, Languages, Mode, Theme } from '../../types';
|
|
3
|
-
import { OAuthProvider } from '@openfort/openfort-js';
|
|
3
|
+
import { OAuthProvider, SDKOverrides, ThirdPartyAuthConfiguration } from '@openfort/openfort-js';
|
|
4
4
|
import { ValueOf } from 'viem/_types/types/utils';
|
|
5
5
|
import { useConnectCallbackProps } from '../../hooks/useConnectCallback';
|
|
6
6
|
import { OpenfortUIOptionsExtended, OpenfortWalletConfig, routes } from './types';
|
|
@@ -33,6 +33,8 @@ export type ContextValue = {
|
|
|
33
33
|
triggerResize: () => void;
|
|
34
34
|
uiConfig?: OpenfortUIOptionsExtended;
|
|
35
35
|
walletConfig?: OpenfortWalletConfig;
|
|
36
|
+
overrides?: SDKOverrides;
|
|
37
|
+
thirdPartyAuth?: ThirdPartyAuthConfiguration;
|
|
36
38
|
} & useConnectCallbackProps;
|
|
37
|
-
export declare const
|
|
39
|
+
export declare const Openfortcontext: React.Context<ContextValue | null>;
|
|
38
40
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { CustomAvatarProps, CustomTheme, Languages, Mode, Theme } from '../../types';
|
|
3
|
-
import { RecoveryMethod } from '@openfort/openfort-js';
|
|
4
|
-
import { CoreOpenfortProviderProps } from '../../openfort/
|
|
3
|
+
import { AccountTypeEnum, RecoveryMethod } from '@openfort/openfort-js';
|
|
4
|
+
import { CoreOpenfortProviderProps } from '../../openfort/CoreOpenfortProvider';
|
|
5
5
|
export declare const routes: {
|
|
6
6
|
readonly PROVIDERS: "providers";
|
|
7
7
|
readonly SOCIAL_PROVIDERS: "socialProviders";
|
|
@@ -35,6 +35,7 @@ type CommonWalletConfig = {
|
|
|
35
35
|
shieldPublishableKey: string;
|
|
36
36
|
/** Policy ID (pol_...) for the embedded signer */
|
|
37
37
|
ethereumProviderPolicyId?: string;
|
|
38
|
+
accountType?: AccountTypeEnum;
|
|
38
39
|
debug?: boolean;
|
|
39
40
|
};
|
|
40
41
|
type EncryptionSession = {
|
|
@@ -77,14 +78,16 @@ type PasswordRecoveryWalletConfig = {
|
|
|
77
78
|
* - `getEncryptionSession.` as a function that returns a promise.
|
|
78
79
|
*/
|
|
79
80
|
export type OpenfortWalletConfig = CommonWalletConfig & (AutomaticRecoveryWalletConfig | PasswordRecoveryWalletConfig);
|
|
80
|
-
export type
|
|
81
|
+
export type OpenfortUIOptions = {
|
|
81
82
|
linkWalletOnSignUp?: boolean;
|
|
82
83
|
authProviders?: AuthProvider[];
|
|
83
84
|
skipEmailVerification?: boolean;
|
|
84
85
|
termsOfServiceUrl?: string;
|
|
85
86
|
privacyPolicyUrl?: string;
|
|
86
87
|
logo?: React.ReactNode;
|
|
87
|
-
|
|
88
|
+
};
|
|
89
|
+
export type OpenfortSDKOptions = {
|
|
90
|
+
overrides?: CoreOpenfortProviderProps['overrides'];
|
|
88
91
|
};
|
|
89
92
|
export type ConnectUIOptions = {
|
|
90
93
|
theme?: Theme;
|
|
@@ -106,7 +109,7 @@ export type ConnectUIOptions = {
|
|
|
106
109
|
initialChainId?: number;
|
|
107
110
|
enforceSupportedChains?: boolean;
|
|
108
111
|
overlayBlur?: number;
|
|
109
|
-
} &
|
|
112
|
+
} & OpenfortUIOptions;
|
|
110
113
|
export type OpenfortUIOptionsExtended = {
|
|
111
114
|
theme: Theme;
|
|
112
115
|
mode: Mode;
|
|
@@ -132,5 +135,5 @@ export type OpenfortUIOptionsExtended = {
|
|
|
132
135
|
walletOnboardingUrl?: string;
|
|
133
136
|
disableSiweRedirect?: boolean;
|
|
134
137
|
overlayBlur?: number;
|
|
135
|
-
} &
|
|
138
|
+
} & OpenfortUIOptions;
|
|
136
139
|
export {};
|
|
@@ -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: (
|
|
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: (
|
|
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<
|
|
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 {
|
|
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:
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import { OpenfortHookOptions, OpenfortError } from '../../../types';
|
|
2
2
|
export declare function useSignOut(hookOptions?: OpenfortHookOptions): {
|
|
3
|
-
signOut: (options?: OpenfortHookOptions) => Promise<{}
|
|
3
|
+
signOut: (options?: OpenfortHookOptions) => Promise<{}>;
|
|
4
4
|
isLoading: boolean;
|
|
5
5
|
isError: boolean;
|
|
6
6
|
isSuccess: boolean;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { AccountTypeEnum, RecoveryParams } 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
|
|
7
|
+
address: Hex;
|
|
7
8
|
connectorType?: string;
|
|
8
9
|
walletClientType?: string;
|
|
9
10
|
connector?: Connector;
|
|
@@ -24,10 +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;
|
|
34
|
+
accountType?: AccountTypeEnum;
|
|
35
|
+
} & OpenfortHookOptions<CreateWalletResult>;
|
|
36
|
+
type RecoverEmbeddedWalletResult = SetActiveWalletResult;
|
|
37
|
+
type SetRecoveryOptions = {
|
|
38
|
+
previousRecovery: RecoveryParams;
|
|
39
|
+
newRecovery: RecoveryParams;
|
|
31
40
|
} & OpenfortHookOptions<CreateWalletResult>;
|
|
32
41
|
type WalletOptions = OpenfortHookOptions<SetActiveWalletResult | CreateWalletResult>;
|
|
33
42
|
export declare function useWallets(hookOptions?: WalletOptions): {
|
|
@@ -37,23 +46,14 @@ export declare function useWallets(hookOptions?: WalletOptions): {
|
|
|
37
46
|
isSuccess: boolean;
|
|
38
47
|
isCreating: boolean;
|
|
39
48
|
isConnecting: boolean;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
address?: `0x${string}`;
|
|
44
|
-
connectorType?: string;
|
|
45
|
-
walletClientType?: string;
|
|
46
|
-
connector?: Connector;
|
|
47
|
-
id: string;
|
|
48
|
-
isAvailable: boolean;
|
|
49
|
-
}[];
|
|
49
|
+
hasWallet: boolean;
|
|
50
|
+
isLoadingWallets: boolean;
|
|
51
|
+
wallets: UserWallet[];
|
|
50
52
|
availableWallets: import("../../wallets/useWallets").WalletProps[];
|
|
51
53
|
activeWallet: UserWallet | undefined;
|
|
54
|
+
setRecovery: (params: SetRecoveryOptions) => Promise<RecoverEmbeddedWalletResult>;
|
|
55
|
+
reset: () => void;
|
|
56
|
+
createWallet: ({ password, ...options }?: CreateWalletOptions) => Promise<CreateWalletResult>;
|
|
52
57
|
setActiveWallet: (options: SetActiveWalletOptions | string) => Promise<SetActiveWalletResult>;
|
|
53
|
-
createWallet: ({ password, ...options }?: CreateWalletOptions) => Promise<{
|
|
54
|
-
error: OpenfortError;
|
|
55
|
-
} | {
|
|
56
|
-
wallet: UserWallet;
|
|
57
|
-
}>;
|
|
58
58
|
};
|
|
59
59
|
export {};
|
package/build/index.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
export {
|
|
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 {
|
|
8
|
-
export {
|
|
9
|
-
export { OpenfortKitButton } from './components/ConnectButton';
|
|
7
|
+
export { OpenfortProvider, } from './components/Openfort/OpenfortProvider';
|
|
8
|
+
export { OpenfortButton } from './components/ConnectButton';
|
|
10
9
|
export { default as Avatar } from './components/Common/Avatar';
|
|
11
10
|
export { default as ChainIcon } from './components/Common/Chain';
|
|
12
11
|
export { useChains } from './hooks/useChains';
|
|
13
12
|
export { useChainIsSupported } from './hooks/useChainIsSupported';
|
|
14
|
-
export { useStatus,
|
|
13
|
+
export { useStatus, OpenfortStatus } from './hooks/openfort/useStatus';
|
|
15
14
|
export { useUser } from './hooks/openfort/useUser';
|
|
16
15
|
export { useUI } from "./hooks/openfort/useUI";
|
|
17
16
|
export { useWallets, UserWallet } from "./hooks/openfort/useWallets";
|