Skip to main content

Function Signature

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

ParameterTypeRequiredDescription
yieldIdStringYesThe ID of the yield opportunity to manage
actionStringYesThe management action to perform (e.g., "claim", "compound")
addressString?NoWallet address (defaults to current wallet)
argumentsString?NoAdditional protocol-specific arguments as JSON string
passthroughStringYesData from balance pendingAction. Throws MISSING_PASSTHROUGH if null or empty.

Returns

YieldXyzActionResponse - An object containing:
PropertyTypeDescription
idStringAction ID for tracking
intentYieldXyzActionIntentAction intent (enter, exit, manage)
typeStringAction type
yieldIdStringThe yield opportunity ID
addressStringWallet address used
amountString?Amount
amountRawString?Raw amount
amountUsdString?USD equivalent amount
transactionsList<YieldXyzActionTransaction?>List of transactions to be signed and broadcast
executionPatternYieldXyzActionExecutionPatternExecution pattern (synchronous, asynchronous, batched)
createdAtStringCreation timestamp
completedAtString?Completion timestamp
statusYieldXyzActionStatusCurrent status (created, processing, success, failed, canceled, waitingForNext, stale)

Example

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

CodeDescription
NOT_INITIALIZEDPortal was not initialized
MISSING_PASSTHROUGHPassthrough is required for manage. Get it from balance pendingAction.
YIELD_FAILEDFailed to manage yield position