Skip to main content

Documentation Index

Fetch the complete documentation index at: https://0xcaptain.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

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.
const txHash = await client.vault.deposit({
  amount: "1000",            // human-readable amount
  receiver: "0x...",         // optional, defaults to connected wallet
});
Parameters (DepositParams):
FieldTypeRequiredDescription
amountstringYesHuman-readable amount (e.g. "1000.5")
receiverAddressNoShare recipient; defaults to connected wallet
Returns: Promise<Hash> — transaction hash

withdraw

Withdraw a specific asset amount from the vault (burns the required shares).
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.
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.
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.
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).
const apy = await client.vault.getAPY();
// Returns: "8.4200" (percentage string)
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.
const assetAddress = await client.vault.getUnderlyingAsset();
Returns: Promise<Address>