For most use cases, use the unified deposit
workflow which
handles authorization automatically.
Import
Usage
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
vaultName | string | Yes | Account name from AmplifyVault.name (e.g. from getVaultsByConfig()) |
depositAsset | Address | Yes | Token contract address to deposit |
depositAmount | string | Yes | Amount to deposit as decimal string (e.g., "100.50") |
to | Address | Yes | Recipient address for account shares |
chainId | number | Yes | Blockchain network ID |
signature | Hex | Yes | Permit signature from wallet signing |
deadline | bigint | Yes | Permit deadline (must match signed deadline) |
slippage | number | No | Slippage tolerance in basis points (default: 50) |
distributorCode | string | No | Distributor code for fee attribution |
Return Type
Returns a discriminated union based on account configuration, matching the same flat shape asprepareDepositTxData().
- Type Definition
- Example Response
As of v0.5.2, the return structure is flat —
abi, functionName, and args are top-level properties, matching prepareDepositTxData(). You can spread the result directly into writeContract.Examples
- Privy
- Wagmi
- Viem
Permit Support
Not all tokens support EIP-2612 permits. UseprepareDepositAuthorization() to check:
| Token | Supports Permit |
|---|---|
| USDC | Yes |
| USDG | Yes |
| pyUSD | Yes |
| USDT | No |
Error Handling
| Error Message Pattern | Description | Resolution |
|---|---|---|
"SDK not initialized" | SDK not initialized | Call initAmplifySDK() first |
"Vault not found" | No account matches vaultName | Verify account name via getVaultsByConfig() |
"does not support EIP-2612 permit" | Token lacks permit support | Use approval flow instead |
"Invalid permit signature format" | Signature parsing failed | Re-sign with correct typed data |
"Invalid slippage value" | Slippage outside 0–10000 bps | Provide value between 0 and 10000 |
Related
- Deposit Workflow - Unified deposit API
- prepareDepositPermitSignature - Build permit signature data directly
- prepareDepositTxData - Standard deposits
- DepositAuthMethod - Authorization types