@openfort/react-native 0.1.19 → 0.1.20

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.
@@ -69,7 +69,7 @@ function startEmbeddedStatePolling(client, onChange, intervalMs = 1000) {
69
69
  * }
70
70
  * ```
71
71
  */
72
- export const OpenfortProvider = ({ children, publishableKey, customAuth, supportedChains, walletConfig, overrides, thirdPartyAuth, verbose = false, }) => {
72
+ export const OpenfortProvider = ({ children, publishableKey, supportedChains, walletConfig, overrides, thirdPartyAuth, verbose = false, }) => {
73
73
  // Validate environment variables before anything else
74
74
  validateEnvironment({
75
75
  publishableKey,
@@ -215,33 +215,10 @@ export const OpenfortProvider = ({ children, publishableKey, customAuth, support
215
215
  cancelled = true;
216
216
  };
217
217
  }, [client, isUserInitialized, handleUserChange, refreshUserState]);
218
- // Custom auth state management
219
- useEffect(() => {
220
- if (customAuth?.enabled && isUserInitialized && isClientReady) {
221
- ;
222
- (async () => {
223
- try {
224
- const { getCustomAccessToken, isLoading } = customAuth;
225
- if (isLoading)
226
- return;
227
- const customToken = await getCustomAccessToken();
228
- if (customToken) {
229
- // Custom auth sync implementation would go here
230
- // This would typically handle SIWE authentication with the custom token
231
- logger.debug('Custom token available for authentication sync');
232
- }
233
- }
234
- catch (err) {
235
- logger.error('Custom auth sync failed', err);
236
- }
237
- })();
238
- }
239
- }, [client, customAuth, isUserInitialized, isClientReady]);
240
218
  // Determine if SDK is ready
241
219
  const isReady = useMemo(() => {
242
- const customAuthReady = !customAuth?.enabled || !customAuth.isLoading;
243
- return isUserInitialized && isClientReady && customAuthReady;
244
- }, [isUserInitialized, isClientReady, customAuth?.enabled, customAuth?.isLoading]);
220
+ return isUserInitialized && isClientReady;
221
+ }, [isUserInitialized, isClientReady]);
245
222
  // Context value
246
223
  const contextValue = useMemo(() => ({
247
224
  client,
@@ -51,7 +51,7 @@ export function useWallets(hookOptions = {}) {
51
51
  const { client, user, supportedChains, walletConfig, embeddedState, _internal } = useOpenfortContext();
52
52
  const [embeddedAccounts, setEmbeddedAccounts] = useState([]);
53
53
  const recoverPromiseRef = useRef(null);
54
- const [activeWalletId, setActiveWalletId] = useState(null); // OPENFORT-JS Should provide this
54
+ const [activeWalletId, setActiveWalletId] = useState(null);
55
55
  const [status, setStatus] = useState({
56
56
  status: 'idle',
57
57
  });
@@ -154,7 +154,7 @@ export function useWallets(hookOptions = {}) {
154
154
  if (!embeddedAccountToRecover) {
155
155
  const errorMsg = walletConfig?.accountType === AccountTypeEnum.EOA
156
156
  ? `No embedded EOA account found for address ${address}`
157
- : `No embedded account found for address ${address} on chain ID ${chainId}`;
157
+ : `No embedded smart account found for address ${address} on chain ID ${chainId}`;
158
158
  throw new OpenfortError(errorMsg, OpenfortErrorType.WALLET_ERROR);
159
159
  }
160
160
  else {
@@ -319,10 +319,9 @@ export function useWallets(hookOptions = {}) {
319
319
  // Use the first supported chain as default
320
320
  chainId = supportedChains[0].id;
321
321
  }
322
- else {
322
+ else if (options?.chainType !== ChainTypeEnum.SVM) {
323
323
  throw new OpenfortError('No supported chains available for wallet creation', OpenfortErrorType.WALLET_ERROR);
324
324
  }
325
- logger.info('Using chain ID for wallet creation', chainId);
326
325
  let recoveryParams;
327
326
  if (options?.recoveryPassword) {
328
327
  recoveryParams = {
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@
11
11
  // Re-export commonly used types from @openfort/openfort-js
12
12
  // Re-export enums and values from @openfort/openfort-js
13
13
  // Re-export event listener functionality from @openfort/openfort-js
14
- export { AccountTypeEnum, EmbeddedState, OAuthProvider, Openfort as OpenfortClient, OpenfortConfiguration, OpenfortError, OpenfortEvents, openfortEvents, RecoveryMethod, ShieldConfiguration, } from '@openfort/openfort-js';
14
+ export { AccountTypeEnum, ChainTypeEnum, EmbeddedState, OAuthProvider, Openfort as OpenfortClient, OpenfortConfiguration, OpenfortError, OpenfortEvents, openfortEvents, RecoveryMethod, ShieldConfiguration, } from '@openfort/openfort-js';
15
15
  // Re-export all components and UI elements
16
16
  export * from './components';
17
17
  // Re-export constants
@@ -19,9 +19,7 @@
19
19
  */
20
20
  export const onSuccess = ({ hookOptions, options, data, }) => {
21
21
  hookOptions?.onSuccess?.(data);
22
- hookOptions?.onSettled?.(data, null);
23
22
  options?.onSuccess?.(data);
24
- options?.onSettled?.(data, null);
25
23
  return data;
26
24
  };
27
25
  /**
@@ -49,9 +47,7 @@ export const onSuccess = ({ hookOptions, options, data, }) => {
49
47
  */
50
48
  export const onError = ({ hookOptions, options, error, }) => {
51
49
  hookOptions?.onError?.(error);
52
- hookOptions?.onSettled?.(null, error);
53
50
  options?.onError?.(error);
54
- options?.onSettled?.(null, error);
55
51
  if (hookOptions?.throwOnError || options?.throwOnError)
56
52
  throw error;
57
53
  return { error };
@@ -1,13 +1,5 @@
1
1
  import { type AccountTypeEnum, type SDKOverrides, type ThirdPartyAuthConfiguration } from '@openfort/openfort-js';
2
2
  import React from 'react';
3
- /**
4
- * Shape for configuring custom authentication synchronization behavior.
5
- */
6
- interface CustomAuthConfig {
7
- enabled: boolean;
8
- isLoading: boolean;
9
- getCustomAccessToken: () => Promise<string | null>;
10
- }
11
3
  type PolicyConfig = string | Record<number, string>;
12
4
  export type CommonEmbeddedWalletConfiguration = {
13
5
  /** Publishable key for the Shield API. */
@@ -88,7 +80,6 @@ export type Chain = {
88
80
  */
89
81
  export interface OpenfortProviderProps {
90
82
  children: React.ReactNode;
91
- customAuth?: CustomAuthConfig;
92
83
  /**
93
84
  * Openfort application ID (can be found in the Openfort developer dashboard).
94
85
  */
@@ -142,5 +133,5 @@ export interface OpenfortProviderProps {
142
133
  * }
143
134
  * ```
144
135
  */
145
- export declare const OpenfortProvider: ({ children, publishableKey, customAuth, supportedChains, walletConfig, overrides, thirdPartyAuth, verbose, }: OpenfortProviderProps) => React.JSX.Element;
136
+ export declare const OpenfortProvider: ({ children, publishableKey, supportedChains, walletConfig, overrides, thirdPartyAuth, verbose, }: OpenfortProviderProps) => React.JSX.Element;
146
137
  export {};
@@ -7,7 +7,7 @@
7
7
  * required to integrate Openfort authentication and embedded wallets into React Native and
8
8
  * Expo applications.
9
9
  */
10
- export { AccountTypeEnum, AuthInitPayload, AuthPlayerResponse, AuthResponse, EmbeddedAccount, EmbeddedState, OAuthProvider, Openfort as OpenfortClient, OpenfortConfiguration, OpenfortError, OpenfortEventMap, OpenfortEvents, openfortEvents, Provider, RecoveryMethod, RecoveryParams, ShieldConfiguration, SignedMessagePayload, } from '@openfort/openfort-js';
10
+ export { AccountTypeEnum, AuthInitPayload, AuthPlayerResponse, AuthResponse, ChainTypeEnum, EmbeddedAccount, EmbeddedState, OAuthProvider, Openfort as OpenfortClient, OpenfortConfiguration, OpenfortError, OpenfortEventMap, OpenfortEvents, openfortEvents, Provider, RecoveryMethod, RecoveryParams, ShieldConfiguration, SignedMessagePayload, } from '@openfort/openfort-js';
11
11
  export * from './components';
12
12
  export * from './constants';
13
13
  export * from './core';
@@ -39,21 +39,6 @@ export type SiweFlowState = {
39
39
  export type RecoveryFlowState = {
40
40
  status: 'initial' | 'creating-wallet' | 'upgrading-recovery' | 'recovering';
41
41
  };
42
- /**
43
- * Custom authentication flow state
44
- */
45
- export type CustomAuthFlowState = {
46
- status: 'initial';
47
- } | {
48
- status: 'loading';
49
- } | {
50
- status: 'not-enabled';
51
- } | {
52
- status: 'done';
53
- } | {
54
- status: 'error';
55
- error: Error | null;
56
- };
57
42
  /**
58
43
  * Authentication success callback
59
44
  */
@@ -1,23 +1,3 @@
1
- /**
2
- * Custom authentication provider configuration
3
- */
4
- export type CustomAuthProviderConfig = {
5
- /**
6
- * If true, enable custom authentication integration.
7
- * This enables a JWT from a custom auth provider to be used to authenticate Openfort embedded wallets.
8
- * Defaults to true.
9
- */
10
- enabled?: boolean;
11
- /**
12
- * A callback that returns the user's custom auth provider's access token as a string.
13
- * Can be left blank if using cookies to store and send access tokens
14
- */
15
- getCustomAccessToken: () => Promise<string | undefined>;
16
- /**
17
- * Custom auth providers loading state
18
- */
19
- isLoading: boolean;
20
- };
21
1
  /**
22
2
  * Create guest account interface
23
3
  */
@@ -4,6 +4,5 @@ export type OpenfortHookOptions<T = {
4
4
  }> = {
5
5
  onSuccess?: (data: T) => void;
6
6
  onError?: (error: OpenfortError) => void;
7
- onSettled?: (data: T | undefined | null, error: OpenfortError | null) => void;
8
7
  throwOnError?: boolean;
9
8
  };
@@ -13,8 +13,8 @@ export interface UseOpenfort {
13
13
  /** A function that gets the current authenticated user's access token. */
14
14
  getAccessToken: () => Promise<string | null>;
15
15
  }
16
- export type { AuthLinkSuccessCallback, AuthSuccessCallback, CustomAuthFlowState, EmailLinkHookOptions, EmailLinkHookResult, EmailLoginHookOptions, EmailLoginHookResult, ErrorCallback, GenerateSiweMessage, GenerateSiweMessageResponse, PasswordFlowState, RecoveryFlowState, SiweFlowState, SiweLinkHookOptions, SiweLinkHookResult, SiweLoginHookOptions, SiweLoginHookResult, } from './auth';
17
- export type { CustomAuthProviderConfig, SetRecoveryParams, UseGuestAuth, UseOnEmbeddedWalletStateChange, UseSetEmbeddedWalletRecovery, UseSetEmbeddedWalletRecoveryResult, } from './config';
16
+ export type { AuthLinkSuccessCallback, AuthSuccessCallback, EmailLinkHookOptions, EmailLinkHookResult, EmailLoginHookOptions, EmailLoginHookResult, ErrorCallback, GenerateSiweMessage, GenerateSiweMessageResponse, PasswordFlowState, RecoveryFlowState, SiweFlowState, SiweLinkHookOptions, SiweLinkHookResult, SiweLoginHookOptions, SiweLoginHookResult, } from './auth';
17
+ export type { SetRecoveryParams, UseGuestAuth, UseOnEmbeddedWalletStateChange, UseSetEmbeddedWalletRecovery, UseSetEmbeddedWalletRecoveryResult, } from './config';
18
18
  export type { LinkWithOAuthInput, LoginWithOAuthInput, OAuthFlowState, OAuthTokens, UnlinkOAuthOptions, UnlinkOAuthParams, UseLinkWithOAuth, UseLoginWithOAuth, UseOAuthTokensOptions, } from './oauth';
19
19
  export { canTransact, getActionText, getStateDescription, hasError, isConnected, isConnecting, isCreating, isDisconnected, isLoading, isNotCreated, isReady, isReconnecting, isStable, needsRecovery, needsUserAction, } from './predicates';
20
20
  export type { ConnectedEmbeddedEthereumWallet, ConnectedEmbeddedSolanaWallet, CreateSolanaEmbeddedWalletOpts, EmbeddedEthereumWalletActions, EmbeddedEthereumWalletState, EmbeddedSolanaWalletActions, EmbeddedSolanaWalletConnectedState, EmbeddedSolanaWalletConnectingState, EmbeddedSolanaWalletCreatingState, EmbeddedSolanaWalletDisconnectedState, EmbeddedSolanaWalletErrorState, EmbeddedSolanaWalletNeedsRecoveryState, EmbeddedSolanaWalletReconnectingState, EmbeddedSolanaWalletState, EmbeddedSolanaWalletStatus, EmbeddedWalletStatus, OpenfortEmbeddedWalletAccount, RecoverSolanaEmbeddedWalletOpts, RecoveryMethodOptions, SolanaWalletRecoveryCallbacks, UserWallet, WalletRecoveryCallbacks, } from './wallet';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openfort/react-native",
3
3
  "main": "dist/index.js",
4
- "version": "0.1.19",
4
+ "version": "0.1.20",
5
5
  "license": "MIT",
6
6
  "description": "React Native SDK for Openfort platform integration",
7
7
  "types": "dist/types/index.d.ts",