@frak-labs/react-sdk 0.1.0-beta.8d103039 → 0.1.0-beta.dd44738a
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/hook/helper/useReferralInteraction.d.cts +24 -0
- package/dist/hook/helper/useReferralInteraction.d.ts +24 -0
- package/dist/hook/index.d.cts +11 -0
- package/dist/hook/index.d.ts +11 -0
- package/dist/hook/useDisplayModal.d.cts +38 -0
- package/dist/hook/useDisplayModal.d.ts +38 -0
- package/dist/hook/useFrakClient.d.cts +6 -0
- package/dist/hook/useFrakClient.d.ts +6 -0
- package/dist/hook/useFrakConfig.d.cts +9 -0
- package/dist/hook/useFrakConfig.d.ts +9 -0
- package/dist/hook/useGetProductInformation.d.cts +30 -0
- package/dist/hook/useGetProductInformation.d.ts +30 -0
- package/dist/hook/useOpenSso.d.cts +33 -0
- package/dist/hook/useOpenSso.d.ts +33 -0
- package/dist/hook/usePrepareSso.d.cts +40 -0
- package/dist/hook/usePrepareSso.d.ts +40 -0
- package/dist/hook/useSendInteraction.d.cts +33 -0
- package/dist/hook/useSendInteraction.d.ts +33 -0
- package/dist/hook/useSendTransaction.d.cts +34 -0
- package/dist/hook/useSendTransaction.d.ts +34 -0
- package/dist/hook/useSiweAuthenticate.d.cts +35 -0
- package/dist/hook/useSiweAuthenticate.d.ts +35 -0
- package/dist/hook/useWalletStatus.d.cts +16 -0
- package/dist/hook/useWalletStatus.d.ts +16 -0
- package/dist/hook/utils/useFrakContext.d.cts +9 -0
- package/dist/hook/utils/useFrakContext.d.ts +9 -0
- package/dist/hook/utils/useMounted.d.cts +2 -0
- package/dist/hook/utils/useMounted.d.ts +2 -0
- package/dist/hook/utils/useWindowLocation.d.cts +8 -0
- package/dist/hook/utils/useWindowLocation.d.ts +8 -0
- package/dist/index.d.cts +3 -386
- package/dist/index.d.ts +3 -386
- package/dist/provider/FrakConfigProvider.d.cts +29 -0
- package/dist/provider/FrakConfigProvider.d.ts +29 -0
- package/dist/provider/FrakIFrameClientProvider.d.cts +32 -0
- package/dist/provider/FrakIFrameClientProvider.d.ts +32 -0
- package/dist/provider/index.d.cts +4 -0
- package/dist/provider/index.d.ts +4 -0
- package/package.json +4 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DisplayEmbeddedWalletParamsType } from "@frak-labs/core-sdk";
|
|
2
|
+
import { type ProcessReferralOptions } from "@frak-labs/core-sdk/actions";
|
|
3
|
+
import type { Hex } from "viem";
|
|
4
|
+
/**
|
|
5
|
+
* Helper hook to automatically submit a referral interaction when detected
|
|
6
|
+
*
|
|
7
|
+
* @group hooks
|
|
8
|
+
*
|
|
9
|
+
* @param args
|
|
10
|
+
* @param args.productId - The product id to interact with (if not specified will be recomputed from the current domain)
|
|
11
|
+
* @param args.modalConfig - The modal configuration to display if the user is not logged in
|
|
12
|
+
* @param args.options - Some options for the referral interaction
|
|
13
|
+
*
|
|
14
|
+
* @returns The resulting referral state, or a potential error
|
|
15
|
+
*
|
|
16
|
+
* @description This function will automatically handle the referral interaction process
|
|
17
|
+
*
|
|
18
|
+
* @see {@link @frak-labs/core-sdk!actions.processReferral | `processReferral()`} for more details on the automatic referral handling process
|
|
19
|
+
*/
|
|
20
|
+
export declare function useReferralInteraction({ productId, modalConfig, options, }?: {
|
|
21
|
+
productId?: Hex;
|
|
22
|
+
modalConfig?: DisplayEmbeddedWalletParamsType;
|
|
23
|
+
options?: ProcessReferralOptions;
|
|
24
|
+
}): Error | ("error" | "no-referrer" | "idle" | "processing" | "success" | "no-wallet" | "no-session" | "self-referral");
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DisplayEmbeddedWalletParamsType } from "@frak-labs/core-sdk";
|
|
2
|
+
import { type ProcessReferralOptions } from "@frak-labs/core-sdk/actions";
|
|
3
|
+
import type { Hex } from "viem";
|
|
4
|
+
/**
|
|
5
|
+
* Helper hook to automatically submit a referral interaction when detected
|
|
6
|
+
*
|
|
7
|
+
* @group hooks
|
|
8
|
+
*
|
|
9
|
+
* @param args
|
|
10
|
+
* @param args.productId - The product id to interact with (if not specified will be recomputed from the current domain)
|
|
11
|
+
* @param args.modalConfig - The modal configuration to display if the user is not logged in
|
|
12
|
+
* @param args.options - Some options for the referral interaction
|
|
13
|
+
*
|
|
14
|
+
* @returns The resulting referral state, or a potential error
|
|
15
|
+
*
|
|
16
|
+
* @description This function will automatically handle the referral interaction process
|
|
17
|
+
*
|
|
18
|
+
* @see {@link @frak-labs/core-sdk!actions.processReferral | `processReferral()`} for more details on the automatic referral handling process
|
|
19
|
+
*/
|
|
20
|
+
export declare function useReferralInteraction({ productId, modalConfig, options, }?: {
|
|
21
|
+
productId?: Hex;
|
|
22
|
+
modalConfig?: DisplayEmbeddedWalletParamsType;
|
|
23
|
+
options?: ProcessReferralOptions;
|
|
24
|
+
}): Error | ("error" | "no-referrer" | "idle" | "processing" | "success" | "no-wallet" | "no-session" | "self-referral");
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { useFrakConfig } from "./useFrakConfig";
|
|
2
|
+
export { useFrakClient } from "./useFrakClient";
|
|
3
|
+
export { useWalletStatus } from "./useWalletStatus";
|
|
4
|
+
export { useSendTransactionAction } from "./useSendTransaction";
|
|
5
|
+
export { useSiweAuthenticate } from "./useSiweAuthenticate";
|
|
6
|
+
export { useReferralInteraction } from "./helper/useReferralInteraction";
|
|
7
|
+
export { useSendInteraction } from "./useSendInteraction";
|
|
8
|
+
export { useDisplayModal } from "./useDisplayModal";
|
|
9
|
+
export { useOpenSso } from "./useOpenSso";
|
|
10
|
+
export { usePrepareSso } from "./usePrepareSso";
|
|
11
|
+
export { useGetProductInformation } from "./useGetProductInformation";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { useFrakConfig } from "./useFrakConfig";
|
|
2
|
+
export { useFrakClient } from "./useFrakClient";
|
|
3
|
+
export { useWalletStatus } from "./useWalletStatus";
|
|
4
|
+
export { useSendTransactionAction } from "./useSendTransaction";
|
|
5
|
+
export { useSiweAuthenticate } from "./useSiweAuthenticate";
|
|
6
|
+
export { useReferralInteraction } from "./helper/useReferralInteraction";
|
|
7
|
+
export { useSendInteraction } from "./useSendInteraction";
|
|
8
|
+
export { useDisplayModal } from "./useDisplayModal";
|
|
9
|
+
export { useOpenSso } from "./useOpenSso";
|
|
10
|
+
export { usePrepareSso } from "./usePrepareSso";
|
|
11
|
+
export { useGetProductInformation } from "./useGetProductInformation";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { DisplayModalParamsType, ModalRpcStepsResultType, ModalStepTypes } from "@frak-labs/core-sdk";
|
|
2
|
+
import { type FrakRpcError } from "@frak-labs/frame-connector";
|
|
3
|
+
import { type UseMutationOptions } from "@tanstack/react-query";
|
|
4
|
+
/** @ignore */
|
|
5
|
+
type MutationOptions<T extends ModalStepTypes[]> = Omit<UseMutationOptions<ModalRpcStepsResultType<T>, FrakRpcError, DisplayModalParamsType<T>>, "mutationFn" | "mutationKey">;
|
|
6
|
+
/** @inline */
|
|
7
|
+
interface UseDisplayModalParams<T extends ModalStepTypes[] = ModalStepTypes[]> {
|
|
8
|
+
/**
|
|
9
|
+
* Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
|
|
10
|
+
*/
|
|
11
|
+
mutations?: MutationOptions<T>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Hook that return a mutation helping to display a modal to the user
|
|
15
|
+
*
|
|
16
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.displayModal | `displayModal()`} action
|
|
17
|
+
*
|
|
18
|
+
* @param args
|
|
19
|
+
*
|
|
20
|
+
* @typeParam T
|
|
21
|
+
* The modal steps types to display (the result will correspond to the steps types asked in params)
|
|
22
|
+
* An array of {@link @frak-labs/core-sdk!index.ModalStepTypes | `ModalStepTypes`}
|
|
23
|
+
* If not provided, it will default to a generic array of `ModalStepTypes`
|
|
24
|
+
*
|
|
25
|
+
* @group hooks
|
|
26
|
+
*
|
|
27
|
+
* @returns
|
|
28
|
+
* The mutation hook wrapping the `displayModal()` action
|
|
29
|
+
* 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
|
|
30
|
+
* The `data` result is a {@link @frak-labs/core-sdk!index.ModalRpcStepsResultType | `ModalRpcStepsResultType`}
|
|
31
|
+
*
|
|
32
|
+
* @see {@link @frak-labs/core-sdk!actions.displayModal | `displayModal()`} for more info about the underlying action
|
|
33
|
+
* @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
|
|
34
|
+
*/
|
|
35
|
+
export declare function useDisplayModal<T extends ModalStepTypes[] = ModalStepTypes[]>({ mutations, }?: UseDisplayModalParams<T>): import("@tanstack/react-query").UseMutationResult<{ [K in T[number]["key"]]: Extract<T[number], {
|
|
36
|
+
key: K;
|
|
37
|
+
}>["returns"]; }, FrakRpcError<undefined>, DisplayModalParamsType<T>, unknown>;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { DisplayModalParamsType, ModalRpcStepsResultType, ModalStepTypes } from "@frak-labs/core-sdk";
|
|
2
|
+
import { type FrakRpcError } from "@frak-labs/frame-connector";
|
|
3
|
+
import { type UseMutationOptions } from "@tanstack/react-query";
|
|
4
|
+
/** @ignore */
|
|
5
|
+
type MutationOptions<T extends ModalStepTypes[]> = Omit<UseMutationOptions<ModalRpcStepsResultType<T>, FrakRpcError, DisplayModalParamsType<T>>, "mutationFn" | "mutationKey">;
|
|
6
|
+
/** @inline */
|
|
7
|
+
interface UseDisplayModalParams<T extends ModalStepTypes[] = ModalStepTypes[]> {
|
|
8
|
+
/**
|
|
9
|
+
* Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
|
|
10
|
+
*/
|
|
11
|
+
mutations?: MutationOptions<T>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Hook that return a mutation helping to display a modal to the user
|
|
15
|
+
*
|
|
16
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.displayModal | `displayModal()`} action
|
|
17
|
+
*
|
|
18
|
+
* @param args
|
|
19
|
+
*
|
|
20
|
+
* @typeParam T
|
|
21
|
+
* The modal steps types to display (the result will correspond to the steps types asked in params)
|
|
22
|
+
* An array of {@link @frak-labs/core-sdk!index.ModalStepTypes | `ModalStepTypes`}
|
|
23
|
+
* If not provided, it will default to a generic array of `ModalStepTypes`
|
|
24
|
+
*
|
|
25
|
+
* @group hooks
|
|
26
|
+
*
|
|
27
|
+
* @returns
|
|
28
|
+
* The mutation hook wrapping the `displayModal()` action
|
|
29
|
+
* 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
|
|
30
|
+
* The `data` result is a {@link @frak-labs/core-sdk!index.ModalRpcStepsResultType | `ModalRpcStepsResultType`}
|
|
31
|
+
*
|
|
32
|
+
* @see {@link @frak-labs/core-sdk!actions.displayModal | `displayModal()`} for more info about the underlying action
|
|
33
|
+
* @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
|
|
34
|
+
*/
|
|
35
|
+
export declare function useDisplayModal<T extends ModalStepTypes[] = ModalStepTypes[]>({ mutations, }?: UseDisplayModalParams<T>): import("@tanstack/react-query").UseMutationResult<{ [K in T[number]["key"]]: Extract<T[number], {
|
|
36
|
+
key: K;
|
|
37
|
+
}>["returns"]; }, FrakRpcError<undefined>, DisplayModalParamsType<T>, unknown>;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the current Frak config
|
|
3
|
+
* @throws {FrakRpcError} if the config is not found (only if this hooks is used outside a FrakConfigProvider)
|
|
4
|
+
* @group hooks
|
|
5
|
+
*
|
|
6
|
+
* @see {@link @frak-labs/react-sdk!FrakConfigProvider | FrakConfigProvider} for the config provider
|
|
7
|
+
* @see {@link @frak-labs/core-sdk!index.FrakWalletSdkConfig | FrakWalletSdkConfig} for the config type
|
|
8
|
+
*/
|
|
9
|
+
export declare function useFrakConfig(): import("@frak-labs/core-sdk").FrakWalletSdkConfig;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the current Frak config
|
|
3
|
+
* @throws {FrakRpcError} if the config is not found (only if this hooks is used outside a FrakConfigProvider)
|
|
4
|
+
* @group hooks
|
|
5
|
+
*
|
|
6
|
+
* @see {@link @frak-labs/react-sdk!FrakConfigProvider | FrakConfigProvider} for the config provider
|
|
7
|
+
* @see {@link @frak-labs/core-sdk!index.FrakWalletSdkConfig | FrakWalletSdkConfig} for the config type
|
|
8
|
+
*/
|
|
9
|
+
export declare function useFrakConfig(): import("@frak-labs/core-sdk").FrakWalletSdkConfig;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { GetProductInformationReturnType } from "@frak-labs/core-sdk";
|
|
2
|
+
import { type FrakRpcError } from "@frak-labs/frame-connector";
|
|
3
|
+
import { type UseQueryOptions } from "@tanstack/react-query";
|
|
4
|
+
/** @ignore */
|
|
5
|
+
type QueryOptions = Omit<UseQueryOptions<GetProductInformationReturnType, FrakRpcError, undefined>, "queryKey" | "queryFn">;
|
|
6
|
+
/** @inline */
|
|
7
|
+
interface UseGetProductInformationParams {
|
|
8
|
+
/**
|
|
9
|
+
* Optional query options, see {@link @tanstack/react-query!useQuery | `useQuery()`} for more infos
|
|
10
|
+
*/
|
|
11
|
+
query?: QueryOptions;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Hook that return a query helping to get the current product information
|
|
15
|
+
*
|
|
16
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.getProductInformation | `getProductInformation()`} action
|
|
17
|
+
*
|
|
18
|
+
* @param args
|
|
19
|
+
*
|
|
20
|
+
* @group hooks
|
|
21
|
+
*
|
|
22
|
+
* @returns
|
|
23
|
+
* The query hook wrapping the `getProductInformation()` action
|
|
24
|
+
* The `data` result is a {@link @frak-labs/core-sdk!index.GetProductInformationReturnType | `GetProductInformationReturnType`}
|
|
25
|
+
*
|
|
26
|
+
* @see {@link @frak-labs/core-sdk!actions.getProductInformation | `getProductInformation()`} for more info about the underlying action
|
|
27
|
+
* @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery options and response
|
|
28
|
+
*/
|
|
29
|
+
export declare function useGetProductInformation({ query, }?: UseGetProductInformationParams): import("@tanstack/react-query").UseQueryResult<undefined, FrakRpcError<undefined>>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { GetProductInformationReturnType } from "@frak-labs/core-sdk";
|
|
2
|
+
import { type FrakRpcError } from "@frak-labs/frame-connector";
|
|
3
|
+
import { type UseQueryOptions } from "@tanstack/react-query";
|
|
4
|
+
/** @ignore */
|
|
5
|
+
type QueryOptions = Omit<UseQueryOptions<GetProductInformationReturnType, FrakRpcError, undefined>, "queryKey" | "queryFn">;
|
|
6
|
+
/** @inline */
|
|
7
|
+
interface UseGetProductInformationParams {
|
|
8
|
+
/**
|
|
9
|
+
* Optional query options, see {@link @tanstack/react-query!useQuery | `useQuery()`} for more infos
|
|
10
|
+
*/
|
|
11
|
+
query?: QueryOptions;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Hook that return a query helping to get the current product information
|
|
15
|
+
*
|
|
16
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.getProductInformation | `getProductInformation()`} action
|
|
17
|
+
*
|
|
18
|
+
* @param args
|
|
19
|
+
*
|
|
20
|
+
* @group hooks
|
|
21
|
+
*
|
|
22
|
+
* @returns
|
|
23
|
+
* The query hook wrapping the `getProductInformation()` action
|
|
24
|
+
* The `data` result is a {@link @frak-labs/core-sdk!index.GetProductInformationReturnType | `GetProductInformationReturnType`}
|
|
25
|
+
*
|
|
26
|
+
* @see {@link @frak-labs/core-sdk!actions.getProductInformation | `getProductInformation()`} for more info about the underlying action
|
|
27
|
+
* @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery options and response
|
|
28
|
+
*/
|
|
29
|
+
export declare function useGetProductInformation({ query, }?: UseGetProductInformationParams): import("@tanstack/react-query").UseQueryResult<undefined, FrakRpcError<undefined>>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { OpenSsoParamsType, OpenSsoReturnType } from "@frak-labs/core-sdk";
|
|
2
|
+
import { type FrakRpcError } from "@frak-labs/frame-connector";
|
|
3
|
+
import { type UseMutationOptions } from "@tanstack/react-query";
|
|
4
|
+
/** @ignore */
|
|
5
|
+
type MutationOptions = Omit<UseMutationOptions<OpenSsoReturnType, FrakRpcError, OpenSsoParamsType>, "mutationFn" | "mutationKey">;
|
|
6
|
+
/** @inline */
|
|
7
|
+
interface UseOpenSsoParams {
|
|
8
|
+
/**
|
|
9
|
+
* Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
|
|
10
|
+
*/
|
|
11
|
+
mutations?: MutationOptions;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Hook that return a mutation helping to open the SSO page
|
|
15
|
+
*
|
|
16
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} action
|
|
17
|
+
*
|
|
18
|
+
* @param args
|
|
19
|
+
*
|
|
20
|
+
* @group hooks
|
|
21
|
+
*
|
|
22
|
+
* @returns
|
|
23
|
+
* The mutation hook wrapping the `openSso()` action
|
|
24
|
+
* The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.OpenSsoParamsType | `OpenSsoParamsType`}
|
|
25
|
+
* The mutation doesn't output any value
|
|
26
|
+
*
|
|
27
|
+
* @see {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} for more info about the underlying action
|
|
28
|
+
* @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
|
|
29
|
+
*/
|
|
30
|
+
export declare function useOpenSso({ mutations }?: UseOpenSsoParams): import("@tanstack/react-query").UseMutationResult<{
|
|
31
|
+
wallet?: import("viem").Hex;
|
|
32
|
+
}, FrakRpcError<undefined>, OpenSsoParamsType, unknown>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { OpenSsoParamsType, OpenSsoReturnType } from "@frak-labs/core-sdk";
|
|
2
|
+
import { type FrakRpcError } from "@frak-labs/frame-connector";
|
|
3
|
+
import { type UseMutationOptions } from "@tanstack/react-query";
|
|
4
|
+
/** @ignore */
|
|
5
|
+
type MutationOptions = Omit<UseMutationOptions<OpenSsoReturnType, FrakRpcError, OpenSsoParamsType>, "mutationFn" | "mutationKey">;
|
|
6
|
+
/** @inline */
|
|
7
|
+
interface UseOpenSsoParams {
|
|
8
|
+
/**
|
|
9
|
+
* Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
|
|
10
|
+
*/
|
|
11
|
+
mutations?: MutationOptions;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Hook that return a mutation helping to open the SSO page
|
|
15
|
+
*
|
|
16
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} action
|
|
17
|
+
*
|
|
18
|
+
* @param args
|
|
19
|
+
*
|
|
20
|
+
* @group hooks
|
|
21
|
+
*
|
|
22
|
+
* @returns
|
|
23
|
+
* The mutation hook wrapping the `openSso()` action
|
|
24
|
+
* The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.OpenSsoParamsType | `OpenSsoParamsType`}
|
|
25
|
+
* The mutation doesn't output any value
|
|
26
|
+
*
|
|
27
|
+
* @see {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} for more info about the underlying action
|
|
28
|
+
* @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
|
|
29
|
+
*/
|
|
30
|
+
export declare function useOpenSso({ mutations }?: UseOpenSsoParams): import("@tanstack/react-query").UseMutationResult<{
|
|
31
|
+
wallet?: import("viem").Hex;
|
|
32
|
+
}, FrakRpcError<undefined>, OpenSsoParamsType, unknown>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { PrepareSsoParamsType } from "@frak-labs/core-sdk";
|
|
2
|
+
/**
|
|
3
|
+
* Hook that generates SSO URL for popup flow
|
|
4
|
+
*
|
|
5
|
+
* This is a **synchronous** hook (no async calls) that generates the SSO URL
|
|
6
|
+
* client-side without communicating with the wallet iframe.
|
|
7
|
+
*
|
|
8
|
+
* @param params - SSO parameters for URL generation
|
|
9
|
+
*
|
|
10
|
+
* @group hooks
|
|
11
|
+
*
|
|
12
|
+
* @returns
|
|
13
|
+
* Object containing:
|
|
14
|
+
* - `ssoUrl`: Generated SSO URL (or undefined if client not ready)
|
|
15
|
+
* - `isReady`: Boolean indicating if URL is available
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* function MyComponent() {
|
|
20
|
+
* const { data } = usePrepareSso({
|
|
21
|
+
* metadata: { logoUrl: "..." },
|
|
22
|
+
* directExit: true
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* const handleClick = () => {
|
|
26
|
+
* if (ssoUrl) {
|
|
27
|
+
* window.open(data?.ssoUrl, "_blank");
|
|
28
|
+
* }
|
|
29
|
+
* };
|
|
30
|
+
*
|
|
31
|
+
* return <button onClick={handleClick} disabled={!isReady}>Login</button>;
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @see {@link @frak-labs/core-sdk!actions.prepareSso | `prepareSso()`} for the underlying action
|
|
36
|
+
* @see {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} for the recommended high-level API
|
|
37
|
+
*/
|
|
38
|
+
export declare function usePrepareSso(params: PrepareSsoParamsType): import("@tanstack/react-query").UseQueryResult<{
|
|
39
|
+
ssoUrl: string;
|
|
40
|
+
}, Error>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { PrepareSsoParamsType } from "@frak-labs/core-sdk";
|
|
2
|
+
/**
|
|
3
|
+
* Hook that generates SSO URL for popup flow
|
|
4
|
+
*
|
|
5
|
+
* This is a **synchronous** hook (no async calls) that generates the SSO URL
|
|
6
|
+
* client-side without communicating with the wallet iframe.
|
|
7
|
+
*
|
|
8
|
+
* @param params - SSO parameters for URL generation
|
|
9
|
+
*
|
|
10
|
+
* @group hooks
|
|
11
|
+
*
|
|
12
|
+
* @returns
|
|
13
|
+
* Object containing:
|
|
14
|
+
* - `ssoUrl`: Generated SSO URL (or undefined if client not ready)
|
|
15
|
+
* - `isReady`: Boolean indicating if URL is available
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* function MyComponent() {
|
|
20
|
+
* const { data } = usePrepareSso({
|
|
21
|
+
* metadata: { logoUrl: "..." },
|
|
22
|
+
* directExit: true
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* const handleClick = () => {
|
|
26
|
+
* if (ssoUrl) {
|
|
27
|
+
* window.open(data?.ssoUrl, "_blank");
|
|
28
|
+
* }
|
|
29
|
+
* };
|
|
30
|
+
*
|
|
31
|
+
* return <button onClick={handleClick} disabled={!isReady}>Login</button>;
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @see {@link @frak-labs/core-sdk!actions.prepareSso | `prepareSso()`} for the underlying action
|
|
36
|
+
* @see {@link @frak-labs/core-sdk!actions.openSso | `openSso()`} for the recommended high-level API
|
|
37
|
+
*/
|
|
38
|
+
export declare function usePrepareSso(params: PrepareSsoParamsType): import("@tanstack/react-query").UseQueryResult<{
|
|
39
|
+
ssoUrl: string;
|
|
40
|
+
}, Error>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SendInteractionParamsType, SendInteractionReturnType } from "@frak-labs/core-sdk";
|
|
2
|
+
import { type FrakRpcError } from "@frak-labs/frame-connector";
|
|
3
|
+
import { type UseMutationOptions } from "@tanstack/react-query";
|
|
4
|
+
/** @ignore */
|
|
5
|
+
type MutationOptions = Omit<UseMutationOptions<SendInteractionReturnType, FrakRpcError, SendInteractionParamsType>, "mutationFn" | "mutationKey">;
|
|
6
|
+
/** @inline */
|
|
7
|
+
interface UseSendInteractionParams {
|
|
8
|
+
/**
|
|
9
|
+
* Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
|
|
10
|
+
*/
|
|
11
|
+
mutations?: MutationOptions;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Hook that return a mutation helping to send a user interaction
|
|
15
|
+
*
|
|
16
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendInteraction | `sendInteraction()`} action
|
|
17
|
+
*
|
|
18
|
+
* @param args
|
|
19
|
+
*
|
|
20
|
+
* @group hooks
|
|
21
|
+
*
|
|
22
|
+
* @returns
|
|
23
|
+
* The mutation hook wrapping the `sendInteraction()` action
|
|
24
|
+
* The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.SendInteractionParamsType | `SendInteractionParamsType`}
|
|
25
|
+
* The `data` result is a {@link @frak-labs/core-sdk!index.SendInteractionReturnType | `SendInteractionReturnType`}
|
|
26
|
+
*
|
|
27
|
+
* @see {@link @frak-labs/core-sdk!actions.sendInteraction | `sendInteraction()`} for more info about the underlying action
|
|
28
|
+
* @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
|
|
29
|
+
*/
|
|
30
|
+
export declare function useSendInteraction({ mutations, }?: UseSendInteractionParams): import("@tanstack/react-query").UseMutationResult<{
|
|
31
|
+
delegationId: string;
|
|
32
|
+
}, FrakRpcError<undefined>, SendInteractionParamsType, unknown>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SendInteractionParamsType, SendInteractionReturnType } from "@frak-labs/core-sdk";
|
|
2
|
+
import { type FrakRpcError } from "@frak-labs/frame-connector";
|
|
3
|
+
import { type UseMutationOptions } from "@tanstack/react-query";
|
|
4
|
+
/** @ignore */
|
|
5
|
+
type MutationOptions = Omit<UseMutationOptions<SendInteractionReturnType, FrakRpcError, SendInteractionParamsType>, "mutationFn" | "mutationKey">;
|
|
6
|
+
/** @inline */
|
|
7
|
+
interface UseSendInteractionParams {
|
|
8
|
+
/**
|
|
9
|
+
* Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
|
|
10
|
+
*/
|
|
11
|
+
mutations?: MutationOptions;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Hook that return a mutation helping to send a user interaction
|
|
15
|
+
*
|
|
16
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendInteraction | `sendInteraction()`} action
|
|
17
|
+
*
|
|
18
|
+
* @param args
|
|
19
|
+
*
|
|
20
|
+
* @group hooks
|
|
21
|
+
*
|
|
22
|
+
* @returns
|
|
23
|
+
* The mutation hook wrapping the `sendInteraction()` action
|
|
24
|
+
* The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!index.SendInteractionParamsType | `SendInteractionParamsType`}
|
|
25
|
+
* The `data` result is a {@link @frak-labs/core-sdk!index.SendInteractionReturnType | `SendInteractionReturnType`}
|
|
26
|
+
*
|
|
27
|
+
* @see {@link @frak-labs/core-sdk!actions.sendInteraction | `sendInteraction()`} for more info about the underlying action
|
|
28
|
+
* @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
|
|
29
|
+
*/
|
|
30
|
+
export declare function useSendInteraction({ mutations, }?: UseSendInteractionParams): import("@tanstack/react-query").UseMutationResult<{
|
|
31
|
+
delegationId: string;
|
|
32
|
+
}, FrakRpcError<undefined>, SendInteractionParamsType, unknown>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { SendTransactionReturnType } from "@frak-labs/core-sdk";
|
|
2
|
+
import { type SendTransactionParams } from "@frak-labs/core-sdk/actions";
|
|
3
|
+
import { type FrakRpcError } from "@frak-labs/frame-connector";
|
|
4
|
+
import { type UseMutationOptions } from "@tanstack/react-query";
|
|
5
|
+
/** @ignore */
|
|
6
|
+
type MutationOptions = Omit<UseMutationOptions<SendTransactionReturnType, FrakRpcError, SendTransactionParams>, "mutationFn" | "mutationKey">;
|
|
7
|
+
/** @inline */
|
|
8
|
+
interface UseSendTransactionParams {
|
|
9
|
+
/**
|
|
10
|
+
* Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
|
|
11
|
+
*/
|
|
12
|
+
mutations?: MutationOptions;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Hook that return a mutation helping to send a transaction
|
|
16
|
+
*
|
|
17
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} action
|
|
18
|
+
*
|
|
19
|
+
* @param args
|
|
20
|
+
*
|
|
21
|
+
* @group hooks
|
|
22
|
+
*
|
|
23
|
+
* @returns
|
|
24
|
+
* The mutation hook wrapping the `sendTransaction()` action
|
|
25
|
+
* The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!actions.SendTransactionParams | `SendTransactionParams`}
|
|
26
|
+
* The `data` result is a {@link @frak-labs/core-sdk!index.SendTransactionReturnType | `SendTransactionReturnType`}
|
|
27
|
+
*
|
|
28
|
+
* @see {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} for more info about the underlying action
|
|
29
|
+
* @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
|
|
30
|
+
*/
|
|
31
|
+
export declare function useSendTransactionAction({ mutations, }?: UseSendTransactionParams): import("@tanstack/react-query").UseMutationResult<{
|
|
32
|
+
hash: import("viem").Hex;
|
|
33
|
+
}, FrakRpcError<undefined>, SendTransactionParams, unknown>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { SendTransactionReturnType } from "@frak-labs/core-sdk";
|
|
2
|
+
import { type SendTransactionParams } from "@frak-labs/core-sdk/actions";
|
|
3
|
+
import { type FrakRpcError } from "@frak-labs/frame-connector";
|
|
4
|
+
import { type UseMutationOptions } from "@tanstack/react-query";
|
|
5
|
+
/** @ignore */
|
|
6
|
+
type MutationOptions = Omit<UseMutationOptions<SendTransactionReturnType, FrakRpcError, SendTransactionParams>, "mutationFn" | "mutationKey">;
|
|
7
|
+
/** @inline */
|
|
8
|
+
interface UseSendTransactionParams {
|
|
9
|
+
/**
|
|
10
|
+
* Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
|
|
11
|
+
*/
|
|
12
|
+
mutations?: MutationOptions;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Hook that return a mutation helping to send a transaction
|
|
16
|
+
*
|
|
17
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} action
|
|
18
|
+
*
|
|
19
|
+
* @param args
|
|
20
|
+
*
|
|
21
|
+
* @group hooks
|
|
22
|
+
*
|
|
23
|
+
* @returns
|
|
24
|
+
* The mutation hook wrapping the `sendTransaction()` action
|
|
25
|
+
* The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!actions.SendTransactionParams | `SendTransactionParams`}
|
|
26
|
+
* The `data` result is a {@link @frak-labs/core-sdk!index.SendTransactionReturnType | `SendTransactionReturnType`}
|
|
27
|
+
*
|
|
28
|
+
* @see {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} for more info about the underlying action
|
|
29
|
+
* @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
|
|
30
|
+
*/
|
|
31
|
+
export declare function useSendTransactionAction({ mutations, }?: UseSendTransactionParams): import("@tanstack/react-query").UseMutationResult<{
|
|
32
|
+
hash: import("viem").Hex;
|
|
33
|
+
}, FrakRpcError<undefined>, SendTransactionParams, unknown>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SiweAuthenticateReturnType } from "@frak-labs/core-sdk";
|
|
2
|
+
import { type SiweAuthenticateModalParams } from "@frak-labs/core-sdk/actions";
|
|
3
|
+
import { type FrakRpcError } from "@frak-labs/frame-connector";
|
|
4
|
+
import { type UseMutationOptions } from "@tanstack/react-query";
|
|
5
|
+
/** @inline */
|
|
6
|
+
type MutationOptions = Omit<UseMutationOptions<SiweAuthenticateReturnType, FrakRpcError, SiweAuthenticateModalParams>, "mutationFn" | "mutationKey">;
|
|
7
|
+
/** @ignore */
|
|
8
|
+
interface UseSiweAuthenticateParams {
|
|
9
|
+
/**
|
|
10
|
+
* Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
|
|
11
|
+
*/
|
|
12
|
+
mutations?: MutationOptions;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Hook that return a mutation helping to send perform a SIWE authentication
|
|
16
|
+
*
|
|
17
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} action
|
|
18
|
+
*
|
|
19
|
+
* @param args
|
|
20
|
+
*
|
|
21
|
+
* @group hooks
|
|
22
|
+
*
|
|
23
|
+
* @returns
|
|
24
|
+
* The mutation hook wrapping the `siweAuthenticate()` action
|
|
25
|
+
* The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!actions.SiweAuthenticateModalParams | `SiweAuthenticateModalParams`}
|
|
26
|
+
* The `data` result is a {@link @frak-labs/core-sdk!index.SiweAuthenticateReturnType | `SiweAuthenticateReturnType`}
|
|
27
|
+
*
|
|
28
|
+
* @see {@link @frak-labs/core-sdk!actions.siweAuthenticate | `siweAuthenticate()`} for more info about the underlying action
|
|
29
|
+
* @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
|
|
30
|
+
*/
|
|
31
|
+
export declare function useSiweAuthenticate({ mutations, }?: UseSiweAuthenticateParams): import("@tanstack/react-query").UseMutationResult<{
|
|
32
|
+
signature: import("viem").Hex;
|
|
33
|
+
message: string;
|
|
34
|
+
}, FrakRpcError<undefined>, SiweAuthenticateModalParams, unknown>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SiweAuthenticateReturnType } from "@frak-labs/core-sdk";
|
|
2
|
+
import { type SiweAuthenticateModalParams } from "@frak-labs/core-sdk/actions";
|
|
3
|
+
import { type FrakRpcError } from "@frak-labs/frame-connector";
|
|
4
|
+
import { type UseMutationOptions } from "@tanstack/react-query";
|
|
5
|
+
/** @inline */
|
|
6
|
+
type MutationOptions = Omit<UseMutationOptions<SiweAuthenticateReturnType, FrakRpcError, SiweAuthenticateModalParams>, "mutationFn" | "mutationKey">;
|
|
7
|
+
/** @ignore */
|
|
8
|
+
interface UseSiweAuthenticateParams {
|
|
9
|
+
/**
|
|
10
|
+
* Optional mutation options, see {@link @tanstack/react-query!useMutation | `useMutation()`} for more infos
|
|
11
|
+
*/
|
|
12
|
+
mutations?: MutationOptions;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Hook that return a mutation helping to send perform a SIWE authentication
|
|
16
|
+
*
|
|
17
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.sendTransaction | `sendTransaction()`} action
|
|
18
|
+
*
|
|
19
|
+
* @param args
|
|
20
|
+
*
|
|
21
|
+
* @group hooks
|
|
22
|
+
*
|
|
23
|
+
* @returns
|
|
24
|
+
* The mutation hook wrapping the `siweAuthenticate()` action
|
|
25
|
+
* The `mutate` and `mutateAsync` argument is of type {@link @frak-labs/core-sdk!actions.SiweAuthenticateModalParams | `SiweAuthenticateModalParams`}
|
|
26
|
+
* The `data` result is a {@link @frak-labs/core-sdk!index.SiweAuthenticateReturnType | `SiweAuthenticateReturnType`}
|
|
27
|
+
*
|
|
28
|
+
* @see {@link @frak-labs/core-sdk!actions.siweAuthenticate | `siweAuthenticate()`} for more info about the underlying action
|
|
29
|
+
* @see {@link @tanstack/react-query!useMutation | `useMutation()`} for more info about the mutation options and response
|
|
30
|
+
*/
|
|
31
|
+
export declare function useSiweAuthenticate({ mutations, }?: UseSiweAuthenticateParams): import("@tanstack/react-query").UseMutationResult<{
|
|
32
|
+
signature: import("viem").Hex;
|
|
33
|
+
message: string;
|
|
34
|
+
}, FrakRpcError<undefined>, SiweAuthenticateModalParams, unknown>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { WalletStatusReturnType } from "@frak-labs/core-sdk";
|
|
2
|
+
/**
|
|
3
|
+
* Hook that return a query helping to get the current wallet status.
|
|
4
|
+
*
|
|
5
|
+
* It's a {@link @tanstack/react-query!home | `tanstack`} wrapper around the {@link @frak-labs/core-sdk!actions.watchWalletStatus | `watchWalletStatus()`} action
|
|
6
|
+
*
|
|
7
|
+
* @group hooks
|
|
8
|
+
*
|
|
9
|
+
* @returns
|
|
10
|
+
* The query hook wrapping the `watchWalletStatus()` action
|
|
11
|
+
* The `data` result is a {@link @frak-labs/core-sdk!index.WalletStatusReturnType | `WalletStatusReturnType`}
|
|
12
|
+
*
|
|
13
|
+
* @see {@link @frak-labs/core-sdk!actions.watchWalletStatus | `watchWalletStatus()`} for more info about the underlying action
|
|
14
|
+
* @see {@link @tanstack/react-query!useQuery | `useQuery()`} for more info about the useQuery response
|
|
15
|
+
*/
|
|
16
|
+
export declare function useWalletStatus(): import("@tanstack/react-query").UseQueryResult<WalletStatusReturnType, Error>;
|