The useParaCosmjsProtoSigner hook returns a CosmJS OfflineDirectSigner for the user’s Cosmos wallet. It supports both embedded Para wallets and external wallets.
If the user has multiple Cosmos wallets, pass address or walletId to select one. When omitted, the active wallet is used automatically.
@getpara/react-sdk includes @getpara/cosmjs-v0-integration. Install CosmJS packages such as @cosmjs/stargate when your app creates clients or imports CosmJS helpers directly.
Import
import { useParaCosmjsProtoSigner } from "@getpara/react-sdk";
Usage
import { useParaCosmjsProtoSigner } from "@getpara/react-sdk";
import { SigningStargateClient } from "@cosmjs/stargate";
function SignDirect() {
const { protoSigner, isLoading } = useParaCosmjsProtoSigner();
const handleSign = async () => {
if (!protoSigner) return;
const signDoc = {
bodyBytes: new TextEncoder().encode(
JSON.stringify({ messages: [], memo: "Hello" })
),
authInfoBytes: new Uint8Array(0),
chainId: "",
accountNumber: BigInt(0),
};
const result = await protoSigner.signDirect(protoSigner.address, signDoc);
console.log("Signature:", result.signature.signature);
};
if (isLoading) return <p>Loading...</p>;
return (
<div>
<p>Address: {protoSigner?.address}</p>
<button onClick={handleSign}>Sign Message</button>
</div>
);
}