> ## Documentation Index
> Fetch the complete documentation index at: https://zyfai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# vaultDeposit

Deposit assets into the Zyfai Vault. Currently only supports USDC on Base chain.

<Info title="Vault vs Safe SubAccount">
  The **Vault** is different from the **Safe subaccount**. The Vault is a shared contract where users deposit assets and receive shares. The Safe is a personal smart wallet for automated yield optimization.
  The vault is redirecting the deposited assets to one globally shared safe subaccount for automated yield optimization. [Full architecture documentation](/docs/product/infra/agent-vault)
</Info>

## Signature

```typescript theme={null}
vaultDeposit(
  amount: string,
  asset?: VaultAsset,
  chainId?: SupportedChainId
): Promise<VaultDepositResponse>
```

## Parameters

| Parameter | Type               | Required | Description                                                             |
| --------- | ------------------ | -------- | ----------------------------------------------------------------------- |
| `amount`  | `string`           | ✅        | Amount to deposit in human readable format (e.g., `"100"` for 100 USDC) |
| `asset`   | `VaultAsset`       | ❌        | Asset to deposit (default: `"USDC"`)                                    |
| `chainId` | `SupportedChainId` | ❌        | Chain ID (default: `8453` - Base)                                       |

## Returns

Deposit transaction result with transaction hash

## Return Type

```typescript theme={null}
interface VaultDepositResponse {
  success: boolean;
  txHash: string;
  amount: string;
  asset: string;
  vaultAddress: string;
}
```

## Example

```typescript theme={null}
// Connect wallet first
await sdk.connectAccount(walletClient, 8453);

// Deposit 100 USDC into the vault
const result = await sdk.vaultDeposit("100", "USDC");
console.log("Deposited:", result.txHash);
console.log("Vault address:", result.vaultAddress);
```

## How It Works

1. **Checks allowance**: Verifies if the vault has permission to spend your USDC
2. **Approves if needed**: If allowance is insufficient, sends an approval transaction
3. **Deposits**: Transfers USDC to the vault and mints shares to your wallet
4. **Waits for confirmation**: Returns after the transaction is confirmed

## Notes

* Wallet must be connected via `connectAccount()` before calling
* The amount is in human readable format (not wei/smallest units)
* You receive vault shares in return, representing your stake in the vault
* Use [getVaultShares](/docs/sdk/vault/get-vault-shares) to check your share balance
* To withdraw, use [vaultWithdraw](/docs/sdk/vault/vault-withdraw)
