Vault Reads

On-chain read functions for querying vault state, balances, and allowances.

Vault State

const state = await client.getVaultState(vaultAddress)

Returns a VaultState object:

Field
Type
Description

address

Address

Vault contract address

name

string

Vault name (e.g., "YO ETH Vault")

symbol

string

Vault symbol (e.g., "yoETH")

decimals

number

Vault share decimals

totalAssets

bigint

Total assets under management

totalSupply

bigint

Total shares issued

asset

Address

Underlying asset address

assetDecimals

number

Underlying asset decimals

exchangeRate

bigint

Current exchange rate (shares per asset)

Preview Functions

// How many shares will I get for 1 ETH?
const shares = await client.previewDeposit(vault, parseEther('1'))

// How many assets will I get for 100 shares?
const assets = await client.previewRedeem(vault, 100n)

// Conversion helpers
const assetsFromShares = await client.convertToAssets(vault, shares)
const sharesFromAssets = await client.convertToShares(vault, parseEther('1'))

Gateway Quote Functions

Quote functions read from the Yo Gateway contract and account for fees and routing.

Balance Queries

Allowance Queries