Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Hook for signing messages with a wallet
useSignMessage
import { useSignMessage } from "@getpara/react-sdk";
function MessageSigner() { const { signMessage, signMessageAsync, isPending, error } = useSignMessage(); const [message, setMessage] = useState(""); const [signature, setSignature] = useState(""); const handleSign = async () => { try { const result = await signMessageAsync({ messageBase64: Buffer.from(message).toString("base64"), }); if ("signature" in result) { setSignature(result.signature); } } catch (err) { console.error("Failed to sign message:", err); } }; return ( <div> <input value={message} onChange={(e) => setMessage(e.target.value)} placeholder="Enter message to sign" /> <button onClick={handleSign} disabled={isPending || !message} > {isPending ? "Signing..." : "Sign Message"} </button> {signature && <p>Signature: {signature}</p>} </div> ); }