use of com.radixdlt.api.core.openapitools.model.StakeUnitResourceIdentifier in project radixdlt by radixdlt.
the class UnstakeStakeUnits method toOperationGroups.
@Override
public List<OperationGroup> toOperationGroups(EngineConfiguration configuration, Function<ConstructionDeriveRequestMetadata, EntityIdentifier> identifierFunction) {
var from = identifierFunction.apply(new ConstructionDeriveRequestMetadataAccount().type("Account"));
var to = identifierFunction.apply(new ConstructionDeriveRequestMetadataPreparedUnstakes().type("PreparedUnstakes"));
var resourceIdentifier = new StakeUnitResourceIdentifier().validatorAddress(validatorAddress).type("StakeUnits");
var operationGroup = new OperationGroup().addOperationsItem(new Operation().type("Resource").amount(new ResourceAmount().resourceIdentifier(resourceIdentifier).value("-" + amount.toSubunits().toString())).entityIdentifier(from)).addOperationsItem(new Operation().type("Resource").amount(new ResourceAmount().resourceIdentifier(resourceIdentifier).value(amount.toSubunits().toString())).entityIdentifier(to));
return List.of(operationGroup);
}
Aggregations