Skip to content

useSignTypedData

Hook for signing typed data, supporting both connected accounts and clients.

Import

import { useSignTypedData } from "@account-kit/react";

Usage

import { useSignTypedData, useSmartAccountClient } from "@account-kit/react";
 
const { client } = useSmartAccountClient({ type: "LightAccount" });
const {
  signTypedData,
  signTypedDataAsync,
  signedTypedData,
  isSigningTypedData,
  error,
} = useSignTypedData({
  client,
  // these are optional
  onSuccess: (result) => {
    // do something on success
  },
  onError: (error) => console.error(error),
});

Parameters

args

UseSignTypedDataArgs The arguments for the hook, including client and mutation-related arguments

Returns

UseSignTypedDataResult An object containing methods and state related to the sign typed data mutation process