<Signature /> · OnchainKit
The <Signature />
component supports signing EIP712 and personal_sign messages.
The <Signature />
components provide a wrapper around the useSignTypedData and useSignMessage wagmi hooks.
These hooks handle EIP712 signatures and personal_sign messages, falling back to eth_sign.
Before using them, ensure you’ve completed all Getting Started steps.
Quick start
You can use the Signature
component with the default implementation without passing any subcomponents or pass any subcomponents to fully customize the UI.
Default implementation for EIP712 signatures
Default implementation for personal_sign messages
Components
The Signature components provide a complete signature flow:
Core Component
<Signature />
- Main container that manages the signature lifecycle
<Signature />
subcomponents
<SignatureButton />
- Handles signature initiation with customizable labels<SignatureStatus />
- Displays current signature status and actions<SignatureToast />
- Shows toast notifications for signature events
<SignatureStatus />
and <SignatureToast />
subcomponents
<SignatureLabel />
- Displays status text (“Success”, “Confirm in wallet”, etc.)<SignatureIcon />
- Shows status icons (pending, success, error)
Component API
Signature
Main wrapper component that manages the signature flow.
SignatureButton
Button component that triggers the signature request.
SignatureStatus
Container for signature status information.
SignatureToast
Toast notification for signature events.
Lifecycle States
The signature flow has the following states:
init
- Initial statepending
- Waiting for wallet signaturesuccess
- Signature completed successfullyerror
- Error occurred during signingreset
- Component reset to initial state
Access the current state through the onStatus
callback:
Error Handling
Errors are handled automatically and displayed in the UI. Common errors include:
- User rejected request
- Invalid message format
- Wallet connection issues
Custom error handling:
Message Types
The <Signature />
component supports two types of messages:
EIP-712 Typed Data
Personal Sign (personal_sign)
Component types
SignatureReact
SignatureButtonProps
SignatureStatusProps
SignatureToastProps
SignatureIconProps
SignatureLabelProps
MessageType
ValidateMessageResult
MessageData
SignatureProviderProps
Related Components
<Wallet />
- Handles the wallet connection<Transaction />
- Handles transaction signing