Skip to main content
The useParaViemClient hook returns a Viem WalletClient for the user’s EVM wallet. It supports both embedded Para wallets and external wallets. If the user has multiple EVM wallets, pass address or walletId to select one. When omitted, the active wallet is used automatically.
Requires @getpara/viem-v2-integration as a peer dependency.
Use the companion mutation hooks for common operations: useParaViemSignMessage, useParaViemSendTransaction, useParaViemSignTypedData, and useParaViemWriteContract.

Import

import { useParaViemClient } from "@getpara/react-sdk";

Usage

import { useParaViemClient } from "@getpara/react-sdk";
import { sepolia } from "viem/chains";
import { http } from "viem";

function SignMessage() {
  const { viemClient, isLoading } = useParaViemClient({
    walletClientConfig: {
      chain: sepolia,
      transport: http("https://ethereum-sepolia-rpc.publicnode.com"),
    },
  });

  const handleSign = async () => {
    if (!viemClient) return;
    const signature = await viemClient.signMessage({ message: "Hello" });
    console.log("Signature:", signature);
  };

  if (isLoading) return <p>Loading...</p>;

  return (
    <div>
      <p>Address: {viemClient?.account?.address}</p>
      <button onClick={handleSign}>Sign Message</button>
    </div>
  );
}