@safe-global/safe-react-hooks
Version:
A collection of React Hooks that facilitates the interaction of React apps with Safe Smart Accounts
17 lines (16 loc) • 1.1 kB
TypeScript
import { type UseMutationResult } from '@tanstack/react-query';
import type { ConfigParam, SafeConfigWithSigner, SafeClient } from '../types/index.js';
export type UseSignerClientMutationParams<TReturnData, TParams> = ConfigParam<SafeConfigWithSigner> & {
mutationSafeClientFn: (safeClient: SafeClient, params: TParams) => Promise<TReturnData>;
mutationKey: string[];
};
export type UseSignerClientMutationReturnType<TReturnData, TParams> = UseMutationResult<TReturnData, Error, TParams>;
/**
* Hook for sending a custom mutation via the SafeClient.
* @param params Parameters to customize the hook behavior.
* @param params.config SafeConfig to use instead of the one provided by `SafeProvider`.
* @param params.mutationSafeClientFn Mutation function to be called with the SafeClient.
* @param params.mutationKey Key to identify the mutation.
* @returns Object containing the mutation result.
*/
export declare function useSignerClientMutation<TReturnData, TParams>(params: UseSignerClientMutationParams<TReturnData, TParams>): UseSignerClientMutationReturnType<TReturnData, TParams>;