Skip to main content
Builds the EIP-712 typed data needed to sign a permit for a deposit. Returns structured data ready to pass to signTypedData or eth_signTypedData_v4.
In most cases you should use prepareDepositAuthorization() which calls this function internally and returns the permit data as part of its result. Use prepareDepositPermitSignature directly when you need fine-grained control over the permit parameters, or need to pre-fetch token metadata to avoid extra RPC calls.

Import

Usage

Parameters

The optional nonce, decimals, tokenName, and tokenVersion parameters are performance optimizations. When provided, they skip the corresponding on-chain multicall reads, reducing latency in applications that already have this token metadata.

Return Type

The returned object is directly compatible with viem’s signTypedData, wagmi’s useSignTypedData, and eth_signTypedData_v4. The account field is the user address passed as the to parameter.

Examples

Helper: toEthSignTypedDataV4

Converts PermitSignatureData to a JSON string format compatible with eth_signTypedData_v4 (adds the EIP712Domain type entry and serializes bigints as strings):

Helper: parsePermitSignature

Splits a hex permit signature into its v, r, s components:
Handles both legacy v-based and modern yParity-based signature formats.

Error Handling