Skip to content

useSignMessage

Custom hook to sign a message using the provided client.

Import

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

Usage

import { useSignMessage, useSmartAccountClient } from "@account-kit/react";
 
const { client } = useSmartAccountClient({ type: "LightAccount" });
const {
  signMessage,
  signMessageAsync,
  signedMessage,
  isSigningMessage,
  error,
} = useSignMessage({
  client,
  // these are optional
  onSuccess: (result) => {
    // do something on success
  },
  onError: (error) => console.error(error),
});

Parameters

config

UseSignMessageArgs The configuration arguments for the hook, including the client and additional mutation arguments

Returns

UseSignMessageResult An object containing methods and state for signing messages