Skip to main content

Function Signature

Future<YieldXyzActionResponse> exit({
  required String yieldId,
  String? address,
  String? amount,
  String? arguments,
})

Description

Withdraw assets from a yield opportunity.

Parameters

ParameterTypeRequiredDescription
yieldIdStringYesThe ID of the yield opportunity to exit
addressString?NoWallet address (defaults to current wallet)
amountString?NoAmount to withdraw (null for full withdrawal)
argumentsString?NoAdditional protocol-specific arguments as JSON string

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?Withdrawal amount
amountRawString?Raw withdrawal 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();

final response = await portal.yieldIntegrations.yieldxyz.exit(
  yieldId: 'aave-v3-usdc-ethereum',
  amount: '50.0',
);

print('Action ID: ${response.id}');

Errors

CodeDescription
NOT_INITIALIZEDPortal was not initialized
YIELD_FAILEDFailed to exit yield position