Search in sources :

Example 1 with ConstructionParseResponse

use of com.radixdlt.api.core.openapitools.model.ConstructionParseResponse in project radixdlt by radixdlt.

the class ConstructionParseHandler method handleRequest.

@Override
public ConstructionParseResponse handleRequest(ConstructionParseRequest request) throws CoreApiException {
    modelMapper.verifyNetwork(request.getNetworkIdentifier());
    var txn = modelMapper.bytes(request.getTransaction());
    REProcessedTxn processed;
    try {
        processed = radixEngineStateComputer.test(txn, request.getSigned());
    } catch (RadixEngineException e) {
        throw modelMapper.radixEngineException(e);
    }
    var response = new ConstructionParseResponse();
    var transaction = modelMapper.transaction(processed, this::symbol);
    transaction.getOperationGroups().forEach(response::addOperationGroupsItem);
    response.metadata(new ParsedTransactionMetadata().fee(transaction.getMetadata().getFee()).message(transaction.getMetadata().getMessage()));
    return response;
}
Also used : ConstructionParseResponse(com.radixdlt.api.core.openapitools.model.ConstructionParseResponse) ParsedTransactionMetadata(com.radixdlt.api.core.openapitools.model.ParsedTransactionMetadata) RadixEngineException(com.radixdlt.engine.RadixEngineException) REProcessedTxn(com.radixdlt.constraintmachine.REProcessedTxn)

Aggregations

ConstructionParseResponse (com.radixdlt.api.core.openapitools.model.ConstructionParseResponse)1 ParsedTransactionMetadata (com.radixdlt.api.core.openapitools.model.ParsedTransactionMetadata)1 REProcessedTxn (com.radixdlt.constraintmachine.REProcessedTxn)1 RadixEngineException (com.radixdlt.engine.RadixEngineException)1