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
| Parameter | Type | Required | Description |
|---|---|---|---|
vaultName | string | Yes | Account name from AmplifyVault.name |
depositAsset | Address | Yes | Token contract address |
depositAmount | string | Yes | Amount to deposit as decimal string (e.g., "100.25") |
to | Address | Yes | Recipient address for account shares |
chainId | number | Yes | Blockchain network ID |
deadline | bigint | No | Permit deadline in seconds (default: 1 hour from now) |
nonce | bigint | No | Token permit nonce (fetched on-chain if omitted) |
decimals | number | No | Token decimals (fetched on-chain if omitted) |
tokenName | string | No | EIP-712 domain token name (fetched on-chain if omitted) |
tokenVersion | string | No | EIP-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
signTypedData, wagmi’s useSignTypedData, and eth_signTypedData_v4. The account field is the user address passed as the to parameter.
Examples
- Viem — direct signing
- Privy — eth_signTypedData_v4
- With pre-fetched metadata
Helper: toEthSignTypedDataV4
PermitSignatureData to a JSON string format compatible with eth_signTypedData_v4 (adds the EIP712Domain type entry and serializes bigints as strings):
Helper: parsePermitSignature
v, r, s components:
v-based and modern yParity-based signature formats.
Error Handling
| Error Message Pattern | Description | Resolution |
|---|---|---|
"SDK not initialized" | SDK used before init | Call initAmplifySDK() first |
"Vault not found" | No account matches vaultName | Verify account name via getVaultsByConfig() |
"Token does not support permits" | Token not on permit allowlist | Use approval flow |
Related
- Deposit Workflow - Unified API (recommended)
- prepareDepositWithPermitTxData - Build deposit tx after signing
- getVaultsByConfig - Discover account names