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

# yieldIntegrations.yieldxyz.getBalances

> Get yield balances for wallet addresses.

## Function Signature

```dart theme={null}
Future<YieldXyzGetBalancesResponse> getBalances({
  required List<YieldXyzGetBalancesQuery> queries,
})
```

## Description

Retrieve current balances across different yield positions for one or more wallet addresses.

## Parameters

| Parameter | Type                             | Required | Description             |
| --------- | -------------------------------- | -------- | ----------------------- |
| `queries` | `List<YieldXyzGetBalancesQuery>` | Yes      | List of balance queries |

**`YieldXyzGetBalancesQuery`** fields:

| Field     | Type      | Description                            |
| --------- | --------- | -------------------------------------- |
| `address` | `String`  | Wallet address to check                |
| `network` | `String`  | Blockchain network                     |
| `yieldId` | `String?` | Optional specific yield opportunity ID |

## Returns

**`YieldXyzGetBalancesResponse`** - An object containing:

| Property   | Type                           | Description                                   |
| ---------- | ------------------------------ | --------------------------------------------- |
| `items`    | `List<YieldBalance?>`          | List of yield balances by yield opportunity   |
| `errors`   | `List<String?>?`               | Any errors encountered during balance queries |
| `metadata` | `YieldXyzGetBalancesMetadata?` | Response metadata                             |
| `error`    | `String?`                      | Top-level error message, if any               |

## Example

```dart theme={null}
import 'package:portal_flutter/portal_flutter.dart';

final portal = Portal();

final response = await portal.yieldIntegrations.yieldxyz.getBalances(
  queries: [
    YieldXyzGetBalancesQuery(
      address: '0x1234...',
      network: 'ethereum',
    ),
  ],
);

for (final balance in response.items) {
  if (balance != null) {
    print('Balance: ${balance.amount}');
  }
}
```

## Errors

| Code              | Description                  |
| ----------------- | ---------------------------- |
| `NOT_INITIALIZED` | Portal was not initialized   |
| `YIELD_FAILED`    | Failed to get yield balances |

## Related

* [Earn with Yield.xyz guide](../guide/yield-xyz)
* [yieldIntegrations.yieldxyz.manage](./yield-manage)
* [yieldIntegrations.yieldxyz.getHistoricalActions](./yield-gethistoricalactions)
