Skip to main content
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.
Parameters (DepositParams): Returns: Promise<Hash> — transaction hash

withdraw

Withdraw a specific asset amount from the vault (burns the required shares).
Returns: Promise<Hash>

redeem

Burn a specific number of shares and receive the proportional assets.
Returns: Promise<Hash>

getShares

Get the vault share balance for any address.
Returns: Promise<string> — formatted share balance

getTVL

Get total assets locked in the vault.
Returns: Promise<string>

getAPY

Estimate current APY from share price appreciation (simplified model).
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.
Returns: Promise<Address>