@openfort/react 0.0.27 → 0.0.28
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/LICENSE +25 -0
- package/README.md +5 -17
- package/build/assets/chains.d.ts +0 -8
- package/build/assets/icons.d.ts +0 -9
- package/build/assets/logos.d.ts +0 -83
- package/build/components/BalanceButton/index.d.ts +2 -4
- package/build/components/Common/Alert/index.d.ts +1 -1
- package/build/components/Common/Avatar/index.d.ts +1 -1
- package/build/components/Common/BrowserIcon/index.d.ts +1 -1
- package/build/components/Common/Button/index.d.ts +2 -2
- package/build/components/Common/Button/types.d.ts +1 -1
- package/build/components/Common/Chain/index.d.ts +1 -1
- package/build/components/Common/ChainSelect/index.d.ts +1 -1
- package/build/components/Common/ChainSelectDropdown/index.d.ts +1 -1
- package/build/components/Common/ChainSelectList/index.d.ts +1 -1
- package/build/components/Common/ConnectorList/styles.d.ts +0 -1
- package/build/components/Common/CopyToClipboard/CopyToClipboardIcon.d.ts +1 -1
- package/build/components/Common/CopyToClipboard/index.d.ts +1 -1
- package/build/components/Common/CustomQRCode/QRCode.d.ts +1 -1
- package/build/components/Common/CustomQRCode/index.d.ts +2 -2
- package/build/components/Common/CustomQRCode/styles.d.ts +0 -1
- package/build/components/Common/CustomQRCode/types.d.ts +1 -1
- package/build/components/Common/FitText/index.d.ts +1 -1
- package/build/components/Common/Input/index.d.ts +1 -1
- package/build/components/Common/Input/types.d.ts +1 -1
- package/build/components/Common/Modal/index.d.ts +4 -4
- package/build/components/Common/Modal/styles.d.ts +0 -5
- package/build/components/Common/PoweredByFooter/index.d.ts +0 -1
- package/build/components/Common/ScrollArea/index.d.ts +1 -1
- package/build/components/Common/SquircleSpinner/index.d.ts +1 -1
- package/build/components/Common/ThemedButton/index.d.ts +2 -3
- package/build/components/Common/Tooltip/index.d.ts +2 -2
- package/build/components/Common/Tooltip/styles.d.ts +1 -1
- package/build/components/ConnectButton/index.d.ts +3 -3
- package/build/components/ConnectButton/styles.d.ts +0 -1
- package/build/components/ConnectKitThemeProvider/ConnectKitThemeProvider.d.ts +1 -1
- package/build/components/ConnectModal/ConnectWithInjector/CircleSpinner/index.d.ts +1 -1
- package/build/components/ConnectModal/ConnectWithInjector/index.d.ts +2 -2
- package/build/components/ConnectModal/ConnectWithMobile.d.ts +1 -1
- package/build/components/ConnectModal/ConnectWithOAuth.d.ts +1 -1
- package/build/components/ConnectModal/index.d.ts +1 -1
- package/build/components/FloatingGraphic/index.d.ts +2 -3
- package/build/components/Openfort/OpenfortProvider.d.ts +4 -4
- package/build/components/Openfort/context.d.ts +8 -8
- package/build/components/Openfort/types.d.ts +6 -9
- package/build/components/Pages/About/graphics.d.ts +1 -1
- package/build/components/Pages/About/index.d.ts +1 -1
- package/build/components/Pages/Connectors/index.d.ts +1 -1
- package/build/components/Pages/EmailLogin/index.d.ts +1 -1
- package/build/components/Pages/EmailVerification/index.d.ts +1 -1
- package/build/components/Pages/ForgotPassword/index.d.ts +1 -1
- package/build/components/Pages/LinkEmail/index.d.ts +1 -1
- package/build/components/Pages/Loading/index.d.ts +1 -1
- package/build/components/Pages/MobileConnectors/index.d.ts +1 -1
- package/build/components/Pages/Onboarding/index.d.ts +1 -1
- package/build/components/Pages/Profile/index.d.ts +1 -1
- package/build/components/Pages/Providers/index.d.ts +2 -2
- package/build/components/Pages/Recover/index.d.ts +1 -1
- package/build/components/Pages/SoicalProviders/index.d.ts +1 -1
- package/build/components/Pages/SwitchNetworks/index.d.ts +1 -1
- package/build/components/PasswordStrength/PasswordStrengthIndicator.d.ts +1 -1
- package/build/components/PasswordStrength/password-utility.d.ts +2 -52
- package/build/components/contexts/web3/index.d.ts +2 -2
- package/build/constants/chainConfigs.d.ts +1 -1
- package/build/defaultConfig.d.ts +2 -3
- package/build/defaultConnectors.d.ts +2 -2
- package/build/hooks/openfort/auth/status.d.ts +2 -2
- package/build/hooks/openfort/auth/useAuthCallback.d.ts +16 -9
- package/build/hooks/openfort/auth/useConnectToWalletPostAuth.d.ts +2 -2
- package/build/hooks/openfort/auth/useEmailAuth.d.ts +13 -12
- package/build/hooks/openfort/auth/useGuestAuth.d.ts +7 -6
- package/build/hooks/openfort/auth/useOAuth.d.ts +9 -9
- package/build/hooks/openfort/auth/useSignOut.d.ts +1 -1
- package/build/hooks/openfort/auth/useWalletAuth.d.ts +2 -2
- package/build/hooks/openfort/hookConsistency.d.ts +1 -1
- package/build/hooks/openfort/use7702Authorization.d.ts +2 -1
- package/build/hooks/openfort/useProviders.d.ts +1 -1
- package/build/hooks/openfort/useWallets.d.ts +9 -16
- package/build/hooks/useChains.d.ts +1 -1
- package/build/hooks/useConnect.d.ts +11 -105
- package/build/hooks/useConnectCallback.d.ts +2 -2
- package/build/hooks/useConnectors.d.ts +0 -3
- package/build/hooks/useEnsFallbackConfig.d.ts +42 -2
- package/build/hooks/useFitText.d.ts +2 -2
- package/build/hooks/useGoogleFont.d.ts +1 -2
- package/build/hooks/useLocales.d.ts +1 -1
- package/build/index.d.ts +20 -19
- package/build/index.es.js +13261 -13306
- package/build/index.es.js.map +1 -1
- package/build/localizations/locales/ar-AE.d.ts +1 -1
- package/build/localizations/locales/ca-AD.d.ts +1 -1
- package/build/localizations/locales/ee-EE.d.ts +1 -1
- package/build/localizations/locales/es-ES.d.ts +1 -1
- package/build/localizations/locales/fa-IR.d.ts +1 -1
- package/build/localizations/locales/fr-FR.d.ts +1 -1
- package/build/localizations/locales/index.d.ts +1 -1
- package/build/localizations/locales/ja-JP.d.ts +1 -1
- package/build/localizations/locales/pt-BR.d.ts +1 -1
- package/build/localizations/locales/ru-RU.d.ts +1 -1
- package/build/localizations/locales/tr-TR.d.ts +1 -1
- package/build/localizations/locales/vi-VN.d.ts +1 -1
- package/build/localizations/locales/zh-CN.d.ts +1 -1
- package/build/openfort/CoreOpenfortProvider.d.ts +7 -5
- package/build/openfort/context.d.ts +1 -1
- package/build/openfort/core/client.d.ts +1 -15
- package/build/openfort/core/index.d.ts +1 -1
- package/build/openfort/useOpenfort.d.ts +1 -1
- package/build/styles/index.d.ts +1 -1
- package/build/types.d.ts +3 -3
- package/build/utils/index.d.ts +1 -7
- package/build/utils/logger.d.ts +2 -2
- package/build/utils/oauthErrorHandler.d.ts +0 -1
- package/build/utils/p3.d.ts +0 -1
- package/build/utils/wallets.d.ts +0 -16
- package/build/version.d.ts +1 -1
- package/build/wallets/index.d.ts +1 -1
- package/build/wallets/useWallets.d.ts +2 -2
- package/package.json +16 -18
- package/build/components/Common/DynamicContainer/index.d.ts +0 -7
- package/build/components/Common/LazyImage/index.d.ts +0 -8
- package/build/components/Common/Logo/index.d.ts +0 -8
- package/build/components/Common/Logo/styles.d.ts +0 -6
- package/build/components/NetworkButton/index.d.ts +0 -8
- package/build/components/Pages/Connectors/styles.d.ts +0 -10
- package/build/components/Pages/SoicalProviders/styles.d.ts +0 -3
- package/build/defaultTransports.d.ts +0 -38
- package/build/hooks/connectors/useCoinbaseWalletUri.d.ts +0 -0
- package/build/hooks/openfort/auth/useThirdPartyAuth.d.ts +0 -1
- package/build/hooks/useLocalStorage.d.ts +0 -7
- package/build/styles/defaultTheme.d.ts +0 -3
- package/build/styles/types.d.ts +0 -80
- package/build/utils/localstorage.d.ts +0 -68
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const PasswordStrengthIndicator: ({ password, showPasswordIsTooWeakError }: {
|
|
1
|
+
export declare const PasswordStrengthIndicator: ({ password, showPasswordIsTooWeakError, }: {
|
|
2
2
|
password: string;
|
|
3
3
|
showPasswordIsTooWeakError: boolean;
|
|
4
4
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,34 +4,10 @@
|
|
|
4
4
|
* Provides functions for password strength calculation, passphrase generation, and password validation.
|
|
5
5
|
*/
|
|
6
6
|
export declare const MEDIUM_SCORE_THRESHOLD = 0.5;
|
|
7
|
-
export declare const STRONG_SCORE_THRESHOLD = 0.75;
|
|
8
|
-
export declare const VERY_STRONG_SCORE_THRESHOLD = 0.9;
|
|
9
7
|
/**
|
|
10
8
|
* Password strength levels.
|
|
11
9
|
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Password summary information.
|
|
15
|
-
*/
|
|
16
|
-
export interface PasswordSummary {
|
|
17
|
-
value: number;
|
|
18
|
-
label: PasswordStrengthLabel;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Gets a list of invalid characters in the provided text.
|
|
22
|
-
*
|
|
23
|
-
* Replaces spaces with `SPACE` for visibility.
|
|
24
|
-
*
|
|
25
|
-
* @param text - The text to check for invalid characters.
|
|
26
|
-
* @returns Array of unique invalid characters.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```ts
|
|
30
|
-
* const invalid = getInvalidCharacters('Pa$$ word');
|
|
31
|
-
* // invalid === ['$', 'SPACE']
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare function getInvalidCharacters(text?: string): string[];
|
|
10
|
+
type PasswordStrengthLabel = 'Weak' | 'Medium' | 'Strong' | 'Very Strong';
|
|
35
11
|
/**
|
|
36
12
|
* Converts a numeric password strength score to a human-readable label.
|
|
37
13
|
*
|
|
@@ -45,20 +21,6 @@ export declare function getInvalidCharacters(text?: string): string[];
|
|
|
45
21
|
* ```
|
|
46
22
|
*/
|
|
47
23
|
export declare function getPasswordStrengthLabel(score: number): PasswordStrengthLabel;
|
|
48
|
-
/**
|
|
49
|
-
* Calculates the diversity score of a password based on character types used.
|
|
50
|
-
*
|
|
51
|
-
* Considers lowercase, uppercase, digits, and special characters.
|
|
52
|
-
*
|
|
53
|
-
* @param password - The password to analyse.
|
|
54
|
-
* @returns A score between 0 and 1 representing character diversity.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* const diversity = calculatePasswordDiversityScore('Password123!');
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
export declare function calculatePasswordDiversityScore(password: string): number;
|
|
62
24
|
/**
|
|
63
25
|
* Calculates the overall password strength combining diversity and entropy.
|
|
64
26
|
*
|
|
@@ -71,16 +33,4 @@ export declare function calculatePasswordDiversityScore(password: string): numbe
|
|
|
71
33
|
* ```
|
|
72
34
|
*/
|
|
73
35
|
export declare function getPasswordStrength(password?: string): number;
|
|
74
|
-
|
|
75
|
-
* Gets a comprehensive summary of password strength.
|
|
76
|
-
*
|
|
77
|
-
* @param password - The password to analyse.
|
|
78
|
-
* @returns An object containing the strength value and label.
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```ts
|
|
82
|
-
* const summary = getPasswordSummary('Password123!');
|
|
83
|
-
* // summary === { value: 0.74, label: 'Strong' }
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
export declare function getPasswordSummary(password?: string): PasswordSummary;
|
|
36
|
+
export {};
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* </Web3ContextProvider>
|
|
9
9
|
* ```
|
|
10
10
|
*/
|
|
11
|
-
import { Address, Chain } from 'viem';
|
|
11
|
+
import type { Address, Chain } from 'viem';
|
|
12
12
|
type Web3Context = {
|
|
13
13
|
connect: {
|
|
14
14
|
getUri: (id?: string) => string;
|
|
@@ -23,7 +23,7 @@ type Web3Context = {
|
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
declare const Web3Context: import("react").Context<Web3Context>;
|
|
26
|
-
export declare const Web3ContextProvider: ({ enabled, children
|
|
26
|
+
export declare const Web3ContextProvider: ({ enabled, children }: {
|
|
27
27
|
enabled?: boolean;
|
|
28
28
|
children: React.ReactNode;
|
|
29
29
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/build/defaultConfig.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CoinbaseWalletParameters } from 'wagmi/connectors';
|
|
1
|
+
import type { CreateConfigParameters } from '@wagmi/core';
|
|
2
|
+
import type { CoinbaseWalletParameters } from 'wagmi/connectors';
|
|
3
3
|
export declare const getAppName: () => string;
|
|
4
|
-
export declare const getAppIcon: () => string;
|
|
5
4
|
type DefaultConfigProps = {
|
|
6
5
|
appName: string;
|
|
7
6
|
appIcon?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { type CoinbaseWalletParameters } from '@wagmi/connectors';
|
|
2
|
+
import type { CreateConnectorFn } from 'wagmi';
|
|
3
3
|
type DefaultConnectorsProps = {
|
|
4
4
|
app: {
|
|
5
5
|
name: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OpenfortError } from
|
|
1
|
+
import type { OpenfortError } from '../../../types';
|
|
2
2
|
export type BaseFlowState = {
|
|
3
|
-
status:
|
|
3
|
+
status: 'idle' | 'awaiting-input' | 'loading' | 'success';
|
|
4
4
|
error?: never;
|
|
5
5
|
} | {
|
|
6
6
|
status: 'error';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { UIAuthProvider } from
|
|
2
|
-
import { OpenfortError, OpenfortHookOptions } from
|
|
3
|
-
import { CreateWalletPostAuthOptions } from
|
|
4
|
-
import { EmailVerificationResult } from
|
|
5
|
-
import { StoreCredentialsResult } from
|
|
1
|
+
import type { UIAuthProvider } from '../../../components/Openfort/types';
|
|
2
|
+
import { OpenfortError, type OpenfortHookOptions } from '../../../types';
|
|
3
|
+
import type { CreateWalletPostAuthOptions } from './useConnectToWalletPostAuth';
|
|
4
|
+
import { type EmailVerificationResult } from './useEmailAuth';
|
|
5
|
+
import { type StoreCredentialsResult } from './useOAuth';
|
|
6
6
|
type CallbackResult = (StoreCredentialsResult & {
|
|
7
|
-
type:
|
|
7
|
+
type: 'storeCredentials';
|
|
8
8
|
}) | (EmailVerificationResult & {
|
|
9
|
-
type:
|
|
9
|
+
type: 'verifyEmail';
|
|
10
10
|
});
|
|
11
11
|
type UseAuthCallbackOptions = {
|
|
12
12
|
enabled?: boolean;
|
|
@@ -77,8 +77,15 @@ type UseAuthCallbackOptions = {
|
|
|
77
77
|
export declare const useAuthCallback: ({ enabled, ...hookOptions }?: UseAuthCallbackOptions) => {
|
|
78
78
|
email: string | null;
|
|
79
79
|
provider: UIAuthProvider | null;
|
|
80
|
-
verifyEmail: (options:
|
|
81
|
-
|
|
80
|
+
verifyEmail: (options: {
|
|
81
|
+
email: string;
|
|
82
|
+
state: string;
|
|
83
|
+
} & OpenfortHookOptions<EmailVerificationResult>) => Promise<EmailVerificationResult>;
|
|
84
|
+
storeCredentials: ({ player, accessToken, refreshToken, ...options }: {
|
|
85
|
+
player: string;
|
|
86
|
+
accessToken: string;
|
|
87
|
+
refreshToken: string;
|
|
88
|
+
} & OpenfortHookOptions<StoreCredentialsResult> & CreateWalletPostAuthOptions) => Promise<StoreCredentialsResult>;
|
|
82
89
|
isLoading: boolean;
|
|
83
90
|
isError: boolean;
|
|
84
91
|
isSuccess: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UserWallet } from
|
|
1
|
+
import { type UserWallet } from '../useWallets';
|
|
2
2
|
/**
|
|
3
3
|
* Options that control the behaviour of {@link useConnectToWalletPostAuth} when attempting to
|
|
4
4
|
* recover or create an embedded wallet after authentication.
|
|
@@ -34,7 +34,7 @@ export type CreateWalletPostAuthOptions = {
|
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
36
|
export declare const useConnectToWalletPostAuth: () => {
|
|
37
|
-
tryUseWallet: ({ logoutOnError: signOutOnError, recoverWalletAutomatically }: CreateWalletPostAuthOptions) => Promise<{
|
|
37
|
+
tryUseWallet: ({ logoutOnError: signOutOnError, recoverWalletAutomatically, }: CreateWalletPostAuthOptions) => Promise<{
|
|
38
38
|
wallet?: UserWallet;
|
|
39
39
|
}>;
|
|
40
40
|
};
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import type { AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
|
|
2
|
+
import { OpenfortError, type OpenfortHookOptions } from '../../../types';
|
|
3
|
+
import type { UserWallet } from '../useWallets';
|
|
4
|
+
import { type CreateWalletPostAuthOptions } from './useConnectToWalletPostAuth';
|
|
5
|
+
type EmailAuthResult = {
|
|
6
6
|
error?: OpenfortError;
|
|
7
7
|
user?: OpenfortUser;
|
|
8
8
|
wallet?: UserWallet;
|
|
9
9
|
requiresEmailVerification?: boolean;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
type SignInEmailOptions = {
|
|
12
12
|
email: string;
|
|
13
13
|
password: string;
|
|
14
14
|
emailVerificationRedirectTo?: string;
|
|
15
15
|
} & OpenfortHookOptions<EmailAuthResult> & CreateWalletPostAuthOptions;
|
|
16
|
-
|
|
16
|
+
type SignUpEmailOptions = {
|
|
17
17
|
email: string;
|
|
18
18
|
password: string;
|
|
19
19
|
name?: string;
|
|
20
20
|
emailVerificationRedirectTo?: string;
|
|
21
21
|
} & OpenfortHookOptions<EmailAuthResult> & CreateWalletPostAuthOptions;
|
|
22
|
-
|
|
22
|
+
type RequestResetPasswordOptions = {
|
|
23
23
|
email: string;
|
|
24
24
|
emailVerificationRedirectTo?: string;
|
|
25
25
|
} & OpenfortHookOptions<EmailAuthResult>;
|
|
26
|
-
|
|
26
|
+
type ResetPasswordOptions = {
|
|
27
27
|
email: string;
|
|
28
28
|
password: string;
|
|
29
29
|
state: string;
|
|
30
30
|
} & OpenfortHookOptions<EmailAuthResult>;
|
|
31
|
-
|
|
31
|
+
type LinkEmailOptions = {
|
|
32
32
|
email: string;
|
|
33
33
|
password: string;
|
|
34
34
|
emailVerificationRedirectTo?: string;
|
|
35
35
|
} & OpenfortHookOptions<EmailAuthResult>;
|
|
36
|
-
|
|
36
|
+
type VerifyEmailOptions = {
|
|
37
37
|
email: string;
|
|
38
38
|
state: string;
|
|
39
39
|
} & OpenfortHookOptions<EmailVerificationResult>;
|
|
@@ -41,7 +41,7 @@ export type EmailVerificationResult = {
|
|
|
41
41
|
email?: string;
|
|
42
42
|
error?: OpenfortError;
|
|
43
43
|
};
|
|
44
|
-
|
|
44
|
+
type UseEmailHookOptions = {
|
|
45
45
|
emailVerificationRedirectTo?: string;
|
|
46
46
|
} & OpenfortHookOptions<EmailAuthResult | EmailVerificationResult> & CreateWalletPostAuthOptions;
|
|
47
47
|
/**
|
|
@@ -130,3 +130,4 @@ export declare const useEmailAuth: (hookOptions?: UseEmailHookOptions) => {
|
|
|
130
130
|
resetPassword: (options: ResetPasswordOptions) => Promise<EmailAuthResult>;
|
|
131
131
|
reset: () => void;
|
|
132
132
|
};
|
|
133
|
+
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import type { AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
|
|
2
|
+
import { OpenfortError, type OpenfortHookOptions } from '../../../types';
|
|
3
|
+
import type { UserWallet } from '../useWallets';
|
|
4
|
+
import { type CreateWalletPostAuthOptions } from './useConnectToWalletPostAuth';
|
|
5
|
+
type GuestHookResult = {
|
|
6
6
|
error?: OpenfortError;
|
|
7
7
|
user?: OpenfortUser;
|
|
8
8
|
wallet?: UserWallet;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
type GuestHookOptions = OpenfortHookOptions<GuestHookResult> & CreateWalletPostAuthOptions;
|
|
11
11
|
/**
|
|
12
12
|
* Hook for guest authentication operations
|
|
13
13
|
*
|
|
@@ -74,3 +74,4 @@ export declare const useGuestAuth: (hookOptions?: GuestHookOptions) => {
|
|
|
74
74
|
error: OpenfortError | null | undefined;
|
|
75
75
|
signUpGuest: (options?: GuestHookOptions) => Promise<GuestHookResult>;
|
|
76
76
|
};
|
|
77
|
+
export {};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { OAuthProvider } from '@openfort/openfort-js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export type InitializeOAuthOptions = {
|
|
1
|
+
import type { OAuthProvider, AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
|
|
2
|
+
import { OpenfortError, type OpenfortHookOptions } from '../../../types';
|
|
3
|
+
import type { UserWallet } from '../useWallets';
|
|
4
|
+
import { type CreateWalletPostAuthOptions } from './useConnectToWalletPostAuth';
|
|
5
|
+
type InitializeOAuthOptions = {
|
|
7
6
|
provider: OAuthProvider;
|
|
8
7
|
redirectTo?: string;
|
|
9
8
|
} & OpenfortHookOptions<InitOAuthReturnType>;
|
|
10
|
-
|
|
9
|
+
type InitOAuthReturnType = {
|
|
11
10
|
error?: OpenfortError;
|
|
12
11
|
};
|
|
13
12
|
export type StoreCredentialsResult = {
|
|
@@ -15,12 +14,12 @@ export type StoreCredentialsResult = {
|
|
|
15
14
|
wallet?: UserWallet;
|
|
16
15
|
error?: OpenfortError;
|
|
17
16
|
};
|
|
18
|
-
|
|
17
|
+
type StoreCredentialsOptions = {
|
|
19
18
|
player: string;
|
|
20
19
|
accessToken: string;
|
|
21
20
|
refreshToken: string;
|
|
22
21
|
} & OpenfortHookOptions<StoreCredentialsResult> & CreateWalletPostAuthOptions;
|
|
23
|
-
|
|
22
|
+
type AuthHookOptions = {
|
|
24
23
|
redirectTo?: string;
|
|
25
24
|
} & OpenfortHookOptions<StoreCredentialsResult | InitOAuthReturnType> & CreateWalletPostAuthOptions;
|
|
26
25
|
/**
|
|
@@ -106,3 +105,4 @@ export declare const useOAuth: (hookOptions?: AuthHookOptions) => {
|
|
|
106
105
|
linkOauth: (options: InitializeOAuthOptions) => Promise<InitOAuthReturnType>;
|
|
107
106
|
storeCredentials: ({ player, accessToken, refreshToken, ...options }: StoreCredentialsOptions) => Promise<StoreCredentialsResult>;
|
|
108
107
|
};
|
|
108
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Connector } from
|
|
2
|
-
import {
|
|
1
|
+
import { type Connector } from 'wagmi';
|
|
2
|
+
import { OpenfortError, type OpenfortHookOptions } from '../../../types';
|
|
3
3
|
type ConnectWalletOptions = {
|
|
4
4
|
connector: Connector | string;
|
|
5
5
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { OpenfortError, OpenfortHookOptions } from '../../types';
|
|
2
2
|
export declare const onSuccess: <T>({ hookOptions, options, data, }: {
|
|
3
3
|
hookOptions?: OpenfortHookOptions<T>;
|
|
4
4
|
options?: OpenfortHookOptions<T>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AuthorizationRequest, type SignedAuthorization } from 'viem';
|
|
2
2
|
export type SignAuthorizationParameters = AuthorizationRequest;
|
|
3
3
|
export type SignAuthorizationReturnType = SignedAuthorization;
|
|
4
|
-
|
|
4
|
+
type SignAuthorizationOptions = {
|
|
5
5
|
hashMessage: boolean;
|
|
6
6
|
arrayifyMessage: boolean;
|
|
7
7
|
};
|
|
@@ -34,3 +34,4 @@ export type SignAuthorizationOptions = {
|
|
|
34
34
|
export declare function use7702Authorization(): {
|
|
35
35
|
signAuthorization: (parameters: SignAuthorizationParameters, options?: SignAuthorizationOptions) => Promise<SignAuthorizationReturnType>;
|
|
36
36
|
};
|
|
37
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AccountTypeEnum, RecoveryMethod, RecoveryParams } from
|
|
2
|
-
import { Hex } from
|
|
3
|
-
import { Connector } from
|
|
4
|
-
import { OpenfortError, OpenfortHookOptions } from
|
|
5
|
-
import { BaseFlowState } from
|
|
1
|
+
import { AccountTypeEnum, RecoveryMethod, type RecoveryParams } from '@openfort/openfort-js';
|
|
2
|
+
import type { Hex } from 'viem';
|
|
3
|
+
import { type Connector } from 'wagmi';
|
|
4
|
+
import { OpenfortError, type OpenfortHookOptions } from '../../types';
|
|
5
|
+
import type { BaseFlowState } from './auth/status';
|
|
6
6
|
export type UserWallet = {
|
|
7
7
|
address: Hex;
|
|
8
8
|
connectorType?: string;
|
|
@@ -20,7 +20,7 @@ export type UserWallet = {
|
|
|
20
20
|
createdAt?: number;
|
|
21
21
|
salt?: string;
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
type WalletRecovery = {
|
|
24
24
|
recoveryMethod: RecoveryMethod;
|
|
25
25
|
password?: string;
|
|
26
26
|
};
|
|
@@ -28,12 +28,12 @@ type SetActiveWalletResult = {
|
|
|
28
28
|
error?: OpenfortError;
|
|
29
29
|
wallet?: UserWallet;
|
|
30
30
|
};
|
|
31
|
-
type SetActiveWalletOptions =
|
|
31
|
+
type SetActiveWalletOptions = {
|
|
32
32
|
walletId: string;
|
|
33
33
|
recovery?: WalletRecovery;
|
|
34
34
|
address?: Hex | undefined;
|
|
35
35
|
showUI?: boolean;
|
|
36
|
-
}
|
|
36
|
+
} & OpenfortHookOptions<SetActiveWalletResult>;
|
|
37
37
|
type CreateWalletResult = SetActiveWalletResult;
|
|
38
38
|
type CreateWalletOptions = {
|
|
39
39
|
recovery?: WalletRecovery;
|
|
@@ -46,17 +46,10 @@ type SetRecoveryOptions = {
|
|
|
46
46
|
} & OpenfortHookOptions<CreateWalletResult>;
|
|
47
47
|
type WalletOptions = OpenfortHookOptions<SetActiveWalletResult | CreateWalletResult>;
|
|
48
48
|
export type WalletFlowStatus = BaseFlowState | {
|
|
49
|
-
status:
|
|
49
|
+
status: 'creating' | 'connecting';
|
|
50
50
|
address?: Hex;
|
|
51
51
|
error?: never;
|
|
52
52
|
};
|
|
53
|
-
export declare const mapWalletStatus: (status: WalletFlowStatus) => {
|
|
54
|
-
error: OpenfortError | null | undefined;
|
|
55
|
-
isError: boolean;
|
|
56
|
-
isSuccess: boolean;
|
|
57
|
-
isCreating: boolean;
|
|
58
|
-
isConnecting: boolean;
|
|
59
|
-
};
|
|
60
53
|
/**
|
|
61
54
|
* Hook for managing and interacting with user wallets
|
|
62
55
|
*
|
|
@@ -10,109 +10,15 @@
|
|
|
10
10
|
* await connect({ connector: connectors[0] });
|
|
11
11
|
* ```
|
|
12
12
|
*/
|
|
13
|
-
import { Connector, CreateConnectorFn, type UseConnectParameters } from 'wagmi';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
isError: false;
|
|
19
|
-
isIdle: true;
|
|
20
|
-
isPending: false;
|
|
21
|
-
isSuccess: false;
|
|
22
|
-
status: "idle";
|
|
23
|
-
reset: () => void;
|
|
24
|
-
context: unknown;
|
|
25
|
-
failureCount: number;
|
|
26
|
-
failureReason: import("@wagmi/core").ConnectErrorType | null;
|
|
27
|
-
isPaused: boolean;
|
|
28
|
-
submittedAt: number;
|
|
29
|
-
connect: ({ connector, chainId, mutation, }: {
|
|
30
|
-
connector: CreateConnectorFn | Connector;
|
|
31
|
-
chainId?: number;
|
|
32
|
-
mutation?: UseConnectParameters["mutation"];
|
|
33
|
-
}) => void;
|
|
34
|
-
connectAsync: ({ connector, chainId, mutation, }: {
|
|
35
|
-
connector: CreateConnectorFn | Connector;
|
|
36
|
-
chainId?: number;
|
|
37
|
-
mutation?: UseConnectParameters["mutation"];
|
|
38
|
-
}) => Promise<import("wagmi/query").ConnectData<import("wagmi").Config, Connector, boolean>>;
|
|
39
|
-
connectors: readonly Connector<CreateConnectorFn>[];
|
|
40
|
-
} | {
|
|
41
|
-
data: undefined;
|
|
42
|
-
variables: import("wagmi/query").ConnectVariables<import("wagmi").Config, Connector<CreateConnectorFn>, boolean>;
|
|
43
|
-
error: null;
|
|
44
|
-
isError: false;
|
|
45
|
-
isIdle: false;
|
|
46
|
-
isPending: true;
|
|
47
|
-
isSuccess: false;
|
|
48
|
-
status: "pending";
|
|
49
|
-
reset: () => void;
|
|
50
|
-
context: unknown;
|
|
51
|
-
failureCount: number;
|
|
52
|
-
failureReason: import("@wagmi/core").ConnectErrorType | null;
|
|
53
|
-
isPaused: boolean;
|
|
54
|
-
submittedAt: number;
|
|
55
|
-
connect: ({ connector, chainId, mutation, }: {
|
|
56
|
-
connector: CreateConnectorFn | Connector;
|
|
57
|
-
chainId?: number;
|
|
58
|
-
mutation?: UseConnectParameters["mutation"];
|
|
59
|
-
}) => void;
|
|
60
|
-
connectAsync: ({ connector, chainId, mutation, }: {
|
|
61
|
-
connector: CreateConnectorFn | Connector;
|
|
62
|
-
chainId?: number;
|
|
63
|
-
mutation?: UseConnectParameters["mutation"];
|
|
64
|
-
}) => Promise<import("wagmi/query").ConnectData<import("wagmi").Config, Connector, boolean>>;
|
|
65
|
-
connectors: readonly Connector<CreateConnectorFn>[];
|
|
66
|
-
} | {
|
|
67
|
-
data: undefined;
|
|
68
|
-
variables: import("wagmi/query").ConnectVariables<import("wagmi").Config, Connector<CreateConnectorFn>, boolean>;
|
|
69
|
-
error: import("@wagmi/core").ConnectErrorType;
|
|
70
|
-
isError: true;
|
|
71
|
-
isIdle: false;
|
|
72
|
-
isPending: false;
|
|
73
|
-
isSuccess: false;
|
|
74
|
-
status: "error";
|
|
75
|
-
reset: () => void;
|
|
76
|
-
context: unknown;
|
|
77
|
-
failureCount: number;
|
|
78
|
-
failureReason: import("@wagmi/core").ConnectErrorType | null;
|
|
79
|
-
isPaused: boolean;
|
|
80
|
-
submittedAt: number;
|
|
81
|
-
connect: ({ connector, chainId, mutation, }: {
|
|
82
|
-
connector: CreateConnectorFn | Connector;
|
|
83
|
-
chainId?: number;
|
|
84
|
-
mutation?: UseConnectParameters["mutation"];
|
|
85
|
-
}) => void;
|
|
86
|
-
connectAsync: ({ connector, chainId, mutation, }: {
|
|
87
|
-
connector: CreateConnectorFn | Connector;
|
|
88
|
-
chainId?: number;
|
|
89
|
-
mutation?: UseConnectParameters["mutation"];
|
|
90
|
-
}) => Promise<import("wagmi/query").ConnectData<import("wagmi").Config, Connector, boolean>>;
|
|
91
|
-
connectors: readonly Connector<CreateConnectorFn>[];
|
|
92
|
-
} | {
|
|
93
|
-
data: import("wagmi/query").ConnectData<import("wagmi").Config, Connector<CreateConnectorFn>, boolean>;
|
|
94
|
-
variables: import("wagmi/query").ConnectVariables<import("wagmi").Config, Connector<CreateConnectorFn>, boolean>;
|
|
95
|
-
error: null;
|
|
96
|
-
isError: false;
|
|
97
|
-
isIdle: false;
|
|
98
|
-
isPending: false;
|
|
99
|
-
isSuccess: true;
|
|
100
|
-
status: "success";
|
|
101
|
-
reset: () => void;
|
|
102
|
-
context: unknown;
|
|
103
|
-
failureCount: number;
|
|
104
|
-
failureReason: import("@wagmi/core").ConnectErrorType | null;
|
|
105
|
-
isPaused: boolean;
|
|
106
|
-
submittedAt: number;
|
|
107
|
-
connect: ({ connector, chainId, mutation, }: {
|
|
108
|
-
connector: CreateConnectorFn | Connector;
|
|
109
|
-
chainId?: number;
|
|
110
|
-
mutation?: UseConnectParameters["mutation"];
|
|
111
|
-
}) => void;
|
|
112
|
-
connectAsync: ({ connector, chainId, mutation, }: {
|
|
113
|
-
connector: CreateConnectorFn | Connector;
|
|
114
|
-
chainId?: number;
|
|
115
|
-
mutation?: UseConnectParameters["mutation"];
|
|
116
|
-
}) => Promise<import("wagmi/query").ConnectData<import("wagmi").Config, Connector, boolean>>;
|
|
117
|
-
connectors: readonly Connector<CreateConnectorFn>[];
|
|
13
|
+
import { type Connector, type CreateConnectorFn, type UseConnectParameters, type UseConnectReturnType } from 'wagmi';
|
|
14
|
+
type CustomConnectParams = {
|
|
15
|
+
connector: CreateConnectorFn | Connector;
|
|
16
|
+
chainId?: number;
|
|
17
|
+
mutation?: UseConnectParameters['mutation'];
|
|
118
18
|
};
|
|
19
|
+
type CustomUseConnectReturnType = Omit<UseConnectReturnType, 'connect' | 'connectAsync'> & {
|
|
20
|
+
connect: (params: CustomConnectParams) => void;
|
|
21
|
+
connectAsync: (params: CustomConnectParams) => Promise<unknown>;
|
|
22
|
+
};
|
|
23
|
+
export declare function useConnect({ ...props }?: UseConnectParameters): CustomUseConnectReturnType;
|
|
24
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthPlayerResponse } from '@openfort/openfort-js';
|
|
1
|
+
import type { AuthPlayerResponse } from '@openfort/openfort-js';
|
|
2
2
|
export type useConnectCallbackProps = {
|
|
3
3
|
onConnect?: ({ address, connectorId, user, }: {
|
|
4
4
|
address?: string;
|
|
@@ -7,4 +7,4 @@ export type useConnectCallbackProps = {
|
|
|
7
7
|
}) => void;
|
|
8
8
|
onDisconnect?: () => void;
|
|
9
9
|
};
|
|
10
|
-
export declare const useConnectCallback: ({ onConnect, onDisconnect
|
|
10
|
+
export declare const useConnectCallback: ({ onConnect, onDisconnect }: useConnectCallbackProps) => void;
|