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

ParameterTypeRequiredDescription
vaultNamestringYesAccount name from AmplifyVault.name
depositAssetAddressYesToken contract address
depositAmountstringYesAmount to deposit as decimal string (e.g., "100.25")
toAddressYesRecipient address for account shares
chainIdnumberYesBlockchain network ID
deadlinebigintNoPermit deadline in seconds (default: 1 hour from now)
noncebigintNoToken permit nonce (fetched on-chain if omitted)
decimalsnumberNoToken decimals (fetched on-chain if omitted)
tokenNamestringNoEIP-712 domain token name (fetched on-chain if omitted)
tokenVersionstringNoEIP-712 domain token version (fetched on-chain if omitted)
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

Error Message PatternDescriptionResolution
"SDK not initialized"SDK used before initCall initAmplifySDK() first
"Vault not found"No account matches vaultNameVerify account name via getVaultsByConfig()
"Token does not support permits"Token not on permit allowlistUse approval flow