@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,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ChainTypeEnum } from '@openfort/openfort-js';
|
|
2
|
+
/**
|
|
3
|
+
* Ethereum wallet provider interface for EIP-1193 compatible operations
|
|
4
|
+
*/
|
|
5
|
+
export interface OpenfortEmbeddedEthereumWalletProvider {
|
|
2
6
|
request: (args: {
|
|
3
7
|
method: string;
|
|
4
8
|
params?: any[];
|
|
@@ -7,256 +11,156 @@ interface OpenfortEmbeddedEthereumWalletProvider {
|
|
|
7
11
|
removeListener: (event: string, handler: (...args: any[]) => void) => void;
|
|
8
12
|
[key: string]: any;
|
|
9
13
|
}
|
|
10
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Solana wallet provider interface
|
|
16
|
+
*/
|
|
17
|
+
export interface OpenfortEmbeddedSolanaWalletProvider {
|
|
18
|
+
signMessage: (message: string) => Promise<string>;
|
|
11
19
|
signTransaction: (transaction: any) => Promise<any>;
|
|
12
20
|
signAllTransactions: (transactions: any[]) => Promise<any[]>;
|
|
13
21
|
publicKey: string;
|
|
14
22
|
[key: string]: any;
|
|
15
23
|
}
|
|
16
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Connected Ethereum wallet
|
|
26
|
+
*/
|
|
27
|
+
export type ConnectedEmbeddedEthereumWallet = {
|
|
17
28
|
address: string;
|
|
18
29
|
ownerAddress?: string;
|
|
19
30
|
implementationType?: string;
|
|
20
|
-
chainType:
|
|
21
|
-
walletIndex: number;
|
|
22
|
-
}
|
|
23
|
-
interface OpenfortSolanaEmbeddedWalletAccount {
|
|
24
|
-
address: string;
|
|
25
|
-
chainType: 'solana';
|
|
31
|
+
chainType: ChainTypeEnum.EVM;
|
|
26
32
|
walletIndex: number;
|
|
27
|
-
|
|
28
|
-
import type { ChainTypeEnum } from '@openfort/openfort-js';
|
|
29
|
-
import type { ErrorCallback } from './auth';
|
|
30
|
-
import type { Hex } from './hex';
|
|
31
|
-
/**
|
|
32
|
-
* Openfort embedded wallet account union type
|
|
33
|
-
*/
|
|
34
|
-
export type OpenfortEmbeddedWalletAccount = OpenfortEthereumEmbeddedWalletAccount | OpenfortSolanaEmbeddedWalletAccount;
|
|
35
|
-
/**
|
|
36
|
-
* Wallet recovery callbacks
|
|
37
|
-
*/
|
|
38
|
-
export type WalletRecoveryCallbacks = {
|
|
39
|
-
onError?: ErrorCallback;
|
|
40
|
-
onSuccess?: (provider: OpenfortEmbeddedEthereumWalletProvider) => void;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Solana wallet recovery callbacks
|
|
44
|
-
*/
|
|
45
|
-
export type SolanaWalletRecoveryCallbacks = {
|
|
46
|
-
onError?: ErrorCallback;
|
|
47
|
-
onSuccess?: (provider: OpenfortEmbeddedSolanaWalletProvider) => void;
|
|
33
|
+
getProvider: () => Promise<OpenfortEmbeddedEthereumWalletProvider>;
|
|
48
34
|
};
|
|
49
35
|
/**
|
|
50
|
-
*
|
|
36
|
+
* Connected Solana wallet
|
|
51
37
|
*/
|
|
52
|
-
export type
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
export type ConnectedEmbeddedSolanaWallet = {
|
|
39
|
+
address: string;
|
|
40
|
+
chainType: ChainTypeEnum.SVM;
|
|
41
|
+
walletIndex: number;
|
|
42
|
+
getProvider: () => Promise<OpenfortEmbeddedSolanaWalletProvider>;
|
|
57
43
|
};
|
|
58
44
|
/**
|
|
59
|
-
* Solana wallet creation options
|
|
45
|
+
* Simplified Solana wallet creation options
|
|
60
46
|
*/
|
|
61
|
-
export type CreateSolanaEmbeddedWalletOpts =
|
|
62
|
-
|
|
63
|
-
|
|
47
|
+
export type CreateSolanaEmbeddedWalletOpts = {
|
|
48
|
+
/**
|
|
49
|
+
* Optional recovery password for password-based recovery.
|
|
50
|
+
* If omitted, automatic recovery will be used.
|
|
51
|
+
*/
|
|
52
|
+
recoveryPassword?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Create additional wallet if one already exists
|
|
55
|
+
*/
|
|
64
56
|
createAdditional?: boolean;
|
|
65
57
|
};
|
|
66
58
|
/**
|
|
67
|
-
*
|
|
59
|
+
* Ethereum wallet hook return type - discriminated union based on status
|
|
68
60
|
*/
|
|
69
|
-
export type
|
|
70
|
-
|
|
61
|
+
export type EmbeddedEthereumWalletState = {
|
|
62
|
+
status: 'disconnected';
|
|
63
|
+
activeWallet: null;
|
|
64
|
+
create: (...args: any[]) => Promise<any>;
|
|
65
|
+
wallets: ConnectedEmbeddedEthereumWallet[];
|
|
66
|
+
setActive: (...args: any[]) => Promise<void>;
|
|
67
|
+
setRecovery: (...args: any[]) => Promise<void>;
|
|
68
|
+
exportPrivateKey: (...args: any[]) => Promise<any>;
|
|
71
69
|
} | {
|
|
72
|
-
recoveryMethod: 'password';
|
|
73
|
-
password: string;
|
|
74
|
-
};
|
|
75
|
-
export type UserWallet = {
|
|
76
|
-
address: Hex;
|
|
77
|
-
ownerAddress?: string;
|
|
78
|
-
implementationType?: string;
|
|
79
|
-
chainType: ChainTypeEnum;
|
|
80
|
-
isActive?: boolean;
|
|
81
|
-
isConnecting?: boolean;
|
|
82
|
-
getProvider: () => Promise<OpenfortEmbeddedEthereumWalletProvider>;
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Connected embedded wallet state
|
|
86
|
-
*/
|
|
87
|
-
interface IEmbeddedEthereumWalletConnectedState {
|
|
88
|
-
status: 'connected';
|
|
89
|
-
provider: OpenfortEmbeddedEthereumWalletProvider;
|
|
90
|
-
activeWallet: UserWallet;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Connecting embedded wallet state
|
|
94
|
-
*/
|
|
95
|
-
interface IEmbeddedEthereumWalletConnectingState {
|
|
96
70
|
status: 'connecting';
|
|
97
|
-
activeWallet:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
71
|
+
activeWallet: ConnectedEmbeddedEthereumWallet;
|
|
72
|
+
create: (...args: any[]) => Promise<any>;
|
|
73
|
+
wallets: ConnectedEmbeddedEthereumWallet[];
|
|
74
|
+
setActive: (...args: any[]) => Promise<void>;
|
|
75
|
+
setRecovery: (...args: any[]) => Promise<void>;
|
|
76
|
+
exportPrivateKey: (...args: any[]) => Promise<any>;
|
|
77
|
+
} | {
|
|
103
78
|
status: 'reconnecting';
|
|
104
|
-
activeWallet:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
activeWallet: null;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Needs recovery embedded wallet state
|
|
115
|
-
*/
|
|
116
|
-
interface IEmbeddedEthereumWalletNeedsRecoveryState {
|
|
117
|
-
status: 'needs-recovery';
|
|
118
|
-
activeWallet: UserWallet;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Creating embedded wallet state
|
|
122
|
-
*/
|
|
123
|
-
interface IEmbeddedEthereumWalletCreatingState {
|
|
79
|
+
activeWallet: ConnectedEmbeddedEthereumWallet;
|
|
80
|
+
create: (...args: any[]) => Promise<any>;
|
|
81
|
+
wallets: ConnectedEmbeddedEthereumWallet[];
|
|
82
|
+
setActive: (...args: any[]) => Promise<void>;
|
|
83
|
+
setRecovery: (...args: any[]) => Promise<void>;
|
|
84
|
+
exportPrivateKey: (...args: any[]) => Promise<any>;
|
|
85
|
+
} | {
|
|
124
86
|
status: 'creating';
|
|
125
87
|
activeWallet: null;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
88
|
+
create: (...args: any[]) => Promise<any>;
|
|
89
|
+
wallets: ConnectedEmbeddedEthereumWallet[];
|
|
90
|
+
setActive: (...args: any[]) => Promise<void>;
|
|
91
|
+
setRecovery: (...args: any[]) => Promise<void>;
|
|
92
|
+
exportPrivateKey: (...args: any[]) => Promise<any>;
|
|
93
|
+
} | {
|
|
94
|
+
status: 'needs-recovery';
|
|
95
|
+
activeWallet: ConnectedEmbeddedEthereumWallet;
|
|
96
|
+
create: (...args: any[]) => Promise<any>;
|
|
97
|
+
wallets: ConnectedEmbeddedEthereumWallet[];
|
|
98
|
+
setActive: (...args: any[]) => Promise<void>;
|
|
99
|
+
setRecovery: (...args: any[]) => Promise<void>;
|
|
100
|
+
exportPrivateKey: (...args: any[]) => Promise<any>;
|
|
101
|
+
} | {
|
|
102
|
+
status: 'connected';
|
|
103
|
+
activeWallet: ConnectedEmbeddedEthereumWallet;
|
|
104
|
+
provider: OpenfortEmbeddedEthereumWalletProvider;
|
|
105
|
+
create: (...args: any[]) => Promise<any>;
|
|
106
|
+
wallets: ConnectedEmbeddedEthereumWallet[];
|
|
107
|
+
setActive: (...args: any[]) => Promise<void>;
|
|
108
|
+
setRecovery: (...args: any[]) => Promise<void>;
|
|
109
|
+
exportPrivateKey: (...args: any[]) => Promise<any>;
|
|
110
|
+
} | {
|
|
131
111
|
status: 'error';
|
|
132
|
-
activeWallet:
|
|
112
|
+
activeWallet: ConnectedEmbeddedEthereumWallet | null;
|
|
133
113
|
error: string;
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Embedded wallet actions
|
|
137
|
-
*/
|
|
138
|
-
export type EmbeddedEthereumWalletActions = {
|
|
139
|
-
/**
|
|
140
|
-
* Configure an embedded wallet for this user.
|
|
141
|
-
*/
|
|
142
|
-
create: (args?: {
|
|
143
|
-
chainId?: number;
|
|
144
|
-
recoveryPassword?: string;
|
|
145
|
-
policyId?: string;
|
|
146
|
-
}) => Promise<import('@openfort/openfort-js').EmbeddedAccount>;
|
|
147
|
-
/**
|
|
148
|
-
* List of embedded ethereum wallets at each derived HD index.
|
|
149
|
-
*/
|
|
114
|
+
create: (...args: any[]) => Promise<any>;
|
|
150
115
|
wallets: ConnectedEmbeddedEthereumWallet[];
|
|
116
|
+
setActive: (...args: any[]) => Promise<void>;
|
|
117
|
+
setRecovery: (...args: any[]) => Promise<void>;
|
|
118
|
+
exportPrivateKey: (...args: any[]) => Promise<any>;
|
|
151
119
|
};
|
|
152
|
-
type EthereumWalletState = IEmbeddedEthereumWalletConnectedState | IEmbeddedEthereumWalletConnectingState | IEmbeddedEthereumWalletReconnectingState | IEmbeddedEthereumWalletDisconnectedState | IEmbeddedEthereumWalletNeedsRecoveryState | IEmbeddedEthereumWalletCreatingState | IEmbeddedEthereumWalletErrorState;
|
|
153
|
-
/**
|
|
154
|
-
* Main embedded wallet state union
|
|
155
|
-
*/
|
|
156
|
-
export type EmbeddedEthereumWalletState = EthereumWalletState & EmbeddedEthereumWalletActions;
|
|
157
|
-
/**
|
|
158
|
-
* Embedded wallet status
|
|
159
|
-
*/
|
|
160
|
-
export type EmbeddedWalletStatus = EmbeddedEthereumWalletState['status'];
|
|
161
120
|
/**
|
|
162
|
-
*
|
|
121
|
+
* Solana wallet hook return type - discriminated union based on status
|
|
163
122
|
*/
|
|
164
|
-
|
|
165
|
-
status: 'connected';
|
|
166
|
-
activeWallet: OpenfortSolanaEmbeddedWalletAccount;
|
|
167
|
-
provider: OpenfortEmbeddedEthereumWalletProvider;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Connecting embedded Solana wallet state
|
|
171
|
-
*/
|
|
172
|
-
interface IEmbeddedSolanaWalletConnectingState {
|
|
173
|
-
status: 'connecting';
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Reconnecting embedded Solana wallet state
|
|
177
|
-
*/
|
|
178
|
-
interface IEmbeddedSolanaWalletReconnectingState {
|
|
179
|
-
status: 'reconnecting';
|
|
180
|
-
activeWallet: OpenfortSolanaEmbeddedWalletAccount;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Disconnected embedded Solana wallet state
|
|
184
|
-
*/
|
|
185
|
-
interface IEmbeddedSolanaWalletDisconnectedState {
|
|
123
|
+
export type EmbeddedSolanaWalletState = {
|
|
186
124
|
status: 'disconnected';
|
|
187
125
|
activeWallet: null;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
126
|
+
create: (...args: any[]) => Promise<any>;
|
|
127
|
+
wallets: ConnectedEmbeddedSolanaWallet[];
|
|
128
|
+
setActive: (...args: any[]) => Promise<void>;
|
|
129
|
+
} | {
|
|
130
|
+
status: 'connecting';
|
|
131
|
+
create: (...args: any[]) => Promise<any>;
|
|
132
|
+
wallets: ConnectedEmbeddedSolanaWallet[];
|
|
133
|
+
setActive: (...args: any[]) => Promise<void>;
|
|
134
|
+
} | {
|
|
135
|
+
status: 'reconnecting';
|
|
136
|
+
activeWallet: ConnectedEmbeddedSolanaWallet;
|
|
137
|
+
create: (...args: any[]) => Promise<any>;
|
|
138
|
+
wallets: ConnectedEmbeddedSolanaWallet[];
|
|
139
|
+
setActive: (...args: any[]) => Promise<void>;
|
|
140
|
+
} | {
|
|
200
141
|
status: 'creating';
|
|
201
142
|
activeWallet: null;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
143
|
+
create: (...args: any[]) => Promise<any>;
|
|
144
|
+
wallets: ConnectedEmbeddedSolanaWallet[];
|
|
145
|
+
setActive: (...args: any[]) => Promise<void>;
|
|
146
|
+
} | {
|
|
147
|
+
status: 'needs-recovery';
|
|
148
|
+
activeWallet: ConnectedEmbeddedSolanaWallet;
|
|
149
|
+
create: (...args: any[]) => Promise<any>;
|
|
150
|
+
wallets: ConnectedEmbeddedSolanaWallet[];
|
|
151
|
+
setActive: (...args: any[]) => Promise<void>;
|
|
152
|
+
} | {
|
|
153
|
+
status: 'connected';
|
|
154
|
+
activeWallet: ConnectedEmbeddedSolanaWallet;
|
|
155
|
+
provider: OpenfortEmbeddedSolanaWalletProvider;
|
|
156
|
+
create: (...args: any[]) => Promise<any>;
|
|
157
|
+
wallets: ConnectedEmbeddedSolanaWallet[];
|
|
158
|
+
setActive: (...args: any[]) => Promise<void>;
|
|
159
|
+
} | {
|
|
207
160
|
status: 'error';
|
|
208
|
-
activeWallet:
|
|
161
|
+
activeWallet: ConnectedEmbeddedSolanaWallet | null;
|
|
209
162
|
error: string;
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Connected embedded Solana wallet
|
|
213
|
-
*/
|
|
214
|
-
export type ConnectedEmbeddedSolanaWallet = {
|
|
215
|
-
address: string;
|
|
216
|
-
chainType: 'solana';
|
|
217
|
-
walletIndex: number;
|
|
218
|
-
getProvider: () => Promise<OpenfortEmbeddedSolanaWalletProvider>;
|
|
219
|
-
};
|
|
220
|
-
/**
|
|
221
|
-
* Embedded Solana wallet actions
|
|
222
|
-
*/
|
|
223
|
-
export type EmbeddedSolanaWalletActions = {
|
|
224
|
-
/**
|
|
225
|
-
* Configure an embedded wallet for this user.
|
|
226
|
-
*/
|
|
227
|
-
create: (args?: {
|
|
228
|
-
chainId?: number;
|
|
229
|
-
recoveryPassword?: string;
|
|
230
|
-
}) => Promise<import('@openfort/openfort-js').EmbeddedAccount>;
|
|
231
|
-
/**
|
|
232
|
-
* List of embedded solana wallets
|
|
233
|
-
*/
|
|
163
|
+
create: (...args: any[]) => Promise<any>;
|
|
234
164
|
wallets: ConnectedEmbeddedSolanaWallet[];
|
|
165
|
+
setActive: (...args: any[]) => Promise<void>;
|
|
235
166
|
};
|
|
236
|
-
export type EmbeddedSolanaWalletConnectedState = EmbeddedSolanaWalletActions & IEmbeddedSolanaWalletConnectedState;
|
|
237
|
-
export type EmbeddedSolanaWalletConnectingState = EmbeddedSolanaWalletActions & IEmbeddedSolanaWalletConnectingState;
|
|
238
|
-
export type EmbeddedSolanaWalletReconnectingState = EmbeddedSolanaWalletActions & IEmbeddedSolanaWalletReconnectingState;
|
|
239
|
-
export type EmbeddedSolanaWalletDisconnectedState = Partial<EmbeddedSolanaWalletActions> & IEmbeddedSolanaWalletDisconnectedState;
|
|
240
|
-
export type EmbeddedSolanaWalletNeedsRecoveryState = EmbeddedSolanaWalletActions & IEmbeddedSolanaWalletNeedsRecoveryState;
|
|
241
|
-
export type EmbeddedSolanaWalletCreatingState = EmbeddedSolanaWalletActions & IEmbeddedSolanaWalletCreatingState;
|
|
242
|
-
export type EmbeddedSolanaWalletErrorState = EmbeddedSolanaWalletActions & IEmbeddedSolanaWalletErrorState;
|
|
243
|
-
/**
|
|
244
|
-
* Main embedded Solana wallet state union
|
|
245
|
-
*/
|
|
246
|
-
export type EmbeddedSolanaWalletState = EmbeddedSolanaWalletConnectedState | EmbeddedSolanaWalletConnectingState | EmbeddedSolanaWalletReconnectingState | EmbeddedSolanaWalletDisconnectedState | EmbeddedSolanaWalletNeedsRecoveryState | EmbeddedSolanaWalletCreatingState | EmbeddedSolanaWalletErrorState;
|
|
247
|
-
/**
|
|
248
|
-
* Embedded Solana wallet status
|
|
249
|
-
*/
|
|
250
|
-
export type EmbeddedSolanaWalletStatus = EmbeddedSolanaWalletState['status'];
|
|
251
|
-
/**
|
|
252
|
-
* Connected Ethereum wallet
|
|
253
|
-
*/
|
|
254
|
-
export type ConnectedEmbeddedEthereumWallet = {
|
|
255
|
-
address: string;
|
|
256
|
-
ownerAddress?: string;
|
|
257
|
-
implementationType?: string;
|
|
258
|
-
chainType: 'ethereum';
|
|
259
|
-
walletIndex: number;
|
|
260
|
-
getProvider: () => Promise<OpenfortEmbeddedEthereumWalletProvider>;
|
|
261
|
-
};
|
|
262
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hook for creating wallets after user authentication.
|
|
4
|
-
*
|
|
5
|
-
* TODO: the implementation is currently a placeholder that always returns an
|
|
6
|
-
* undefined wallet. Once the post-auth wallet flow is wired up, this helper will
|
|
7
|
-
* attempt to provision or connect an embedded wallet automatically.
|
|
8
|
-
*
|
|
9
|
-
* @returns Object containing wallet creation utilities (placeholder for now).
|
|
10
|
-
*/
|
|
11
|
-
const _useCreateWalletPostAuth = () => {
|
|
12
|
-
// This would connect to the wallet and set it as active
|
|
13
|
-
// eslint-disable-next-line no-empty-pattern
|
|
14
|
-
const tryUseWallet = useCallback(
|
|
15
|
-
// async ({/* logoutOnError: signOutOnError = true, automaticRecovery = true */}: CreateWalletPostAuthOptions) => {
|
|
16
|
-
async (_props) => {
|
|
17
|
-
// if (!walletConfig || walletConfig.recoveryMethod !== RecoveryMethod.AUTOMATIC || !automaticRecovery) {
|
|
18
|
-
// return {};
|
|
19
|
-
// }
|
|
20
|
-
// const wallet = await setActiveWallet({
|
|
21
|
-
// connector: embeddedWalletId,
|
|
22
|
-
// });
|
|
23
|
-
// if (wallet.error && signOutOnError) {
|
|
24
|
-
// // If there was an error and we should log out, we can call the logout function
|
|
25
|
-
// await signOut();
|
|
26
|
-
// }
|
|
27
|
-
return { wallet: undefined };
|
|
28
|
-
}, [
|
|
29
|
-
/* walletConfig, setActiveWallet, signOut */
|
|
30
|
-
]);
|
|
31
|
-
return {
|
|
32
|
-
tryUseWallet,
|
|
33
|
-
};
|
|
34
|
-
};
|