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.
@getpara/react-sdk includes @getpara/viem-v2-integration. Install viem when your app imports Viem helpers such as chains, transports, parsers, or types directly.
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>
);
}