@openfort/react-native 0.1.20 → 0.1.21
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/dist/components/AuthBoundary.js +4 -1
- package/dist/core/index.js +1 -1
- package/dist/core/provider.js +0 -1
- package/dist/hooks/auth/useEmailAuth.js +90 -3
- package/dist/hooks/core/useOpenfort.js +3 -17
- package/dist/hooks/wallet/index.js +4 -2
- package/dist/hooks/wallet/solanaProvider.js +77 -0
- package/dist/hooks/wallet/useEmbeddedEthereumWallet.js +465 -0
- package/dist/hooks/wallet/useEmbeddedSolanaWallet.js +391 -0
- package/dist/hooks/wallet/utils.js +75 -0
- package/dist/lib/hookConsistency.js +6 -0
- package/dist/native/oauth.js +13 -0
- package/dist/native/storage.js +4 -0
- package/dist/native/webview.js +15 -1
- package/dist/types/components/AuthBoundary.d.ts +1 -0
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/hooks/auth/useEmailAuth.d.ts +6 -7
- package/dist/types/hooks/auth/useGuestAuth.d.ts +1 -2
- package/dist/types/hooks/auth/useOAuth.d.ts +1 -2
- package/dist/types/hooks/core/useOpenfort.d.ts +2 -13
- package/dist/types/hooks/wallet/index.d.ts +2 -1
- package/dist/types/hooks/wallet/solanaProvider.d.ts +75 -0
- package/dist/types/hooks/wallet/useEmbeddedEthereumWallet.d.ts +53 -0
- package/dist/types/hooks/wallet/useEmbeddedSolanaWallet.d.ts +47 -0
- package/dist/types/hooks/wallet/utils.d.ts +17 -0
- package/dist/types/index.js +1 -2
- package/dist/types/lib/hookConsistency.d.ts +6 -0
- package/dist/types/native/oauth.d.ts +13 -0
- package/dist/types/native/storage.d.ts +4 -0
- package/dist/types/native/webview.d.ts +14 -0
- package/dist/types/types/auth.d.ts +0 -41
- package/dist/types/types/index.d.ts +3 -30
- package/dist/types/types/oauth.d.ts +0 -38
- package/dist/types/types/wallet.d.ts +120 -216
- package/package.json +1 -1
- package/dist/hooks/auth/useCreateWalletPostAuth.js +0 -34
- package/dist/hooks/wallet/useWallets.js +0 -436
- package/dist/types/config.js +0 -1
- package/dist/types/hooks/auth/useCreateWalletPostAuth.d.ts +0 -1
- package/dist/types/hooks/wallet/useWallets.d.ts +0 -78
- package/dist/types/predicates.js +0 -120
- package/dist/types/types/config.d.ts +0 -39
- package/dist/types/types/predicates.d.ts +0 -118
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import type { EmbeddedEthereumWalletState, EmbeddedSolanaWalletConnectedState, EmbeddedSolanaWalletConnectingState, EmbeddedSolanaWalletCreatingState, EmbeddedSolanaWalletDisconnectedState, EmbeddedSolanaWalletErrorState, EmbeddedSolanaWalletNeedsRecoveryState, EmbeddedSolanaWalletReconnectingState, EmbeddedSolanaWalletState } from './wallet';
|
|
2
|
-
/**
|
|
3
|
-
* Type guard to check if embedded wallet is connected
|
|
4
|
-
*
|
|
5
|
-
* This function determines whether an embedded wallet is in a connected state and ready for use.
|
|
6
|
-
* It provides TypeScript type narrowing for wallet state management.
|
|
7
|
-
*
|
|
8
|
-
* @param s - The embedded wallet state to check
|
|
9
|
-
* @returns True if the wallet is connected, false otherwise
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
* const { wallets } = useWallets();
|
|
14
|
-
* const wallet = wallets[0];
|
|
15
|
-
*
|
|
16
|
-
* if (isConnected(wallet)) {
|
|
17
|
-
* // TypeScript knows wallet is connected, safe to use
|
|
18
|
-
* const provider = await wallet.getProvider();
|
|
19
|
-
* console.log('Wallet is connected:', wallet.address);
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare function isConnected(s: EmbeddedSolanaWalletState): s is EmbeddedSolanaWalletConnectedState;
|
|
24
|
-
/**
|
|
25
|
-
* Type guard to check if embedded wallet is reconnecting
|
|
26
|
-
*/
|
|
27
|
-
export declare function isReconnecting(s: EmbeddedSolanaWalletState): s is EmbeddedSolanaWalletReconnectingState;
|
|
28
|
-
/**
|
|
29
|
-
* Type guard to check if embedded wallet is connecting
|
|
30
|
-
*/
|
|
31
|
-
export declare function isConnecting(s: EmbeddedSolanaWalletState): s is EmbeddedSolanaWalletConnectingState;
|
|
32
|
-
/**
|
|
33
|
-
* Type guard to check if embedded wallet is disconnected
|
|
34
|
-
*
|
|
35
|
-
* This function determines whether an embedded wallet is in a disconnected state.
|
|
36
|
-
* Disconnected wallets need to be connected before they can be used for transactions.
|
|
37
|
-
*
|
|
38
|
-
* @param s - The embedded wallet state to check
|
|
39
|
-
* @returns True if the wallet is disconnected, false otherwise
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```tsx
|
|
43
|
-
* const { wallets, setActiveWallet } = useWallets();
|
|
44
|
-
* const wallet = wallets[0];
|
|
45
|
-
*
|
|
46
|
-
* if (isDisconnected(wallet)) {
|
|
47
|
-
* console.log('Wallet needs connection');
|
|
48
|
-
* await setActiveWallet({ address: wallet.address });
|
|
49
|
-
* }
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export declare function isDisconnected(s: EmbeddedSolanaWalletState): s is EmbeddedSolanaWalletDisconnectedState;
|
|
53
|
-
/**
|
|
54
|
-
* Type guard to check if embedded wallet is not created
|
|
55
|
-
*/
|
|
56
|
-
export declare function isNotCreated(s: EmbeddedSolanaWalletState): s is EmbeddedSolanaWalletDisconnectedState;
|
|
57
|
-
/**
|
|
58
|
-
* Type guard to check if embedded wallet is being created
|
|
59
|
-
*/
|
|
60
|
-
export declare function isCreating(s: EmbeddedSolanaWalletState): s is EmbeddedSolanaWalletCreatingState;
|
|
61
|
-
/**
|
|
62
|
-
* Type guard to check if embedded wallet has an error
|
|
63
|
-
*/
|
|
64
|
-
export declare function hasError(s: EmbeddedSolanaWalletState): s is EmbeddedSolanaWalletErrorState;
|
|
65
|
-
/**
|
|
66
|
-
* Type guard to check if embedded wallet needs recovery
|
|
67
|
-
*/
|
|
68
|
-
export declare function needsRecovery(s: EmbeddedSolanaWalletState): s is EmbeddedSolanaWalletNeedsRecoveryState;
|
|
69
|
-
/**
|
|
70
|
-
* Additional utility predicates
|
|
71
|
-
*/
|
|
72
|
-
/**
|
|
73
|
-
* Type guard to check if wallet is in a loading state
|
|
74
|
-
*
|
|
75
|
-
* This function determines whether a wallet is currently in a transitional state
|
|
76
|
-
* (connecting, creating, or reconnecting) and should show loading indicators.
|
|
77
|
-
*
|
|
78
|
-
* @param s - The embedded wallet state to check
|
|
79
|
-
* @returns True if the wallet is in any loading state, false otherwise
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* ```tsx
|
|
83
|
-
* const { wallets } = useWallets();
|
|
84
|
-
* const wallet = wallets[0];
|
|
85
|
-
*
|
|
86
|
-
* if (isLoading(wallet)) {
|
|
87
|
-
* return <ActivityIndicator />; // Show spinner
|
|
88
|
-
* }
|
|
89
|
-
*
|
|
90
|
-
* // Safe to show wallet interface
|
|
91
|
-
* return <WalletInterface wallet={wallet} />;
|
|
92
|
-
* ```
|
|
93
|
-
*/
|
|
94
|
-
export declare function isLoading(s: EmbeddedEthereumWalletState | EmbeddedSolanaWalletState): boolean;
|
|
95
|
-
/**
|
|
96
|
-
* Type guard to check if wallet is ready for use
|
|
97
|
-
*/
|
|
98
|
-
export declare function isReady(s: EmbeddedEthereumWalletState | EmbeddedSolanaWalletState): boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Type guard to check if wallet needs user action
|
|
101
|
-
*/
|
|
102
|
-
export declare function needsUserAction(s: EmbeddedEthereumWalletState | EmbeddedSolanaWalletState): boolean;
|
|
103
|
-
/**
|
|
104
|
-
* Type guard to check if wallet state is stable (not in transition)
|
|
105
|
-
*/
|
|
106
|
-
export declare function isStable(s: EmbeddedEthereumWalletState | EmbeddedSolanaWalletState): boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Type guard to check if wallet can perform transactions
|
|
109
|
-
*/
|
|
110
|
-
export declare function canTransact(s: EmbeddedEthereumWalletState | EmbeddedSolanaWalletState): boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Gets a human-readable description of the wallet state
|
|
113
|
-
*/
|
|
114
|
-
export declare function getStateDescription(s: EmbeddedEthereumWalletState | EmbeddedSolanaWalletState): string;
|
|
115
|
-
/**
|
|
116
|
-
* Gets appropriate action text for the current state
|
|
117
|
-
*/
|
|
118
|
-
export declare function getActionText(s: EmbeddedEthereumWalletState | EmbeddedSolanaWalletState): string;
|