Skip to main content
Prepares the transaction data for executing a deposit after the user has approved token spending. Use this for the approval flow or when allowance is already sufficient.
For most use cases, use the unified deposit workflow which handles authorization automatically.

Import

Usage

Parameters

ParameterTypeRequiredDescription
vaultNamestringYesAccount name from AmplifyVault.name (e.g. from getVaultsByConfig())
depositAssetAddressYesToken contract address to deposit
depositAmountstringYesAmount to deposit as decimal string (e.g., "100.50")
toAddressYesRecipient address for account shares
chainIdnumberYesBlockchain network ID
slippagenumberNoSlippage tolerance in basis points (default: 50 = 0.5%)
distributorCodestringNoDistributor code for fee attribution

Return Type

Returns a discriminated union based on the account’s configuration. Use depositType or the type guards isStandardDeposit() / isKytDeposit() to narrow.
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

Slippage Configuration

The default slippage is 50 basis points (0.5%). Adjust for volatile conditions:

Error Handling

Error Message PatternDescriptionResolution
"SDK not initialized"SDK not initializedCall initAmplifySDK() first
"Vault not found"No account matches vaultNameVerify account name via getVaultsByConfig()
"Asset metadata not found"Token not in asset cacheVerify token is supported via getSupportedAssets()