We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e9b0051 commit 893ec93Copy full SHA for 893ec93
apps/wallet/src/hooks/use-get-wallet.tsx
@@ -0,0 +1,29 @@
1
+import { queryOptions, useQuery } from '@tanstack/react-query'
2
+
3
+import { useAPI } from '../providers/api-client'
4
5
+export const useGetWallet = (walletId: string, password: string) => {
6
+ const api = useAPI()
7
8
+ const result = useQuery(
9
+ queryOptions({
10
+ enabled: Boolean(walletId && password),
11
+ queryKey: ['get-wallet', walletId],
12
+ queryFn: async () => {
13
+ const { mnemonic } = await api.wallet.get.query({
14
+ walletId,
15
+ password,
16
+ })
17
18
+ return mnemonic
19
+ },
20
+ staleTime: 60 * 60 * 1000, // 1 hour
21
+ gcTime: 60 * 60 * 1000, // 1 hour
22
+ refetchOnMount: false,
23
+ refetchOnWindowFocus: false,
24
+ refetchOnReconnect: false,
25
+ }),
26
+ )
27
28
+ return result
29
+}
0 commit comments