Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.getpara.com/llms.txt

Use this file to discover all available pages before exploring further.

Mutation hook for signing messages using a Viem WalletClient from useParaViemClient.
Requires @getpara/viem-v2-integration and viem as peer dependencies.
Get the viemClient parameter from the viem setup pattern in Setup Libraries.

Import

import { useParaViemSignMessage } from "@getpara/react-native-wallet/evm/viem";

Usage

import { useParaViemClient, useParaViemSignMessage } from "@getpara/react-native-wallet/evm/viem";
import { sepolia } from "viem/chains";
import { http } from "viem";

function SignMessage() {
  const { viemClient } = useParaViemClient({
    walletClientConfig: { chain: sepolia, transport: http() },
  });

  const { signMessageAsync, isPending, data: signature } = useParaViemSignMessage(viemClient);

  return (
    <div>
      <button onClick={() => signMessageAsync({ message: "Hello" })} disabled={isPending}>
        {isPending ? "Signing..." : "Sign Message"}
      </button>
      {signature && <p>Signature: {signature}</p>}
    </div>
  );
}
mutate/mutateAsync are also available alongside the named aliases. All other UseMutationResult fields (data, error, isSuccess, isError, reset, etc.) work as expected.