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 |
slippage | number | No | Slippage tolerance in basis points (default: 50 = 0.5%) |
distributorCode | string | No | Distributor code for fee attribution |
Return Type
Returns a discriminated union based on the account’s configuration. UsedepositType or the type guards isStandardDeposit() / isKytDeposit() to narrow.
- Type Definition
- Standard Example
- KYT Example
KYT routing is automatic — the SDK checks
vault.enterpriseConfig.predicatePolicyId and returns the correct variant. Most consumers can ignore depositType and pass the result directly to writeContract.Examples
- Privy
- Wagmi
- Viem
Slippage Configuration
The default slippage is 50 basis points (0.5%). Adjust for volatile conditions: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() |
"Asset metadata not found" | Token not in asset cache | Verify token is supported via getSupportedAssets() |
Related
- Deposit Workflow - Unified deposit API
- getVaultsByConfig - Discover account names
- prepareDepositWithPermitTxData - Permit-based deposits
- Deposits Guide - Complete examples