Skip to main content
WalletKit prompts the user with a modal that shows the message. The user can then review and sign the message using their 6-digit pin.
import { useWalletKitLink } from "@walletkit/react-link";
import { toHex } from "viem";

function App() {
  const walletKit = useWalletKitLink();
  const [signature, setSignature] = useState("");

  const signMessage = async () => {
    const signature = await walletKit.signMessage(toHex("hello world"));
    setSignature(signature);
  };

  return (
    <div>
      <button onClick={() => signMessage()}>Sign Message</button>
      {signature ? <div>Signature: {signature}</div> : null}
    </div>
  );
}
import { useSignMessage } from "wagmi";

function App() {
  const { data, isError, isLoading, isSuccess, signMessage } = useSignMessage({
    message: "hello world",
  });

  return (
    <div>
      <button disabled={isLoading} onClick={() => signMessage()}>
        Sign message
      </button>
      {isSuccess && <div>Signature: {data}</div>}
      {isError && <div>Error signing message</div>}
    </div>
  );
}