Signing
Signing Hooks
The hooks provide tools for signing messages and typed data on VeChain:
Core Signing Hooks
useSignMessage: Hook for signing plain text messages, supporting both Privy and VeChain walletsuseSignTypedData: Hook for signing typed data (EIP-712), supporting both Privy and VeChain wallets
Types
// Signing Types
interface SignTypedDataParams {
domain: {
name?: string;
version?: string;
chainId?: number;
verifyingContract?: string;
salt?: string;
};
types: Record<string, Array<{ name: string; type: string }>>;
message: Record<string, any>;
}
interface UseSignMessageReturnValue {
signMessage: (message: string) => Promise<string>;
isSigningPending: boolean;
signature: string | null;
error: Error | null;
reset: () => void;
}
interface UseSignTypedDataReturnValue {
signTypedData: (data: SignTypedDataParams) => Promise<string>;
isSigningPending: boolean;
signature: string | null;
error: Error | null;
reset: () => void;
}Usage example
Was this helpful?