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

> Manage a yield position.

## Function Signature

```dart theme={null}
Future<YieldXyzActionResponse> manage({
  required String yieldId,
  required String action,
  String? address,
  String? arguments,
  String? passthrough,
})
```

## Description

Perform management actions on a yield position, such as claiming rewards or compounding. Requires a `passthrough` value obtained from a balance's `pendingAction`.

## Parameters

| Parameter     | Type      | Required | Description                                                                       |
| ------------- | --------- | -------- | --------------------------------------------------------------------------------- |
| `yieldId`     | `String`  | Yes      | The ID of the yield opportunity to manage                                         |
| `action`      | `String`  | Yes      | The management action to perform (e.g., `"claim"`, `"compound"`)                  |
| `address`     | `String?` | No       | Wallet address (defaults to current wallet)                                       |
| `arguments`   | `String?` | No       | Additional protocol-specific arguments as JSON string                             |
| `passthrough` | `String`  | Yes      | Data from balance `pendingAction`. Throws `MISSING_PASSTHROUGH` if null or empty. |

## Returns

**`YieldXyzActionResponse`** - An object containing:

| Property           | Type                               | Description                                                                                          |
| ------------------ | ---------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `id`               | `String`                           | Action ID for tracking                                                                               |
| `intent`           | `YieldXyzActionIntent`             | Action intent (`enter`, `exit`, `manage`)                                                            |
| `type`             | `String`                           | Action type                                                                                          |
| `yieldId`          | `String`                           | The yield opportunity ID                                                                             |
| `address`          | `String`                           | Wallet address used                                                                                  |
| `amount`           | `String?`                          | Amount                                                                                               |
| `amountRaw`        | `String?`                          | Raw amount                                                                                           |
| `amountUsd`        | `String?`                          | USD equivalent amount                                                                                |
| `transactions`     | `List<YieldXyzActionTransaction?>` | List of transactions to be signed and broadcast                                                      |
| `executionPattern` | `YieldXyzActionExecutionPattern`   | Execution pattern (`synchronous`, `asynchronous`, `batched`)                                         |
| `createdAt`        | `String`                           | Creation timestamp                                                                                   |
| `completedAt`      | `String?`                          | Completion timestamp                                                                                 |
| `status`           | `YieldXyzActionStatus`             | Current status (`created`, `processing`, `success`, `failed`, `canceled`, `waitingForNext`, `stale`) |

## Example

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

final portal = Portal();

// First get balances to find pending actions
final balances = await portal.yieldIntegrations.yieldxyz.getBalances(
  queries: [YieldXyzGetBalancesQuery(address: '0x...', network: 'ethereum')],
);

// Use the passthrough from a pending action
final response = await portal.yieldIntegrations.yieldxyz.manage(
  yieldId: 'aave-v3-usdc-ethereum',
  action: 'claim',
  passthrough: balances.items.first.pendingAction?.passthrough,
);
```

## Errors

| Code                  | Description                                                              |
| --------------------- | ------------------------------------------------------------------------ |
| `NOT_INITIALIZED`     | Portal was not initialized                                               |
| `MISSING_PASSTHROUGH` | Passthrough is required for manage. Get it from balance `pendingAction`. |
| `YIELD_FAILED`        | Failed to manage yield position                                          |

## Related

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