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

# getVaultShares

Get the vault share balance for a wallet. Shares represent your stake in the Zyfai Vault.

## Signature

```typescript theme={null}
getVaultShares(
  userAddress?: string,
  chainId?: SupportedChainId
): Promise<VaultSharesResponse>
```

## Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `userAddress` | `string` | ❌ | User address to check (defaults to connected wallet) |
| `chainId` | `SupportedChainId` | ❌ | Chain ID (default: `8453` - Base) |

## Returns

Vault shares balance and token symbol

## Return Type

```typescript theme={null}
interface VaultSharesResponse {
  success: boolean;
  shares: bigint;
  symbol: string;
}
```

## Example

```typescript theme={null}
// Get shares for connected wallet
const { shares, symbol } = await sdk.getVaultShares();
console.log(`Balance: ${shares} ${symbol}`);

// Get shares for specific address
const info = await sdk.getVaultShares("0xUser...");
console.log(`User has ${info.shares} vault shares`);
```

### Check Before Withdrawal

```typescript theme={null}
// Verify you have shares before withdrawing
const { shares } = await sdk.getVaultShares();

if (shares > 0n) {
  const withdraw = await sdk.vaultWithdraw();
  console.log("Withdrawal requested:", withdraw.withdrawKey);
} else {
  console.log("No shares to withdraw");
}
```

## Notes

* If no `userAddress` is provided, uses the connected wallet address
* Shares are returned as `bigint` in the smallest unit (wei)
* The `symbol` is the vault's share token symbol (e.g., "zyUSDC")
* Shares are minted when you deposit via [vaultDeposit](https://docs.zyf.ai/docs/sdk/vault/vault-deposit)
* Shares are burned when you withdraw via [vaultWithdraw](https://docs.zyf.ai/docs/sdk/vault/vault-withdraw)


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