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

# VaultClient: deposit and withdraw from AgentBank

> Reference for the @agentbank/sdk VaultClient — deposit, withdraw, redeem, getShares, getTVL, getAPY, and getUnderlyingAsset methods with TypeScript examples.

`VaultClient` wraps the ERC-4626 `AgentBankVaultV2` contract. Access it via `client.vault` on the `AgentBankClient`.

## Methods

### deposit

Deposit assets into the vault and receive shares.

```typescript theme={null}
const txHash = await client.vault.deposit({
  amount: "1000",            // human-readable amount
  receiver: "0x...",         // optional, defaults to connected wallet
});
```

**Parameters** (`DepositParams`):

| Field | Type | Required | Description |
| - | - | - | - |
| `amount` | `string` | Yes | Human-readable amount (e.g. `"1000.5"`) |
| `receiver` | `Address` | No | Share recipient; defaults to connected wallet |

**Returns**: `Promise<Hash>` — transaction hash

***

### withdraw

Withdraw a specific asset amount from the vault (burns the required shares).

```typescript theme={null}
const txHash = await client.vault.withdraw({
  amount: "500",
  receiver: "0x...",   // optional
  owner: "0x...",      // optional
});
```

**Returns**: `Promise<Hash>`

***

### redeem

Burn a specific number of shares and receive the proportional assets.

```typescript theme={null}
const txHash = await client.vault.redeem({
  shares: "100",
  receiver: "0x...",   // optional
  owner: "0x...",      // optional
});
```

**Returns**: `Promise<Hash>`

***

### getShares

Get the vault share balance for any address.

```typescript theme={null}
const shares = await client.vault.getShares("0x...");
// Returns: "123.456789" (formatted string)
```

**Returns**: `Promise<string>` — formatted share balance

***

### getTVL

Get total assets locked in the vault.

```typescript theme={null}
const tvl = await client.vault.getTVL();
// Returns: "4250000.000000" (in underlying asset units)
```

**Returns**: `Promise<string>`

***

### getAPY

Estimate current APY from share price appreciation (simplified model).

```typescript theme={null}
const apy = await client.vault.getAPY();
// Returns: "8.4200" (percentage string)
```

> [!NOTE]
>
> This is a simplified heuristic based on current share price vs 1:1 ratio. For production, integrate with off-chain oracle data or historical share price comparison.

**Returns**: `Promise<string>` — APY percentage with 4 decimal places

***

### getUnderlyingAsset

Get the address of the vault's underlying asset.

```typescript theme={null}
const assetAddress = await client.vault.getUnderlyingAsset();
```

**Returns**: `Promise<Address>`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.