> ## 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.discover

> Discover yield opportunities.

## Function Signature

```dart theme={null}
Future<YieldXyzGetYieldsResponse> discover({
  YieldXyzGetYieldsRequest? request,
})
```

## Description

Search for available yield opportunities across different networks and protocols.

## Parameters

| Parameter | Type                        | Required | Description                     |
| --------- | --------------------------- | -------- | ------------------------------- |
| `request` | `YieldXyzGetYieldsRequest?` | No       | Optional filters for the search |

**`YieldXyzGetYieldsRequest`** fields:

| Field               | Type                     | Description                                                                                           |
| ------------------- | ------------------------ | ----------------------------------------------------------------------------------------------------- |
| `offset`            | `int?`                   | Pagination offset                                                                                     |
| `limit`             | `int?`                   | Maximum number of results                                                                             |
| `network`           | `String?`                | Filter by blockchain network                                                                          |
| `yieldId`           | `String?`                | Filter by specific yield opportunity ID                                                               |
| `type`              | `YieldXyzMechanicsType?` | Filter by mechanics type (`staking`, `restaking`, `lending`, `vault`, `fixedYield`, `realWorldAsset`) |
| `hasCooldownPeriod` | `bool?`                  | Filter opportunities with cooldown                                                                    |
| `hasWarmupPeriod`   | `bool?`                  | Filter opportunities with warmup                                                                      |
| `token`             | `String?`                | Filter by token symbol                                                                                |
| `inputToken`        | `String?`                | Filter by input token                                                                                 |
| `provider`          | `String?`                | Filter by yield provider                                                                              |
| `search`            | `String?`                | Text search across opportunities                                                                      |
| `sort`              | `YieldXyzGetYieldsSort?` | Sort order (`statusEnterAsc`, `statusEnterDesc`, `statusExitAsc`, `statusExitDesc`)                   |

## Returns

**`YieldXyzGetYieldsResponse`** - An object containing:

| Property | Type                      | Description                             |
| -------- | ------------------------- | --------------------------------------- |
| `items`  | `List<YieldOpportunity?>` | List of yield opportunities             |
| `total`  | `int`                     | Total number of available opportunities |
| `offset` | `int`                     | Current pagination offset               |
| `limit`  | `int`                     | Current page size                       |

## Example

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

final portal = Portal();

final response = await portal.yieldIntegrations.yieldxyz.discover(
  request: YieldXyzGetYieldsRequest(
    network: 'ethereum',
    token: 'USDC',
    type: YieldXyzMechanicsType.lending,
    limit: 10,
  ),
);

for (final opportunity in response.items) {
  print('Yield: ${opportunity?.id}');
}
```

## Errors

| Code              | Description                            |
| ----------------- | -------------------------------------- |
| `NOT_INITIALIZED` | Portal was not initialized             |
| `YIELD_FAILED`    | Failed to discover yield opportunities |

## Related

* [Earn with Yield.xyz guide](../guide/yield-xyz)
* [yieldIntegrations.yieldxyz.enter](./yield-enter)
* [yieldIntegrations.yieldxyz.getBalances](./yield-getbalances)
