Hook for retrieving a Cosmjs Amino signer for a Para wallet
useCosmjsAminoSigner
hook provides a Cosmjs Amino signer for a Para wallet.
import { useCosmjsAminoSigner } from "@getpara/react-sdk";
function CosmjsAminoSigner() {
const { aminoSigner, isLoading } = useCosmjsAminoSigner();
const handleSign = async () => {
if (!aminoSigner) {
return;
}
// Create a simple sign doc for the message
const signDoc = {
bodyBytes: new TextEncoder().encode(
JSON.stringify({
messages: [],
memo: "Test Message",
})
),
authInfoBytes: new Uint8Array(0),
chainId: "",
accountNumber: BigInt(0),
};
const result = await aminoSigner.signAmino(aminoSigner.address, signDoc);
console.log("Signature:", result.signature.signature);
};
if (isLoading) return <div>Loading Cosmjs Amino signer...</div>;
return (
<div>
<p>Address: {aminoSigner?.address}</p>
<button onClick={handleSign}>Sign Message</button>
</div>
);
}
useCosmjsAminoSigner
object with the following properties: