@frak-labs/react-sdk 0.0.6 → 0.0.8

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/index.d.ts CHANGED
@@ -1,298 +1,342 @@
1
- import * as react from 'react';
2
- import { PropsWithChildren, CSSProperties, ReactNode } from 'react';
3
- import * as _frak_labs_core_sdk from '@frak-labs/core-sdk';
4
- import { FrakWalletSdkConfig, FrakClient, WalletStatusReturnType, SendTransactionReturnType, FrakRpcError, SiweAuthenticateReturnType, DisplayModalParamsType, ModalStepTypes, SendInteractionReturnType, SendInteractionParamsType, ModalRpcStepsResultType, OpenSsoParamsType, GetProductInformationReturnType } from '@frak-labs/core-sdk';
5
- import * as _tanstack_react_query from '@tanstack/react-query';
6
- import { UseMutationOptions, UseQueryOptions } from '@tanstack/react-query';
7
- import { SendTransactionParams, SiweAuthenticateModalParams, ProcessReferralOptions } from '@frak-labs/core-sdk/actions';
8
- import { Hex } from 'viem';
9
-
10
- /**
11
- * The context that will keep the Frak Wallet SDK configuration
12
- * @ignore
13
- */
14
- declare const FrakConfigContext: react.Context<FrakWalletSdkConfig | undefined>;
15
- /**
16
- * Props to instantiate the Frak Wallet SDK configuration provider
17
- *
18
- * @group provider
19
- */
20
- type FrakConfigProviderProps = {
21
- /**
22
- * The wanted Frak configuration
23
- * @see {@link @frak-labs/core-sdk!index.FrakWalletSdkConfig | FrakWalletSdkConfig}
24
- */
25
- config: FrakWalletSdkConfig;
26
- };
27
- /**
28
- * Simple config provider for the Frak Wallet SDK
29
- *
30
- * Should be wrapped within a {@link @tanstack/react-query!QueryClientProvider | `QueryClientProvider`}
31
- *
32
- * @group provider
33
- *
34
- * @param parameters
35
- */
36
- declare function FrakConfigProvider(parameters: PropsWithChildren<FrakConfigProviderProps>): react.FunctionComponentElement<react.ProviderProps<FrakWalletSdkConfig | undefined>>;
37
-
38
- /**
39
- * The context that will keep the Frak Wallet SDK client
40
- * @ignore
41
- */
42
- declare const FrakIFrameClientContext: react.Context<FrakClient | undefined>;
43
- /**
44
- * Props to instantiate the Frak Wallet SDK configuration provider
45
- *
46
- * @group provider
47
- */
48
- type FrakIFrameClientProps = {
49
- config: FrakWalletSdkConfig;
50
- };
51
- /**
52
- * IFrame client provider for the Frak Wallet SDK
53
- * It will automatically create the frak wallet iFrame (required for the wallet to communicate with the SDK securely), and provide it in the context
54
- *
55
- * @group provider
56
- *
57
- * @remarks
58
- * This provider must be wrapped within a {@link FrakConfigProvider} to work properly
59
- *
60
- * @param args
61
- * @param args.style - Some custom styles to apply to the iFrame
62
- * @param args.children - Descedant components that will have access to the Frak Client
63
- */
64
- declare function FrakIFrameClientProvider({ style, children, }: {
65
- style?: CSSProperties;
66
- children?: ReactNode;
67
- }): react.FunctionComponentElement<{
68
- children?: ReactNode | undefined;
69
- }>;
70
-
71
- /**
72
- * Get the current Frak config
73
- * @throws {FrakRpcError} if the config is not found (only if this hooks is used outside a FrakConfigProvider)
74
- * @group hooks
75
- *
76
- * @see {@link @frak-labs/react-sdk!FrakConfigProvider | FrakConfigProvider} for the config provider
77
- * @see {@link @frak-labs/core-sdk!index.FrakWalletSdkConfig | FrakWalletSdkConfig} for the config type
78
- */
79
- declare function useFrakConfig(): _frak_labs_core_sdk.FrakWalletSdkConfig;
80
-
81
- /**
82
- * Get the current Frak client
83
- *
84
- * @group hooks
85
- */
86
- declare function useFrakClient(): _frak_labs_core_sdk.FrakClient | undefined;
87
-
88
- /**
89
- * Hook that return a query helping to get the current wallet status.
90
- *
91
- * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.watchWalletStatus | `watchWalletStatus()`} action
92
- *
93
- * @group hooks
94
- *
95
- * @returns
96
- * The query hook wrapping the `watchWalletStatus()` action
97
- * The `data` result is a {@link @frak-labs/core-sdk!index.WalletStatusReturnType | `WalletStatusReturnType`}
98
- *
99
- * @see {@link @frak-labs/core-sdk!actions.watchWalletStatus | `watchWalletStatus()`} for more info about the underlying action
100
- * @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery response
101
- */
102
- declare function useWalletStatus(): _tanstack_react_query.UseQueryResult<WalletStatusReturnType, Error>;
103
-
104
- /** @ignore */
105
- type MutationOptions$4 = Omit<UseMutationOptions<SendTransactionReturnType, FrakRpcError, SendTransactionParams>, "mutationFn" | "mutationKey">;
106
- /** @inline */
107
- interface UseSendTransactionParams {
108
- /**
109
- * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
110
- */
111
- mutations?: MutationOptions$4;
112
- }
113
- /**
114
- * Hook that return a mutation helping to send a transaction
115
- *
116
- * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} action
117
- *
118
- * @param args
119
- *
120
- * @group hooks
121
- *
122
- * @returns
123
- * The mutation hook wrapping the `sendTransaction()` action
124
- * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!actions.SendTransactionParams | `SendTransactionParams`}
125
- * The `data` result is a {@link @frak-labs/core-sdk!index.SendTransactionReturnType | `SendTransactionReturnType`}
126
- *
127
- * @see {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} for more info about the underlying action
128
- * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
129
- */
130
- declare function useSendTransactionAction({ mutations, }?: UseSendTransactionParams): _tanstack_react_query.UseMutationResult<SendTransactionReturnType, FrakRpcError<undefined>, SendTransactionParams, unknown>;
131
-
132
- /** @inline */
133
- type MutationOptions$3 = Omit<UseMutationOptions<SiweAuthenticateReturnType, FrakRpcError, SiweAuthenticateModalParams>, "mutationFn" | "mutationKey">;
134
- /** @ignore */
135
- interface UseSiweAuthenticateParams {
136
- /**
137
- * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
138
- */
139
- mutations?: MutationOptions$3;
140
- }
141
- /**
142
- * Hook that return a mutation helping to send perform a SIWE authentication
143
- *
144
- * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} action
145
- *
146
- * @param args
147
- *
148
- * @group hooks
149
- *
150
- * @returns
151
- * The mutation hook wrapping the `siweAuthenticate()` action
152
- * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!actions.SiweAuthenticateModalParams | `SiweAuthenticateModalParams`}
153
- * The `data` result is a {@link @frak-labs/core-sdk!index.SiweAuthenticateReturnType | `SiweAuthenticateReturnType`}
154
- *
155
- * @see {@link @frak-labs/core-sdk!actions.siweAuthenticate | `siweAuthenticate()`} for more info about the underlying action
156
- * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
157
- */
158
- declare function useSiweAuthenticate({ mutations, }?: UseSiweAuthenticateParams): _tanstack_react_query.UseMutationResult<SiweAuthenticateReturnType, FrakRpcError<undefined>, SiweAuthenticateModalParams, unknown>;
159
-
160
- /**
161
- * Helper hook to automatically submit a referral interaction when detected
162
- *
163
- * @group hooks
164
- *
165
- * @param args
166
- * @param args.productId - The product id to interact with (if not specified will be recomputed from the current domain)
167
- * @param args.modalConfig - The modal configuration to display if the user is not logged in
168
- * @param args.options - Some options for the referral interaction
169
- *
170
- * @returns The resulting referral state, or a potential error
171
- *
172
- * @description This function will automatically handle the referral interaction process
173
- *
174
- * @see {@link @frak-labs/core-sdk!actions.processReferral | `processReferral()`} for more details on the automatic referral handling process
175
- */
176
- declare function useReferralInteraction({ productId, modalConfig, options, }?: {
177
- productId?: Hex;
178
- modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
179
- options?: ProcessReferralOptions;
180
- }): Error | ("error" | "no-referrer" | "idle" | "processing" | "success" | "no-wallet" | "no-session" | "self-referral");
181
-
182
- /** @ignore */
183
- type MutationOptions$2 = Omit<UseMutationOptions<SendInteractionReturnType, FrakRpcError, SendInteractionParamsType>, "mutationFn" | "mutationKey">;
184
- /** @inline */
185
- interface UseSendInteractionParams$1 {
186
- /**
187
- * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
188
- */
189
- mutations?: MutationOptions$2;
190
- }
191
- /**
192
- * Hook that return a mutation helping to send a user interaction
193
- *
194
- * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendInteraction | `sendInteraction()`} action
195
- *
196
- * @param args
197
- *
198
- * @group hooks
199
- *
200
- * @returns
201
- * The mutation hook wrapping the `sendInteraction()` action
202
- * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.SendInteractionParamsType | `SendInteractionParamsType`}
203
- * The `data` result is a {@link @frak-labs/core-sdk!index.SendInteractionReturnType | `SendInteractionReturnType`}
204
- *
205
- * @see {@link @frak-labs/core-sdk!actions.sendInteraction | `sendInteraction()`} for more info about the underlying action
206
- * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
207
- */
208
- declare function useSendInteraction({ mutations, }?: UseSendInteractionParams$1): _tanstack_react_query.UseMutationResult<SendInteractionReturnType, FrakRpcError<undefined>, SendInteractionParamsType, unknown>;
209
-
210
- /** @ignore */
211
- type MutationOptions$1<T extends ModalStepTypes[]> = Omit<UseMutationOptions<ModalRpcStepsResultType<T>, FrakRpcError, DisplayModalParamsType<T>>, "mutationFn" | "mutationKey">;
212
- /** @inline */
213
- interface UseDisplayModalParams<T extends ModalStepTypes[] = ModalStepTypes[]> {
214
- /**
215
- * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
216
- */
217
- mutations?: MutationOptions$1<T>;
218
- }
219
- /**
220
- * Hook that return a mutation helping to display a modal to the user
221
- *
222
- * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.displayModal | `displayModal()`} action
223
- *
224
- * @param args
225
- *
226
- * @typeParam T
227
- * The modal steps types to display (the result will correspond to the steps types asked in params)
228
- * An array of {@link @frak-labs/core-sdk!index.ModalStepTypes | `ModalStepTypes`}
229
- * If not provided, it will default to a generic array of `ModalStepTypes`
230
- *
231
- * @group hooks
232
- *
233
- * @returns
234
- * The mutation hook wrapping the `displayModal()` action
235
- * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.DisplayModalParamsType | `DisplayModalParamsType<T>`}, with type params `T` being the modal steps types to display
236
- * The `data` result is a {@link @frak-labs/core-sdk!index.ModalRpcStepsResultType | `ModalRpcStepsResultType`}
237
- *
238
- * @see {@link @frak-labs/core-sdk!actions.displayModal | `displayModal()`} for more info about the underlying action
239
- * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
240
- */
241
- declare function useDisplayModal<T extends ModalStepTypes[] = ModalStepTypes[]>({ mutations, }?: UseDisplayModalParams<T>): _tanstack_react_query.UseMutationResult<ModalRpcStepsResultType<T>, FrakRpcError<undefined>, DisplayModalParamsType<T>, unknown>;
242
-
243
- /** @ignore */
244
- type MutationOptions = Omit<UseMutationOptions<void, FrakRpcError, OpenSsoParamsType>, "mutationFn" | "mutationKey">;
245
- /** @inline */
246
- interface UseSendInteractionParams {
247
- /**
248
- * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
249
- */
250
- mutations?: MutationOptions;
251
- }
252
- /**
253
- * Hook that return a mutation helping to open the SSO page
254
- *
255
- * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} action
256
- *
257
- * @param args
258
- *
259
- * @group hooks
260
- *
261
- * @returns
262
- * The mutation hook wrapping the `openSso()` action
263
- * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.OpenSsoParamsType | `OpenSsoParamsType`}
264
- * The mutation doesn't output any value
265
- *
266
- * @see {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} for more info about the underlying action
267
- * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
268
- */
269
- declare function useOpenSso({ mutations }?: UseSendInteractionParams): _tanstack_react_query.UseMutationResult<void, FrakRpcError<undefined>, OpenSsoParamsType, unknown>;
270
-
271
- /** @ignore */
272
- type QueryOptions = Omit<UseQueryOptions<GetProductInformationReturnType, FrakRpcError, undefined>, "queryKey" | "queryFn">;
273
- /** @inline */
274
- interface UseGetProductInformationParams {
275
- /**
276
- * Optional query options, see {@link @tanstack/react-query!useQuery | `useQuery()`} for more infos
277
- */
278
- query?: QueryOptions;
279
- }
280
- /**
281
- * Hook that return a query helping to get the current product information
282
- *
283
- * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.getProductInformation | `getProductInformation()`} action
284
- *
285
- * @param args
286
- *
287
- * @group hooks
288
- *
289
- * @returns
290
- * The query hook wrapping the `getProductInformation()` action
291
- * The `data` result is a {@link @frak-labs/core-sdk!index.GetProductInformationReturnType | `GetProductInformationReturnType`}
292
- *
293
- * @see {@link @frak-labs/core-sdk!actions.getProductInformation | `getProductInformation()`} for more info about the underlying action
294
- * @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery options and response
295
- */
296
- declare function useGetProductInformation({ query, }?: UseGetProductInformationParams): _tanstack_react_query.UseQueryResult<undefined, FrakRpcError<undefined>>;
297
-
298
- export { FrakConfigContext, FrakConfigProvider, type FrakConfigProviderProps, FrakIFrameClientContext, type FrakIFrameClientProps, FrakIFrameClientProvider, useDisplayModal, useFrakClient, useFrakConfig, useGetProductInformation, useOpenSso, useReferralInteraction, useSendInteraction, useSendTransactionAction, useSiweAuthenticate, useWalletStatus };
1
+ import { Context } from 'react';
2
+ import { CSSProperties } from 'react';
3
+ import { DisplayModalParamsType } from '@frak-labs/core-sdk';
4
+ import { FrakClient } from '@frak-labs/core-sdk';
5
+ import { FrakRpcError } from '@frak-labs/core-sdk';
6
+ import { FrakWalletSdkConfig } from '@frak-labs/core-sdk';
7
+ import { FunctionComponentElement } from 'react';
8
+ import { GetProductInformationReturnType } from '@frak-labs/core-sdk';
9
+ import { Hex } from 'viem';
10
+ import { ModalRpcStepsResultType } from '@frak-labs/core-sdk';
11
+ import { ModalStepTypes } from '@frak-labs/core-sdk';
12
+ import { OpenSsoParamsType } from '@frak-labs/core-sdk';
13
+ import { ProcessReferralOptions } from '@frak-labs/core-sdk/actions';
14
+ import { PropsWithChildren } from 'react';
15
+ import { ProviderProps } from 'react';
16
+ import { ReactNode } from 'react';
17
+ import { SendInteractionParamsType } from '@frak-labs/core-sdk';
18
+ import { SendInteractionReturnType } from '@frak-labs/core-sdk';
19
+ import { SendTransactionParams } from '@frak-labs/core-sdk/actions';
20
+ import { SendTransactionReturnType } from '@frak-labs/core-sdk';
21
+ import { SiweAuthenticateModalParams } from '@frak-labs/core-sdk/actions';
22
+ import { SiweAuthenticateReturnType } from '@frak-labs/core-sdk';
23
+ import { UseMutationOptions } from '@tanstack/react-query';
24
+ import { UseMutationResult } from '@tanstack/react-query';
25
+ import { UseQueryOptions } from '@tanstack/react-query';
26
+ import { UseQueryResult } from '@tanstack/react-query';
27
+ import { WalletStatusReturnType } from '@frak-labs/core-sdk';
28
+
29
+ /**
30
+ * The context that will keep the Frak Wallet SDK configuration
31
+ * @ignore
32
+ */
33
+ export declare const FrakConfigContext: Context<FrakWalletSdkConfig | undefined>;
34
+
35
+ /**
36
+ * Simple config provider for the Frak Wallet SDK
37
+ *
38
+ * Should be wrapped within a {@link @tanstack/react-query!QueryClientProvider | `QueryClientProvider`}
39
+ *
40
+ * @group provider
41
+ *
42
+ * @param parameters
43
+ */
44
+ export declare function FrakConfigProvider(parameters: PropsWithChildren<FrakConfigProviderProps>): FunctionComponentElement<ProviderProps<FrakWalletSdkConfig | undefined>>;
45
+
46
+ /**
47
+ * Props to instantiate the Frak Wallet SDK configuration provider
48
+ *
49
+ * @group provider
50
+ */
51
+ export declare type FrakConfigProviderProps = {
52
+ /**
53
+ * The wanted Frak configuration
54
+ * @see {@link @frak-labs/core-sdk!index.FrakWalletSdkConfig | FrakWalletSdkConfig}
55
+ */
56
+ config: FrakWalletSdkConfig;
57
+ };
58
+
59
+ /**
60
+ * The context that will keep the Frak Wallet SDK client
61
+ * @ignore
62
+ */
63
+ export declare const FrakIFrameClientContext: Context<FrakClient | undefined>;
64
+
65
+ /**
66
+ * Props to instantiate the Frak Wallet SDK configuration provider
67
+ *
68
+ * @group provider
69
+ */
70
+ export declare type FrakIFrameClientProps = {
71
+ config: FrakWalletSdkConfig;
72
+ };
73
+
74
+ /**
75
+ * IFrame client provider for the Frak Wallet SDK
76
+ * It will automatically create the frak wallet iFrame (required for the wallet to communicate with the SDK securely), and provide it in the context
77
+ *
78
+ * @group provider
79
+ *
80
+ * @remarks
81
+ * This provider must be wrapped within a {@link FrakConfigProvider} to work properly
82
+ *
83
+ * @param args
84
+ * @param args.style - Some custom styles to apply to the iFrame
85
+ * @param args.children - Descedant components that will have access to the Frak Client
86
+ */
87
+ export declare function FrakIFrameClientProvider({ style, children, }: {
88
+ style?: CSSProperties;
89
+ children?: ReactNode;
90
+ }): FunctionComponentElement< {
91
+ children?: ReactNode | undefined;
92
+ }>;
93
+
94
+ /** @ignore */
95
+ declare type MutationOptions = Omit<UseMutationOptions<SendTransactionReturnType, FrakRpcError, SendTransactionParams>, "mutationFn" | "mutationKey">;
96
+
97
+ /** @ignore */
98
+ declare type MutationOptions_2 = Omit<UseMutationOptions<SendInteractionReturnType, FrakRpcError, SendInteractionParamsType>, "mutationFn" | "mutationKey">;
99
+
100
+ /** @inline */
101
+ declare type MutationOptions_3 = Omit<UseMutationOptions<SiweAuthenticateReturnType, FrakRpcError, SiweAuthenticateModalParams>, "mutationFn" | "mutationKey">;
102
+
103
+ /** @ignore */
104
+ declare type MutationOptions_4<T extends ModalStepTypes[]> = Omit<UseMutationOptions<ModalRpcStepsResultType<T>, FrakRpcError, DisplayModalParamsType<T>>, "mutationFn" | "mutationKey">;
105
+
106
+ /** @ignore */
107
+ declare type MutationOptions_5 = Omit<UseMutationOptions<void, FrakRpcError, OpenSsoParamsType>, "mutationFn" | "mutationKey">;
108
+
109
+ /** @ignore */
110
+ declare type QueryOptions = Omit<UseQueryOptions<GetProductInformationReturnType, FrakRpcError, undefined>, "queryKey" | "queryFn">;
111
+
112
+ /**
113
+ * Hook that return a mutation helping to display a modal to the user
114
+ *
115
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.displayModal | `displayModal()`} action
116
+ *
117
+ * @param args
118
+ *
119
+ * @typeParam T
120
+ * The modal steps types to display (the result will correspond to the steps types asked in params)
121
+ * An array of {@link @frak-labs/core-sdk!index.ModalStepTypes | `ModalStepTypes`}
122
+ * If not provided, it will default to a generic array of `ModalStepTypes`
123
+ *
124
+ * @group hooks
125
+ *
126
+ * @returns
127
+ * The mutation hook wrapping the `displayModal()` action
128
+ * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.DisplayModalParamsType | `DisplayModalParamsType<T>`}, with type params `T` being the modal steps types to display
129
+ * The `data` result is a {@link @frak-labs/core-sdk!index.ModalRpcStepsResultType | `ModalRpcStepsResultType`}
130
+ *
131
+ * @see {@link @frak-labs/core-sdk!actions.displayModal | `displayModal()`} for more info about the underlying action
132
+ * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
133
+ */
134
+ export declare function useDisplayModal<T extends ModalStepTypes[] = ModalStepTypes[]>({ mutations, }?: UseDisplayModalParams<T>): UseMutationResult< { [K in T[number]["key"]]: Extract<T[number], {
135
+ key: K;
136
+ }>["returns"]; }, FrakRpcError<undefined>, DisplayModalParamsType<T>, unknown>;
137
+
138
+ /** @inline */
139
+ declare interface UseDisplayModalParams<T extends ModalStepTypes[] = ModalStepTypes[]> {
140
+ /**
141
+ * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
142
+ */
143
+ mutations?: MutationOptions_4<T>;
144
+ }
145
+
146
+ /**
147
+ * Get the current Frak client
148
+ *
149
+ * @group hooks
150
+ */
151
+ export declare function useFrakClient(): FrakClient | undefined;
152
+
153
+ /**
154
+ * Get the current Frak config
155
+ * @throws {FrakRpcError} if the config is not found (only if this hooks is used outside a FrakConfigProvider)
156
+ * @group hooks
157
+ *
158
+ * @see {@link @frak-labs/react-sdk!FrakConfigProvider | FrakConfigProvider} for the config provider
159
+ * @see {@link @frak-labs/core-sdk!index.FrakWalletSdkConfig | FrakWalletSdkConfig} for the config type
160
+ */
161
+ export declare function useFrakConfig(): FrakWalletSdkConfig;
162
+
163
+ /**
164
+ * Hook that return a query helping to get the current product information
165
+ *
166
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.getProductInformation | `getProductInformation()`} action
167
+ *
168
+ * @param args
169
+ *
170
+ * @group hooks
171
+ *
172
+ * @returns
173
+ * The query hook wrapping the `getProductInformation()` action
174
+ * The `data` result is a {@link @frak-labs/core-sdk!index.GetProductInformationReturnType | `GetProductInformationReturnType`}
175
+ *
176
+ * @see {@link @frak-labs/core-sdk!actions.getProductInformation | `getProductInformation()`} for more info about the underlying action
177
+ * @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery options and response
178
+ */
179
+ export declare function useGetProductInformation({ query, }?: UseGetProductInformationParams): UseQueryResult<undefined, FrakRpcError<undefined>>;
180
+
181
+ /** @inline */
182
+ declare interface UseGetProductInformationParams {
183
+ /**
184
+ * Optional query options, see {@link @tanstack/react-query!useQuery | `useQuery()`} for more infos
185
+ */
186
+ query?: QueryOptions;
187
+ }
188
+
189
+ /**
190
+ * Hook that return a mutation helping to open the SSO page
191
+ *
192
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} action
193
+ *
194
+ * @param args
195
+ *
196
+ * @group hooks
197
+ *
198
+ * @returns
199
+ * The mutation hook wrapping the `openSso()` action
200
+ * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.OpenSsoParamsType | `OpenSsoParamsType`}
201
+ * The mutation doesn't output any value
202
+ *
203
+ * @see {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} for more info about the underlying action
204
+ * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
205
+ */
206
+ export declare function useOpenSso({ mutations }?: UseSendInteractionParams_2): UseMutationResult<void, FrakRpcError<undefined>, OpenSsoParamsType, unknown>;
207
+
208
+ /**
209
+ * Helper hook to automatically submit a referral interaction when detected
210
+ *
211
+ * @group hooks
212
+ *
213
+ * @param args
214
+ * @param args.productId - The product id to interact with (if not specified will be recomputed from the current domain)
215
+ * @param args.modalConfig - The modal configuration to display if the user is not logged in
216
+ * @param args.options - Some options for the referral interaction
217
+ *
218
+ * @returns The resulting referral state, or a potential error
219
+ *
220
+ * @description This function will automatically handle the referral interaction process
221
+ *
222
+ * @see {@link @frak-labs/core-sdk!actions.processReferral | `processReferral()`} for more details on the automatic referral handling process
223
+ */
224
+ export declare function useReferralInteraction({ productId, modalConfig, options, }?: {
225
+ productId?: Hex;
226
+ modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
227
+ options?: ProcessReferralOptions;
228
+ }): Error | ("error" | "no-referrer" | "idle" | "processing" | "success" | "no-wallet" | "no-session" | "self-referral");
229
+
230
+ /**
231
+ * Hook that return a mutation helping to send a user interaction
232
+ *
233
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendInteraction | `sendInteraction()`} action
234
+ *
235
+ * @param args
236
+ *
237
+ * @group hooks
238
+ *
239
+ * @returns
240
+ * The mutation hook wrapping the `sendInteraction()` action
241
+ * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.SendInteractionParamsType | `SendInteractionParamsType`}
242
+ * The `data` result is a {@link @frak-labs/core-sdk!index.SendInteractionReturnType | `SendInteractionReturnType`}
243
+ *
244
+ * @see {@link @frak-labs/core-sdk!actions.sendInteraction | `sendInteraction()`} for more info about the underlying action
245
+ * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
246
+ */
247
+ export declare function useSendInteraction({ mutations, }?: UseSendInteractionParams): UseMutationResult< {
248
+ delegationId: string;
249
+ }, FrakRpcError<undefined>, SendInteractionParamsType, unknown>;
250
+
251
+ /** @inline */
252
+ declare interface UseSendInteractionParams {
253
+ /**
254
+ * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
255
+ */
256
+ mutations?: MutationOptions_2;
257
+ }
258
+
259
+ /** @inline */
260
+ declare interface UseSendInteractionParams_2 {
261
+ /**
262
+ * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
263
+ */
264
+ mutations?: MutationOptions_5;
265
+ }
266
+
267
+ /**
268
+ * Hook that return a mutation helping to send a transaction
269
+ *
270
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} action
271
+ *
272
+ * @param args
273
+ *
274
+ * @group hooks
275
+ *
276
+ * @returns
277
+ * The mutation hook wrapping the `sendTransaction()` action
278
+ * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!actions.SendTransactionParams | `SendTransactionParams`}
279
+ * The `data` result is a {@link @frak-labs/core-sdk!index.SendTransactionReturnType | `SendTransactionReturnType`}
280
+ *
281
+ * @see {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} for more info about the underlying action
282
+ * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
283
+ */
284
+ export declare function useSendTransactionAction({ mutations, }?: UseSendTransactionParams): UseMutationResult< {
285
+ hash: Hex;
286
+ }, FrakRpcError<undefined>, SendTransactionParams, unknown>;
287
+
288
+ /** @inline */
289
+ declare interface UseSendTransactionParams {
290
+ /**
291
+ * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
292
+ */
293
+ mutations?: MutationOptions;
294
+ }
295
+
296
+ /**
297
+ * Hook that return a mutation helping to send perform a SIWE authentication
298
+ *
299
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} action
300
+ *
301
+ * @param args
302
+ *
303
+ * @group hooks
304
+ *
305
+ * @returns
306
+ * The mutation hook wrapping the `siweAuthenticate()` action
307
+ * The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!actions.SiweAuthenticateModalParams | `SiweAuthenticateModalParams`}
308
+ * The `data` result is a {@link @frak-labs/core-sdk!index.SiweAuthenticateReturnType | `SiweAuthenticateReturnType`}
309
+ *
310
+ * @see {@link @frak-labs/core-sdk!actions.siweAuthenticate | `siweAuthenticate()`} for more info about the underlying action
311
+ * @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
312
+ */
313
+ export declare function useSiweAuthenticate({ mutations, }?: UseSiweAuthenticateParams): UseMutationResult< {
314
+ signature: Hex;
315
+ message: string;
316
+ }, FrakRpcError<undefined>, SiweAuthenticateModalParams, unknown>;
317
+
318
+ /** @ignore */
319
+ declare interface UseSiweAuthenticateParams {
320
+ /**
321
+ * Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
322
+ */
323
+ mutations?: MutationOptions_3;
324
+ }
325
+
326
+ /**
327
+ * Hook that return a query helping to get the current wallet status.
328
+ *
329
+ * It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.watchWalletStatus | `watchWalletStatus()`} action
330
+ *
331
+ * @group hooks
332
+ *
333
+ * @returns
334
+ * The query hook wrapping the `watchWalletStatus()` action
335
+ * The `data` result is a {@link @frak-labs/core-sdk!index.WalletStatusReturnType | `WalletStatusReturnType`}
336
+ *
337
+ * @see {@link @frak-labs/core-sdk!actions.watchWalletStatus | `watchWalletStatus()`} for more info about the underlying action
338
+ * @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery response
339
+ */
340
+ export declare function useWalletStatus(): UseQueryResult<WalletStatusReturnType, Error>;
341
+
342
+ export { }